/* Generated by Cython 0.14.1 on Sun Feb  6 20:10:18 2011 */

#define PY_SSIZE_T_CLEAN
#include "Python.h"
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#else

#include <stddef.h> /* For offsetof */
#ifndef offsetof
#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif

#if !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
  #ifndef __fastcall
    #define __fastcall
  #endif
#endif

#ifndef DL_IMPORT
  #define DL_IMPORT(t) t
#endif
#ifndef DL_EXPORT
  #define DL_EXPORT(t) t
#endif

#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif

#if PY_VERSION_HEX < 0x02040000
  #define METH_COEXIST 0
  #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type)
  #define PyDict_Contains(d,o)   PySequence_Contains(d,o)
#endif

#if PY_VERSION_HEX < 0x02050000
  typedef int Py_ssize_t;
  #define PY_SSIZE_T_MAX INT_MAX
  #define PY_SSIZE_T_MIN INT_MIN
  #define PY_FORMAT_SIZE_T ""
  #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
  #define PyInt_AsSsize_t(o)   PyInt_AsLong(o)
  #define PyNumber_Index(o)    PyNumber_Int(o)
  #define PyIndex_Check(o)     PyNumber_Check(o)
  #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
#endif

#if PY_VERSION_HEX < 0x02060000
  #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
  #define Py_TYPE(ob)   (((PyObject*)(ob))->ob_type)
  #define Py_SIZE(ob)   (((PyVarObject*)(ob))->ob_size)
  #define PyVarObject_HEAD_INIT(type, size) \
          PyObject_HEAD_INIT(type) size,
  #define PyType_Modified(t)

  typedef struct {
     void *buf;
     PyObject *obj;
     Py_ssize_t len;
     Py_ssize_t itemsize;
     int readonly;
     int ndim;
     char *format;
     Py_ssize_t *shape;
     Py_ssize_t *strides;
     Py_ssize_t *suboffsets;
     void *internal;
  } Py_buffer;

  #define PyBUF_SIMPLE 0
  #define PyBUF_WRITABLE 0x0001
  #define PyBUF_FORMAT 0x0004
  #define PyBUF_ND 0x0008
  #define PyBUF_STRIDES (0x0010 | PyBUF_ND)
  #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
  #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
  #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
  #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)

#endif

#if PY_MAJOR_VERSION < 3
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
#else
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
#endif

#if PY_MAJOR_VERSION >= 3
  #define Py_TPFLAGS_CHECKTYPES 0
  #define Py_TPFLAGS_HAVE_INDEX 0
#endif

#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif

#if PY_MAJOR_VERSION >= 3
  #define PyBaseString_Type            PyUnicode_Type
  #define PyStringObject               PyUnicodeObject
  #define PyString_Type                PyUnicode_Type
  #define PyString_Check               PyUnicode_Check
  #define PyString_CheckExact          PyUnicode_CheckExact
#endif

#if PY_VERSION_HEX < 0x02060000
  #define PyBytesObject                PyStringObject
  #define PyBytes_Type                 PyString_Type
  #define PyBytes_Check                PyString_Check
  #define PyBytes_CheckExact           PyString_CheckExact
  #define PyBytes_FromString           PyString_FromString
  #define PyBytes_FromStringAndSize    PyString_FromStringAndSize
  #define PyBytes_FromFormat           PyString_FromFormat
  #define PyBytes_DecodeEscape         PyString_DecodeEscape
  #define PyBytes_AsString             PyString_AsString
  #define PyBytes_AsStringAndSize      PyString_AsStringAndSize
  #define PyBytes_Size                 PyString_Size
  #define PyBytes_AS_STRING            PyString_AS_STRING
  #define PyBytes_GET_SIZE             PyString_GET_SIZE
  #define PyBytes_Repr                 PyString_Repr
  #define PyBytes_Concat               PyString_Concat
  #define PyBytes_ConcatAndDel         PyString_ConcatAndDel
#endif

#if PY_VERSION_HEX < 0x02060000
  #define PySet_Check(obj)             PyObject_TypeCheck(obj, &PySet_Type)
  #define PyFrozenSet_Check(obj)       PyObject_TypeCheck(obj, &PyFrozenSet_Type)
#endif
#ifndef PySet_CheckExact
  #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
#endif

#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)

#if PY_MAJOR_VERSION >= 3
  #define PyIntObject                  PyLongObject
  #define PyInt_Type                   PyLong_Type
  #define PyInt_Check(op)              PyLong_Check(op)
  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
  #define PyInt_FromString             PyLong_FromString
  #define PyInt_FromUnicode            PyLong_FromUnicode
  #define PyInt_FromLong               PyLong_FromLong
  #define PyInt_FromSize_t             PyLong_FromSize_t
  #define PyInt_FromSsize_t            PyLong_FromSsize_t
  #define PyInt_AsLong                 PyLong_AsLong
  #define PyInt_AS_LONG                PyLong_AS_LONG
  #define PyInt_AsSsize_t              PyLong_AsSsize_t
  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
#endif

#if PY_MAJOR_VERSION >= 3
  #define PyBoolObject                 PyLongObject
#endif


#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#else
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
#endif

#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300)
  #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b)
  #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value)
  #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b)
#else
  #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \
        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \
        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \
            (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0)))
  #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \
        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \
            (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1)))
  #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \
        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
            (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
#endif

#if PY_MAJOR_VERSION >= 3
  #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
#endif

#if PY_VERSION_HEX < 0x02050000
  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),((char *)(n)))
  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),((char *)(n)))
#else
  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),(n))
  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),(n))
#endif

#if PY_VERSION_HEX < 0x02050000
  #define __Pyx_NAMESTR(n) ((char *)(n))
  #define __Pyx_DOCSTR(n)  ((char *)(n))
#else
  #define __Pyx_NAMESTR(n) (n)
  #define __Pyx_DOCSTR(n)  (n)
#endif

#ifdef __cplusplus
#define __PYX_EXTERN_C extern "C"
#else
#define __PYX_EXTERN_C extern
#endif

#if defined(WIN32) || defined(MS_WINDOWS)
#define _USE_MATH_DEFINES
#endif
#include <math.h>
#define __PYX_HAVE_API__lxml__etree
#include "string.h"
#include "stdio.h"
#include "stdlib.h"
#include "stdarg.h"
#include "etree_defs.h"
#include "lxml-version.h"
#include "libxml/xmlversion.h"
#include "libxml/encoding.h"
#include "libxml/chvalid.h"
#include "libxml/hash.h"
#include "libxml/tree.h"
#include "libxml/uri.h"
#include "libxml/HTMLtree.h"
#include "libxml/valid.h"
#include "libxml/xmlIO.h"
#include "libxml/xmlsave.h"
#include "libxml/globals.h"
#include "libxml/xmlstring.h"
#include "libxml/xmlmemory.h"
#include "pythread.h"
#include "libxml/xmlerror.h"
#include "libxml/xpath.h"
#include "libxml/xpathInternals.h"
#include "libxml/c14n.h"
#include "libxml/parser.h"
#include "libxml/parserInternals.h"
#include "libxml/HTMLparser.h"
#include "libxml/xinclude.h"
#include "libxslt/xslt.h"
#include "libxslt/xsltconfig.h"
#include "libxslt/xsltInternals.h"
#include "libxslt/extensions.h"
#include "libxslt/documents.h"
#include "libxslt/transform.h"
#include "libxslt/xsltutils.h"
#include "libxslt/security.h"
#include "libxslt/variables.h"
#include "libxslt/extra.h"
#include "libexslt/exslt.h"
#include "libxml/relaxng.h"
#include "libxml/xmlschemas.h"
#include "libxml/schematron.h"

#ifdef PYREX_WITHOUT_ASSERTIONS
#define CYTHON_WITHOUT_ASSERTIONS
#endif


/* inline attribute */
#ifndef CYTHON_INLINE
  #if defined(__GNUC__)
    #define CYTHON_INLINE __inline__
  #elif defined(_MSC_VER)
    #define CYTHON_INLINE __inline
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_INLINE inline
  #else
    #define CYTHON_INLINE
  #endif
#endif

/* unused attribute */
#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define CYTHON_UNUSED __attribute__ ((__unused__))
#   else
#     define CYTHON_UNUSED
#   endif
# elif defined(__ICC) || defined(__INTEL_COMPILER)
#   define CYTHON_UNUSED __attribute__ ((__unused__))
# else
#   define CYTHON_UNUSED
# endif
#endif

typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/


/* Type Conversion Predeclarations */

#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s)
#define __Pyx_PyBytes_AsUString(s)   ((unsigned char*) PyBytes_AsString(s))

#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);

static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);

#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))


#ifdef __GNUC__
/* Test for GCC > 2.95 */
#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
#define likely(x)   __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
#else /* __GNUC__ > 2 ... */
#define likely(x)   (x)
#define unlikely(x) (x)
#endif /* __GNUC__ > 2 ... */
#else /* __GNUC__ */
#define likely(x)   (x)
#define unlikely(x) (x)
#endif /* __GNUC__ */
    
static PyObject *__pyx_m;
static PyObject *__pyx_b;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;


static const char *__pyx_f[] = {
  "lxml.etree.pyx",
  "xmlerror.pxi",
  "apihelpers.pxi",
  "parser.pxi",
  "serializer.pxi",
  "cleanup.pxi",
  "extensions.pxi",
  "proxy.pxi",
  "readonlytree.pxi",
  "classlookup.pxi",
  "nsclasses.pxi",
  "docloader.pxi",
  "saxparser.pxi",
  "parsertarget.pxi",
  "iterparse.pxi",
  "xmlid.pxi",
  "xinclude.pxi",
  "xpath.pxi",
  "xslt.pxi",
  "xsltext.pxi",
  "dtd.pxi",
  "relaxng.pxi",
  "xmlschema.pxi",
  "schematron.pxi",
  "public-api.pxi",
};

/* Type declarations */

typedef xmlNode *(*_node_to_node_function)(xmlNode *);

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":215
 *         c_parent = c_parent.parent
 * 
 * ctypedef struct _nscache:             # <<<<<<<<<<<<<<
 *     xmlNs** new
 *     xmlNs** old
 */

typedef struct {
  xmlNs **new;
  xmlNs **old;
  size_t size;
  size_t last;
} __pyx_t_4lxml_5etree__nscache;

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":308
 *                                   _cstr(attr_name_utf), _cstr(value_utf))
 * 
 * ctypedef struct _ns_node_ref:             # <<<<<<<<<<<<<<
 *     xmlNs* ns
 *     xmlNode* node
 */

typedef struct {
  xmlNs *ns;
  xmlNode *node;
} __pyx_t_4lxml_5etree__ns_node_ref;

typedef PyObject *(*_element_class_lookup_function)(PyObject *, struct LxmlDocument *, xmlNode *);

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":3
 * # Custom resolver API
 * 
 * ctypedef enum _InputDocumentDataType:             # <<<<<<<<<<<<<<
 *     PARSER_DATA_INVALID
 *     PARSER_DATA_EMPTY
 */

typedef enum {
  __pyx_e_4lxml_5etree_PARSER_DATA_INVALID,
  __pyx_e_4lxml_5etree_PARSER_DATA_EMPTY,
  __pyx_e_4lxml_5etree_PARSER_DATA_STRING,
  __pyx_e_4lxml_5etree_PARSER_DATA_FILENAME,
  __pyx_e_4lxml_5etree_PARSER_DATA_FILE
} __pyx_t_4lxml_5etree__InputDocumentDataType;

typedef enum {
  __pyx_e_4lxml_5etree_SAX_EVENT_START = 1,
  __pyx_e_4lxml_5etree_SAX_EVENT_END = 2,
  __pyx_e_4lxml_5etree_SAX_EVENT_DATA = 4,
  __pyx_e_4lxml_5etree_SAX_EVENT_DOCTYPE = 8,
  __pyx_e_4lxml_5etree_SAX_EVENT_PI = 16,
  __pyx_e_4lxml_5etree_SAX_EVENT_COMMENT = 32
} __pyx_t_4lxml_5etree__SaxParserEvents;

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":7
 *     """
 * 
 * cdef enum _OutputMethods:             # <<<<<<<<<<<<<<
 *     OUTPUT_METHOD_XML
 *     OUTPUT_METHOD_HTML
 */

enum __pyx_t_4lxml_5etree__OutputMethods {
  __pyx_e_4lxml_5etree_OUTPUT_METHOD_XML,
  __pyx_e_4lxml_5etree_OUTPUT_METHOD_HTML,
  __pyx_e_4lxml_5etree_OUTPUT_METHOD_TEXT
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":5
 * DEF __ITERPARSE_CHUNK_SIZE = 32768
 * 
 * ctypedef enum _IterparseEventFilter:             # <<<<<<<<<<<<<<
 *     ITERPARSE_FILTER_START     =  1
 *     ITERPARSE_FILTER_END       =  2
 */

typedef enum {
  __pyx_e_4lxml_5etree_ITERPARSE_FILTER_START = 1,
  __pyx_e_4lxml_5etree_ITERPARSE_FILTER_END = 2,
  __pyx_e_4lxml_5etree_ITERPARSE_FILTER_START_NS = 4,
  __pyx_e_4lxml_5etree_ITERPARSE_FILTER_END_NS = 8,
  __pyx_e_4lxml_5etree_ITERPARSE_FILTER_COMMENT = 16,
  __pyx_e_4lxml_5etree_ITERPARSE_FILTER_PI = 32
} __pyx_t_4lxml_5etree__IterparseEventFilter;

typedef int (*__pyx_t_4lxml_5etree__register_function)(void *, PyObject *, PyObject *);

/* "src/lxml/lxml.etree.pyx":288
 * cdef public class _Document [ type LxmlDocumentType, object LxmlDocument ]
 * cdef public class _Element [ type LxmlElementType, object LxmlElement ]
 * cdef class _BaseParser             # <<<<<<<<<<<<<<
 * cdef class QName
 * ctypedef public xmlNode* (*_node_to_node_function)(xmlNode*)
 */

struct __pyx_obj_4lxml_5etree__BaseParser {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__BaseParser *__pyx_vtab;
  struct LxmlElementClassLookup *_class_lookup;
  struct __pyx_obj_4lxml_5etree__ResolverRegistry *_resolvers;
  struct __pyx_obj_4lxml_5etree__ParserContext *_parser_context;
  struct __pyx_obj_4lxml_5etree__ParserContext *_push_parser_context;
  int _parse_options;
  int _for_html;
  int _remove_comments;
  int _remove_pis;
  int _strip_cdata;
  struct __pyx_obj_4lxml_5etree_XMLSchema *_schema;
  PyObject *_filename;
  PyObject *target;
  PyObject *_default_encoding;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1028
 * ############################################################
 * 
 * cdef class _FeedParser(_BaseParser):             # <<<<<<<<<<<<<<
 *     cdef bint _feed_parser_running
 * 
 */

struct __pyx_obj_4lxml_5etree__FeedParser {
  struct __pyx_obj_4lxml_5etree__BaseParser __pyx_base;
  int _feed_parser_running;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1210
 *     )
 * 
 * cdef class XMLParser(_FeedParser):             # <<<<<<<<<<<<<<
 *     u"""XMLParser(self, encoding=None, attribute_defaults=False, dtd_validation=False, load_dtd=False, no_network=True, ns_clean=False, recover=False, XMLSchema schema=None, remove_blank_text=False, resolve_entities=True, remove_comments=False, remove_pis=False, strip_cdata=True, target=None, compact=True)
 * 
 */

struct __pyx_obj_4lxml_5etree_XMLParser {
  struct __pyx_obj_4lxml_5etree__FeedParser __pyx_base;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1292
 *                              target, None, encoding)
 * 
 * cdef class ETCompatXMLParser(XMLParser):             # <<<<<<<<<<<<<<
 *     u"""ETCompatXMLParser(self, encoding=None, attribute_defaults=False, \
 *                  dtd_validation=False, load_dtd=False, no_network=True, \
 */

struct __pyx_obj_4lxml_5etree_ETCompatXMLParser {
  struct __pyx_obj_4lxml_5etree_XMLParser __pyx_base;
};

/* "src/lxml/lxml.etree.pyx":287
 * # forward declarations
 * cdef public class _Document [ type LxmlDocumentType, object LxmlDocument ]
 * cdef public class _Element [ type LxmlElementType, object LxmlElement ]             # <<<<<<<<<<<<<<
 * cdef class _BaseParser
 * cdef class QName
 */

struct LxmlElement {
  PyObject_HEAD
  PyObject *_gc_doc;
  struct LxmlDocument *_doc;
  xmlNode *_c_node;
  PyObject *_tag;
};

/* "src/lxml/lxml.etree.pyx":1491
 * 
 * 
 * cdef class __ContentOnlyElement(_Element):             # <<<<<<<<<<<<<<
 *     cdef int _raiseImmutable(self) except -1:
 *         raise TypeError, u"this element does not have children or attributes"
 */

struct __pyx_obj_4lxml_5etree___ContentOnlyElement {
  struct LxmlElement __pyx_base;
  struct __pyx_vtabstruct_4lxml_5etree___ContentOnlyElement *__pyx_vtab;
};

/* "src/lxml/lxml.etree.pyx":1570
 *         return u"<!--%s-->" % self.text
 * 
 * cdef class _ProcessingInstruction(__ContentOnlyElement):             # <<<<<<<<<<<<<<
 *     property tag:
 *         def __get__(self):
 */

struct __pyx_obj_4lxml_5etree__ProcessingInstruction {
  struct __pyx_obj_4lxml_5etree___ContentOnlyElement __pyx_base;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":126
 *         tree.xmlAddChild(<xmlNode*>c_doc, self._c_node)
 * 
 * cdef class PIBase(_ProcessingInstruction):             # <<<<<<<<<<<<<<
 *     u"""All custom Processing Instruction classes must inherit from this one.
 * 
 */

struct __pyx_obj_4lxml_5etree_PIBase {
  struct __pyx_obj_4lxml_5etree__ProcessingInstruction __pyx_base;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":829
 *     return __findStylesheetByID(doc, id=id)
 * 
 * cdef class _XSLTProcessingInstruction(PIBase):             # <<<<<<<<<<<<<<
 *     def parseXSL(self, parser=None):
 *         u"""parseXSL(self, parser=None)
 */

struct __pyx_obj_4lxml_5etree__XSLTProcessingInstruction {
  struct __pyx_obj_4lxml_5etree_PIBase __pyx_base;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":14
 * 
 * 
 * cdef class _NamespaceRegistry:             # <<<<<<<<<<<<<<
 *     u"Dictionary-like namespace registry"
 *     cdef object _ns_uri
 */

struct __pyx_obj_4lxml_5etree__NamespaceRegistry {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__NamespaceRegistry *__pyx_vtab;
  PyObject *_ns_uri;
  PyObject *_ns_uri_utf;
  PyObject *_entries;
  char *_c_ns_uri_utf;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":188
 *         return registry
 * 
 * cdef class _FunctionNamespaceRegistry(_NamespaceRegistry):             # <<<<<<<<<<<<<<
 *     def __setitem__(self, name, item):
 *         if not callable(item):
 */

struct __pyx_obj_4lxml_5etree__FunctionNamespaceRegistry {
  struct __pyx_obj_4lxml_5etree__NamespaceRegistry __pyx_base;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":201
 *         return u"FunctionNamespace(%r)" % self._ns_uri
 * 
 * cdef class _XPathFunctionNamespaceRegistry(_FunctionNamespaceRegistry):             # <<<<<<<<<<<<<<
 *     cdef object _prefix
 *     cdef object _prefix_utf
 */

struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry {
  struct __pyx_obj_4lxml_5etree__FunctionNamespaceRegistry __pyx_base;
  PyObject *_prefix;
  PyObject *_prefix_utf;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":11
 *     SAX_EVENT_COMMENT = 32
 * 
 * cdef class _SaxParserTarget:             # <<<<<<<<<<<<<<
 *     cdef int _sax_event_filter
 *     cdef int _sax_event_propagate
 */

struct __pyx_obj_4lxml_5etree__SaxParserTarget {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget *__pyx_vtab;
  int _sax_event_filter;
  int _sax_event_propagate;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":123
 *             return ErrorLevels._getName(self.level, u"unknown")
 * 
 * cdef class _BaseErrorLog:             # <<<<<<<<<<<<<<
 *     cdef _LogEntry _first_error
 *     cdef readonly object last_error
 */

struct __pyx_obj_4lxml_5etree__BaseErrorLog {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__BaseErrorLog *__pyx_vtab;
  struct __pyx_obj_4lxml_5etree__LogEntry *_first_error;
  PyObject *last_error;
};

/* "src/lxml/lxml.etree.pyx":2303
 * 
 * 
 * cdef public class _ElementTagMatcher [ object LxmlElementTagMatcher,             # <<<<<<<<<<<<<<
 *                                        type LxmlElementTagMatcherType ]:
 *     cdef object _pystrings
 */

struct LxmlElementTagMatcher {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__ElementTagMatcher *__pyx_vtab;
  PyObject *_pystrings;
  int _node_type;
  char *_href;
  char *_name;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":328
 * 
 * 
 * cdef class XSLT:             # <<<<<<<<<<<<<<
 *     u"""XSLT(self, xslt_input, extensions=None, regexp=True, access_control=None)
 * 
 */

struct __pyx_obj_4lxml_5etree_XSLT {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree_XSLT *__pyx_vtab;
  struct __pyx_obj_4lxml_5etree__XSLTContext *_context;
  xsltStylesheet *_c_style;
  struct __pyx_obj_4lxml_5etree__XSLTResolverContext *_xslt_resolver_context;
  struct __pyx_obj_4lxml_5etree_XSLTAccessControl *_access_control;
  struct __pyx_obj_4lxml_5etree__ErrorLog *_error_log;
};

/* "src/lxml/lxml.etree.pyx":2412
 *         self._storeNext(node)
 * 
 * cdef class ElementDepthFirstIterator(_ElementTagMatcher):             # <<<<<<<<<<<<<<
 *     u"""ElementDepthFirstIterator(self, node, tag=None, inclusive=True)
 *     Iterates over an element and its sub-elements in document order (depth
 */

struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator {
  struct LxmlElementTagMatcher __pyx_base;
  struct LxmlElement *_next_node;
  struct LxmlElement *_top_node;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":187
 * 
 * # class to store element class lookup functions
 * cdef public class ElementClassLookup [ type LxmlElementClassLookupType,             # <<<<<<<<<<<<<<
 *                                        object LxmlElementClassLookup ]:
 *     u"""ElementClassLookup(self)
 */

struct LxmlElementClassLookup {
  PyObject_HEAD
  _element_class_lookup_function _lookup_function;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":106
 *         return doc_ref
 * 
 * cdef class _ResolverRegistry:             # <<<<<<<<<<<<<<
 *     cdef object _resolvers
 *     cdef Resolver _default_resolver
 */

struct __pyx_obj_4lxml_5etree__ResolverRegistry {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__ResolverRegistry *__pyx_vtab;
  PyObject *_resolvers;
  struct __pyx_obj_4lxml_5etree_Resolver *_default_resolver;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":332
 * ############################################################
 * 
 * cdef class TreeBuilder(_SaxParserTarget):             # <<<<<<<<<<<<<<
 *     u"""TreeBuilder(self, element_factory=None, parser=None)
 *     Parser target that builds a tree.
 */

struct __pyx_obj_4lxml_5etree_TreeBuilder {
  struct __pyx_obj_4lxml_5etree__SaxParserTarget __pyx_base;
  struct __pyx_obj_4lxml_5etree__BaseParser *_parser;
  PyObject *_factory;
  PyObject *_data;
  PyObject *_element_stack;
  PyObject *_element_stack_pop;
  struct LxmlElement *_last;
  int _in_tail;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":128
 *     _XPATH_VERSION_WARNING_REQUIRED = 0
 * 
 * cdef class _XPathEvaluatorBase:             # <<<<<<<<<<<<<<
 *     cdef xpath.xmlXPathContext* _xpathCtxt
 *     cdef _XPathContext _context
 */

struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__XPathEvaluatorBase *__pyx_vtab;
  xmlXPathContext *_xpathCtxt;
  struct __pyx_obj_4lxml_5etree__XPathContext *_context;
  PyThread_type_lock _eval_lock;
  struct __pyx_obj_4lxml_5etree__ErrorLog *_error_log;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":253
 * 
 * 
 * cdef class XPathElementEvaluator(_XPathEvaluatorBase):             # <<<<<<<<<<<<<<
 *     u"""XPathElementEvaluator(self, element, namespaces=None, extensions=None, regexp=True, smart_strings=True)
 *     Create an XPath evaluator for an element.
 */

struct __pyx_obj_4lxml_5etree_XPathElementEvaluator {
  struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase __pyx_base;
  struct LxmlElement *_element;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":333
 * 
 * 
 * cdef class XPathDocumentEvaluator(XPathElementEvaluator):             # <<<<<<<<<<<<<<
 *     u"""XPathDocumentEvaluator(self, etree, namespaces=None, extensions=None, regexp=True, smart_strings=True)
 *     Create an XPath evaluator for an ElementTree.
 */

struct __pyx_obj_4lxml_5etree_XPathDocumentEvaluator {
  struct __pyx_obj_4lxml_5etree_XPathElementEvaluator __pyx_base;
};

/* "src/lxml/lxml.etree.pyx":1562
 *         return []
 * 
 * cdef class _Comment(__ContentOnlyElement):             # <<<<<<<<<<<<<<
 *     property tag:
 *         def __get__(self):
 */

struct __pyx_obj_4lxml_5etree__Comment {
  struct __pyx_obj_4lxml_5etree___ContentOnlyElement __pyx_base;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":361
 * # read-only status of the node, so use with caution.
 * 
 * cdef class _OpaqueNodeWrapper:             # <<<<<<<<<<<<<<
 *     cdef tree.xmlNode* _c_node
 *     def __init__(self):
 */

struct __pyx_obj_4lxml_5etree__OpaqueNodeWrapper {
  PyObject_HEAD
  xmlNode *_c_node;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":366
 *         raise TypeError, u"This type cannot be instatiated from Python"
 * 
 * cdef class _OpaqueDocumentWrapper(_OpaqueNodeWrapper):             # <<<<<<<<<<<<<<
 *     cdef int _assertNode(self) except -1:
 *         u"""This is our way of saying: this proxy is invalid!
 */

struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper {
  struct __pyx_obj_4lxml_5etree__OpaqueNodeWrapper __pyx_base;
  struct __pyx_vtabstruct_4lxml_5etree__OpaqueDocumentWrapper *__pyx_vtab;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":415
 * 
 * 
 * cdef class XPath(_XPathEvaluatorBase):             # <<<<<<<<<<<<<<
 *     u"""XPath(self, path, namespaces=None, extensions=None, regexp=True, smart_strings=True)
 *     A compiled XPath expression that can be called on Elements and ElementTrees.
 */

struct __pyx_obj_4lxml_5etree_XPath {
  struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase __pyx_base;
  xmlXPathCompExpr *_xpath;
  PyObject *_path;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":495
 * _find_namespaces = re.compile(b'({[^}]+})').findall
 * 
 * cdef class ETXPath(XPath):             # <<<<<<<<<<<<<<
 *     u"""ETXPath(self, path, extensions=None, regexp=True, smart_strings=True)
 *     Special XPath class that supports the ElementTree {uri} notation for namespaces.
 */

struct __pyx_obj_4lxml_5etree_ETXPath {
  struct __pyx_obj_4lxml_5etree_XPath __pyx_base;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":196
 *         self._lookup_function = NULL # use default lookup
 * 
 * cdef public class FallbackElementClassLookup(ElementClassLookup) \             # <<<<<<<<<<<<<<
 *          [ type LxmlFallbackElementClassLookupType,
 *            object LxmlFallbackElementClassLookup ]:
 */

struct LxmlFallbackElementClassLookup {
  struct LxmlElementClassLookup __pyx_base;
  struct __pyx_vtabstruct_4lxml_5etree_FallbackElementClassLookup *__pyx_vtab;
  struct LxmlElementClassLookup *fallback;
  _element_class_lookup_function _fallback_function;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":386
 * #  custom class lookup based on node type, namespace, name
 * 
 * cdef class CustomElementClassLookup(FallbackElementClassLookup):             # <<<<<<<<<<<<<<
 *     u"""CustomElementClassLookup(self, fallback=None)
 *     Element class lookup based on a subclass method.
 */

struct __pyx_obj_4lxml_5etree_CustomElementClassLookup {
  struct LxmlFallbackElementClassLookup __pyx_base;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":3
 * # read-only tree implementation
 * 
 * cdef class _ReadOnlyProxy:             # <<<<<<<<<<<<<<
 *     u"A read-only proxy class suitable for PIs/Comments (for internal use only!)."
 *     cdef bint _free_after_use
 */

struct __pyx_obj_4lxml_5etree__ReadOnlyProxy {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *__pyx_vtab;
  int _free_after_use;
  xmlNode *_c_node;
  struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *_source_proxy;
  PyObject *_dependent_proxies;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":268
 * 
 * 
 * cdef class _ReadOnlyElementProxy(_ReadOnlyProxy):             # <<<<<<<<<<<<<<
 *     u"The main read-only Element proxy class (for internal use only!)."
 * 
 */

struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy {
  struct __pyx_obj_4lxml_5etree__ReadOnlyProxy __pyx_base;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":101
 *                 raise TypeError, "Invalid child type: %r" % type(child)
 * 
 * cdef class CommentBase(_Comment):             # <<<<<<<<<<<<<<
 *     u"""All custom Comment classes must inherit from this one.
 * 
 */

struct __pyx_obj_4lxml_5etree_CommentBase {
  struct __pyx_obj_4lxml_5etree__Comment __pyx_base;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":319
 * 
 * 
 * cdef class _XSLTQuotedStringParam:             # <<<<<<<<<<<<<<
 *     u"""A wrapper class for literal XSLT string parameters that require
 *     quote escaping.
 */

struct __pyx_obj_4lxml_5etree__XSLTQuotedStringParam {
  PyObject_HEAD
  PyObject *strval;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":31
 * # Base class for XSLT and XPath evaluation contexts: functions, namespaces, ...
 * 
 * cdef class _BaseContext:             # <<<<<<<<<<<<<<
 *     cdef xpath.xmlXPathContext* _xpathCtxt
 *     cdef _Document _doc
 */

struct __pyx_obj_4lxml_5etree__BaseContext {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__BaseContext *__pyx_vtab;
  xmlXPathContext *_xpathCtxt;
  struct LxmlDocument *_doc;
  PyObject *_extensions;
  PyObject *_namespaces;
  PyObject *_global_namespaces;
  PyObject *_utf_refs;
  PyObject *_function_cache;
  PyObject *_eval_context_dict;
  int _build_smart_strings;
  struct __pyx_obj_4lxml_5etree__TempStore *_temp_refs;
  PyObject *_temp_documents;
  struct __pyx_obj_4lxml_5etree__ExceptionContext *_exc;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":269
 * cdef dict EMPTY_DICT = {}
 * 
 * cdef class _XSLTContext(_BaseContext):             # <<<<<<<<<<<<<<
 *     cdef xslt.xsltTransformContext* _xsltCtxt
 *     cdef _ReadOnlyElementProxy _extension_element_proxy
 */

struct __pyx_obj_4lxml_5etree__XSLTContext {
  struct __pyx_obj_4lxml_5etree__BaseContext __pyx_base;
  xsltTransformContext *_xsltCtxt;
  struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *_extension_element_proxy;
  PyObject *_extension_elements;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":3
 * # XSLT extension elements
 * 
 * cdef class XSLTExtension:             # <<<<<<<<<<<<<<
 *     u"""Base class of an XSLT extension element.
 *     """
 */

struct __pyx_obj_4lxml_5etree_XSLTExtension {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree_XSLTExtension *__pyx_vtab;
};

/* "src/lxml/lxml.etree.pyx":260
 * 
 * # class for temporarily storing exceptions raised in extensions
 * cdef class _ExceptionContext:             # <<<<<<<<<<<<<<
 *     cdef object _exc_info
 *     cdef void clear(self):
 */

struct __pyx_obj_4lxml_5etree__ExceptionContext {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext *__pyx_vtab;
  PyObject *_exc_info;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":153
 *         return repr(self._resolvers)
 * 
 * cdef class _ResolverContext(_ExceptionContext):             # <<<<<<<<<<<<<<
 *     cdef _ResolverRegistry _resolvers
 *     cdef _TempStore _storage
 */

struct __pyx_obj_4lxml_5etree__ResolverContext {
  struct __pyx_obj_4lxml_5etree__ExceptionContext __pyx_base;
  struct __pyx_obj_4lxml_5etree__ResolverRegistry *_resolvers;
  struct __pyx_obj_4lxml_5etree__TempStore *_storage;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":6
 * cimport htmlparser
 * 
 * cdef class _ParserContext(_ResolverContext)             # <<<<<<<<<<<<<<
 * cdef class _SaxParserContext(_ParserContext)
 * cdef class _TargetParserContext(_SaxParserContext)
 */

struct __pyx_obj_4lxml_5etree__ParserContext {
  struct __pyx_obj_4lxml_5etree__ResolverContext __pyx_base;
  struct __pyx_obj_4lxml_5etree__ErrorLog *_error_log;
  struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *_validator;
  xmlParserCtxt *_c_ctxt;
  PyThread_type_lock _lock;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":7
 * 
 * cdef class _ParserContext(_ResolverContext)
 * cdef class _SaxParserContext(_ParserContext)             # <<<<<<<<<<<<<<
 * cdef class _TargetParserContext(_SaxParserContext)
 * cdef class _ParserSchemaValidationContext
 */

struct __pyx_obj_4lxml_5etree__SaxParserContext {
  struct __pyx_obj_4lxml_5etree__ParserContext __pyx_base;
  struct __pyx_obj_4lxml_5etree__SaxParserTarget *_target;
  startElementNsSAX2Func _origSaxStart;
  endElementNsSAX2Func _origSaxEnd;
  startElementSAXFunc _origSaxStartNoNs;
  endElementSAXFunc _origSaxEndNoNs;
  charactersSAXFunc _origSaxData;
  cdataBlockSAXFunc _origSaxCData;
  internalSubsetSAXFunc _origSaxDoctype;
  commentSAXFunc _origSaxComment;
  processingInstructionSAXFunc _origSaxPi;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":8
 * cdef class _ParserContext(_ResolverContext)
 * cdef class _SaxParserContext(_ParserContext)
 * cdef class _TargetParserContext(_SaxParserContext)             # <<<<<<<<<<<<<<
 * cdef class _ParserSchemaValidationContext
 * cdef class _Validator
 */

struct __pyx_obj_4lxml_5etree__TargetParserContext {
  struct __pyx_obj_4lxml_5etree__SaxParserContext __pyx_base;
  PyObject *_python_target;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":20
 * 
 * 
 * cdef class Resolver:             # <<<<<<<<<<<<<<
 *     u"This is the base class of all resolvers."
 *     def resolve(self, system_url, public_id, context):
 */

struct __pyx_obj_4lxml_5etree_Resolver {
  PyObject_HEAD
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":50
 * 
 * 
 * cdef class _XPathContext(_BaseContext):             # <<<<<<<<<<<<<<
 *     cdef object _variables
 *     def __init__(self, namespaces, extensions, enable_regexp, variables,
 */

struct __pyx_obj_4lxml_5etree__XPathContext {
  struct __pyx_obj_4lxml_5etree__BaseContext __pyx_base;
  PyObject *_variables;
};

/* "src/lxml/lxml.etree.pyx":1594
 *             return u"<?%s?>" % self.target
 * 
 * cdef class _Entity(__ContentOnlyElement):             # <<<<<<<<<<<<<<
 *     property tag:
 *         def __get__(self):
 */

struct __pyx_obj_4lxml_5etree__Entity {
  struct __pyx_obj_4lxml_5etree___ContentOnlyElement __pyx_base;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":153
 *         tree.xmlAddChild(<xmlNode*>c_doc, self._c_node)
 * 
 * cdef class EntityBase(_Entity):             # <<<<<<<<<<<<<<
 *     u"""All custom Entity classes must inherit from this one.
 * 
 */

struct __pyx_obj_4lxml_5etree_EntityBase {
  struct __pyx_obj_4lxml_5etree__Entity __pyx_base;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xinclude.pxi":10
 *     pass
 * 
 * cdef class XInclude:             # <<<<<<<<<<<<<<
 *     u"""XInclude(self)
 *     XInclude processor.
 */

struct __pyx_obj_4lxml_5etree_XInclude {
  PyObject_HEAD
  struct __pyx_obj_4lxml_5etree__ErrorLog *_error_log;
};

/* "src/lxml/lxml.etree.pyx":286
 * 
 * # forward declarations
 * cdef public class _Document [ type LxmlDocumentType, object LxmlDocument ]             # <<<<<<<<<<<<<<
 * cdef public class _Element [ type LxmlElementType, object LxmlElement ]
 * cdef class _BaseParser
 */

struct LxmlDocument {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__Document *__pyx_vtab;
  int _ns_counter;
  PyObject *_prefix_tail;
  xmlDoc *_c_doc;
  struct __pyx_obj_4lxml_5etree__BaseParser *_parser;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":10
 *     PARSER_DATA_FILE
 * 
 * cdef class _InputDocument:             # <<<<<<<<<<<<<<
 *     cdef _InputDocumentDataType _type
 *     cdef object _data_bytes
 */

struct __pyx_obj_4lxml_5etree__InputDocument {
  PyObject_HEAD
  __pyx_t_4lxml_5etree__InputDocumentDataType _type;
  PyObject *_data_bytes;
  PyObject *_filename;
  PyObject *_file;
};

/* "src/lxml/lxml.etree.pyx":1683
 * 
 * 
 * cdef public class _ElementTree [ type LxmlElementTreeType,             # <<<<<<<<<<<<<<
 *                                  object LxmlElementTree ]:
 *     cdef _Document _doc
 */

struct LxmlElementTree {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__ElementTree *__pyx_vtab;
  struct LxmlDocument *_doc;
  struct LxmlElement *_context_node;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":413
 * # element proxies that allow restricted modification
 * 
 * cdef class _ModifyContentOnlyProxy(_ReadOnlyProxy):             # <<<<<<<<<<<<<<
 *     u"""A read-only proxy that allows changing the text content.
 *     """
 */

struct __pyx_obj_4lxml_5etree__ModifyContentOnlyProxy {
  struct __pyx_obj_4lxml_5etree__ReadOnlyProxy __pyx_base;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":369
 * #  per-parser lookup scheme
 * 
 * cdef class ParserBasedElementClassLookup(FallbackElementClassLookup):             # <<<<<<<<<<<<<<
 *     u"""ParserBasedElementClassLookup(self, fallback=None)
 *     Element class lookup based on the XML parser.
 */

struct __pyx_obj_4lxml_5etree_ParserBasedElementClassLookup {
  struct LxmlFallbackElementClassLookup __pyx_base;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":10
 * cdef class _TargetParserContext(_SaxParserContext)
 * cdef class _ParserSchemaValidationContext
 * cdef class _Validator             # <<<<<<<<<<<<<<
 * cdef class XMLSchema(_Validator)
 * 
 */

struct __pyx_obj_4lxml_5etree__Validator {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__Validator *__pyx_vtab;
  struct __pyx_obj_4lxml_5etree__ErrorLog *_error_log;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":22
 * # RelaxNG
 * 
 * cdef class RelaxNG(_Validator):             # <<<<<<<<<<<<<<
 *     u"""RelaxNG(self, etree=None, file=None)
 *     Turn a document into a Relax NG validator.
 */

struct __pyx_obj_4lxml_5etree_RelaxNG {
  struct __pyx_obj_4lxml_5etree__Validator __pyx_base;
  xmlRelaxNG *_c_schema;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":41
 * # Logging classes
 * 
 * cdef class _LogEntry:             # <<<<<<<<<<<<<<
 *     """A log message entry from an error log.
 * 
 */

struct __pyx_obj_4lxml_5etree__LogEntry {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__LogEntry *__pyx_vtab;
  int domain;
  int type;
  int level;
  int line;
  int column;
  PyObject *message;
  PyObject *filename;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":260
 * ############################################################
 * 
 * cdef class _FileReaderContext:             # <<<<<<<<<<<<<<
 *     cdef object _filelike
 *     cdef object _encoding
 */

struct __pyx_obj_4lxml_5etree__FileReaderContext {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__FileReaderContext *__pyx_vtab;
  PyObject *_filelike;
  PyObject *_encoding;
  PyObject *_url;
  PyObject *_bytes;
  struct __pyx_obj_4lxml_5etree__ExceptionContext *_exc_context;
  Py_ssize_t _bytes_read;
  char *_c_url;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":13
 *         self.result = result
 * 
 * cdef class _PythonSaxParserTarget(_SaxParserTarget):             # <<<<<<<<<<<<<<
 *     cdef object _target_start
 *     cdef object _target_end
 */

struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget {
  struct __pyx_obj_4lxml_5etree__SaxParserTarget __pyx_base;
  PyObject *_target_start;
  PyObject *_target_end;
  PyObject *_target_data;
  PyObject *_target_doctype;
  PyObject *_target_pi;
  PyObject *_target_comment;
  int _start_takes_nsmap;
};

/* "src/lxml/lxml.etree.pyx":2601
 * PI = ProcessingInstruction
 * 
 * cdef class CDATA:             # <<<<<<<<<<<<<<
 *     u"""CDATA(data)
 * 
 */

struct __pyx_obj_4lxml_5etree_CDATA {
  PyObject_HEAD
  PyObject *_utf8_data;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":62
 *     return count
 * 
 * cdef class _IterparseContext(_ParserContext):             # <<<<<<<<<<<<<<
 *     cdef xmlparser.startElementNsSAX2Func _origSaxStart
 *     cdef xmlparser.endElementNsSAX2Func   _origSaxEnd
 */

struct __pyx_obj_4lxml_5etree__IterparseContext {
  struct __pyx_obj_4lxml_5etree__ParserContext __pyx_base;
  startElementNsSAX2Func _origSaxStart;
  endElementNsSAX2Func _origSaxEnd;
  startElementSAXFunc _origSaxStartNoNs;
  endElementSAXFunc _origSaxEndNoNs;
  commentSAXFunc _origSaxComment;
  processingInstructionSAXFunc _origSaxPI;
  struct LxmlElement *_root;
  struct LxmlDocument *_doc;
  int _event_filter;
  PyObject *_events;
  int _event_index;
  PyObject *_ns_stack;
  PyObject *_pop_ns;
  PyObject *_node_stack;
  PyObject *_pop_node;
  PyObject *_tag_tuple;
  char *_tag_href;
  char *_tag_name;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":206
 *         return message
 * 
 * cdef class _ListErrorLog(_BaseErrorLog):             # <<<<<<<<<<<<<<
 *     u"Immutable base version of a list based error log."
 *     cdef list _entries
 */

struct __pyx_obj_4lxml_5etree__ListErrorLog {
  struct __pyx_obj_4lxml_5etree__BaseErrorLog __pyx_base;
  PyObject *_entries;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":326
 *         return self.filter_from_level(ErrorLevels.WARNING)
 * 
 * cdef class _ErrorLog(_ListErrorLog):             # <<<<<<<<<<<<<<
 *     def __init__(self):
 *         _ListErrorLog.__init__(self, [], None, None)
 */

struct __pyx_obj_4lxml_5etree__ErrorLog {
  struct __pyx_obj_4lxml_5etree__ListErrorLog __pyx_base;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":244
 * 
 * 
 * cdef class _ReadOnlyPIProxy(_ReadOnlyProxy):             # <<<<<<<<<<<<<<
 *     u"A read-only proxy for processing instructions (for internal use only!)"
 *     property target:
 */

struct __pyx_obj_4lxml_5etree__ReadOnlyPIProxy {
  struct __pyx_obj_4lxml_5etree__ReadOnlyProxy __pyx_base;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":672
 *     return new_xslt
 * 
 * cdef class _XSLTResultTree(_ElementTree):             # <<<<<<<<<<<<<<
 *     cdef XSLT _xslt
 *     cdef _Document _profile
 */

struct __pyx_obj_4lxml_5etree__XSLTResultTree {
  struct LxmlElementTree __pyx_base;
  struct __pyx_obj_4lxml_5etree_XSLT *_xslt;
  struct LxmlDocument *_profile;
  char *_buffer;
  Py_ssize_t _buffer_len;
  Py_ssize_t _buffer_refcnt;
};

/* "src/lxml/lxml.etree.pyx":2491
 *         return NULL
 * 
 * cdef class ElementTextIterator:             # <<<<<<<<<<<<<<
 *     u"""ElementTextIterator(self, element, tag=None, with_tail=True)
 *     Iterates over the text content of a subtree.
 */

struct __pyx_obj_4lxml_5etree_ElementTextIterator {
  PyObject_HEAD
  PyObject *_nextEvent;
  struct LxmlElement *_start_element;
};

/* "src/lxml/lxml.etree.pyx":2331
 *                 self._name = NULL
 * 
 * cdef public class _ElementIterator(_ElementTagMatcher) [             # <<<<<<<<<<<<<<
 *     object LxmlElementIterator, type LxmlElementIteratorType ]:
 *     # we keep Python references here to control GC
 */

struct LxmlElementIterator {
  struct LxmlElementTagMatcher __pyx_base;
  struct LxmlElement *_node;
  _node_to_node_function _next_element;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":6
 * # Custom Element classes
 * 
 * cdef public class ElementBase(_Element) [ type LxmlElementBaseType,             # <<<<<<<<<<<<<<
 *                                           object LxmlElementBase ]:
 *     u"""ElementBase(*children, attrib=None, nsmap=None, **_extra)
 */

struct LxmlElementBase {
  struct LxmlElement __pyx_base;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":376
 *         self._entries.append(entry)
 * 
 * cdef class PyErrorLog(_BaseErrorLog):             # <<<<<<<<<<<<<<
 *     u"""PyErrorLog(self, logger_name=None, logger=None)
 *     A global error log that connects to the Python stdlib logging package.
 */

struct __pyx_obj_4lxml_5etree_PyErrorLog {
  struct __pyx_obj_4lxml_5etree__BaseErrorLog __pyx_base;
  PyObject *level_map;
  PyObject *_map_level;
  PyObject *_log;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":22
 * # DTD
 * 
 * cdef class DTD(_Validator):             # <<<<<<<<<<<<<<
 *     u"""DTD(self, file=None, external_id=None)
 *     A DTD validator.
 */

struct __pyx_obj_4lxml_5etree_DTD {
  struct __pyx_obj_4lxml_5etree__Validator __pyx_base;
  xmlDtd *_c_dtd;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":311
 *         return c_ctxt.node.next
 * 
 * cdef class iterparse(_BaseParser):             # <<<<<<<<<<<<<<
 *     u"""iterparse(self, source, events=("end",), tag=None, attribute_defaults=False, dtd_validation=False, load_dtd=False, no_network=True, remove_blank_text=False, remove_comments=False, remove_pis=False, encoding=None, html=False, huge_tree=False, schema=None)
 * 
 */

struct __pyx_obj_4lxml_5etree_iterparse {
  struct __pyx_obj_4lxml_5etree__BaseParser __pyx_base;
  PyObject *_tag;
  PyObject *_events;
  PyObject *root;
  PyObject *_source;
  PyObject *_buffer;
  int (*_parse_chunk)(xmlParserCtxt *, char *, int, int);
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":50
 * # XSLT document loaders
 * 
 * cdef class _XSLTResolverContext(_ResolverContext):             # <<<<<<<<<<<<<<
 *     cdef xmlDoc* _c_style_doc
 *     cdef _BaseParser _parser
 */

struct __pyx_obj_4lxml_5etree__XSLTResolverContext {
  struct __pyx_obj_4lxml_5etree__ResolverContext __pyx_base;
  xmlDoc *_c_style_doc;
  struct __pyx_obj_4lxml_5etree__BaseParser *_parser;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":40
 *     pass
 * 
 * cdef class _ParserDictionaryContext:             # <<<<<<<<<<<<<<
 *     # Global parser context to share the string dictionary.
 *     #
 */

struct __pyx_obj_4lxml_5etree__ParserDictionaryContext {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext *__pyx_vtab;
  xmlDict *_c_dict;
  struct __pyx_obj_4lxml_5etree__BaseParser *_default_parser;
  PyObject *_implied_parser_contexts;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":537
 * 
 * 
 * cdef class iterwalk:             # <<<<<<<<<<<<<<
 *     u"""iterwalk(self, element_or_tree, events=("end",), tag=None)
 * 
 */

struct __pyx_obj_4lxml_5etree_iterwalk {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree_iterwalk *__pyx_vtab;
  PyObject *_node_stack;
  PyObject *_pop_node;
  int _index;
  PyObject *_events;
  PyObject *_pop_event;
  int _event_filter;
  PyObject *_tag_tuple;
  char *_tag_href;
  char *_tag_name;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":356
 *         self._entries.append(entry)
 * 
 * cdef class _DomainErrorLog(_ErrorLog):             # <<<<<<<<<<<<<<
 *     def __init__(self, domains):
 *         _ErrorLog.__init__(self)
 */

struct __pyx_obj_4lxml_5etree__DomainErrorLog {
  struct __pyx_obj_4lxml_5etree__ErrorLog __pyx_base;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":319
 * # attribute based lookup scheme
 * 
 * cdef class AttributeBasedElementClassLookup(FallbackElementClassLookup):             # <<<<<<<<<<<<<<
 *     u"""AttributeBasedElementClassLookup(self, attribute_name, class_mapping, fallback=None)
 *     Checks an attribute of an Element and looks up the value in a
 */

struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup {
  struct LxmlFallbackElementClassLookup __pyx_base;
  PyObject *_class_mapping;
  PyObject *_pytag;
  char *_c_ns;
  char *_c_name;
};

/* "src/lxml/lxml.etree.pyx":471
 * 
 * 
 * cdef class DocInfo:             # <<<<<<<<<<<<<<
 *     u"Document information provided by parser and DTD."
 *     cdef _Document _doc
 */

struct __pyx_obj_4lxml_5etree_DocInfo {
  PyObject_HEAD
  struct LxmlDocument *_doc;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":11
 * cdef class _ParserSchemaValidationContext
 * cdef class _Validator
 * cdef class XMLSchema(_Validator)             # <<<<<<<<<<<<<<
 * 
 * class ParseError(LxmlSyntaxError):
 */

struct __pyx_obj_4lxml_5etree_XMLSchema {
  struct __pyx_obj_4lxml_5etree__Validator __pyx_base;
  xmlSchema *_c_schema;
  int _has_default_attributes;
  int _add_attribute_defaults;
};

/* "src/lxml/lxml.etree.pyx":2402
 *         self._storeNext(node)
 * 
 * cdef class AncestorsIterator(_ElementIterator):             # <<<<<<<<<<<<<<
 *     u"""AncestorsIterator(self, node, tag=None)
 *     Iterates over the ancestors of an element (from parent to parent).
 */

struct __pyx_obj_4lxml_5etree_AncestorsIterator {
  struct LxmlElementIterator __pyx_base;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":58
 *     return (_elementTreeFactory(doc, None), _IDDict(doc))
 * 
 * cdef class _IDDict:             # <<<<<<<<<<<<<<
 *     u"""IDDict(self, etree)
 *     A dictionary-like proxy class that mapps ID attributes to elements.
 */

struct __pyx_obj_4lxml_5etree__IDDict {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__IDDict *__pyx_vtab;
  struct LxmlDocument *_doc;
  PyObject *_keys;
  PyObject *_items;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":95
 * 
 * 
 * cdef class ElementNamespaceClassLookup(FallbackElementClassLookup):             # <<<<<<<<<<<<<<
 *     u"""ElementNamespaceClassLookup(self, fallback=None)
 * 
 */

struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup {
  struct LxmlFallbackElementClassLookup __pyx_base;
  PyObject *_namespace_registries;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":464
 * 
 * 
 * cdef class _AppendOnlyElementProxy(_ReadOnlyElementProxy):             # <<<<<<<<<<<<<<
 *     u"""A read-only element that allows adding children and changing the
 *     text content (i.e. everything that adds to the subtree).
 */

struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy {
  struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy __pyx_base;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":450
 *             tree.xmlNodeSetName(self._c_node, c_text)
 * 
 * cdef class _ModifyContentOnlyEntityProxy(_ModifyContentOnlyProxy):             # <<<<<<<<<<<<<<
 *     u"A read-only proxy for entity references (for internal use only!)"
 *     property name:
 */

struct __pyx_obj_4lxml_5etree__ModifyContentOnlyEntityProxy {
  struct __pyx_obj_4lxml_5etree__ModifyContentOnlyProxy __pyx_base;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":251
 *             return funicode(self._c_node.name)
 * 
 * cdef class _ReadOnlyEntityProxy(_ReadOnlyProxy):             # <<<<<<<<<<<<<<
 *     u"A read-only proxy for entity references (for internal use only!)"
 *     property name:
 */

struct __pyx_obj_4lxml_5etree__ReadOnlyEntityProxy {
  struct __pyx_obj_4lxml_5etree__ReadOnlyProxy __pyx_base;
};

/* "src/lxml/lxml.etree.pyx":2135
 * 
 * 
 * cdef class _Attrib:             # <<<<<<<<<<<<<<
 *     u"""A dict-like proxy for the ``Element.attrib`` property.
 *     """
 */

struct __pyx_obj_4lxml_5etree__Attrib {
  PyObject_HEAD
  struct LxmlElement *_element;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":238
 * # default lookup scheme
 * 
 * cdef class ElementDefaultClassLookup(ElementClassLookup):             # <<<<<<<<<<<<<<
 *     u"""ElementDefaultClassLookup(self, element=None, comment=None, pi=None, entity=None)
 *     Element class lookup scheme that always returns the default Element
 */

struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup {
  struct LxmlElementClassLookup __pyx_base;
  PyObject *element_class;
  PyObject *comment_class;
  PyObject *pi_class;
  PyObject *entity_class;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":654
 * # special str/unicode subclasses
 * 
 * cdef class _ElementUnicodeResult(unicode):             # <<<<<<<<<<<<<<
 *     cdef _Element _parent
 *     cdef readonly object is_tail
 */

struct __pyx_obj_4lxml_5etree__ElementUnicodeResult {
  PyUnicodeObject __pyx_base;
  struct LxmlElement *_parent;
  PyObject *is_tail;
  PyObject *is_text;
  PyObject *is_attribute;
  PyObject *attrname;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":26
 * 
 * ctypedef int (*_register_function)(void* ctxt, name_utf, ns_uri_utf)
 * cdef class _ExsltRegExp             # <<<<<<<<<<<<<<
 * 
 * ################################################################################
 */

struct __pyx_obj_4lxml_5etree__ExsltRegExp {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__ExsltRegExp *__pyx_vtab;
  PyObject *_compile_map;
};

/* "src/lxml/lxml.etree.pyx":289
 * cdef public class _Element [ type LxmlElementType, object LxmlElement ]
 * cdef class _BaseParser
 * cdef class QName             # <<<<<<<<<<<<<<
 * ctypedef public xmlNode* (*_node_to_node_function)(xmlNode*)
 * 
 */

struct __pyx_obj_4lxml_5etree_QName {
  PyObject_HEAD
  PyObject *text;
  PyObject *localname;
  PyObject *namespace;
};

/* "src/lxml/lxml.etree.pyx":246
 * # class for temporary storage of Python references,
 * # used e.g. for XPath results
 * cdef class _TempStore:             # <<<<<<<<<<<<<<
 *     cdef list _storage
 *     def __init__(self):
 */

struct __pyx_obj_4lxml_5etree__TempStore {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__TempStore *__pyx_vtab;
  PyObject *_storage;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":346
 * # output to file-like objects
 * 
 * cdef class _FilelikeWriter:             # <<<<<<<<<<<<<<
 *     cdef object _filelike
 *     cdef object _close_filelike
 */

struct __pyx_obj_4lxml_5etree__FilelikeWriter {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__FilelikeWriter *__pyx_vtab;
  PyObject *_filelike;
  PyObject *_close_filelike;
  struct __pyx_obj_4lxml_5etree__ExceptionContext *_exc_context;
  struct __pyx_obj_4lxml_5etree__ErrorLog *error_log;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":22
 * # Schematron
 * 
 * cdef class Schematron(_Validator):             # <<<<<<<<<<<<<<
 *     u"""Schematron(self, etree=None, file=None)
 *     A Schematron validator.
 */

struct __pyx_obj_4lxml_5etree_Schematron {
  struct __pyx_obj_4lxml_5etree__Validator __pyx_base;
  xmlSchematron *_c_schema;
  xmlDoc *_c_schema_doc;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":166
 * # XSLT file/network access control
 * 
 * cdef class XSLTAccessControl:             # <<<<<<<<<<<<<<
 *     u"""XSLTAccessControl(self, read_file=True, write_file=True, create_dir=True, read_network=True, write_network=True)
 * 
 */

struct __pyx_obj_4lxml_5etree_XSLTAccessControl {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree_XSLTAccessControl *__pyx_vtab;
  xsltSecurityPrefs *_prefs;
};

/* "src/lxml/lxml.etree.pyx":2387
 *             self._node = _elementFactory(node._doc, c_node)
 * 
 * cdef class SiblingsIterator(_ElementIterator):             # <<<<<<<<<<<<<<
 *     u"""SiblingsIterator(self, node, tag=None, preceding=False)
 *     Iterates over the siblings of an element.
 */

struct __pyx_obj_4lxml_5etree_SiblingsIterator {
  struct LxmlElementIterator __pyx_base;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1371
 *     )
 * 
 * cdef class HTMLParser(_FeedParser):             # <<<<<<<<<<<<<<
 *     u"""HTMLParser(self, encoding=None, remove_blank_text=False, \
 *                    remove_comments=False, remove_pis=False, strip_cdata=True, \
 */

struct __pyx_obj_4lxml_5etree_HTMLParser {
  struct __pyx_obj_4lxml_5etree__FeedParser __pyx_base;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":435
 *             tree.xmlNodeSetContent(self._c_node, c_text)
 * 
 * cdef class _ModifyContentOnlyPIProxy(_ModifyContentOnlyProxy):             # <<<<<<<<<<<<<<
 *     u"""A read-only proxy that allows changing the text/target content of a
 *     processing instruction.
 */

struct __pyx_obj_4lxml_5etree__ModifyContentOnlyPIProxy {
  struct __pyx_obj_4lxml_5etree__ModifyContentOnlyProxy __pyx_base;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":81
 *         python.PyDict_Clear(self._entries)
 * 
 * cdef class _ClassNamespaceRegistry(_NamespaceRegistry):             # <<<<<<<<<<<<<<
 *     u"Dictionary-like registry for namespace implementation classes"
 *     def __setitem__(self, name, item):
 */

struct __pyx_obj_4lxml_5etree__ClassNamespaceRegistry {
  struct __pyx_obj_4lxml_5etree__NamespaceRegistry __pyx_base;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":9
 * cdef class _SaxParserContext(_ParserContext)
 * cdef class _TargetParserContext(_SaxParserContext)
 * cdef class _ParserSchemaValidationContext             # <<<<<<<<<<<<<<
 * cdef class _Validator
 * cdef class XMLSchema(_Validator)
 */

struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__ParserSchemaValidationContext *__pyx_vtab;
  struct __pyx_obj_4lxml_5etree_XMLSchema *_schema;
  xmlSchemaValidCtxt *_valid_ctxt;
  xmlSchemaSAXPlugStruct *_sax_plug;
  int _add_default_attributes;
};

/* "src/lxml/lxml.etree.pyx":2262
 * 
 * 
 * cdef class _AttribIterator:             # <<<<<<<<<<<<<<
 *     u"""Attribute iterator - for internal use only!
 *     """
 */

struct __pyx_obj_4lxml_5etree__AttribIterator {
  PyObject_HEAD
  struct LxmlElement *_node;
  xmlAttr *_c_attr;
  int _keysvalues;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":444
 * # read-only tree based class lookup
 * 
 * cdef class PythonElementClassLookup(FallbackElementClassLookup):             # <<<<<<<<<<<<<<
 *     u"""PythonElementClassLookup(self, fallback=None)
 *     Element class lookup based on a subclass method.
 */

struct __pyx_obj_4lxml_5etree_PythonElementClassLookup {
  struct LxmlFallbackElementClassLookup __pyx_base;
};

/* "src/lxml/lxml.etree.pyx":2363
 *         return current_node
 * 
 * cdef class ElementChildIterator(_ElementIterator):             # <<<<<<<<<<<<<<
 *     u"""ElementChildIterator(self, node, tag=None, reversed=False)
 *     Iterates over the children of an element.
 */

struct __pyx_obj_4lxml_5etree_ElementChildIterator {
  struct LxmlElementIterator __pyx_base;
};

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":365
 *             _ErrorLog.receive(self, entry)
 * 
 * cdef class _RotatingErrorLog(_ErrorLog):             # <<<<<<<<<<<<<<
 *     cdef int _max_len
 *     def __init__(self, max_len):
 */

struct __pyx_obj_4lxml_5etree__RotatingErrorLog {
  struct __pyx_obj_4lxml_5etree__ErrorLog __pyx_base;
  int _max_len;
};


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":106
 *         return doc_ref
 * 
 * cdef class _ResolverRegistry:             # <<<<<<<<<<<<<<
 *     cdef object _resolvers
 *     cdef Resolver _default_resolver
 */

struct __pyx_vtabstruct_4lxml_5etree__ResolverRegistry {
  struct __pyx_obj_4lxml_5etree__ResolverRegistry *(*_copy)(struct __pyx_obj_4lxml_5etree__ResolverRegistry *);
};
static struct __pyx_vtabstruct_4lxml_5etree__ResolverRegistry *__pyx_vtabptr_4lxml_5etree__ResolverRegistry;


/* "src/lxml/lxml.etree.pyx":260
 * 
 * # class for temporarily storing exceptions raised in extensions
 * cdef class _ExceptionContext:             # <<<<<<<<<<<<<<
 *     cdef object _exc_info
 *     cdef void clear(self):
 */

struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext {
  void (*clear)(struct __pyx_obj_4lxml_5etree__ExceptionContext *);
  void (*_store_raised)(struct __pyx_obj_4lxml_5etree__ExceptionContext *);
  void (*_store_exception)(struct __pyx_obj_4lxml_5etree__ExceptionContext *, PyObject *);
  int (*_has_raised)(struct __pyx_obj_4lxml_5etree__ExceptionContext *);
  int (*_raise_if_stored)(struct __pyx_obj_4lxml_5etree__ExceptionContext *);
};
static struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext *__pyx_vtabptr_4lxml_5etree__ExceptionContext;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":153
 *         return repr(self._resolvers)
 * 
 * cdef class _ResolverContext(_ExceptionContext):             # <<<<<<<<<<<<<<
 *     cdef _ResolverRegistry _resolvers
 *     cdef _TempStore _storage
 */

struct __pyx_vtabstruct_4lxml_5etree__ResolverContext {
  struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree__ResolverContext *__pyx_vtabptr_4lxml_5etree__ResolverContext;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":696
 *     return 0
 * 
 * cdef class _BaseParser:             # <<<<<<<<<<<<<<
 *     cdef ElementClassLookup _class_lookup
 *     cdef _ResolverRegistry _resolvers
 */

struct __pyx_vtabstruct_4lxml_5etree__BaseParser {
  struct __pyx_obj_4lxml_5etree__ParserContext *(*_getParserContext)(struct __pyx_obj_4lxml_5etree__BaseParser *);
  struct __pyx_obj_4lxml_5etree__ParserContext *(*_getPushParserContext)(struct __pyx_obj_4lxml_5etree__BaseParser *);
  struct __pyx_obj_4lxml_5etree__ParserContext *(*_createContext)(struct __pyx_obj_4lxml_5etree__BaseParser *, PyObject *);
  xmlParserCtxt *(*_newParserCtxt)(struct __pyx_obj_4lxml_5etree__BaseParser *);
  xmlParserCtxt *(*_newPushParserCtxt)(struct __pyx_obj_4lxml_5etree__BaseParser *);
  struct __pyx_obj_4lxml_5etree__BaseParser *(*_copy)(struct __pyx_obj_4lxml_5etree__BaseParser *);
  xmlDoc *(*_parseUnicodeDoc)(struct __pyx_obj_4lxml_5etree__BaseParser *, PyObject *, char *);
  xmlDoc *(*_parseDoc)(struct __pyx_obj_4lxml_5etree__BaseParser *, char *, Py_ssize_t, char *);
  xmlDoc *(*_parseDocFromFile)(struct __pyx_obj_4lxml_5etree__BaseParser *, char *);
  xmlDoc *(*_parseDocFromFilelike)(struct __pyx_obj_4lxml_5etree__BaseParser *, PyObject *, PyObject *);
};
static struct __pyx_vtabstruct_4lxml_5etree__BaseParser *__pyx_vtabptr_4lxml_5etree__BaseParser;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1028
 * ############################################################
 * 
 * cdef class _FeedParser(_BaseParser):             # <<<<<<<<<<<<<<
 *     cdef bint _feed_parser_running
 * 
 */

struct __pyx_vtabstruct_4lxml_5etree__FeedParser {
  struct __pyx_vtabstruct_4lxml_5etree__BaseParser __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree__FeedParser *__pyx_vtabptr_4lxml_5etree__FeedParser;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1210
 *     )
 * 
 * cdef class XMLParser(_FeedParser):             # <<<<<<<<<<<<<<
 *     u"""XMLParser(self, encoding=None, attribute_defaults=False, dtd_validation=False, load_dtd=False, no_network=True, ns_clean=False, recover=False, XMLSchema schema=None, remove_blank_text=False, resolve_entities=True, remove_comments=False, remove_pis=False, strip_cdata=True, target=None, compact=True)
 * 
 */

struct __pyx_vtabstruct_4lxml_5etree_XMLParser {
  struct __pyx_vtabstruct_4lxml_5etree__FeedParser __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_XMLParser *__pyx_vtabptr_4lxml_5etree_XMLParser;

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) LxmlElementTagMatcherType;

/* "src/lxml/lxml.etree.pyx":2303
 * 
 * 
 * cdef public class _ElementTagMatcher [ object LxmlElementTagMatcher,             # <<<<<<<<<<<<<<
 *                                        type LxmlElementTagMatcherType ]:
 *     cdef object _pystrings
 */

struct __pyx_vtabstruct_4lxml_5etree__ElementTagMatcher {
  PyObject *(*_initTagMatch)(struct LxmlElementTagMatcher *, PyObject *);
};
static struct __pyx_vtabstruct_4lxml_5etree__ElementTagMatcher *__pyx_vtabptr_4lxml_5etree__ElementTagMatcher;


/* "src/lxml/lxml.etree.pyx":1491
 * 
 * 
 * cdef class __ContentOnlyElement(_Element):             # <<<<<<<<<<<<<<
 *     cdef int _raiseImmutable(self) except -1:
 *         raise TypeError, u"this element does not have children or attributes"
 */

struct __pyx_vtabstruct_4lxml_5etree___ContentOnlyElement {
  int (*_raiseImmutable)(struct __pyx_obj_4lxml_5etree___ContentOnlyElement *);
};
static struct __pyx_vtabstruct_4lxml_5etree___ContentOnlyElement *__pyx_vtabptr_4lxml_5etree___ContentOnlyElement;


/* "src/lxml/lxml.etree.pyx":1594
 *             return u"<?%s?>" % self.target
 * 
 * cdef class _Entity(__ContentOnlyElement):             # <<<<<<<<<<<<<<
 *     property tag:
 *         def __get__(self):
 */

struct __pyx_vtabstruct_4lxml_5etree__Entity {
  struct __pyx_vtabstruct_4lxml_5etree___ContentOnlyElement __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree__Entity *__pyx_vtabptr_4lxml_5etree__Entity;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":153
 *         tree.xmlAddChild(<xmlNode*>c_doc, self._c_node)
 * 
 * cdef class EntityBase(_Entity):             # <<<<<<<<<<<<<<
 *     u"""All custom Entity classes must inherit from this one.
 * 
 */

struct __pyx_vtabstruct_4lxml_5etree_EntityBase {
  struct __pyx_vtabstruct_4lxml_5etree__Entity __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_EntityBase *__pyx_vtabptr_4lxml_5etree_EntityBase;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":3
 * # read-only tree implementation
 * 
 * cdef class _ReadOnlyProxy:             # <<<<<<<<<<<<<<
 *     u"A read-only proxy class suitable for PIs/Comments (for internal use only!)."
 *     cdef bint _free_after_use
 */

struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy {
  int (*_assertNode)(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *);
  int (*_raise_unsupported_type)(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *);
  void (*free_after_use)(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *);
  PyObject *(*__copy__)(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *, int __pyx_skip_dispatch);
  PyObject *(*getchildren)(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *__pyx_vtabptr_4lxml_5etree__ReadOnlyProxy;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":251
 *             return funicode(self._c_node.name)
 * 
 * cdef class _ReadOnlyEntityProxy(_ReadOnlyProxy):             # <<<<<<<<<<<<<<
 *     u"A read-only proxy for entity references (for internal use only!)"
 *     property name:
 */

struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyEntityProxy {
  struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyEntityProxy *__pyx_vtabptr_4lxml_5etree__ReadOnlyEntityProxy;


/* "src/lxml/lxml.etree.pyx":2985
 *     pass
 * 
 * cdef class _Validator:             # <<<<<<<<<<<<<<
 *     u"Base class for XML validators."
 *     cdef _ErrorLog _error_log
 */

struct __pyx_vtabstruct_4lxml_5etree__Validator {
  PyObject *(*_append_log_message)(struct __pyx_obj_4lxml_5etree__Validator *, int, int, int, int, PyObject *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*_clear_error_log)(struct __pyx_obj_4lxml_5etree__Validator *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_4lxml_5etree__Validator *__pyx_vtabptr_4lxml_5etree__Validator;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":26
 *     namespaces={u'xs': u'http://www.w3.org/2001/XMLSchema'})
 * 
 * cdef class XMLSchema(_Validator):             # <<<<<<<<<<<<<<
 *     u"""XMLSchema(self, etree=None, file=None)
 *     Turn a document into an XML Schema validator.
 */

struct __pyx_vtabstruct_4lxml_5etree_XMLSchema {
  struct __pyx_vtabstruct_4lxml_5etree__Validator __pyx_base;
  struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *(*_newSaxValidator)(struct __pyx_obj_4lxml_5etree_XMLSchema *, int);
};
static struct __pyx_vtabstruct_4lxml_5etree_XMLSchema *__pyx_vtabptr_4lxml_5etree_XMLSchema;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":537
 * 
 * 
 * cdef class iterwalk:             # <<<<<<<<<<<<<<
 *     u"""iterwalk(self, element_or_tree, events=("end",), tag=None)
 * 
 */

struct __pyx_vtabstruct_4lxml_5etree_iterwalk {
  void (*_setTagFilter)(struct __pyx_obj_4lxml_5etree_iterwalk *, PyObject *);
  int (*_start_node)(struct __pyx_obj_4lxml_5etree_iterwalk *, struct LxmlElement *);
  struct LxmlElement *(*_end_node)(struct __pyx_obj_4lxml_5etree_iterwalk *);
};
static struct __pyx_vtabstruct_4lxml_5etree_iterwalk *__pyx_vtabptr_4lxml_5etree_iterwalk;

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) LxmlFallbackElementClassLookupType;

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":196
 *         self._lookup_function = NULL # use default lookup
 * 
 * cdef public class FallbackElementClassLookup(ElementClassLookup) \             # <<<<<<<<<<<<<<
 *          [ type LxmlFallbackElementClassLookupType,
 *            object LxmlFallbackElementClassLookup ]:
 */

struct __pyx_vtabstruct_4lxml_5etree_FallbackElementClassLookup {
  void (*_setFallback)(struct LxmlFallbackElementClassLookup *, struct LxmlElementClassLookup *);
};
static struct __pyx_vtabstruct_4lxml_5etree_FallbackElementClassLookup *__pyx_vtabptr_4lxml_5etree_FallbackElementClassLookup;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":319
 * # attribute based lookup scheme
 * 
 * cdef class AttributeBasedElementClassLookup(FallbackElementClassLookup):             # <<<<<<<<<<<<<<
 *     u"""AttributeBasedElementClassLookup(self, attribute_name, class_mapping, fallback=None)
 *     Checks an attribute of an Element and looks up the value in a
 */

struct __pyx_vtabstruct_4lxml_5etree_AttributeBasedElementClassLookup {
  struct __pyx_vtabstruct_4lxml_5etree_FallbackElementClassLookup __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_AttributeBasedElementClassLookup *__pyx_vtabptr_4lxml_5etree_AttributeBasedElementClassLookup;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":123
 *             return ErrorLevels._getName(self.level, u"unknown")
 * 
 * cdef class _BaseErrorLog:             # <<<<<<<<<<<<<<
 *     cdef _LogEntry _first_error
 *     cdef readonly object last_error
 */

struct __pyx_vtabstruct_4lxml_5etree__BaseErrorLog {
  void (*_receive)(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, xmlError *);
  void (*_receiveGeneric)(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, int, int, int, int, PyObject *, PyObject *);
  PyObject *(*_buildParseException)(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, PyObject *, PyObject *);
  PyObject *(*_buildExceptionMessage)(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, PyObject *);
};
static struct __pyx_vtabstruct_4lxml_5etree__BaseErrorLog *__pyx_vtabptr_4lxml_5etree__BaseErrorLog;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":206
 *         return message
 * 
 * cdef class _ListErrorLog(_BaseErrorLog):             # <<<<<<<<<<<<<<
 *     u"Immutable base version of a list based error log."
 *     cdef list _entries
 */

struct __pyx_vtabstruct_4lxml_5etree__ListErrorLog {
  struct __pyx_vtabstruct_4lxml_5etree__BaseErrorLog __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree__ListErrorLog *__pyx_vtabptr_4lxml_5etree__ListErrorLog;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":326
 *         return self.filter_from_level(ErrorLevels.WARNING)
 * 
 * cdef class _ErrorLog(_ListErrorLog):             # <<<<<<<<<<<<<<
 *     def __init__(self):
 *         _ListErrorLog.__init__(self, [], None, None)
 */

struct __pyx_vtabstruct_4lxml_5etree__ErrorLog {
  struct __pyx_vtabstruct_4lxml_5etree__ListErrorLog __pyx_base;
  void (*connect)(struct __pyx_obj_4lxml_5etree__ErrorLog *);
  void (*disconnect)(struct __pyx_obj_4lxml_5etree__ErrorLog *);
};
static struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *__pyx_vtabptr_4lxml_5etree__ErrorLog;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":356
 *         self._entries.append(entry)
 * 
 * cdef class _DomainErrorLog(_ErrorLog):             # <<<<<<<<<<<<<<
 *     def __init__(self, domains):
 *         _ErrorLog.__init__(self)
 */

struct __pyx_vtabstruct_4lxml_5etree__DomainErrorLog {
  struct __pyx_vtabstruct_4lxml_5etree__ErrorLog __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree__DomainErrorLog *__pyx_vtabptr_4lxml_5etree__DomainErrorLog;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":311
 *         return c_ctxt.node.next
 * 
 * cdef class iterparse(_BaseParser):             # <<<<<<<<<<<<<<
 *     u"""iterparse(self, source, events=("end",), tag=None, attribute_defaults=False, dtd_validation=False, load_dtd=False, no_network=True, remove_blank_text=False, remove_comments=False, remove_pis=False, encoding=None, html=False, huge_tree=False, schema=None)
 * 
 */

struct __pyx_vtabstruct_4lxml_5etree_iterparse {
  struct __pyx_vtabstruct_4lxml_5etree__BaseParser __pyx_base;
  PyObject *(*_close_source)(struct __pyx_obj_4lxml_5etree_iterparse *);
  PyObject *(*_read_more_events)(struct __pyx_obj_4lxml_5etree_iterparse *, struct __pyx_obj_4lxml_5etree__IterparseContext *);
};
static struct __pyx_vtabstruct_4lxml_5etree_iterparse *__pyx_vtabptr_4lxml_5etree_iterparse;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":260
 * ############################################################
 * 
 * cdef class _FileReaderContext:             # <<<<<<<<<<<<<<
 *     cdef object _filelike
 *     cdef object _encoding
 */

struct __pyx_vtabstruct_4lxml_5etree__FileReaderContext {
  PyObject *(*_close_file)(struct __pyx_obj_4lxml_5etree__FileReaderContext *);
  xmlParserInputBuffer *(*_createParserInputBuffer)(struct __pyx_obj_4lxml_5etree__FileReaderContext *);
  xmlParserInput *(*_createParserInput)(struct __pyx_obj_4lxml_5etree__FileReaderContext *, xmlParserCtxt *);
  xmlDtd *(*_readDtd)(struct __pyx_obj_4lxml_5etree__FileReaderContext *);
  xmlDoc *(*_readDoc)(struct __pyx_obj_4lxml_5etree__FileReaderContext *, xmlParserCtxt *, int);
  int (*copyToBuffer)(struct __pyx_obj_4lxml_5etree__FileReaderContext *, char *, int);
};
static struct __pyx_vtabstruct_4lxml_5etree__FileReaderContext *__pyx_vtabptr_4lxml_5etree__FileReaderContext;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":11
 *     SAX_EVENT_COMMENT = 32
 * 
 * cdef class _SaxParserTarget:             # <<<<<<<<<<<<<<
 *     cdef int _sax_event_filter
 *     cdef int _sax_event_propagate
 */

struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget {
  PyObject *(*_handleSaxStart)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *, PyObject *, PyObject *);
  PyObject *(*_handleSaxEnd)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *);
  int (*_handleSaxData)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *);
  int (*_handleSaxDoctype)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *, PyObject *, PyObject *);
  PyObject *(*_handleSaxPi)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *, PyObject *);
  PyObject *(*_handleSaxComment)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *);
};
static struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget *__pyx_vtabptr_4lxml_5etree__SaxParserTarget;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":332
 * ############################################################
 * 
 * cdef class TreeBuilder(_SaxParserTarget):             # <<<<<<<<<<<<<<
 *     u"""TreeBuilder(self, element_factory=None, parser=None)
 *     Parser target that builds a tree.
 */

struct __pyx_vtabstruct_4lxml_5etree_TreeBuilder {
  struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget __pyx_base;
  int (*_flush)(struct __pyx_obj_4lxml_5etree_TreeBuilder *);
};
static struct __pyx_vtabstruct_4lxml_5etree_TreeBuilder *__pyx_vtabptr_4lxml_5etree_TreeBuilder;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":413
 * # element proxies that allow restricted modification
 * 
 * cdef class _ModifyContentOnlyProxy(_ReadOnlyProxy):             # <<<<<<<<<<<<<<
 *     u"""A read-only proxy that allows changing the text content.
 *     """
 */

struct __pyx_vtabstruct_4lxml_5etree__ModifyContentOnlyProxy {
  struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree__ModifyContentOnlyProxy *__pyx_vtabptr_4lxml_5etree__ModifyContentOnlyProxy;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":435
 *             tree.xmlNodeSetContent(self._c_node, c_text)
 * 
 * cdef class _ModifyContentOnlyPIProxy(_ModifyContentOnlyProxy):             # <<<<<<<<<<<<<<
 *     u"""A read-only proxy that allows changing the text/target content of a
 *     processing instruction.
 */

struct __pyx_vtabstruct_4lxml_5etree__ModifyContentOnlyPIProxy {
  struct __pyx_vtabstruct_4lxml_5etree__ModifyContentOnlyProxy __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree__ModifyContentOnlyPIProxy *__pyx_vtabptr_4lxml_5etree__ModifyContentOnlyPIProxy;


/* "src/lxml/lxml.etree.pyx":1562
 *         return []
 * 
 * cdef class _Comment(__ContentOnlyElement):             # <<<<<<<<<<<<<<
 *     property tag:
 *         def __get__(self):
 */

struct __pyx_vtabstruct_4lxml_5etree__Comment {
  struct __pyx_vtabstruct_4lxml_5etree___ContentOnlyElement __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree__Comment *__pyx_vtabptr_4lxml_5etree__Comment;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":22
 * # DTD
 * 
 * cdef class DTD(_Validator):             # <<<<<<<<<<<<<<
 *     u"""DTD(self, file=None, external_id=None)
 *     A DTD validator.
 */

struct __pyx_vtabstruct_4lxml_5etree_DTD {
  struct __pyx_vtabstruct_4lxml_5etree__Validator __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_DTD *__pyx_vtabptr_4lxml_5etree_DTD;


struct __pyx_vtabstruct_4lxml_5etree_RelaxNG {
  struct __pyx_vtabstruct_4lxml_5etree__Validator __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_RelaxNG *__pyx_vtabptr_4lxml_5etree_RelaxNG;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":50
 * # XSLT document loaders
 * 
 * cdef class _XSLTResolverContext(_ResolverContext):             # <<<<<<<<<<<<<<
 *     cdef xmlDoc* _c_style_doc
 *     cdef _BaseParser _parser
 */

struct __pyx_vtabstruct_4lxml_5etree__XSLTResolverContext {
  struct __pyx_vtabstruct_4lxml_5etree__ResolverContext __pyx_base;
  struct __pyx_obj_4lxml_5etree__XSLTResolverContext *(*_copy)(struct __pyx_obj_4lxml_5etree__XSLTResolverContext *);
};
static struct __pyx_vtabstruct_4lxml_5etree__XSLTResolverContext *__pyx_vtabptr_4lxml_5etree__XSLTResolverContext;


/* "src/lxml/lxml.etree.pyx":246
 * # class for temporary storage of Python references,
 * # used e.g. for XPath results
 * cdef class _TempStore:             # <<<<<<<<<<<<<<
 *     cdef list _storage
 *     def __init__(self):
 */

struct __pyx_vtabstruct_4lxml_5etree__TempStore {
  int (*add)(struct __pyx_obj_4lxml_5etree__TempStore *, PyObject *);
  int (*clear)(struct __pyx_obj_4lxml_5etree__TempStore *);
};
static struct __pyx_vtabstruct_4lxml_5etree__TempStore *__pyx_vtabptr_4lxml_5etree__TempStore;

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) LxmlElementIteratorType;

/* "src/lxml/lxml.etree.pyx":2331
 *                 self._name = NULL
 * 
 * cdef public class _ElementIterator(_ElementTagMatcher) [             # <<<<<<<<<<<<<<
 *     object LxmlElementIterator, type LxmlElementIteratorType ]:
 *     # we keep Python references here to control GC
 */

struct __pyx_vtabstruct_4lxml_5etree__ElementIterator {
  struct __pyx_vtabstruct_4lxml_5etree__ElementTagMatcher __pyx_base;
  void (*_storeNext)(struct LxmlElementIterator *, struct LxmlElement *);
};
static struct __pyx_vtabstruct_4lxml_5etree__ElementIterator *__pyx_vtabptr_4lxml_5etree__ElementIterator;


/* "src/lxml/lxml.etree.pyx":2387
 *             self._node = _elementFactory(node._doc, c_node)
 * 
 * cdef class SiblingsIterator(_ElementIterator):             # <<<<<<<<<<<<<<
 *     u"""SiblingsIterator(self, node, tag=None, preceding=False)
 *     Iterates over the siblings of an element.
 */

struct __pyx_vtabstruct_4lxml_5etree_SiblingsIterator {
  struct __pyx_vtabstruct_4lxml_5etree__ElementIterator __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_SiblingsIterator *__pyx_vtabptr_4lxml_5etree_SiblingsIterator;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":346
 * # output to file-like objects
 * 
 * cdef class _FilelikeWriter:             # <<<<<<<<<<<<<<
 *     cdef object _filelike
 *     cdef object _close_filelike
 */

struct __pyx_vtabstruct_4lxml_5etree__FilelikeWriter {
  xmlOutputBuffer *(*_createOutputBuffer)(struct __pyx_obj_4lxml_5etree__FilelikeWriter *, xmlCharEncodingHandler *);
  int (*write)(struct __pyx_obj_4lxml_5etree__FilelikeWriter *, char *, int);
  int (*close)(struct __pyx_obj_4lxml_5etree__FilelikeWriter *);
};
static struct __pyx_vtabstruct_4lxml_5etree__FilelikeWriter *__pyx_vtabptr_4lxml_5etree__FilelikeWriter;


/* "src/lxml/lxml.etree.pyx":1570
 *         return u"<!--%s-->" % self.text
 * 
 * cdef class _ProcessingInstruction(__ContentOnlyElement):             # <<<<<<<<<<<<<<
 *     property tag:
 *         def __get__(self):
 */

struct __pyx_vtabstruct_4lxml_5etree__ProcessingInstruction {
  struct __pyx_vtabstruct_4lxml_5etree___ContentOnlyElement __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree__ProcessingInstruction *__pyx_vtabptr_4lxml_5etree__ProcessingInstruction;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":126
 *         tree.xmlAddChild(<xmlNode*>c_doc, self._c_node)
 * 
 * cdef class PIBase(_ProcessingInstruction):             # <<<<<<<<<<<<<<
 *     u"""All custom Processing Instruction classes must inherit from this one.
 * 
 */

struct __pyx_vtabstruct_4lxml_5etree_PIBase {
  struct __pyx_vtabstruct_4lxml_5etree__ProcessingInstruction __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_PIBase *__pyx_vtabptr_4lxml_5etree_PIBase;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":328
 * 
 * 
 * cdef class XSLT:             # <<<<<<<<<<<<<<
 *     u"""XSLT(self, xslt_input, extensions=None, regexp=True, access_control=None)
 * 
 */

struct __pyx_vtabstruct_4lxml_5etree_XSLT {
  xmlDoc *(*_run_transform)(struct __pyx_obj_4lxml_5etree_XSLT *, xmlDoc *, char **, struct __pyx_obj_4lxml_5etree__XSLTContext *, xsltTransformContext *);
};
static struct __pyx_vtabstruct_4lxml_5etree_XSLT *__pyx_vtabptr_4lxml_5etree_XSLT;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":365
 *             _ErrorLog.receive(self, entry)
 * 
 * cdef class _RotatingErrorLog(_ErrorLog):             # <<<<<<<<<<<<<<
 *     cdef int _max_len
 *     def __init__(self, max_len):
 */

struct __pyx_vtabstruct_4lxml_5etree__RotatingErrorLog {
  struct __pyx_vtabstruct_4lxml_5etree__ErrorLog __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree__RotatingErrorLog *__pyx_vtabptr_4lxml_5etree__RotatingErrorLog;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":3
 * # XSLT extension elements
 * 
 * cdef class XSLTExtension:             # <<<<<<<<<<<<<<
 *     u"""Base class of an XSLT extension element.
 *     """
 */

struct __pyx_vtabstruct_4lxml_5etree_XSLTExtension {
  PyObject *(*_collectXSLTResultContent)(struct __pyx_obj_4lxml_5etree_XSLTExtension *, struct __pyx_obj_4lxml_5etree__XSLTContext *, xmlNode *);
};
static struct __pyx_vtabstruct_4lxml_5etree_XSLTExtension *__pyx_vtabptr_4lxml_5etree_XSLTExtension;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":13
 *         self.result = result
 * 
 * cdef class _PythonSaxParserTarget(_SaxParserTarget):             # <<<<<<<<<<<<<<
 *     cdef object _target_start
 *     cdef object _target_end
 */

struct __pyx_vtabstruct_4lxml_5etree__PythonSaxParserTarget {
  struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree__PythonSaxParserTarget *__pyx_vtabptr_4lxml_5etree__PythonSaxParserTarget;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":22
 * # Schematron
 * 
 * cdef class Schematron(_Validator):             # <<<<<<<<<<<<<<
 *     u"""Schematron(self, etree=None, file=None)
 *     A Schematron validator.
 */

struct __pyx_vtabstruct_4lxml_5etree_Schematron {
  struct __pyx_vtabstruct_4lxml_5etree__Validator __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_Schematron *__pyx_vtabptr_4lxml_5etree_Schematron;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":14
 * 
 * 
 * cdef class _NamespaceRegistry:             # <<<<<<<<<<<<<<
 *     u"Dictionary-like namespace registry"
 *     cdef object _ns_uri
 */

struct __pyx_vtabstruct_4lxml_5etree__NamespaceRegistry {
  PyObject *(*_get)(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *, PyObject *);
  PyObject *(*_getForString)(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *, char *);
};
static struct __pyx_vtabstruct_4lxml_5etree__NamespaceRegistry *__pyx_vtabptr_4lxml_5etree__NamespaceRegistry;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":188
 *         return registry
 * 
 * cdef class _FunctionNamespaceRegistry(_NamespaceRegistry):             # <<<<<<<<<<<<<<
 *     def __setitem__(self, name, item):
 *         if not callable(item):
 */

struct __pyx_vtabstruct_4lxml_5etree__FunctionNamespaceRegistry {
  struct __pyx_vtabstruct_4lxml_5etree__NamespaceRegistry __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree__FunctionNamespaceRegistry *__pyx_vtabptr_4lxml_5etree__FunctionNamespaceRegistry;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":41
 * # Logging classes
 * 
 * cdef class _LogEntry:             # <<<<<<<<<<<<<<
 *     """A log message entry from an error log.
 * 
 */

struct __pyx_vtabstruct_4lxml_5etree__LogEntry {
  PyObject *(*_setError)(struct __pyx_obj_4lxml_5etree__LogEntry *, xmlError *);
  PyObject *(*_setGeneric)(struct __pyx_obj_4lxml_5etree__LogEntry *, int, int, int, int, PyObject *, PyObject *);
};
static struct __pyx_vtabstruct_4lxml_5etree__LogEntry *__pyx_vtabptr_4lxml_5etree__LogEntry;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":487
 * ############################################################
 * 
 * cdef class _ParserContext(_ResolverContext):             # <<<<<<<<<<<<<<
 *     cdef _ErrorLog _error_log
 *     cdef _ParserSchemaValidationContext _validator
 */

struct __pyx_vtabstruct_4lxml_5etree__ParserContext {
  struct __pyx_vtabstruct_4lxml_5etree__ResolverContext __pyx_base;
  struct __pyx_obj_4lxml_5etree__ParserContext *(*_copy)(struct __pyx_obj_4lxml_5etree__ParserContext *);
  void (*_initParserContext)(struct __pyx_obj_4lxml_5etree__ParserContext *, xmlParserCtxt *);
  void (*_resetParserContext)(struct __pyx_obj_4lxml_5etree__ParserContext *);
  int (*prepare)(struct __pyx_obj_4lxml_5etree__ParserContext *);
  int (*cleanup)(struct __pyx_obj_4lxml_5etree__ParserContext *);
  PyObject *(*_handleParseResult)(struct __pyx_obj_4lxml_5etree__ParserContext *, struct __pyx_obj_4lxml_5etree__BaseParser *, xmlDoc *, PyObject *);
  xmlDoc *(*_handleParseResultDoc)(struct __pyx_obj_4lxml_5etree__ParserContext *, struct __pyx_obj_4lxml_5etree__BaseParser *, xmlDoc *, PyObject *);
};
static struct __pyx_vtabstruct_4lxml_5etree__ParserContext *__pyx_vtabptr_4lxml_5etree__ParserContext;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":128
 *     _XPATH_VERSION_WARNING_REQUIRED = 0
 * 
 * cdef class _XPathEvaluatorBase:             # <<<<<<<<<<<<<<
 *     cdef xpath.xmlXPathContext* _xpathCtxt
 *     cdef _XPathContext _context
 */

struct __pyx_vtabstruct_4lxml_5etree__XPathEvaluatorBase {
  PyObject *(*set_context)(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *, xmlXPathContext *);
  int (*_checkAbsolutePath)(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *, char *);
  int (*_lock)(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *);
  void (*_unlock)(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *);
  PyObject *(*_raise_parse_error)(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *);
  PyObject *(*_raise_eval_error)(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *);
  PyObject *(*_handle_result)(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *, xmlXPathObject *, struct LxmlDocument *);
};
static struct __pyx_vtabstruct_4lxml_5etree__XPathEvaluatorBase *__pyx_vtabptr_4lxml_5etree__XPathEvaluatorBase;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":253
 * 
 * 
 * cdef class XPathElementEvaluator(_XPathEvaluatorBase):             # <<<<<<<<<<<<<<
 *     u"""XPathElementEvaluator(self, element, namespaces=None, extensions=None, regexp=True, smart_strings=True)
 *     Create an XPath evaluator for an element.
 */

struct __pyx_vtabstruct_4lxml_5etree_XPathElementEvaluator {
  struct __pyx_vtabstruct_4lxml_5etree__XPathEvaluatorBase __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_XPathElementEvaluator *__pyx_vtabptr_4lxml_5etree_XPathElementEvaluator;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":101
 *                 raise TypeError, "Invalid child type: %r" % type(child)
 * 
 * cdef class CommentBase(_Comment):             # <<<<<<<<<<<<<<
 *     u"""All custom Comment classes must inherit from this one.
 * 
 */

struct __pyx_vtabstruct_4lxml_5etree_CommentBase {
  struct __pyx_vtabstruct_4lxml_5etree__Comment __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_CommentBase *__pyx_vtabptr_4lxml_5etree_CommentBase;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":450
 *             tree.xmlNodeSetName(self._c_node, c_text)
 * 
 * cdef class _ModifyContentOnlyEntityProxy(_ModifyContentOnlyProxy):             # <<<<<<<<<<<<<<
 *     u"A read-only proxy for entity references (for internal use only!)"
 *     property name:
 */

struct __pyx_vtabstruct_4lxml_5etree__ModifyContentOnlyEntityProxy {
  struct __pyx_vtabstruct_4lxml_5etree__ModifyContentOnlyProxy __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree__ModifyContentOnlyEntityProxy *__pyx_vtabptr_4lxml_5etree__ModifyContentOnlyEntityProxy;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":171
 *         return context
 * 
 * cdef class _ParserSchemaValidationContext:             # <<<<<<<<<<<<<<
 *     cdef XMLSchema _schema
 *     cdef xmlschema.xmlSchemaValidCtxt* _valid_ctxt
 */

struct __pyx_vtabstruct_4lxml_5etree__ParserSchemaValidationContext {
  struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *(*copy)(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *);
  void (*inject_default_attributes)(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *, xmlDoc *);
  int (*connect)(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *, xmlParserCtxt *);
  void (*disconnect)(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *);
  int (*isvalid)(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *);
};
static struct __pyx_vtabstruct_4lxml_5etree__ParserSchemaValidationContext *__pyx_vtabptr_4lxml_5etree__ParserSchemaValidationContext;


/* "src/lxml/lxml.etree.pyx":2363
 *         return current_node
 * 
 * cdef class ElementChildIterator(_ElementIterator):             # <<<<<<<<<<<<<<
 *     u"""ElementChildIterator(self, node, tag=None, reversed=False)
 *     Iterates over the children of an element.
 */

struct __pyx_vtabstruct_4lxml_5etree_ElementChildIterator {
  struct __pyx_vtabstruct_4lxml_5etree__ElementIterator __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_ElementChildIterator *__pyx_vtabptr_4lxml_5etree_ElementChildIterator;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":369
 * #  per-parser lookup scheme
 * 
 * cdef class ParserBasedElementClassLookup(FallbackElementClassLookup):             # <<<<<<<<<<<<<<
 *     u"""ParserBasedElementClassLookup(self, fallback=None)
 *     Element class lookup based on the XML parser.
 */

struct __pyx_vtabstruct_4lxml_5etree_ParserBasedElementClassLookup {
  struct __pyx_vtabstruct_4lxml_5etree_FallbackElementClassLookup __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_ParserBasedElementClassLookup *__pyx_vtabptr_4lxml_5etree_ParserBasedElementClassLookup;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":31
 *         return None
 * 
 * cdef class _SaxParserContext(_ParserContext):             # <<<<<<<<<<<<<<
 *     u"""This class maps SAX2 events to method calls.
 *     """
 */

struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext {
  struct __pyx_vtabstruct_4lxml_5etree__ParserContext __pyx_base;
  void (*_setSaxParserTarget)(struct __pyx_obj_4lxml_5etree__SaxParserContext *, struct __pyx_obj_4lxml_5etree__SaxParserTarget *);
  void (*_handleSaxException)(struct __pyx_obj_4lxml_5etree__SaxParserContext *, xmlParserCtxt *);
};
static struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *__pyx_vtabptr_4lxml_5etree__SaxParserContext;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":829
 *     return __findStylesheetByID(doc, id=id)
 * 
 * cdef class _XSLTProcessingInstruction(PIBase):             # <<<<<<<<<<<<<<
 *     def parseXSL(self, parser=None):
 *         u"""parseXSL(self, parser=None)
 */

struct __pyx_vtabstruct_4lxml_5etree__XSLTProcessingInstruction {
  struct __pyx_vtabstruct_4lxml_5etree_PIBase __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree__XSLTProcessingInstruction *__pyx_vtabptr_4lxml_5etree__XSLTProcessingInstruction;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":62
 *     return count
 * 
 * cdef class _IterparseContext(_ParserContext):             # <<<<<<<<<<<<<<
 *     cdef xmlparser.startElementNsSAX2Func _origSaxStart
 *     cdef xmlparser.endElementNsSAX2Func   _origSaxEnd
 */

struct __pyx_vtabstruct_4lxml_5etree__IterparseContext {
  struct __pyx_vtabstruct_4lxml_5etree__ParserContext __pyx_base;
  PyObject *(*_setEventFilter)(struct __pyx_obj_4lxml_5etree__IterparseContext *, PyObject *, PyObject *);
  int (*startNode)(struct __pyx_obj_4lxml_5etree__IterparseContext *, xmlNode *);
  int (*endNode)(struct __pyx_obj_4lxml_5etree__IterparseContext *, xmlNode *);
  int (*pushEvent)(struct __pyx_obj_4lxml_5etree__IterparseContext *, PyObject *, xmlNode *);
  void (*_assureDocGetsFreed)(struct __pyx_obj_4lxml_5etree__IterparseContext *);
};
static struct __pyx_vtabstruct_4lxml_5etree__IterparseContext *__pyx_vtabptr_4lxml_5etree__IterparseContext;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":244
 * 
 * 
 * cdef class _ReadOnlyPIProxy(_ReadOnlyProxy):             # <<<<<<<<<<<<<<
 *     u"A read-only proxy for processing instructions (for internal use only!)"
 *     property target:
 */

struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyPIProxy {
  struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyPIProxy *__pyx_vtabptr_4lxml_5etree__ReadOnlyPIProxy;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":31
 * # Base class for XSLT and XPath evaluation contexts: functions, namespaces, ...
 * 
 * cdef class _BaseContext:             # <<<<<<<<<<<<<<
 *     cdef xpath.xmlXPathContext* _xpathCtxt
 *     cdef _Document _doc
 */

struct __pyx_vtabstruct_4lxml_5etree__BaseContext {
  struct __pyx_obj_4lxml_5etree__BaseContext *(*_copy)(struct __pyx_obj_4lxml_5etree__BaseContext *);
  PyObject *(*_to_utf)(struct __pyx_obj_4lxml_5etree__BaseContext *, PyObject *);
  void (*_set_xpath_context)(struct __pyx_obj_4lxml_5etree__BaseContext *, xmlXPathContext *);
  PyObject *(*_register_context)(struct __pyx_obj_4lxml_5etree__BaseContext *, struct LxmlDocument *);
  PyObject *(*_cleanup_context)(struct __pyx_obj_4lxml_5etree__BaseContext *);
  PyObject *(*_release_context)(struct __pyx_obj_4lxml_5etree__BaseContext *);
  PyObject *(*addNamespace)(struct __pyx_obj_4lxml_5etree__BaseContext *, PyObject *, PyObject *);
  PyObject *(*registerNamespace)(struct __pyx_obj_4lxml_5etree__BaseContext *, PyObject *, PyObject *);
  PyObject *(*registerLocalNamespaces)(struct __pyx_obj_4lxml_5etree__BaseContext *);
  PyObject *(*registerGlobalNamespaces)(struct __pyx_obj_4lxml_5etree__BaseContext *);
  PyObject *(*unregisterGlobalNamespaces)(struct __pyx_obj_4lxml_5etree__BaseContext *);
  void (*_unregisterNamespace)(struct __pyx_obj_4lxml_5etree__BaseContext *, PyObject *);
  void (*_addLocalExtensionFunction)(struct __pyx_obj_4lxml_5etree__BaseContext *, PyObject *, PyObject *, PyObject *);
  void (*registerGlobalFunctions)(struct __pyx_obj_4lxml_5etree__BaseContext *, void *, __pyx_t_4lxml_5etree__register_function);
  void (*registerLocalFunctions)(struct __pyx_obj_4lxml_5etree__BaseContext *, void *, __pyx_t_4lxml_5etree__register_function);
  PyObject *(*unregisterAllFunctions)(struct __pyx_obj_4lxml_5etree__BaseContext *, void *, __pyx_t_4lxml_5etree__register_function);
  PyObject *(*unregisterGlobalFunctions)(struct __pyx_obj_4lxml_5etree__BaseContext *, void *, __pyx_t_4lxml_5etree__register_function);
  PyObject *(*_find_cached_function)(struct __pyx_obj_4lxml_5etree__BaseContext *, char *, char *);
  PyObject *(*_release_temp_refs)(struct __pyx_obj_4lxml_5etree__BaseContext *);
  PyObject *(*_hold)(struct __pyx_obj_4lxml_5etree__BaseContext *, PyObject *);
  struct LxmlDocument *(*_findDocumentForNode)(struct __pyx_obj_4lxml_5etree__BaseContext *, xmlNode *);
};
static struct __pyx_vtabstruct_4lxml_5etree__BaseContext *__pyx_vtabptr_4lxml_5etree__BaseContext;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":386
 * #  custom class lookup based on node type, namespace, name
 * 
 * cdef class CustomElementClassLookup(FallbackElementClassLookup):             # <<<<<<<<<<<<<<
 *     u"""CustomElementClassLookup(self, fallback=None)
 *     Element class lookup based on a subclass method.
 */

struct __pyx_vtabstruct_4lxml_5etree_CustomElementClassLookup {
  struct __pyx_vtabstruct_4lxml_5etree_FallbackElementClassLookup __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_CustomElementClassLookup *__pyx_vtabptr_4lxml_5etree_CustomElementClassLookup;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":268
 * 
 * 
 * cdef class _ReadOnlyElementProxy(_ReadOnlyProxy):             # <<<<<<<<<<<<<<
 *     u"The main read-only Element proxy class (for internal use only!)."
 * 
 */

struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyElementProxy {
  struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyElementProxy *__pyx_vtabptr_4lxml_5etree__ReadOnlyElementProxy;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":464
 * 
 * 
 * cdef class _AppendOnlyElementProxy(_ReadOnlyElementProxy):             # <<<<<<<<<<<<<<
 *     u"""A read-only element that allows adding children and changing the
 *     text content (i.e. everything that adds to the subtree).
 */

struct __pyx_vtabstruct_4lxml_5etree__AppendOnlyElementProxy {
  struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyElementProxy __pyx_base;
  PyObject *(*append)(struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *, PyObject *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_4lxml_5etree__AppendOnlyElementProxy *__pyx_vtabptr_4lxml_5etree__AppendOnlyElementProxy;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":415
 * 
 * 
 * cdef class XPath(_XPathEvaluatorBase):             # <<<<<<<<<<<<<<
 *     u"""XPath(self, path, namespaces=None, extensions=None, regexp=True, smart_strings=True)
 *     A compiled XPath expression that can be called on Elements and ElementTrees.
 */

struct __pyx_vtabstruct_4lxml_5etree_XPath {
  struct __pyx_vtabstruct_4lxml_5etree__XPathEvaluatorBase __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_XPath *__pyx_vtabptr_4lxml_5etree_XPath;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":495
 * _find_namespaces = re.compile(b'({[^}]+})').findall
 * 
 * cdef class ETXPath(XPath):             # <<<<<<<<<<<<<<
 *     u"""ETXPath(self, path, extensions=None, regexp=True, smart_strings=True)
 *     Special XPath class that supports the ElementTree {uri} notation for namespaces.
 */

struct __pyx_vtabstruct_4lxml_5etree_ETXPath {
  struct __pyx_vtabstruct_4lxml_5etree_XPath __pyx_base;
  PyObject *(*_nsextract_path)(struct __pyx_obj_4lxml_5etree_ETXPath *, PyObject *);
};
static struct __pyx_vtabstruct_4lxml_5etree_ETXPath *__pyx_vtabptr_4lxml_5etree_ETXPath;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":81
 *         python.PyDict_Clear(self._entries)
 * 
 * cdef class _ClassNamespaceRegistry(_NamespaceRegistry):             # <<<<<<<<<<<<<<
 *     u"Dictionary-like registry for namespace implementation classes"
 *     def __setitem__(self, name, item):
 */

struct __pyx_vtabstruct_4lxml_5etree__ClassNamespaceRegistry {
  struct __pyx_vtabstruct_4lxml_5etree__NamespaceRegistry __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree__ClassNamespaceRegistry *__pyx_vtabptr_4lxml_5etree__ClassNamespaceRegistry;

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) LxmlElementTreeType;

/* "src/lxml/lxml.etree.pyx":1683
 * 
 * 
 * cdef public class _ElementTree [ type LxmlElementTreeType,             # <<<<<<<<<<<<<<
 *                                  object LxmlElementTree ]:
 *     cdef _Document _doc
 */

struct __pyx_vtabstruct_4lxml_5etree__ElementTree {
  PyObject *(*_assertHasRoot)(struct LxmlElementTree *);
};
static struct __pyx_vtabstruct_4lxml_5etree__ElementTree *__pyx_vtabptr_4lxml_5etree__ElementTree;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":672
 *     return new_xslt
 * 
 * cdef class _XSLTResultTree(_ElementTree):             # <<<<<<<<<<<<<<
 *     cdef XSLT _xslt
 *     cdef _Document _profile
 */

struct __pyx_vtabstruct_4lxml_5etree__XSLTResultTree {
  struct __pyx_vtabstruct_4lxml_5etree__ElementTree __pyx_base;
  PyObject *(*_saveToStringAndSize)(struct __pyx_obj_4lxml_5etree__XSLTResultTree *, char **, int *);
};
static struct __pyx_vtabstruct_4lxml_5etree__XSLTResultTree *__pyx_vtabptr_4lxml_5etree__XSLTResultTree;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":95
 * 
 * 
 * cdef class ElementNamespaceClassLookup(FallbackElementClassLookup):             # <<<<<<<<<<<<<<
 *     u"""ElementNamespaceClassLookup(self, fallback=None)
 * 
 */

struct __pyx_vtabstruct_4lxml_5etree_ElementNamespaceClassLookup {
  struct __pyx_vtabstruct_4lxml_5etree_FallbackElementClassLookup __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_ElementNamespaceClassLookup *__pyx_vtabptr_4lxml_5etree_ElementNamespaceClassLookup;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":444
 * # read-only tree based class lookup
 * 
 * cdef class PythonElementClassLookup(FallbackElementClassLookup):             # <<<<<<<<<<<<<<
 *     u"""PythonElementClassLookup(self, fallback=None)
 *     Element class lookup based on a subclass method.
 */

struct __pyx_vtabstruct_4lxml_5etree_PythonElementClassLookup {
  struct __pyx_vtabstruct_4lxml_5etree_FallbackElementClassLookup __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_PythonElementClassLookup *__pyx_vtabptr_4lxml_5etree_PythonElementClassLookup;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":333
 * 
 * 
 * cdef class XPathDocumentEvaluator(XPathElementEvaluator):             # <<<<<<<<<<<<<<
 *     u"""XPathDocumentEvaluator(self, etree, namespaces=None, extensions=None, regexp=True, smart_strings=True)
 *     Create an XPath evaluator for an ElementTree.
 */

struct __pyx_vtabstruct_4lxml_5etree_XPathDocumentEvaluator {
  struct __pyx_vtabstruct_4lxml_5etree_XPathElementEvaluator __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_XPathDocumentEvaluator *__pyx_vtabptr_4lxml_5etree_XPathDocumentEvaluator;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":166
 * # XSLT file/network access control
 * 
 * cdef class XSLTAccessControl:             # <<<<<<<<<<<<<<
 *     u"""XSLTAccessControl(self, read_file=True, write_file=True, create_dir=True, read_network=True, write_network=True)
 * 
 */

struct __pyx_vtabstruct_4lxml_5etree_XSLTAccessControl {
  PyObject *(*_setAccess)(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *, xsltSecurityOption, PyObject *);
  void (*_register_in_context)(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *, xsltTransformContext *);
  PyObject *(*_optval)(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *, xsltSecurityOption);
};
static struct __pyx_vtabstruct_4lxml_5etree_XSLTAccessControl *__pyx_vtabptr_4lxml_5etree_XSLTAccessControl;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":269
 * cdef dict EMPTY_DICT = {}
 * 
 * cdef class _XSLTContext(_BaseContext):             # <<<<<<<<<<<<<<
 *     cdef xslt.xsltTransformContext* _xsltCtxt
 *     cdef _ReadOnlyElementProxy _extension_element_proxy
 */

struct __pyx_vtabstruct_4lxml_5etree__XSLTContext {
  struct __pyx_vtabstruct_4lxml_5etree__BaseContext __pyx_base;
  PyObject *(*register_context)(struct __pyx_obj_4lxml_5etree__XSLTContext *, xsltTransformContext *, struct LxmlDocument *);
  PyObject *(*free_context)(struct __pyx_obj_4lxml_5etree__XSLTContext *);
};
static struct __pyx_vtabstruct_4lxml_5etree__XSLTContext *__pyx_vtabptr_4lxml_5etree__XSLTContext;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":366
 *         raise TypeError, u"This type cannot be instatiated from Python"
 * 
 * cdef class _OpaqueDocumentWrapper(_OpaqueNodeWrapper):             # <<<<<<<<<<<<<<
 *     cdef int _assertNode(self) except -1:
 *         u"""This is our way of saying: this proxy is invalid!
 */

struct __pyx_vtabstruct_4lxml_5etree__OpaqueDocumentWrapper {
  int (*_assertNode)(struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper *);
  PyObject *(*append)(struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper *, PyObject *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_4lxml_5etree__OpaqueDocumentWrapper *__pyx_vtabptr_4lxml_5etree__OpaqueDocumentWrapper;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":377
 * # EXSLT regexp implementation
 * 
 * cdef class _ExsltRegExp:             # <<<<<<<<<<<<<<
 *     cdef dict _compile_map
 *     def __cinit__(self):
 */

struct __pyx_vtabstruct_4lxml_5etree__ExsltRegExp {
  PyObject *(*_make_string)(struct __pyx_obj_4lxml_5etree__ExsltRegExp *, PyObject *);
  PyObject *(*_compile)(struct __pyx_obj_4lxml_5etree__ExsltRegExp *, PyObject *, PyObject *);
  PyObject *(*_register_in_context)(struct __pyx_obj_4lxml_5etree__ExsltRegExp *, struct __pyx_obj_4lxml_5etree__BaseContext *);
};
static struct __pyx_vtabstruct_4lxml_5etree__ExsltRegExp *__pyx_vtabptr_4lxml_5etree__ExsltRegExp;


/* "src/lxml/lxml.etree.pyx":2402
 *         self._storeNext(node)
 * 
 * cdef class AncestorsIterator(_ElementIterator):             # <<<<<<<<<<<<<<
 *     u"""AncestorsIterator(self, node, tag=None)
 *     Iterates over the ancestors of an element (from parent to parent).
 */

struct __pyx_vtabstruct_4lxml_5etree_AncestorsIterator {
  struct __pyx_vtabstruct_4lxml_5etree__ElementIterator __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_AncestorsIterator *__pyx_vtabptr_4lxml_5etree_AncestorsIterator;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":50
 * 
 * 
 * cdef class _XPathContext(_BaseContext):             # <<<<<<<<<<<<<<
 *     cdef object _variables
 *     def __init__(self, namespaces, extensions, enable_regexp, variables,
 */

struct __pyx_vtabstruct_4lxml_5etree__XPathContext {
  struct __pyx_vtabstruct_4lxml_5etree__BaseContext __pyx_base;
  PyObject *(*set_context)(struct __pyx_obj_4lxml_5etree__XPathContext *, xmlXPathContext *);
  PyObject *(*register_context)(struct __pyx_obj_4lxml_5etree__XPathContext *, struct LxmlDocument *);
  PyObject *(*unregister_context)(struct __pyx_obj_4lxml_5etree__XPathContext *);
  void (*registerExsltFunctions)(struct __pyx_obj_4lxml_5etree__XPathContext *);
  PyObject *(*registerVariables)(struct __pyx_obj_4lxml_5etree__XPathContext *, PyObject *);
  PyObject *(*registerVariable)(struct __pyx_obj_4lxml_5etree__XPathContext *, PyObject *, PyObject *);
  void (*_registerVariable)(struct __pyx_obj_4lxml_5etree__XPathContext *, PyObject *, PyObject *);
  void (*_setupDict)(struct __pyx_obj_4lxml_5etree__XPathContext *, xmlXPathContext *);
};
static struct __pyx_vtabstruct_4lxml_5etree__XPathContext *__pyx_vtabptr_4lxml_5etree__XPathContext;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":376
 *         self._entries.append(entry)
 * 
 * cdef class PyErrorLog(_BaseErrorLog):             # <<<<<<<<<<<<<<
 *     u"""PyErrorLog(self, logger_name=None, logger=None)
 *     A global error log that connects to the Python stdlib logging package.
 */

struct __pyx_vtabstruct_4lxml_5etree_PyErrorLog {
  struct __pyx_vtabstruct_4lxml_5etree__BaseErrorLog __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_PyErrorLog *__pyx_vtabptr_4lxml_5etree_PyErrorLog;


/* "src/lxml/lxml.etree.pyx":2412
 *         self._storeNext(node)
 * 
 * cdef class ElementDepthFirstIterator(_ElementTagMatcher):             # <<<<<<<<<<<<<<
 *     u"""ElementDepthFirstIterator(self, node, tag=None, inclusive=True)
 *     Iterates over an element and its sub-elements in document order (depth
 */

struct __pyx_vtabstruct_4lxml_5etree_ElementDepthFirstIterator {
  struct __pyx_vtabstruct_4lxml_5etree__ElementTagMatcher __pyx_base;
  xmlNode *(*_nextNodeAnyTag)(struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *, xmlNode *);
  xmlNode *(*_nextNodeMatchTag)(struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *, xmlNode *);
};
static struct __pyx_vtabstruct_4lxml_5etree_ElementDepthFirstIterator *__pyx_vtabptr_4lxml_5etree_ElementDepthFirstIterator;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":201
 *         return u"FunctionNamespace(%r)" % self._ns_uri
 * 
 * cdef class _XPathFunctionNamespaceRegistry(_FunctionNamespaceRegistry):             # <<<<<<<<<<<<<<
 *     cdef object _prefix
 *     cdef object _prefix_utf
 */

struct __pyx_vtabstruct_4lxml_5etree__XPathFunctionNamespaceRegistry {
  struct __pyx_vtabstruct_4lxml_5etree__FunctionNamespaceRegistry __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree__XPathFunctionNamespaceRegistry *__pyx_vtabptr_4lxml_5etree__XPathFunctionNamespaceRegistry;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":58
 *     return (_elementTreeFactory(doc, None), _IDDict(doc))
 * 
 * cdef class _IDDict:             # <<<<<<<<<<<<<<
 *     u"""IDDict(self, etree)
 *     A dictionary-like proxy class that mapps ID attributes to elements.
 */

struct __pyx_vtabstruct_4lxml_5etree__IDDict {
  PyObject *(*_build_keys)(struct __pyx_obj_4lxml_5etree__IDDict *);
  PyObject *(*_build_items)(struct __pyx_obj_4lxml_5etree__IDDict *);
};
static struct __pyx_vtabstruct_4lxml_5etree__IDDict *__pyx_vtabptr_4lxml_5etree__IDDict;

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) LxmlDocumentType;

/* "src/lxml/lxml.etree.pyx":303
 * # Public Python API
 * 
 * cdef public class _Document [ type LxmlDocumentType, object LxmlDocument ]:             # <<<<<<<<<<<<<<
 *     u"""Internal base class to reference a libxml document.
 * 
 */

struct __pyx_vtabstruct_4lxml_5etree__Document {
  PyObject *(*getroot)(struct LxmlDocument *);
  int (*hasdoctype)(struct LxmlDocument *);
  PyObject *(*getdoctype)(struct LxmlDocument *);
  PyObject *(*getxmlinfo)(struct LxmlDocument *);
  PyObject *(*isstandalone)(struct LxmlDocument *);
  PyObject *(*buildNewPrefix)(struct LxmlDocument *);
  xmlNs *(*_findOrBuildNodeNs)(struct LxmlDocument *, xmlNode *, char *, char *, int);
  int (*_setNodeNs)(struct LxmlDocument *, xmlNode *, char *);
};
static struct __pyx_vtabstruct_4lxml_5etree__Document *__pyx_vtabptr_4lxml_5etree__Document;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":40
 *     pass
 * 
 * cdef class _ParserDictionaryContext:             # <<<<<<<<<<<<<<
 *     # Global parser context to share the string dictionary.
 *     #
 */

struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext {
  void (*initMainParserContext)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *);
  struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *(*_findThreadParserContext)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *);
  void (*setDefaultParser)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, struct __pyx_obj_4lxml_5etree__BaseParser *);
  struct __pyx_obj_4lxml_5etree__BaseParser *(*getDefaultParser)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *);
  xmlDict *(*_getThreadDict)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, xmlDict *);
  void (*initThreadDictRef)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, xmlDict **);
  void (*initParserDict)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, xmlParserCtxt *);
  void (*initXPathParserDict)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, xmlXPathContext *);
  void (*initDocDict)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, xmlDoc *);
  struct __pyx_obj_4lxml_5etree__ParserContext *(*findImpliedContext)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *);
  void (*pushImpliedContextFromParser)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, struct __pyx_obj_4lxml_5etree__BaseParser *);
  void (*pushImpliedContext)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, struct __pyx_obj_4lxml_5etree__ParserContext *);
  void (*popImpliedContext)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *);
};
static struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext *__pyx_vtabptr_4lxml_5etree__ParserDictionaryContext;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1292
 *                              target, None, encoding)
 * 
 * cdef class ETCompatXMLParser(XMLParser):             # <<<<<<<<<<<<<<
 *     u"""ETCompatXMLParser(self, encoding=None, attribute_defaults=False, \
 *                  dtd_validation=False, load_dtd=False, no_network=True, \
 */

struct __pyx_vtabstruct_4lxml_5etree_ETCompatXMLParser {
  struct __pyx_vtabstruct_4lxml_5etree_XMLParser __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_ETCompatXMLParser *__pyx_vtabptr_4lxml_5etree_ETCompatXMLParser;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":93
 * 
 * 
 * cdef class _TargetParserContext(_SaxParserContext):             # <<<<<<<<<<<<<<
 *     u"""This class maps SAX2 events to the ET parser target interface.
 *     """
 */

struct __pyx_vtabstruct_4lxml_5etree__TargetParserContext {
  struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext __pyx_base;
  int (*_setTarget)(struct __pyx_obj_4lxml_5etree__TargetParserContext *, PyObject *);
  void (*_cleanupTargetParserContext)(struct __pyx_obj_4lxml_5etree__TargetParserContext *, xmlDoc *);
};
static struct __pyx_vtabstruct_4lxml_5etree__TargetParserContext *__pyx_vtabptr_4lxml_5etree__TargetParserContext;


/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1371
 *     )
 * 
 * cdef class HTMLParser(_FeedParser):             # <<<<<<<<<<<<<<
 *     u"""HTMLParser(self, encoding=None, remove_blank_text=False, \
 *                    remove_comments=False, remove_pis=False, strip_cdata=True, \
 */

struct __pyx_vtabstruct_4lxml_5etree_HTMLParser {
  struct __pyx_vtabstruct_4lxml_5etree__FeedParser __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_HTMLParser *__pyx_vtabptr_4lxml_5etree_HTMLParser;

#ifndef CYTHON_REFNANNY
  #define CYTHON_REFNANNY 0
#endif

#if CYTHON_REFNANNY
  typedef struct {
    void (*INCREF)(void*, PyObject*, int);
    void (*DECREF)(void*, PyObject*, int);
    void (*GOTREF)(void*, PyObject*, int);
    void (*GIVEREF)(void*, PyObject*, int);
    void* (*SetupContext)(const char*, int, const char*);
    void (*FinishContext)(void**);
  } __Pyx_RefNannyAPIStruct;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  static __Pyx_RefNannyAPIStruct * __Pyx_RefNannyImportAPI(const char *modname) {
    PyObject *m = NULL, *p = NULL;
    void *r = NULL;
    m = PyImport_ImportModule((char *)modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
  end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
  }
  #define __Pyx_RefNannySetupContext(name)           void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
  #define __Pyx_RefNannyFinishContext()           __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0)
#else
  #define __Pyx_RefNannySetupContext(name)
  #define __Pyx_RefNannyFinishContext()
  #define __Pyx_INCREF(r) Py_INCREF(r)
  #define __Pyx_DECREF(r) Py_DECREF(r)
  #define __Pyx_GOTREF(r)
  #define __Pyx_GIVEREF(r)
  #define __Pyx_XDECREF(r) Py_XDECREF(r)
#endif /* CYTHON_REFNANNY */
#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0)
#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0)

static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/

static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
    Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/

static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name, PyObject* kw_name); /*proto*/

static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,     const char* function_name); /*proto*/

static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/

static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);

static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/
static int __Pyx_EndUnpack(PyObject *, Py_ssize_t expected); /*proto*/

static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/

static CYTHON_INLINE long __Pyx_mod_long(long, long); /* proto */

static CYTHON_INLINE long __Pyx_div_long(long, long); /* proto */

static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict,
    const char* function_name, int kw_allowed); /*proto*/

static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/

static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);

static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/

static CYTHON_INLINE long __Pyx_NegateNonNeg(long b) { return unlikely(b < 0) ? b : !b; }
static CYTHON_INLINE PyObject* __Pyx_PyBoolOrNull_FromLong(long b) {
    return unlikely(b < 0) ? NULL : __Pyx_PyBool_FromLong(b);
}

static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t); /* proto */


static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
    PyObject *r;
    if (!j) return NULL;
    r = PyObject_GetItem(o, j);
    Py_DECREF(j);
    return r;
}


#define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
                                                    __Pyx_GetItemInt_List_Fast(o, i) : \
                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))

static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) {
    if (likely(o != Py_None)) {
        if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
            PyObject *r = PyList_GET_ITEM(o, i);
            Py_INCREF(r);
            return r;
        }
        else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) {
            PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i);
            Py_INCREF(r);
            return r;
        }
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}

#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
                                                    __Pyx_GetItemInt_Tuple_Fast(o, i) : \
                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))

static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) {
    if (likely(o != Py_None)) {
        if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
            PyObject *r = PyTuple_GET_ITEM(o, i);
            Py_INCREF(r);
            return r;
        }
        else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) {
            PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i);
            Py_INCREF(r);
            return r;
        }
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}


#define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
                                                    __Pyx_GetItemInt_Fast(o, i) : \
                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))

static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) {
    PyObject *r;
    if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) {
        r = PyList_GET_ITEM(o, i);
        Py_INCREF(r);
    }
    else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
        r = PyTuple_GET_ITEM(o, i);
        Py_INCREF(r);
    }
    else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) {
        r = PySequence_GetItem(o, i);
    }
    else {
        r = __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
    }
    return r;
}

#define __Pyx_DelItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
                                                    __Pyx_DelItemInt_Fast(o, i) : \
                                                    __Pyx_DelItem_Generic(o, to_py_func(i)))

static CYTHON_INLINE int __Pyx_DelItem_Generic(PyObject *o, PyObject *j) {
    int r;
    if (!j) return -1;
    r = PyObject_DelItem(o, j);
    Py_DECREF(j);
    return r;
}

static CYTHON_INLINE int __Pyx_DelItemInt_Fast(PyObject *o, Py_ssize_t i) {
    if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_ass_item && likely(i >= 0))
        return PySequence_DelItem(o, i);
    else {
        PyObject *j = PyInt_FromSsize_t(i);
        return __Pyx_DelItem_Generic(o, j);
    }
}

static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
    const char *name, int exact); /*proto*/

static CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void);

#if PY_MAJOR_VERSION >= 3
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
    PyObject *value;
    if (unlikely(d == Py_None)) {
        __Pyx_RaiseNoneIndexingError();
        return NULL;
    }
    value = PyDict_GetItemWithError(d, key);
    if (unlikely(!value)) {
        if (!PyErr_Occurred())
            PyErr_SetObject(PyExc_KeyError, key);
        return NULL;
    }
    Py_INCREF(value);
    return value;
}
#else
    #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
#endif

#if PY_VERSION_HEX < 0x02050000
#ifndef PyAnySet_CheckExact

#define PyAnySet_CheckExact(ob) \
    ((ob)->ob_type == &PySet_Type || \
     (ob)->ob_type == &PyFrozenSet_Type)

#define PySet_New(iterable) \
    PyObject_CallFunctionObjArgs((PyObject *)&PySet_Type, (iterable), NULL)

#define Pyx_PyFrozenSet_New(iterable) \
    PyObject_CallFunctionObjArgs((PyObject *)&PyFrozenSet_Type, (iterable), NULL)

#define PySet_Size(anyset) \
    PyObject_Size((anyset))

#define PySet_Contains(anyset, key) \
    PySequence_Contains((anyset), (key))

#define PySet_Pop(set) \
    PyObject_CallMethod(set, (char *)"pop", NULL)

static CYTHON_INLINE int PySet_Clear(PyObject *set) {
    PyObject *ret = PyObject_CallMethod(set, (char *)"clear", NULL);
    if (!ret) return -1;
    Py_DECREF(ret); return 0;
}

static CYTHON_INLINE int PySet_Discard(PyObject *set, PyObject *key) {
    PyObject *ret = PyObject_CallMethod(set, (char *)"discard", (char *)"O", key);
    if (!ret) return -1;
    Py_DECREF(ret); return 0;
}

static CYTHON_INLINE int PySet_Add(PyObject *set, PyObject *key) {
    PyObject *ret = PyObject_CallMethod(set, (char *)"add", (char *)"O", key);
    if (!ret) return -1;
    Py_DECREF(ret); return 0;
}

#endif /* PyAnySet_CheckExact (<= Py2.4) */

#if PY_VERSION_HEX < 0x02040000
#ifndef Py_SETOBJECT_H
#define Py_SETOBJECT_H

static PyTypeObject *__Pyx_PySet_Type = NULL;
static PyTypeObject *__Pyx_PyFrozenSet_Type = NULL;

#define PySet_Type (*__Pyx_PySet_Type)
#define PyFrozenSet_Type (*__Pyx_PyFrozenSet_Type)

#define PyAnySet_Check(ob) \
    (PyAnySet_CheckExact(ob) || \
     PyType_IsSubtype((ob)->ob_type, &PySet_Type) || \
     PyType_IsSubtype((ob)->ob_type, &PyFrozenSet_Type))

#define PyFrozenSet_CheckExact(ob) ((ob)->ob_type == &PyFrozenSet_Type)

static int __Pyx_Py23SetsImport(void) {
    PyObject *sets=0, *Set=0, *ImmutableSet=0;

    sets = PyImport_ImportModule((char *)"sets");
    if (!sets) goto bad;
    Set = PyObject_GetAttrString(sets, (char *)"Set");
    if (!Set) goto bad;
    ImmutableSet = PyObject_GetAttrString(sets, (char *)"ImmutableSet");
    if (!ImmutableSet) goto bad;
    Py_DECREF(sets);

    __Pyx_PySet_Type       = (PyTypeObject*) Set;
    __Pyx_PyFrozenSet_Type = (PyTypeObject*) ImmutableSet;

    return 0;

 bad:
    Py_XDECREF(sets);
    Py_XDECREF(Set);
    Py_XDECREF(ImmutableSet);
    return -1;
}

#else
static int __Pyx_Py23SetsImport(void) { return 0; }
#endif /* !Py_SETOBJECT_H */
#endif /* < Py2.4  */
#endif /* < Py2.5  */

static CYTHON_INLINE PyObject* __Pyx_PyObject_Pop(PyObject* L) {
    PyObject *r, *m;
#if PY_VERSION_HEX >= 0x02040000
    if (likely(PyList_CheckExact(L))
            /* Check that both the size is positive and no reallocation shrinking needs to be done. */
            && likely(PyList_GET_SIZE(L) > (((PyListObject*)L)->allocated >> 1))) {
        Py_SIZE(L) -= 1;
        return PyList_GET_ITEM(L, PyList_GET_SIZE(L));
    }
#endif
    m = __Pyx_GetAttrString(L, "pop");
    if (!m) return NULL;
    r = PyObject_CallObject(m, NULL);
    Py_DECREF(m);
    return r;
}

#include <string.h>

static int __Pyx_RegisterCleanup(void); /*proto*/
static PyObject* __pyx_module_cleanup(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef cleanup_def = {__Pyx_NAMESTR("__cleanup"), (PyCFunction)&__pyx_module_cleanup, METH_NOARGS, 0};

static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/

static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases); /*proto*/

static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name,
                                   PyObject *modname); /*proto*/

#define __pyx_binding_PyCFunctionType_USED 1

typedef struct {
    PyCFunctionObject func;
} __pyx_binding_PyCFunctionType_object;

static PyTypeObject __pyx_binding_PyCFunctionType_type;
static PyTypeObject *__pyx_binding_PyCFunctionType = NULL;

static PyObject *__pyx_binding_PyCFunctionType_NewEx(PyMethodDef *ml, PyObject *self, PyObject *module); /* proto */
#define __pyx_binding_PyCFunctionType_New(ml, self) __pyx_binding_PyCFunctionType_NewEx(ml, self, NULL)

static int __pyx_binding_PyCFunctionType_init(void); /* proto */

static int __Pyx_Print(PyObject*, PyObject *, int); /*proto*/
#if PY_MAJOR_VERSION >= 3
static PyObject* __pyx_print = 0;
static PyObject* __pyx_print_kwargs = 0;
#endif

static int __Pyx_PrintOne(PyObject* stream, PyObject *o); /*proto*/

#include "descrobject.h"
static PyObject* __Pyx_Method_ClassMethod(PyObject *method); /*proto*/

static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/

#ifndef __PYX_FORCE_INIT_THREADS
  #if PY_VERSION_HEX < 0x02040200
    #define __PYX_FORCE_INIT_THREADS 1
  #else
    #define __PYX_FORCE_INIT_THREADS 0
  #endif
#endif

static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); /*proto*/

static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);

static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);

static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *);

static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *);

static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *);

static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *);

static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *);

static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);

static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);

static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *);

static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);

static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);

static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *);

static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *);

static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);

static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);

static void __Pyx_WriteUnraisable(const char *name); /*proto*/

static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig); /*proto*/

static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/

static PyObject *__Pyx_ImportModule(const char *name); /*proto*/

static void __Pyx_AddTraceback(const char *funcname); /*proto*/

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
/* Module declarations from lxml.cstd */

/* Module declarations from lxml.tree */

/* Module declarations from cython */

/* Module declarations from lxml.python */

/* Module declarations from lxml.config */

/* Module declarations from lxml.xmlerror */

/* Module declarations from lxml.xpath */

/* Module declarations from lxml.c14n */

/* Module declarations from lxml.uri */

/* Module declarations from lxml.xmlparser */

/* Module declarations from lxml.htmlparser */

/* Module declarations from lxml.xinclude */

/* Module declarations from lxml.xslt */

/* Module declarations from lxml.dtdvalid */

/* Module declarations from lxml.relaxng */

/* Module declarations from lxml.xmlschema */

/* Module declarations from lxml.schematron */

/* Module declarations from lxml.etree */

static PyTypeObject *__pyx_ptype_4lxml_5etree__TempStore = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__ExceptionContext = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__Document = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__Element = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__BaseParser = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_QName = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__LogEntry = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__BaseErrorLog = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__ListErrorLog = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__ErrorLog = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__DomainErrorLog = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__RotatingErrorLog = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_PyErrorLog = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_DocInfo = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree___ContentOnlyElement = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__Comment = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__ProcessingInstruction = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__Entity = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__ElementTree = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__Attrib = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__AttribIterator = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__ElementTagMatcher = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__ElementIterator = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_ElementChildIterator = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_SiblingsIterator = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_AncestorsIterator = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_ElementDepthFirstIterator = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_ElementTextIterator = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_CDATA = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__ReadOnlyProxy = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__ReadOnlyPIProxy = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__ReadOnlyEntityProxy = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__ReadOnlyElementProxy = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__OpaqueNodeWrapper = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__OpaqueDocumentWrapper = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__ModifyContentOnlyProxy = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__ModifyContentOnlyPIProxy = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__ModifyContentOnlyEntityProxy = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__AppendOnlyElementProxy = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_ElementBase = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_CommentBase = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_PIBase = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_EntityBase = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_ElementClassLookup = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_FallbackElementClassLookup = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_ElementDefaultClassLookup = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_AttributeBasedElementClassLookup = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_ParserBasedElementClassLookup = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_CustomElementClassLookup = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_PythonElementClassLookup = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__NamespaceRegistry = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__ClassNamespaceRegistry = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_ElementNamespaceClassLookup = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__FunctionNamespaceRegistry = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__XPathFunctionNamespaceRegistry = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__InputDocument = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_Resolver = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__ResolverRegistry = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__ResolverContext = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__ParserContext = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__SaxParserContext = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__TargetParserContext = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__ParserSchemaValidationContext = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__Validator = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_XMLSchema = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__ParserDictionaryContext = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__FileReaderContext = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__FeedParser = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_XMLParser = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_ETCompatXMLParser = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_HTMLParser = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__SaxParserTarget = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_TreeBuilder = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__PythonSaxParserTarget = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__FilelikeWriter = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__IterparseContext = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_iterparse = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_iterwalk = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__IDDict = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_XInclude = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__ExsltRegExp = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__BaseContext = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__ElementUnicodeResult = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__XPathContext = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__XPathEvaluatorBase = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_XPathElementEvaluator = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_XPathDocumentEvaluator = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_XPath = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_ETXPath = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__XSLTResolverContext = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_XSLTAccessControl = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__XSLTContext = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__XSLTQuotedStringParam = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_XSLT = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__XSLTResultTree = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__XSLTProcessingInstruction = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_XSLTExtension = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_DTD = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_RelaxNG = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_Schematron = 0;
static PyObject *__pyx_v_4lxml_5etree__unicode = 0;
static PyObject *__pyx_v_4lxml_5etree_os_path_abspath = 0;
static PyObject *__pyx_v_4lxml_5etree_BytesIO = 0;
static PyObject *__pyx_v_4lxml_5etree_StringIO = 0;
static PyObject *__pyx_v_4lxml_5etree__elementpath = 0;
static PyObject *__pyx_v_4lxml_5etree_sys = 0;
static PyObject *__pyx_v_4lxml_5etree_re = 0;
static PyObject *__pyx_v_4lxml_5etree_gzip = 0;
static PyObject *__pyx_v_4lxml_5etree_ITER_EMPTY = 0;
static PyObject *__pyx_v_4lxml_5etree_EMPTY_READ_ONLY_DICT = 0;
static PyObject *__pyx_v_4lxml_5etree__FILENAME_ENCODING = 0;
static char *__pyx_v_4lxml_5etree__C_FILENAME_ENCODING;
static PyObject *__pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES = 0;
static PyObject *__pyx_v_4lxml_5etree__check_internal_prefix = 0;
static PyObject *__pyx_v_4lxml_5etree__Error = 0;
static PyObject *__pyx_v_4lxml_5etree_error_super_init = 0;
static int __pyx_v_4lxml_5etree__LIBXML_VERSION_INT;
static PyObject *__pyx_v_4lxml_5etree___RE_XML_ENCODING = 0;
static PyObject *__pyx_v_4lxml_5etree___REPLACE_XML_ENCODING = 0;
static PyObject *__pyx_v_4lxml_5etree___HAS_XML_ENCODING = 0;
static struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_4lxml_5etree___GLOBAL_ERROR_LOG = 0;
static PyObject *__pyx_v_4lxml_5etree___ERROR_LEVELS = 0;
static PyObject *__pyx_v_4lxml_5etree___ERROR_DOMAINS = 0;
static PyObject *__pyx_v_4lxml_5etree___PARSER_ERROR_TYPES = 0;
static PyObject *__pyx_v_4lxml_5etree___RELAXNG_ERROR_TYPES = 0;
static PyObject *__pyx_v_4lxml_5etree__PREFIX_CACHE = 0;
static _element_class_lookup_function __pyx_v_4lxml_5etree_LOOKUP_ELEMENT_CLASS;
static PyObject *__pyx_v_4lxml_5etree_ELEMENT_CLASS_LOOKUP_STATE = 0;
static struct __pyx_obj_4lxml_5etree_ParserBasedElementClassLookup *__pyx_v_4lxml_5etree_DEFAULT_ELEMENT_CLASS_LOOKUP = 0;
static PyObject *__pyx_v_4lxml_5etree___FUNCTION_NAMESPACE_REGISTRIES = 0;
static PyObject *__pyx_v_4lxml_5etree__LxmlSyntaxError = 0;
static PyObject *__pyx_v_4lxml_5etree__ParseError = 0;
static struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT = 0;
static char *__pyx_v_4lxml_5etree__UNICODE_ENCODING;
static xmlExternalEntityLoader __pyx_v_4lxml_5etree___DEFAULT_ENTITY_LOADER;
static int __pyx_v_4lxml_5etree__XML_DEFAULT_PARSE_OPTIONS;
static struct __pyx_obj_4lxml_5etree_XMLParser *__pyx_v_4lxml_5etree___DEFAULT_XML_PARSER = 0;
static int __pyx_v_4lxml_5etree__HTML_DEFAULT_PARSE_OPTIONS;
static struct __pyx_obj_4lxml_5etree_HTMLParser *__pyx_v_4lxml_5etree___DEFAULT_HTML_PARSER = 0;
static PyObject *__pyx_v_4lxml_5etree_inspect_getargspec = 0;
static PyObject *__pyx_v_4lxml_5etree__find_id_attributes = 0;
static PyObject *__pyx_v_4lxml_5etree__XPATH_SYNTAX_ERRORS = 0;
static PyObject *__pyx_v_4lxml_5etree__XPATH_EVAL_ERRORS = 0;
static int __pyx_v_4lxml_5etree__XPATH_VERSION_WARNING_REQUIRED;
static PyObject *__pyx_v_4lxml_5etree__replace_strings = 0;
static PyObject *__pyx_v_4lxml_5etree__find_namespaces = 0;
static xsltDocLoaderFunc __pyx_v_4lxml_5etree_XSLT_DOC_DEFAULT_LOADER;
static PyObject *__pyx_v_4lxml_5etree_EMPTY_DICT = 0;
static PyObject *__pyx_v_4lxml_5etree__FIND_PI_ATTRIBUTES = 0;
static PyObject *__pyx_v_4lxml_5etree__RE_PI_HREF = 0;
static PyObject *__pyx_v_4lxml_5etree__FIND_PI_HREF = 0;
static PyObject *__pyx_v_4lxml_5etree__REPLACE_PI_HREF = 0;
static struct __pyx_obj_4lxml_5etree_XPath *__pyx_v_4lxml_5etree___findStylesheetByID = 0;
static struct __pyx_obj_4lxml_5etree_XPath *__pyx_v_4lxml_5etree__check_for_default_attributes = 0;
static PyObject *__pyx_f_4lxml_5etree___unpackDottedVersion(PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree___unpackIntVersion(int); /*proto*/
static CYTHON_INLINE struct LxmlElement *__pyx_f_4lxml_5etree_getProxy(xmlNode *); /*proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree_hasProxy(xmlNode *); /*proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree__registerProxy(struct LxmlElement *, struct LxmlDocument *, xmlNode *); /*proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree__unregisterProxy(struct LxmlElement *); /*proto*/
static CYTHON_INLINE void __pyx_f_4lxml_5etree__releaseProxy(struct LxmlElement *); /*proto*/
static CYTHON_INLINE void __pyx_f_4lxml_5etree__updateProxyDocument(xmlNode *, struct LxmlDocument *); /*proto*/
static xmlDoc *__pyx_f_4lxml_5etree__fakeRootDoc(xmlDoc *, xmlNode *); /*proto*/
static xmlDoc *__pyx_f_4lxml_5etree__plainFakeRootDoc(xmlDoc *, xmlNode *, int); /*proto*/
static void __pyx_f_4lxml_5etree__destroyFakeDoc(xmlDoc *, xmlDoc *); /*proto*/
static struct LxmlElement *__pyx_f_4lxml_5etree__fakeDocElementFactory(struct LxmlDocument *, xmlNode *); /*proto*/
static int __pyx_f_4lxml_5etree_attemptDeallocation(xmlNode *); /*proto*/
static xmlNode *__pyx_f_4lxml_5etree_getDeallocationTop(xmlNode *); /*proto*/
static int __pyx_f_4lxml_5etree_canDeallocateChildNodes(xmlNode *); /*proto*/
static void __pyx_f_4lxml_5etree__copyParentNamespaces(xmlNode *, xmlNode *); /*proto*/
static int __pyx_f_4lxml_5etree__growNsCache(__pyx_t_4lxml_5etree__nscache *); /*proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree__appendToNsCache(__pyx_t_4lxml_5etree__nscache *, xmlNs *, xmlNs *); /*proto*/
static int __pyx_f_4lxml_5etree__stripRedundantNamespaceDeclarations(xmlNode *, __pyx_t_4lxml_5etree__nscache *, xmlNs **); /*proto*/
static int __pyx_f_4lxml_5etree_moveNodeToDocument(struct LxmlDocument *, xmlDoc *, xmlNode *); /*proto*/
static void __pyx_f_4lxml_5etree_fixElementDocument(xmlNode *, struct LxmlDocument *, size_t); /*proto*/
static void __pyx_f_4lxml_5etree_fixThreadDictNames(xmlNode *, xmlDict *, xmlDict *); /*proto*/
static void __pyx_f_4lxml_5etree_fixThreadDictNamesForNode(xmlNode *, xmlDict *, xmlDict *); /*proto*/
static CYTHON_INLINE void __pyx_f_4lxml_5etree_fixThreadDictNamesForAttributes(xmlAttr *, xmlDict *, xmlDict *); /*proto*/
static CYTHON_INLINE void __pyx_f_4lxml_5etree_fixThreadDictNameForNode(xmlNode *, xmlDict *, xmlDict *); /*proto*/
static CYTHON_INLINE void __pyx_f_4lxml_5etree_fixThreadDictContentForNode(xmlNode *, xmlDict *, xmlDict *); /*proto*/
static CYTHON_INLINE void __pyx_f_4lxml_5etree_fixThreadDictNsForNode(xmlNode *, xmlDict *, xmlDict *); /*proto*/
static void __pyx_f_4lxml_5etree_displayNode(xmlNode *, PyObject *); /*proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree__assertValidNode(struct LxmlElement *); /*proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree__assertValidDoc(struct LxmlDocument *); /*proto*/
static struct LxmlDocument *__pyx_f_4lxml_5etree__documentOrRaise(PyObject *); /*proto*/
static struct LxmlElement *__pyx_f_4lxml_5etree__rootNodeOrRaise(PyObject *); /*proto*/
static struct LxmlDocument *__pyx_f_4lxml_5etree__documentOf(PyObject *); /*proto*/
static struct LxmlElement *__pyx_f_4lxml_5etree__rootNodeOf(PyObject *); /*proto*/
static struct LxmlElement *__pyx_f_4lxml_5etree__makeElement(PyObject *, xmlDoc *, struct LxmlDocument *, struct __pyx_obj_4lxml_5etree__BaseParser *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__initNewElement(struct LxmlElement *, int, PyObject *, PyObject *, struct __pyx_obj_4lxml_5etree__BaseParser *, PyObject *, PyObject *, PyObject *); /*proto*/
static struct LxmlElement *__pyx_f_4lxml_5etree__makeSubElement(struct LxmlElement *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__initNodeNamespaces(xmlNode *, struct LxmlDocument *, PyObject *, PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__initNodeAttributes(xmlNode *, struct LxmlDocument *, PyObject *, PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__removeUnusedNamespaceDeclarations(xmlNode *); /*proto*/
static xmlNs *__pyx_f_4lxml_5etree__searchNsByHref(xmlNode *, char *, int); /*proto*/
static int __pyx_f_4lxml_5etree__replaceNodeByChildren(struct LxmlDocument *, xmlNode *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__attributeValue(xmlNode *, xmlAttr *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__attributeValueFromNsName(xmlNode *, char *, char *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__getNodeAttributeValue(xmlNode *, PyObject *, PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_4lxml_5etree__getAttributeValue(struct LxmlElement *, PyObject *, PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__setAttributeValue(struct LxmlElement *, PyObject *, PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__delAttribute(struct LxmlElement *, PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__delAttributeFromNsName(xmlNode *, char *, char *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__collectAttributes(xmlNode *, int); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__stripEncodingDeclaration(PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__hasEncodingDeclaration(PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__stripDeclaration(PyObject *); /*proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree__hasText(xmlNode *); /*proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree__hasTail(xmlNode *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__collectText(xmlNode *); /*proto*/
static void __pyx_f_4lxml_5etree__removeText(xmlNode *); /*proto*/
static int __pyx_f_4lxml_5etree__setNodeText(xmlNode *, PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__setTailText(xmlNode *, PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__resolveQNameText(struct LxmlElement *, PyObject *); /*proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree__hasChild(xmlNode *); /*proto*/
static CYTHON_INLINE Py_ssize_t __pyx_f_4lxml_5etree__countElements(xmlNode *); /*proto*/
static int __pyx_f_4lxml_5etree__findChildSlice(PyObject *, xmlNode *, xmlNode **, Py_ssize_t *, Py_ssize_t *); /*proto*/
static int __pyx_f_4lxml_5etree__isFullSlice(PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__collectChildren(struct LxmlElement *); /*proto*/
static CYTHON_INLINE xmlNode *__pyx_f_4lxml_5etree__findChild(xmlNode *, Py_ssize_t); /*proto*/
static CYTHON_INLINE xmlNode *__pyx_f_4lxml_5etree__findChildForwards(xmlNode *, Py_ssize_t); /*proto*/
static CYTHON_INLINE xmlNode *__pyx_f_4lxml_5etree__findChildBackwards(xmlNode *, Py_ssize_t); /*proto*/
static CYTHON_INLINE xmlNode *__pyx_f_4lxml_5etree__textNodeOrSkip(xmlNode *); /*proto*/
static CYTHON_INLINE xmlNode *__pyx_f_4lxml_5etree__nextElement(xmlNode *); /*proto*/
static CYTHON_INLINE xmlNode *__pyx_f_4lxml_5etree__previousElement(xmlNode *); /*proto*/
static CYTHON_INLINE xmlNode *__pyx_f_4lxml_5etree__parentElement(xmlNode *); /*proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree__tagMatches(xmlNode *, char *, char *); /*proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree__tagMatchesExactly(xmlNode *, char *, char *); /*proto*/
static int __pyx_f_4lxml_5etree__removeNode(struct LxmlDocument *, xmlNode *); /*proto*/
static int __pyx_f_4lxml_5etree__removeSiblings(xmlNode *, int, int); /*proto*/
static void __pyx_f_4lxml_5etree__moveTail(xmlNode *, xmlNode *); /*proto*/
static int __pyx_f_4lxml_5etree__copyTail(xmlNode *, xmlNode *); /*proto*/
static int __pyx_f_4lxml_5etree__copyNonElementSiblings(xmlNode *, xmlNode *); /*proto*/
static int __pyx_f_4lxml_5etree__deleteSlice(struct LxmlDocument *, xmlNode *, Py_ssize_t, Py_ssize_t); /*proto*/
static int __pyx_f_4lxml_5etree__replaceSlice(struct LxmlElement *, xmlNode *, Py_ssize_t, Py_ssize_t, int, PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__appendChild(struct LxmlElement *, struct LxmlElement *); /*proto*/
static int __pyx_f_4lxml_5etree__prependChild(struct LxmlElement *, struct LxmlElement *); /*proto*/
static int __pyx_f_4lxml_5etree__appendSibling(struct LxmlElement *, struct LxmlElement *); /*proto*/
static int __pyx_f_4lxml_5etree__prependSibling(struct LxmlElement *, struct LxmlElement *); /*proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree_isutf8(char *); /*proto*/
static int __pyx_f_4lxml_5etree_check_string_utf8(PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree_funicode(char *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__utf8(PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__isFilePath(char *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__encodeFilename(PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__decodeFilename(char *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__encodeFilenameUTF8(PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__getNsTag(PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__getNsTagWithEmptyNs(PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree___getNsTag(PyObject *, int); /*proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree__pyXmlNameIsValid(PyObject *); /*proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree__pyHtmlNameIsValid(PyObject *); /*proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree__xmlNameIsValid(char *); /*proto*/
static int __pyx_f_4lxml_5etree__htmlNameIsValid(char *); /*proto*/
static int __pyx_f_4lxml_5etree__characterReferenceIsValid(char *); /*proto*/
static int __pyx_f_4lxml_5etree__tagValidOrRaise(PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__htmlTagValidOrRaise(PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__attributeValidOrRaise(PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__prefixValidOrRaise(PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__uriValidOrRaise(PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_4lxml_5etree__namespacedName(xmlNode *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__namespacedNameFromNsName(char *, char *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__getFilenameForFile(PyObject *); /*proto*/
static void __pyx_f_4lxml_5etree__nullGenericErrorFunc(void *, char *, ...); /*proto*/
static void __pyx_f_4lxml_5etree__initThreadLogging(void); /*proto*/
static void __pyx_f_4lxml_5etree_connectErrorLog(void *); /*proto*/
static struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_f_4lxml_5etree__getGlobalErrorLog(void); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__setGlobalErrorLog(struct __pyx_obj_4lxml_5etree__BaseErrorLog *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree___copyGlobalErrorLog(void); /*proto*/
static void __pyx_f_4lxml_5etree__forwardError(void *, xmlError *); /*proto*/
static void __pyx_f_4lxml_5etree__receiveError(void *, xmlError *); /*proto*/
static void __pyx_f_4lxml_5etree__receiveXSLTError(void *, char *, ...); /*proto*/
static void __pyx_f_4lxml_5etree___initErrorConstants(void); /*proto*/
static PyObject *__pyx_f_4lxml_5etree___initPrefixCache(void); /*proto*/
static struct LxmlDocument *__pyx_f_4lxml_5etree__documentFactory(xmlDoc *, struct __pyx_obj_4lxml_5etree__BaseParser *); /*proto*/
static struct LxmlElement *__pyx_f_4lxml_5etree__elementFactory(struct LxmlDocument *, xmlNode *); /*proto*/
static struct LxmlElementTree *__pyx_f_4lxml_5etree__elementTreeFactory(struct LxmlDocument *, struct LxmlElement *); /*proto*/
static struct LxmlElementTree *__pyx_f_4lxml_5etree__newElementTree(struct LxmlDocument *, struct LxmlElement *, PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__attributeIteratorFactory(struct LxmlElement *, int); /*proto*/
static xmlNode *__pyx_f_4lxml_5etree__createElement(xmlDoc *, PyObject *); /*proto*/
static xmlNode *__pyx_f_4lxml_5etree__createComment(xmlDoc *, char *); /*proto*/
static xmlNode *__pyx_f_4lxml_5etree__createPI(xmlDoc *, char *, char *); /*proto*/
static xmlNode *__pyx_f_4lxml_5etree__createEntity(xmlDoc *, char *); /*proto*/
static struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_f_4lxml_5etree__newReadOnlyProxy(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *, xmlNode *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_4lxml_5etree__initReadOnlyProxy(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *, struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__freeReadOnlyProxies(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *); /*proto*/
static struct __pyx_obj_4lxml_5etree__OpaqueNodeWrapper *__pyx_f_4lxml_5etree__newOpaqueAppendOnlyNodeWrapper(xmlNode *); /*proto*/
static struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_f_4lxml_5etree__newAppendOnlyProxy(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *, xmlNode *); /*proto*/
static xmlNode *__pyx_f_4lxml_5etree__roNodeOf(PyObject *); /*proto*/
static xmlNode *__pyx_f_4lxml_5etree__nonRoNodeOf(PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_4lxml_5etree__callLookupFallback(struct LxmlFallbackElementClassLookup *, struct LxmlDocument *, xmlNode *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__lookupDefaultElementClass(PyObject *, struct LxmlDocument *, xmlNode *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__attribute_class_lookup(PyObject *, struct LxmlDocument *, xmlNode *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__parser_class_lookup(PyObject *, struct LxmlDocument *, xmlNode *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__custom_class_lookup(PyObject *, struct LxmlDocument *, xmlNode *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__python_class_lookup(PyObject *, struct LxmlDocument *, xmlNode *); /*proto*/
static void __pyx_f_4lxml_5etree__setElementClassLookupFunction(_element_class_lookup_function, PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__find_nselement_class(PyObject *, struct LxmlDocument *, xmlNode *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__find_all_extension_prefixes(void); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__find_extension(PyObject *, PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__initResolverContext(struct __pyx_obj_4lxml_5etree__ResolverContext *, struct __pyx_obj_4lxml_5etree__ResolverRegistry *); /*proto*/
static int __pyx_f_4lxml_5etree__checkThreadDict(xmlDict *); /*proto*/
static void __pyx_f_4lxml_5etree__setupPythonUnicode(void); /*proto*/
static char *__pyx_f_4lxml_5etree__findEncodingName(char *, int); /*proto*/
static int __pyx_f_4lxml_5etree__readFilelikeParser(void *, char *, int); /*proto*/
static int __pyx_f_4lxml_5etree__readFileParser(void *, char *, int); /*proto*/
static xmlParserInput *__pyx_f_4lxml_5etree__local_resolver(char *, char *, xmlParserCtxt *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__initParserContext(struct __pyx_obj_4lxml_5etree__ParserContext *, struct __pyx_obj_4lxml_5etree__ResolverRegistry *, xmlParserCtxt *); /*proto*/
static int __pyx_f_4lxml_5etree__raiseParseError(xmlParserCtxt *, PyObject *, struct __pyx_obj_4lxml_5etree__ErrorLog *); /*proto*/
static xmlDoc *__pyx_f_4lxml_5etree__handleParseResult(struct __pyx_obj_4lxml_5etree__ParserContext *, xmlParserCtxt *, xmlDoc *, PyObject *, int); /*proto*/
static int __pyx_f_4lxml_5etree__fixHtmlDictNames(xmlDict *, xmlDoc *); /*proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree__fixHtmlDictNodeNames(xmlDict *, xmlNode *); /*proto*/
static int __pyx_f_4lxml_5etree__htmlCtxtResetPush(xmlParserCtxt *, char *, int, char *, int); /*proto*/
static xmlDoc *__pyx_f_4lxml_5etree__parseDoc(PyObject *, PyObject *, struct __pyx_obj_4lxml_5etree__BaseParser *); /*proto*/
static xmlDoc *__pyx_f_4lxml_5etree__parseDocFromFile(PyObject *, struct __pyx_obj_4lxml_5etree__BaseParser *); /*proto*/
static xmlDoc *__pyx_f_4lxml_5etree__parseDocFromFilelike(PyObject *, PyObject *, struct __pyx_obj_4lxml_5etree__BaseParser *); /*proto*/
static xmlDoc *__pyx_f_4lxml_5etree__newXMLDoc(void); /*proto*/
static xmlDoc *__pyx_f_4lxml_5etree__newHTMLDoc(void); /*proto*/
static xmlDoc *__pyx_f_4lxml_5etree__copyDoc(xmlDoc *, int); /*proto*/
static xmlDoc *__pyx_f_4lxml_5etree__copyDocRoot(xmlDoc *, xmlNode *); /*proto*/
static xmlNode *__pyx_f_4lxml_5etree__copyNodeToDoc(xmlNode *, xmlDoc *); /*proto*/
static struct LxmlDocument *__pyx_f_4lxml_5etree__parseDocument(PyObject *, struct __pyx_obj_4lxml_5etree__BaseParser *, PyObject *); /*proto*/
static struct LxmlDocument *__pyx_f_4lxml_5etree__parseDocumentFromURL(PyObject *, struct __pyx_obj_4lxml_5etree__BaseParser *); /*proto*/
static struct LxmlDocument *__pyx_f_4lxml_5etree__parseMemoryDocument(PyObject *, PyObject *, struct __pyx_obj_4lxml_5etree__BaseParser *); /*proto*/
static struct LxmlDocument *__pyx_f_4lxml_5etree__parseFilelikeDocument(PyObject *, PyObject *, struct __pyx_obj_4lxml_5etree__BaseParser *); /*proto*/
static void __pyx_f_4lxml_5etree__handleSaxStart(void *, char *, char *, char *, int, char **, int, int, char **); /*proto*/
static void __pyx_f_4lxml_5etree__handleSaxStartNoNs(void *, char *, char **); /*proto*/
static void __pyx_f_4lxml_5etree__handleSaxEnd(void *, char *, char *, char *); /*proto*/
static void __pyx_f_4lxml_5etree__handleSaxEndNoNs(void *, char *); /*proto*/
static void __pyx_f_4lxml_5etree__handleSaxData(void *, char *, int); /*proto*/
static void __pyx_f_4lxml_5etree__handleSaxCData(void *, char *, int); /*proto*/
static void __pyx_f_4lxml_5etree__handleSaxDoctype(void *, char *, char *, char *); /*proto*/
static void __pyx_f_4lxml_5etree__handleSaxPI(void *, char *, char *); /*proto*/
static void __pyx_f_4lxml_5etree__handleSaxComment(void *, char *); /*proto*/
static int __pyx_f_4lxml_5etree__findOutputMethod(PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__textToString(xmlNode *, PyObject *, int); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__tostring(struct LxmlElement *, PyObject *, PyObject *, PyObject *, int, int, int, int, int); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__tostringC14N(PyObject *, int, int); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__raiseSerialisationError(int); /*proto*/
static void __pyx_f_4lxml_5etree__writeNodeToBuffer(xmlOutputBuffer *, xmlNode *, char *, char *, int, int, int, int, int, int); /*proto*/
static void __pyx_f_4lxml_5etree__writeDeclarationToBuffer(xmlOutputBuffer *, char *, char *, int); /*proto*/
static void __pyx_f_4lxml_5etree__writeDtdToBuffer(xmlOutputBuffer *, xmlDoc *, char *, char *); /*proto*/
static void __pyx_f_4lxml_5etree__writeTail(xmlOutputBuffer *, xmlNode *, char *, int); /*proto*/
static void __pyx_f_4lxml_5etree__writePrevSiblings(xmlOutputBuffer *, xmlNode *, char *, int); /*proto*/
static void __pyx_f_4lxml_5etree__writeNextSiblings(xmlOutputBuffer *, xmlNode *, char *, int); /*proto*/
static int __pyx_f_4lxml_5etree__writeFilelikeWriter(void *, char *, int); /*proto*/
static int __pyx_f_4lxml_5etree__closeFilelikeWriter(void *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__tofilelike(PyObject *, struct LxmlElement *, PyObject *, PyObject *, PyObject *, int, int, int, int, int, int); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__tofilelikeC14N(PyObject *, struct LxmlElement *, int, int, int); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__dumpToFile(PyObject *, xmlNode *, int, int); /*proto*/
static int __pyx_f_4lxml_5etree__buildIterparseEventFilter(PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__countNsDefs(xmlNode *); /*proto*/
static int __pyx_f_4lxml_5etree__appendStartNsEvents(xmlNode *, PyObject *); /*proto*/
static CYTHON_INLINE void __pyx_f_4lxml_5etree__pushSaxStartEvent(struct __pyx_obj_4lxml_5etree__IterparseContext *, xmlNode *); /*proto*/
static CYTHON_INLINE void __pyx_f_4lxml_5etree__pushSaxEndEvent(struct __pyx_obj_4lxml_5etree__IterparseContext *, xmlNode *); /*proto*/
static CYTHON_INLINE void __pyx_f_4lxml_5etree__pushSaxEvent(struct __pyx_obj_4lxml_5etree__IterparseContext *, PyObject *, xmlNode *); /*proto*/
static void __pyx_f_4lxml_5etree__iterparseSaxStart(void *, char *, char *, char *, int, char **, int, int, char **); /*proto*/
static void __pyx_f_4lxml_5etree__iterparseSaxEnd(void *, char *, char *, char *); /*proto*/
static void __pyx_f_4lxml_5etree__iterparseSaxStartNoNs(void *, char *, char **); /*proto*/
static void __pyx_f_4lxml_5etree__iterparseSaxEndNoNs(void *, char *); /*proto*/
static void __pyx_f_4lxml_5etree__iterparseSaxComment(void *, char *); /*proto*/
static void __pyx_f_4lxml_5etree__iterparseSaxPI(void *, char *, char *); /*proto*/
static CYTHON_INLINE xmlNode *__pyx_f_4lxml_5etree__iterparseFindLastNode(xmlParserCtxt *); /*proto*/
static void __pyx_f_4lxml_5etree__collectIdHashItemDict(void *, void *, char *); /*proto*/
static void __pyx_f_4lxml_5etree__collectIdHashItemList(void *, void *, char *); /*proto*/
static void __pyx_f_4lxml_5etree__collectIdHashKeys(void *, void *, char *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__strip_attributes(xmlNode *, char **, Py_ssize_t); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__strip_elements(struct LxmlDocument *, xmlNode *, char **, Py_ssize_t, int, int, int, int); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__strip_tags(struct LxmlDocument *, xmlNode *, char **, Py_ssize_t, int, int, int); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__sortedTagList(PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__filterSpecialTagNames(PyObject *, int *, int *, int *); /*proto*/
static Py_ssize_t __pyx_f_4lxml_5etree__mapTagsToCharArray(xmlDoc *, PyObject *, char **); /*proto*/
static xmlXPathObject *__pyx_f_4lxml_5etree__wrapXPathObject(PyObject *, struct LxmlDocument *, struct __pyx_obj_4lxml_5etree__BaseContext *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__unwrapXPathObject(xmlXPathObject *, struct LxmlDocument *, struct __pyx_obj_4lxml_5etree__BaseContext *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__createNodeSetResult(xmlXPathObject *, struct LxmlDocument *, struct __pyx_obj_4lxml_5etree__BaseContext *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__unpackNodeSetEntry(PyObject *, xmlNode *, struct LxmlDocument *, struct __pyx_obj_4lxml_5etree__BaseContext *, int); /*proto*/
static void __pyx_f_4lxml_5etree__freeXPathObject(xmlXPathObject *); /*proto*/
static struct LxmlElement *__pyx_f_4lxml_5etree__instantiateElementFromXPath(xmlNode *, struct LxmlDocument *, struct __pyx_obj_4lxml_5etree__BaseContext *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__elementStringResultFactory(PyObject *, struct LxmlElement *, PyObject *, int); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__buildElementStringResult(struct LxmlDocument *, xmlNode *, struct __pyx_obj_4lxml_5etree__BaseContext *); /*proto*/
static void __pyx_f_4lxml_5etree__extension_function_call(struct __pyx_obj_4lxml_5etree__BaseContext *, PyObject *, xmlXPathParserContext *, int); /*proto*/
static void __pyx_f_4lxml_5etree__xpath_function_call(xmlXPathParserContext *, int); /*proto*/
static int __pyx_f_4lxml_5etree__register_xpath_function(void *, PyObject *, PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__unregister_xpath_function(void *, PyObject *, PyObject *); /*proto*/
static void __pyx_f_4lxml_5etree__registerExsltFunctionsForNamespaces(void *, void *, char *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__initXSLTResolverContext(struct __pyx_obj_4lxml_5etree__XSLTResolverContext *, struct __pyx_obj_4lxml_5etree__BaseParser *); /*proto*/
static xmlDoc *__pyx_f_4lxml_5etree__xslt_resolve_from_python(char *, void *, int, int *); /*proto*/
static void __pyx_f_4lxml_5etree__xslt_store_resolver_exception(char *, void *, xsltLoadType); /*proto*/
static xmlDoc *__pyx_f_4lxml_5etree__xslt_doc_loader(char *, xmlDict *, int, void *, xsltLoadType); /*proto*/
static int __pyx_f_4lxml_5etree__register_xslt_function(void *, PyObject *, PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__unregister_xslt_function(void *, PyObject *, PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__convert_xslt_parameters(xsltTransformContext *, PyObject *, char ***); /*proto*/
static struct __pyx_obj_4lxml_5etree_XSLT *__pyx_f_4lxml_5etree__copyXSLT(struct __pyx_obj_4lxml_5etree_XSLT *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__xsltResultTreeFactory(struct LxmlDocument *, struct __pyx_obj_4lxml_5etree_XSLT *, struct LxmlDocument *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__findStylesheetByID(struct LxmlDocument *, PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__registerXSLTExtensions(xsltTransformContext *, PyObject *); /*proto*/
static void __pyx_f_4lxml_5etree__callExtensionElement(xsltTransformContext *, xmlNode *, xmlNode *, void *); /*proto*/
static xmlDtd *__pyx_f_4lxml_5etree__parseDtdFromFilelike(PyObject *); /*proto*/
static struct __pyx_obj_4lxml_5etree_DTD *__pyx_f_4lxml_5etree__dtdFactory(xmlDtd *); /*proto*/
DL_EXPORT(struct LxmlElement) *deepcopyNodeToDocument(struct LxmlDocument *, xmlNode *); /*proto*/
DL_EXPORT(struct LxmlElementTree) *elementTreeFactory(struct LxmlElement *); /*proto*/
DL_EXPORT(struct LxmlElementTree) *newElementTree(struct LxmlElement *, PyObject *); /*proto*/
DL_EXPORT(struct LxmlElement) *elementFactory(struct LxmlDocument *, xmlNode *); /*proto*/
DL_EXPORT(struct LxmlElement) *makeElement(PyObject *, struct LxmlDocument *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/
DL_EXPORT(struct LxmlElement) *makeSubElement(struct LxmlElement *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/
DL_EXPORT(void) setElementClassLookupFunction(_element_class_lookup_function, PyObject *); /*proto*/
DL_EXPORT(PyObject) *lookupDefaultElementClass(PyObject *, PyObject *, xmlNode *); /*proto*/
DL_EXPORT(PyObject) *lookupNamespaceElementClass(PyObject *, PyObject *, xmlNode *); /*proto*/
DL_EXPORT(PyObject) *callLookupFallback(struct LxmlFallbackElementClassLookup *, struct LxmlDocument *, xmlNode *); /*proto*/
DL_EXPORT(int) tagMatches(xmlNode *, char *, char *); /*proto*/
DL_EXPORT(struct LxmlDocument) *documentOrRaise(PyObject *); /*proto*/
DL_EXPORT(struct LxmlElement) *rootNodeOrRaise(PyObject *); /*proto*/
DL_EXPORT(int) hasText(xmlNode *); /*proto*/
DL_EXPORT(int) hasTail(xmlNode *); /*proto*/
DL_EXPORT(PyObject) *textOf(xmlNode *); /*proto*/
DL_EXPORT(PyObject) *tailOf(xmlNode *); /*proto*/
DL_EXPORT(int) setNodeText(xmlNode *, PyObject *); /*proto*/
DL_EXPORT(int) setTailText(xmlNode *, PyObject *); /*proto*/
DL_EXPORT(PyObject) *attributeValue(xmlNode *, xmlAttr *); /*proto*/
DL_EXPORT(PyObject) *attributeValueFromNsName(xmlNode *, char *, char *); /*proto*/
DL_EXPORT(PyObject) *getAttributeValue(struct LxmlElement *, PyObject *, PyObject *); /*proto*/
DL_EXPORT(PyObject) *iterattributes(struct LxmlElement *, int); /*proto*/
DL_EXPORT(PyObject) *collectAttributes(xmlNode *, int); /*proto*/
DL_EXPORT(int) setAttributeValue(struct LxmlElement *, PyObject *, PyObject *); /*proto*/
DL_EXPORT(int) delAttribute(struct LxmlElement *, PyObject *); /*proto*/
DL_EXPORT(int) delAttributeFromNsName(xmlNode *, char *, char *); /*proto*/
DL_EXPORT(int) hasChild(xmlNode *); /*proto*/
DL_EXPORT(xmlNode) *findChild(xmlNode *, Py_ssize_t); /*proto*/
DL_EXPORT(xmlNode) *findChildForwards(xmlNode *, Py_ssize_t); /*proto*/
DL_EXPORT(xmlNode) *findChildBackwards(xmlNode *, Py_ssize_t); /*proto*/
DL_EXPORT(xmlNode) *nextElement(xmlNode *); /*proto*/
DL_EXPORT(xmlNode) *previousElement(xmlNode *); /*proto*/
DL_EXPORT(void) appendChild(struct LxmlElement *, struct LxmlElement *); /*proto*/
DL_EXPORT(PyObject) *pyunicode(char *); /*proto*/
DL_EXPORT(PyObject) *utf8(PyObject *); /*proto*/
DL_EXPORT(PyObject) *getNsTag(PyObject *); /*proto*/
DL_EXPORT(PyObject) *getNsTagWithEmptyNs(PyObject *); /*proto*/
DL_EXPORT(PyObject) *namespacedName(xmlNode *); /*proto*/
DL_EXPORT(PyObject) *namespacedNameFromNsName(char *, char *); /*proto*/
DL_EXPORT(void) iteratorStoreNext(struct LxmlElementIterator *, struct LxmlElement *); /*proto*/
DL_EXPORT(void) initTagMatch(struct LxmlElementTagMatcher *, PyObject *); /*proto*/
DL_EXPORT(xmlNs) *findOrBuildNodeNsPrefix(struct LxmlDocument *, xmlNode *, char *, char *); /*proto*/
#define __Pyx_MODULE_NAME "lxml.etree"
static int __pyx_module_is_main_lxml__etree = 0;

/* Implementation of lxml.etree */
static PyObject *__pyx_builtin_ImportError;
static PyObject *__pyx_builtin_AttributeError;
static PyObject *__pyx_builtin_Exception;
static PyObject *__pyx_builtin_SyntaxError;
static PyObject *__pyx_builtin_object;
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_super;
static PyObject *__pyx_builtin_id;
static PyObject *__pyx_builtin_TypeError;
static PyObject *__pyx_builtin_KeyError;
static PyObject *__pyx_builtin_UnicodeEncodeError;
static PyObject *__pyx_builtin_UnicodeDecodeError;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_IndexError;
static PyObject *__pyx_builtin_FutureWarning;
static PyObject *__pyx_builtin_StopIteration;
static PyObject *__pyx_builtin_IOError;
static PyObject *__pyx_builtin_LookupError;
static PyObject *__pyx_builtin_open;
static PyObject *__pyx_builtin_enumerate;
static PyObject *__pyx_builtin_NotImplementedError;
static PyObject *__pyx_builtin_AssertionError;
static char __pyx_k_1[] = "Prefix format reserved for internal use";
static char __pyx_k_4[] = "-";
static char __pyx_k_5[] = ".";
static char __pyx_k_11[] = "double registering proxy!";
static char __pyx_k_12[] = "Tried to unregister unknown proxy";
static char __pyx_k_13[] = " ";
static char __pyx_k_14[] = "invalid Element proxy at %s";
static char __pyx_k_15[] = "invalid Document proxy at %s";
static char __pyx_k_16[] = "Invalid input object: %s";
static char __pyx_k_17[] = "Input object has no document: %s";
static char __pyx_k_18[] = "Input object has no element: %s";
static char __pyx_k_19[] = "Invalid attribute dictionary: %s";
static char __pyx_k_20[] = "\\g<1>";
static char __pyx_k_21[] = "<?xml";
static char __pyx_k_22[] = "?>";
static char __pyx_k_24[] = "\n\r ";
static char __pyx_k_25[] = "";
static char __pyx_k_26[] = "%s:%s";
static char __pyx_k_27[] = "attempt to assign sequence of size %d to extended slice of size %d";
static char __pyx_k_28[] = "Node must not be None";
static char __pyx_k_29[] = "Argument must be bytes or unicode, got '%.200s'";
static char __pyx_k_30[] = "All strings must be XML compatible: Unicode or ASCII, no NULL bytes or control characters";
static char __pyx_k_31[] = "UTF-8";
static char __pyx_k_32[] = "Argument must be string or unicode.";
static char __pyx_k_33[] = "Invalid tag name";
static char __pyx_k_34[] = "Empty tag name";
static char __pyx_k_35[] = "Invalid tag name %r";
static char __pyx_k_36[] = "Invalid HTML tag name %r";
static char __pyx_k_37[] = "Invalid attribute name %r";
static char __pyx_k_38[] = "Invalid namespace prefix %r";
static char __pyx_k_39[] = "Invalid namespace URI %r";
static char __pyx_k_40[] = "{%s}%s";
static char __pyx_k_41[] = "PyUnicode_DecodeASCII";
static char __pyx_k_42[] = "<undecodable error message>";
static char __pyx_k_43[] = "<string>";
static char __pyx_k_44[] = "%s:%d:%d:%s:%s:%s: %s";
static char __pyx_k_45[] = "%s, line %d, column %d";
static char __pyx_k_46[] = "%s, line %d";
static char __pyx_k_47[] = "\n";
static char __pyx_k_49[] = "file %s";
static char __pyx_k_50[] = "string://__STRING__XSLT";
static char __pyx_k_51[] = "<xslt>";
static char __pyx_k_52[] = "line %d";
static char __pyx_k_53[] = "element %s";
static char __pyx_k_54[] = "%s, element '%s'";
static char __pyx_k_55[] = "\\s*([a-zA-Z0-9_]+)\\s*=\\s*([0-9]+)";
static char __pyx_k_57[] = "ns%d";
static char __pyx_k_58[] = "invalid node type %d, expected %d";
static char __pyx_k_59[] = "Could not find root node";
static char __pyx_k_60[] = "<!DOCTYPE %s PUBLIC \"%s\" \"%s\">";
static char __pyx_k_61[] = "<!DOCTYPE %s PUBLIC \"%s\">";
static char __pyx_k_62[] = "<!DOCTYPE %s SYSTEM \"%s\">";
static char __pyx_k_63[] = "<!DOCTYPE %s>";
static char __pyx_k_64[] = "cannot assign None";
static char __pyx_k_65[] = "list index out of range";
static char __pyx_k_66[] = "index out of range: %d";
static char __pyx_k_67[] = "Only processing instructions and comments can be siblings of the root element";
static char __pyx_k_68[] = "Element is not a child of this node.";
static char __pyx_k_69[] = "<Element %s at 0x%x>";
static char __pyx_k_70[] = "The behavior of this method will change in future versions. Use specific 'len(elem)' or 'elem is not None' test instead.";
static char __pyx_k_71[] = "list.index(x): x not in slice";
static char __pyx_k_72[] = "list.index(x): x not in list";
static char __pyx_k_77[] = "this element does not have children or attributes";
static char __pyx_k_78[] = "<!--%s-->";
static char __pyx_k_79[] = "ProcessingInstruction";
static char __pyx_k_80[] = "<?%s %s?>";
static char __pyx_k_81[] = "<?%s?>";
static char __pyx_k_82[] = "&";
static char __pyx_k_83[] = ";";
static char __pyx_k_84[] = "Invalid entity name '%s'";
static char __pyx_k_85[] = "&%s;";
static char __pyx_k_86[] = "text_or_uri_or_element";
static char __pyx_k_87[] = "Invalid input tag of type %r";
static char __pyx_k_88[] = "ElementTree not initialized, missing root";
static char __pyx_k_89[] = "Only elements can be the root of an ElementTree";
static char __pyx_k_94[] = "Cannot specify encoding with C14N";
static char __pyx_k_96[] = "Cannot enable XML declaration in C14N";
static char __pyx_k_98[] = "Can only discard comments in C14N serialisation";
static char __pyx_k__A[] = "A";
static char __pyx_k__B[] = "B";
static char __pyx_k__U[] = "U";
static char __pyx_k___[] = "_";
static char __pyx_k__f[] = "f";
static char __pyx_k__g[] = "g";
static char __pyx_k__i[] = "i";
static char __pyx_k__s[] = "s";
static char __pyx_k_100[] = "US-ASCII";
static char __pyx_k_101[] = "Element is not in this tree.";
static char __pyx_k_102[] = "/";
static char __pyx_k_106[] = "pop expected at most 2 arguments, got %d";
static char __pyx_k_113[] = "Invalid character reference: '%s'";
static char __pyx_k_114[] = "Invalid entity reference: '%s'";
static char __pyx_k_124[] = "Serialisation to unicode must not request an XML declaration";
static char __pyx_k_125[] = "Type '%s' cannot be serialized.";
static char __pyx_k_128[] = "Proxy invalidated!";
static char __pyx_k_129[] = "Unsupported node type: %d";
static char __pyx_k_130[] = "_raise_unsupported_type";
static char __pyx_k_132[] = "*";
static char __pyx_k_133[] = "Unsupported element type: %d";
static char __pyx_k_134[] = "This type cannot be instatiated from Python";
static char __pyx_k_135[] = "cannot append, document already has a root element";
static char __pyx_k_136[] = "unsupported element type for top-level node: %d";
static char __pyx_k_137[] = "invalid argument type %s";
static char __pyx_k_138[] = "invalid element";
static char __pyx_k_140[] = "Invalid child type: %r";
static char __pyx_k_141[] = "element class must be subclass of ElementBase";
static char __pyx_k_142[] = "comment class must be subclass of CommentBase";
static char __pyx_k_143[] = "Entity class must be subclass of EntityBase";
static char __pyx_k_144[] = "PI class must be subclass of PIBase";
static char __pyx_k_145[] = "xml-stylesheet";
static char __pyx_k_146[] = "text/xsl";
static char __pyx_k_147[] = "text/xml";
static char __pyx_k_148[] = "Unknown node type: %s";
static char __pyx_k_149[] = "Name not registered.";
static char __pyx_k_150[] = "NamespaceRegistryError";
static char __pyx_k_151[] = "Registered element classes must be subtypes of ElementBase";
static char __pyx_k_152[] = "Namespace(%r)";
static char __pyx_k_153[] = "_namespace_registries";
static char __pyx_k_154[] = "Registered functions must be callable.";
static char __pyx_k_155[] = "extensions must have non empty names";
static char __pyx_k_156[] = "FunctionNamespace(%r)";
static char __pyx_k_157[] = "argument must be a byte string or unicode string";
static char __pyx_k_158[] = "Argument is not a file-like object";
static char __pyx_k_159[] = "_implied_parser_contexts";
static char __pyx_k_160[] = "_ParserDictionaryContext";
static char __pyx_k_161[] = "_findThreadParserContext";
static char __pyx_k_162[] = "<test/>";
static char __pyx_k_163[] = "UTF-16LE";
static char __pyx_k_164[] = "UTF-16BE";
static char __pyx_k_165[] = "UCS-4LE";
static char __pyx_k_166[] = "UCS-4BE";
static char __pyx_k_167[] = "_createParserInputBuffer";
static char __pyx_k_168[] = "reading from file-like objects must return byte strings or unicode strings";
static char __pyx_k_169[] = "parser locking failed";
static char __pyx_k_170[] = "Error reading file '%s': %s";
static char __pyx_k_171[] = "Error reading '%s'";
static char __pyx_k_172[] = "_buildParseException";
static char __pyx_k_173[] = "Document is not well formed";
static char __pyx_k_174[] = "line %d: %s";
static char __pyx_k_175[] = "WAR_UNDECLARED_ENTITY";
static char __pyx_k_176[] = "ERR_UNDECLARED_ENTITY";
static char __pyx_k_177[] = "_add_default_attributes";
static char __pyx_k_178[] = "inject_default_attributes";
static char __pyx_k_179[] = "This class cannot be instantiated";
static char __pyx_k_180[] = "unknown encoding: '%s'";
static char __pyx_k_181[] = "processingInstruction";
static char __pyx_k_182[] = "_push_parser_context";
static char __pyx_k_183[] = "libxml2 %d.%d.%d";
static char __pyx_k_184[] = "set_element_class_lookup";
static char __pyx_k_185[] = "_handleParseResultDoc";
static char __pyx_k_186[] = "string is too long to parse it with libxml2";
static char __pyx_k_187[] = "_getPushParserContext";
static char __pyx_k_188[] = "Unicode parsing is not supported on this platform";
static char __pyx_k_189[] = "Parsing requires string data";
static char __pyx_k_190[] = "_feed_parser_running";
static char __pyx_k_191[] = "no element found";
static char __pyx_k_225[] = "_parseDocFromFilelike";
static char __pyx_k_226[] = "cannot parse from '%s'";
static char __pyx_k_227[] = "Unicode strings with encoding declaration are not supported.";
static char __pyx_k_228[] = "can only parse strings";
static char __pyx_k_229[] = "_sax_event_propagate";
static char __pyx_k_230[] = "internal error (tail)";
static char __pyx_k_231[] = "internal error (text)";
static char __pyx_k_232[] = "missing end tags";
static char __pyx_k_233[] = "missing toplevel element";
static char __pyx_k_234[] = "end tag mismatch (expected %s, got %s)";
static char __pyx_k_235[] = "_cleanupTargetParserContext";
static char __pyx_k_236[] = "unknown output method %r";
static char __pyx_k_237[] = "Error during serialisation (out of memory?)";
static char __pyx_k_239[] = "C14N failed";
static char __pyx_k_240[] = "unknown error %d";
static char __pyx_k_241[] = "1.0";
static char __pyx_k_242[] = "<?xml version='";
static char __pyx_k_243[] = "' encoding='";
static char __pyx_k_244[] = "' standalone='no'?>\n";
static char __pyx_k_245[] = "' standalone='yes'?>\n";
static char __pyx_k_246[] = "'?>\n";
static char __pyx_k_247[] = "<!DOCTYPE ";
static char __pyx_k_248[] = " PUBLIC \"";
static char __pyx_k_249[] = "\" \"";
static char __pyx_k_250[] = " SYSTEM \"";
static char __pyx_k_251[] = "\"";
static char __pyx_k_252[] = ">\n";
static char __pyx_k_253[] = " [\n";
static char __pyx_k_254[] = "]>\n";
static char __pyx_k_255[] = "Could not create I/O writer context.";
static char __pyx_k_256[] = "File is already closed";
static char __pyx_k_258[] = "File or filename expected, got '%s'";
static char __pyx_k_259[] = "not a file";
static char __pyx_k_260[] = "start-ns";
static char __pyx_k_261[] = "end-ns";
static char __pyx_k_262[] = "invalid event name '%s'";
static char __pyx_k_278[] = "iterparse parsers cannot be copied";
static char __pyx_k_280[] = "reading file objects must return plain strings";
static char __pyx_k_286[] = "//*[string(@id)]";
static char __pyx_k_289[] = "No ID dictionary available.";
static char __pyx_k_290[] = "key not found.";
static char __pyx_k_291[] = "ID attribute not found.";
static char __pyx_k_292[] = "XInclude instance not initialised";
static char __pyx_k_293[] = "XPath evaluator not initialised";
static char __pyx_k_294[] = "pushImpliedContextFromParser";
static char __pyx_k_295[] = "_buildExceptionMessage";
static char __pyx_k_296[] = "XInclude processing failed";
static char __pyx_k_297[] = "empty namespace prefix is not supported in XPath";
static char __pyx_k_298[] = "setting default namespace is not supported in XPath";
static char __pyx_k_299[] = "_build_smart_strings";
static char __pyx_k_300[] = "_register_in_context";
static char __pyx_k_301[] = "empty prefix is not supported in XPath";
static char __pyx_k_302[] = "XPath context is only usable during the evaluation";
static char __pyx_k_303[] = "no context node";
static char __pyx_k_304[] = "document-external context nodes are not supported";
static char __pyx_k_305[] = "document context is missing";
static char __pyx_k_309[] = "http://exslt.org/regular-expressions";
static char __pyx_k_310[] = "_addLocalExtensionFunction";
static char __pyx_k_311[] = "Non-Element values not supported at this point - got %r";
static char __pyx_k_312[] = "text-root";
static char __pyx_k_313[] = "This is not a supported node-set result: %r";
static char __pyx_k_314[] = "Unknown return type: %s";
static char __pyx_k_315[] = "Undefined xpath result";
static char __pyx_k_316[] = "Unknown xpath result %s";
static char __pyx_k_317[] = "Not yet implemented result node type: %d";
static char __pyx_k_318[] = "_findDocumentForNode";
static char __pyx_k_319[] = "_ElementStringResult";
static char __pyx_k_320[] = "_find_cached_function";
static char __pyx_k_321[] = "XPath function '%s' not found";
static char __pyx_k_322[] = "registerLocalNamespaces";
static char __pyx_k_323[] = "registerLocalFunctions";
static char __pyx_k_324[] = "registerGlobalNamespaces";
static char __pyx_k_325[] = "registerGlobalFunctions";
static char __pyx_k_326[] = "registerExsltFunctions";
static char __pyx_k_327[] = "unregisterGlobalFunctions";
static char __pyx_k_328[] = "unregisterGlobalNamespaces";
static char __pyx_k_329[] = "This version of libxml2 has a known XPath bug. Use it at your own risk.";
static char __pyx_k_331[] = "XPath evaluator locking failed";
static char __pyx_k_332[] = "Error in xpath expression";
static char __pyx_k_335[] = "XPath context not initialised";
static char __pyx_k_345[] = "__xpp%02d";
static char __pyx_k_346[] = ":";
static char __pyx_k_347[] = "string://__STRING__XSLT__/";
static char __pyx_k_348[] = "Cannot resolve URI %s";
static char __pyx_k_354[] = "%s(%s)";
static char __pyx_k_356[] = ", ";
static char __pyx_k_357[] = "%s=%r";
static char __pyx_k_358[] = "extensions must not have empty namespaces";
static char __pyx_k_360[] = "string://__STRING__XSLT__/%d.xslt";
static char __pyx_k_361[] = "_xslt_resolver_context";
static char __pyx_k_362[] = "Cannot parse stylesheet";
static char __pyx_k_365[] = "XSLT stylesheet not initialised";
static char __pyx_k_366[] = "Error applying stylesheet, line %d";
static char __pyx_k_367[] = "Error applying stylesheet";
static char __pyx_k_368[] = "_saveToStringAndSize";
static char __pyx_k_369[] = "//xsl:stylesheet[@xml:id = $id]";
static char __pyx_k_371[] = "http://www.w3.org/1999/XSL/Transform";
static char __pyx_k_372[] = "PI lacks content";
static char __pyx_k_373[] = "malformed PI attributes";
static char __pyx_k_374[] = "reference to non-existing embedded stylesheet";
static char __pyx_k_375[] = "ambiguous reference to embedded stylesheet";
static char __pyx_k_376[] = "only setting the 'href' attribute is supported on XSLT-PIs";
static char __pyx_k_377[] = ">";
static char __pyx_k_378[] = "Invalid URL, must not contain '\"' or '>'";
static char __pyx_k_379[] = " href=\"%s\"";
static char __pyx_k_380[] = "XSLT context not initialised";
static char __pyx_k_381[] = "fake-parent";
static char __pyx_k_382[] = "_collectXSLTResultContent";
static char __pyx_k_383[] = "_extension_element_proxy";
static char __pyx_k_384[] = "unsupported XSLT result type: %d";
static char __pyx_k_385[] = "extension element %s not found";
static char __pyx_k_387[] = "Error executing extension element '%s': %s";
static char __pyx_k_388[] = "Error executing extension element '%s'";
static char __pyx_k_389[] = "Error during XSLT extension element evaluation";
static char __pyx_k_390[] = "Document does not comply with schema";
static char __pyx_k_391[] = "file must be a filename or file-like object";
static char __pyx_k_392[] = "either filename or external ID required";
static char __pyx_k_393[] = "error parsing DTD";
static char __pyx_k_394[] = "DTD not initialised";
static char __pyx_k_395[] = "Failed to create validation context";
static char __pyx_k_396[] = "Internal error in DTD validation";
static char __pyx_k_397[] = "http://relaxng.org/ns/structure/1.0";
static char __pyx_k_398[] = "Document is not Relax NG";
static char __pyx_k_399[] = "No tree or file given";
static char __pyx_k_400[] = "Document is not parsable as Relax NG";
static char __pyx_k_401[] = "Document is not valid Relax NG";
static char __pyx_k_402[] = "RelaxNG instance not initialised";
static char __pyx_k_403[] = "RelaxNGValidateError";
static char __pyx_k_404[] = "Internal error in Relax NG validation";
static char __pyx_k_405[] = "_has_default_attributes";
static char __pyx_k_406[] = "_add_attribute_defaults";
static char __pyx_k_408[] = "http://www.w3.org/2001/XMLSchema";
static char __pyx_k_409[] = "Document is not XML Schema";
static char __pyx_k_410[] = "Document is not valid XML Schema";
static char __pyx_k_411[] = "Schema instance not initialised";
static char __pyx_k_412[] = "XMLSchemaValidateError";
static char __pyx_k_413[] = "Internal error in XML Schema validation.";
static char __pyx_k_414[] = "_ParserSchemaValidationContext not initialised";
static char __pyx_k_415[] = "lxml.etree was compiled without Schematron support.";
static char __pyx_k_416[] = "SchematronParseError";
static char __pyx_k_417[] = "Document is not a valid Schematron schema";
static char __pyx_k_418[] = "Schematron instance not initialised";
static char __pyx_k_419[] = "SchematronValidateError";
static char __pyx_k_420[] = "Internal error in Schematron validation";
static char __pyx_k_421[] = "Element tag\n        ";
static char __pyx_k_422[] = "Element attribute dictionary. Where possible, use get(), set(),\n        keys(), values() and items() to access element attributes.\n        ";
static char __pyx_k_423[] = "Text before the first subelement. This is either a string or \n        the value None, if there was no text.\n        ";
static char __pyx_k_424[] = "Text after this element's end tag, but before the next sibling\n        element's start tag. This is either a string or the value None, if\n        there was no text.\n        ";
static char __pyx_k_425[] = "Namespace prefix or None.\n        ";
static char __pyx_k_426[] = "Original line number as found by the parser or None if unknown.\n        ";
static char __pyx_k_427[] = "Namespace prefix->URI mapping known in the context of this\n        Element.  This includes all namespace declarations of the\n        parents.\n\n        Note that changing the returned dict has no effect on the Element.\n        ";
static char __pyx_k_428[] = "The base URI of the Element (xml:base or HTML base URL).\n        None if the base URI is unknown.\n\n        Note that the value depends on the URL of the document that\n        holds the Element if there is no xml:base attribute on the\n        Element or its ancestors.\n\n        Setting this property will set an xml:base attribute on the\n        Element, regardless of the document type (XML or HTML).\n        ";
static char __pyx_k_429[] = "The error log of the last parser run.\n        ";
static char __pyx_k_430[] = "The custom resolver registry of this parser.";
static char __pyx_k_431[] = "The version of the underlying XML parser.";
static char __pyx_k_432[] = "The name of the error domain.  See lxml.etree.ErrorDomains\n        ";
static char __pyx_k_433[] = "The name of the error type.  See lxml.etree.ErrorTypes\n        ";
static char __pyx_k_434[] = "The name of the error level.  See lxml.etree.ErrorLevels\n        ";
static char __pyx_k_435[] = "Returns the name of the root node as defined by the DOCTYPE.";
static char __pyx_k_436[] = "Returns the public ID of the DOCTYPE.";
static char __pyx_k_437[] = "Returns the system ID of the DOCTYPE.";
static char __pyx_k_438[] = "Returns the XML version as declared by the document.";
static char __pyx_k_439[] = "Returns the encoding name as declared by the document.";
static char __pyx_k_440[] = "Returns the standalone flag as declared by the document.  The possible\n        values are True (``standalone='yes'``), False\n        (``standalone='no'`` or flag not provided in the declaration),\n        and None (unknown or no declaration found).  Note that a\n        normal truth test on this value will always tell if the\n        ``standalone`` flag was set to ``'yes'`` or not.\n        ";
static char __pyx_k_441[] = "The source URL of the document (or None if unknown).";
static char __pyx_k_442[] = "Returns a DOCTYPE declaration string for the document.";
static char __pyx_k_443[] = "Returns a DTD validator based on the internal subset of the document.";
static char __pyx_k_444[] = "Returns a DTD validator based on the external subset of the document.";
static char __pyx_k_445[] = "Information about the document provided by parser and DTD.  This\n        value is only defined for ElementTree objects based on the root node\n        of a parsed document (e.g.  those returned by the parse functions),\n        not for trees that were built manually.\n        ";
static char __pyx_k_446[] = "The parser that was used to parse the document in this ElementTree.\n        ";
static char __pyx_k_447[] = "Text before the first subelement. This is either a string or the\n        value None, if there was no text.\n        ";
static char __pyx_k_448[] = "Namespace prefix for extension functions.";
static char __pyx_k_449[] = "The log of validation errors and warnings.";
static char __pyx_k_450[] = "The error log of the last (or current) run of the feed parser.\n\n        Note that this is local to the feed parser and thus is\n        different from what the ``error_log`` property returns.\n        ";
static char __pyx_k_451[] = "The error log of the last (or current) parser run.\n        ";
static char __pyx_k_452[] = "The literal XPath expression.\n        ";
static char __pyx_k_453[] = "The access control configuration as a map of options.";
static char __pyx_k_454[] = "The log of errors and warnings of an XSLT execution.";
static char __pyx_k_455[] = "Return an ElementTree with profiling data for the stylesheet run.\n        ";
static char __pyx_k_456[] = "The ``lxml.etree`` module implements the extended ElementTree API\nfor XML.\n";
static char __pyx_k_457[] = "restructuredtext en";
static char __pyx_k_458[] = "AttributeBasedElementClassLookup";
static char __pyx_k_459[] = "CustomElementClassLookup";
static char __pyx_k_460[] = "ElementDefaultClassLookup";
static char __pyx_k_461[] = "ElementNamespaceClassLookup";
static char __pyx_k_462[] = "FallbackElementClassLookup";
static char __pyx_k_463[] = "LIBXML_COMPILED_VERSION";
static char __pyx_k_464[] = "LIBXSLT_COMPILED_VERSION";
static char __pyx_k_465[] = "ParserBasedElementClassLookup";
static char __pyx_k_466[] = "PythonElementClassLookup";
static char __pyx_k_467[] = "XPathDocumentEvaluator";
static char __pyx_k_468[] = "use_global_python_log";
static char __pyx_k_469[] = "os.path";
static char __pyx_k_470[] = "getfilesystemencoding";
static char __pyx_k_472[] = "http://www.w3.org/XML/1998/namespace";
static char __pyx_k_473[] = "http://www.w3.org/1999/xhtml";
static char __pyx_k_474[] = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
static char __pyx_k_475[] = "http://schemas.xmlsoap.org/wsdl/";
static char __pyx_k_476[] = "http://www.w3.org/2001/XMLSchema-instance";
static char __pyx_k_477[] = "http://purl.org/dc/elements/1.1/";
static char __pyx_k_478[] = "http://codespeak.net/lxml/objectify/pytype";
static char __pyx_k_479[] = "ns\\d+$";
static char __pyx_k_481[] = "lxml.etree";
static char __pyx_k_482[] = "Main exception base class for lxml.  All other exceptions inherit from\n    this one.\n    ";
static char __pyx_k_483[] = "Base class for all syntax errors.\n    ";
static char __pyx_k_484[] = "Error during C14N serialisation.\n    ";
static char __pyx_k_485[] = "[0-9]+";
static char __pyx_k_487[] = "Unknown libxml2 version: %s";
static char __pyx_k_488[] = "^(\\s*<\\?\\s*xml[^>]+)\\s+encoding\\s*=\\s*[\"\\'][^\"\\']*[\"\\']\\s*";
static char __pyx_k_490[] = "Libxml2 error levels";
static char __pyx_k_491[] = "Libxml2 error domains";
static char __pyx_k_492[] = "Libxml2 error types";
static char __pyx_k_493[] = "Libxml2 RelaxNG error types";
static char __pyx_k_494[] = "NONE=0\nWARNING=1\nERROR=2\nFATAL=3\n";
static char __pyx_k_496[] = "NONE=0\nPARSER=1\nTREE=2\nNAMESPACE=3\nDTD=4\nHTML=5\nMEMORY=6\nOUTPUT=7\nIO=8\nFTP=9\nHTTP=10\nXINCLUDE=11\nXPATH=12\nXPOINTER=13\nREGEXP=14\nDATATYPE=15\nSCHEMASP=16\nSCHEMASV=17\nRELAXNGP=18\nRELAXNGV=19\nCATALOG=20\nC14N=21\nXSLT=22\nVALID=23\nCHECK=24\nWRITER=25\nMODULE=26\nI18N=27\nSCHEMATRONV=28\n";
static char __pyx_k_498[] = "ERR_OK=0\nERR_INTERNAL_ERROR=1\nERR_NO_MEMORY=2\nERR_DOCUMENT_START=3\nERR_DOCUMENT_EMPTY=4\nERR_DOCUMENT_END=5\nERR_INVALID_HEX_CHARREF=6\nERR_INVALID_DEC_CHARREF=7\nERR_INVALID_CHARREF=8\nERR_INVALID_CHAR=9\nERR_CHARREF_AT_EOF=10\nERR_CHARREF_IN_PROLOG=11\nERR_CHARREF_IN_EPILOG=12\nERR_CHARREF_IN_DTD=13\nERR_ENTITYREF_AT_EOF=14\nERR_ENTITYREF_IN_PROLOG=15\nERR_ENTITYREF_IN_EPILOG=16\nERR_ENTITYREF_IN_DTD=17\nERR_PEREF_AT_EOF=18\nERR_PEREF_IN_PROLOG=19\nERR_PEREF_IN_EPILOG=20\nERR_PEREF_IN_INT_SUBSET=21\nERR_ENTITYREF_NO_NAME=22\nERR_ENTITYREF_SEMICOL_MISSING=23\nERR_PEREF_NO_NAME=24\nERR_PEREF_SEMICOL_MISSING=25\nERR_UNDECLARED_ENTITY=26\nWAR_UNDECLARED_ENTITY=27\nERR_UNPARSED_ENTITY=28\nERR_ENTITY_IS_EXTERNAL=29\nERR_ENTITY_IS_PARAMETER=30\nERR_UNKNOWN_ENCODING=31\nERR_UNSUPPORTED_ENCODING=32\nERR_STRING_NOT_STARTED=33\nERR_STRING_NOT_CLOSED=34\nERR_NS_DECL_ERROR=35\nERR_ENTITY_NOT_STARTED=36\nERR_ENTITY_NOT_FINISHED=37\nERR_LT_IN_ATTRIBUTE=38\nERR_ATTRIBUTE_NOT_STARTED=39\nERR_ATTRIBUTE_NOT_FINISHED=40\nERR_ATTRIBUTE_WITHOUT_VALUE=41\nERR_ATTRIBUTE_REDEFINED=42\nERR_LITERAL_NOT_STARTED=43\nERR_LITERAL_NOT_FINISHED=44\nERR_COMMENT_NOT_FINISHED=45\nERR_PI_NOT_STARTED=46\nERR_PI_NOT_FINISHED=47\nERR_NOTATION_NOT_STARTED=48\nERR_NOTATION_NOT_FINISHED=49\nERR_ATTLIST_NOT_STARTED=50\nERR_ATTLIST_NOT_FINISHED=51\nERR_MIXED_NOT_STARTED=52\nERR_MIXED_NOT_FINISHED=53\nERR_ELEMCONTENT_NOT_STARTED=54\nERR_ELEMCONTENT_NOT_FINISHED=55\nERR_XMLDECL_NOT_STARTED=56\nERR_XMLDECL_NOT_FINISHED=57\nERR_CONDSEC_NOT_STARTED=58\nERR_CONDSEC_NOT_FINISHED=59\nERR_EXT_SUBSET_NOT_FINISHED=60\nERR_DOCTYPE_NOT_FINISHED=61\nERR_MISPLACED_CDATA_END=62\nERR_CDATA_NOT_FINISHED=63\nERR_RESERVED_XML_NAME=64\nERR_SPACE_REQUIRED=65\nERR_SEPARATOR_REQUIRED=66\nERR_NMTOKEN_REQUIRED=67\nERR_NAME_REQUIRED=68\nERR_PCDATA_REQUIRED=69\nERR_URI_REQUIRED=70\nERR_PUBID_REQUIRED=71\nERR_LT_REQUIRED=72\nERR_GT_REQUIRED=73\nERR_LTSLASH_REQUIRED=74\nERR_EQUAL_REQUIRED=75\nERR_TAG_NAME_MISMATCH=76\nERR_TAG_NOT_FIN""ISHED=77\nERR_STANDALONE_VALUE=78\n";
static char __pyx_k_499[] = "ERR_ENCODING_NAME=79\nERR_HYPHEN_IN_COMMENT=80\nERR_INVALID_ENCODING=81\nERR_EXT_ENTITY_STANDALONE=82\nERR_CONDSEC_INVALID=83\nERR_VALUE_REQUIRED=84\nERR_NOT_WELL_BALANCED=85\nERR_EXTRA_CONTENT=86\nERR_ENTITY_CHAR_ERROR=87\nERR_ENTITY_PE_INTERNAL=88\nERR_ENTITY_LOOP=89\nERR_ENTITY_BOUNDARY=90\nERR_INVALID_URI=91\nERR_URI_FRAGMENT=92\nWAR_CATALOG_PI=93\nERR_NO_DTD=94\nERR_CONDSEC_INVALID_KEYWORD=95\nERR_VERSION_MISSING=96\nWAR_UNKNOWN_VERSION=97\nWAR_LANG_VALUE=98\nWAR_NS_URI=99\nWAR_NS_URI_RELATIVE=100\nERR_MISSING_ENCODING=101\nWAR_SPACE_VALUE=102\nERR_NOT_STANDALONE=103\nERR_ENTITY_PROCESSING=104\nERR_NOTATION_PROCESSING=105\nWAR_NS_COLUMN=106\nWAR_ENTITY_REDEFINED=107\nERR_UNKNOWN_VERSION=108\nERR_VERSION_MISMATCH=109\nNS_ERR_XML_NAMESPACE=200\nNS_ERR_UNDEFINED_NAMESPACE=201\nNS_ERR_QNAME=202\nNS_ERR_ATTRIBUTE_REDEFINED=203\nNS_ERR_EMPTY=204\nNS_ERR_COLON=205\nDTD_ATTRIBUTE_DEFAULT=500\nDTD_ATTRIBUTE_REDEFINED=501\nDTD_ATTRIBUTE_VALUE=502\nDTD_CONTENT_ERROR=503\nDTD_CONTENT_MODEL=504\nDTD_CONTENT_NOT_DETERMINIST=505\nDTD_DIFFERENT_PREFIX=506\nDTD_ELEM_DEFAULT_NAMESPACE=507\nDTD_ELEM_NAMESPACE=508\nDTD_ELEM_REDEFINED=509\nDTD_EMPTY_NOTATION=510\nDTD_ENTITY_TYPE=511\nDTD_ID_FIXED=512\nDTD_ID_REDEFINED=513\nDTD_ID_SUBSET=514\nDTD_INVALID_CHILD=515\nDTD_INVALID_DEFAULT=516\nDTD_LOAD_ERROR=517\nDTD_MISSING_ATTRIBUTE=518\nDTD_MIXED_CORRUPT=519\nDTD_MULTIPLE_ID=520\nDTD_NO_DOC=521\nDTD_NO_DTD=522\nDTD_NO_ELEM_NAME=523\nDTD_NO_PREFIX=524\nDTD_NO_ROOT=525\nDTD_NOTATION_REDEFINED=526\nDTD_NOTATION_VALUE=527\nDTD_NOT_EMPTY=528\nDTD_NOT_PCDATA=529\nDTD_NOT_STANDALONE=530\nDTD_ROOT_NAME=531\nDTD_STANDALONE_WHITE_SPACE=532\nDTD_UNKNOWN_ATTRIBUTE=533\nDTD_UNKNOWN_ELEM=534\nDTD_UNKNOWN_ENTITY=535\nDTD_UNKNOWN_ID=536\nDTD_UNKNOWN_NOTATION=537\nDTD_STANDALONE_DEFAULTED=538\nDTD_XMLID_VALUE=539\nDTD_XMLID_TYPE=540\nDTD_DUP_TOKEN=541\nHTML_STRUCURE_ERROR=800\nHTML_UNKNOWN_TAG=801\nRNGP_ANYNAME_ATTR_ANCESTOR=1000\nRNGP_ATTR_CONFLICT=1001\nRNGP_ATTRIBUTE_CHILDREN=1002\nRNGP_ATTRIBUTE_""CONTENT=1003\n";
static char __pyx_k_500[] = "RNGP_ATTRIBUTE_EMPTY=1004\nRNGP_ATTRIBUTE_NOOP=1005\nRNGP_CHOICE_CONTENT=1006\nRNGP_CHOICE_EMPTY=1007\nRNGP_CREATE_FAILURE=1008\nRNGP_DATA_CONTENT=1009\nRNGP_DEF_CHOICE_AND_INTERLEAVE=1010\nRNGP_DEFINE_CREATE_FAILED=1011\nRNGP_DEFINE_EMPTY=1012\nRNGP_DEFINE_MISSING=1013\nRNGP_DEFINE_NAME_MISSING=1014\nRNGP_ELEM_CONTENT_EMPTY=1015\nRNGP_ELEM_CONTENT_ERROR=1016\nRNGP_ELEMENT_EMPTY=1017\nRNGP_ELEMENT_CONTENT=1018\nRNGP_ELEMENT_NAME=1019\nRNGP_ELEMENT_NO_CONTENT=1020\nRNGP_ELEM_TEXT_CONFLICT=1021\nRNGP_EMPTY=1022\nRNGP_EMPTY_CONSTRUCT=1023\nRNGP_EMPTY_CONTENT=1024\nRNGP_EMPTY_NOT_EMPTY=1025\nRNGP_ERROR_TYPE_LIB=1026\nRNGP_EXCEPT_EMPTY=1027\nRNGP_EXCEPT_MISSING=1028\nRNGP_EXCEPT_MULTIPLE=1029\nRNGP_EXCEPT_NO_CONTENT=1030\nRNGP_EXTERNALREF_EMTPY=1031\nRNGP_EXTERNAL_REF_FAILURE=1032\nRNGP_EXTERNALREF_RECURSE=1033\nRNGP_FORBIDDEN_ATTRIBUTE=1034\nRNGP_FOREIGN_ELEMENT=1035\nRNGP_GRAMMAR_CONTENT=1036\nRNGP_GRAMMAR_EMPTY=1037\nRNGP_GRAMMAR_MISSING=1038\nRNGP_GRAMMAR_NO_START=1039\nRNGP_GROUP_ATTR_CONFLICT=1040\nRNGP_HREF_ERROR=1041\nRNGP_INCLUDE_EMPTY=1042\nRNGP_INCLUDE_FAILURE=1043\nRNGP_INCLUDE_RECURSE=1044\nRNGP_INTERLEAVE_ADD=1045\nRNGP_INTERLEAVE_CREATE_FAILED=1046\nRNGP_INTERLEAVE_EMPTY=1047\nRNGP_INTERLEAVE_NO_CONTENT=1048\nRNGP_INVALID_DEFINE_NAME=1049\nRNGP_INVALID_URI=1050\nRNGP_INVALID_VALUE=1051\nRNGP_MISSING_HREF=1052\nRNGP_NAME_MISSING=1053\nRNGP_NEED_COMBINE=1054\nRNGP_NOTALLOWED_NOT_EMPTY=1055\nRNGP_NSNAME_ATTR_ANCESTOR=1056\nRNGP_NSNAME_NO_NS=1057\nRNGP_PARAM_FORBIDDEN=1058\nRNGP_PARAM_NAME_MISSING=1059\nRNGP_PARENTREF_CREATE_FAILED=1060\nRNGP_PARENTREF_NAME_INVALID=1061\nRNGP_PARENTREF_NO_NAME=1062\nRNGP_PARENTREF_NO_PARENT=1063\nRNGP_PARENTREF_NOT_EMPTY=1064\nRNGP_PARSE_ERROR=1065\nRNGP_PAT_ANYNAME_EXCEPT_ANYNAME=1066\nRNGP_PAT_ATTR_ATTR=1067\nRNGP_PAT_ATTR_ELEM=1068\nRNGP_PAT_DATA_EXCEPT_ATTR=1069\nRNGP_PAT_DATA_EXCEPT_ELEM=1070\nRNGP_PAT_DATA_EXCEPT_EMPTY=1071\nRNGP_PAT_DATA_EXCEPT_GROUP=1072\nRNGP_PAT_DATA_EXCEPT_INTERLEAVE=1073\nRNGP_PAT_DATA_EXCEPT_LIST=""1074\n";
static char __pyx_k_501[] = "RNGP_PAT_DATA_EXCEPT_ONEMORE=1075\nRNGP_PAT_DATA_EXCEPT_REF=1076\nRNGP_PAT_DATA_EXCEPT_TEXT=1077\nRNGP_PAT_LIST_ATTR=1078\nRNGP_PAT_LIST_ELEM=1079\nRNGP_PAT_LIST_INTERLEAVE=1080\nRNGP_PAT_LIST_LIST=1081\nRNGP_PAT_LIST_REF=1082\nRNGP_PAT_LIST_TEXT=1083\nRNGP_PAT_NSNAME_EXCEPT_ANYNAME=1084\nRNGP_PAT_NSNAME_EXCEPT_NSNAME=1085\nRNGP_PAT_ONEMORE_GROUP_ATTR=1086\nRNGP_PAT_ONEMORE_INTERLEAVE_ATTR=1087\nRNGP_PAT_START_ATTR=1088\nRNGP_PAT_START_DATA=1089\nRNGP_PAT_START_EMPTY=1090\nRNGP_PAT_START_GROUP=1091\nRNGP_PAT_START_INTERLEAVE=1092\nRNGP_PAT_START_LIST=1093\nRNGP_PAT_START_ONEMORE=1094\nRNGP_PAT_START_TEXT=1095\nRNGP_PAT_START_VALUE=1096\nRNGP_PREFIX_UNDEFINED=1097\nRNGP_REF_CREATE_FAILED=1098\nRNGP_REF_CYCLE=1099\nRNGP_REF_NAME_INVALID=1100\nRNGP_REF_NO_DEF=1101\nRNGP_REF_NO_NAME=1102\nRNGP_REF_NOT_EMPTY=1103\nRNGP_START_CHOICE_AND_INTERLEAVE=1104\nRNGP_START_CONTENT=1105\nRNGP_START_EMPTY=1106\nRNGP_START_MISSING=1107\nRNGP_TEXT_EXPECTED=1108\nRNGP_TEXT_HAS_CHILD=1109\nRNGP_TYPE_MISSING=1110\nRNGP_TYPE_NOT_FOUND=1111\nRNGP_TYPE_VALUE=1112\nRNGP_UNKNOWN_ATTRIBUTE=1113\nRNGP_UNKNOWN_COMBINE=1114\nRNGP_UNKNOWN_CONSTRUCT=1115\nRNGP_UNKNOWN_TYPE_LIB=1116\nRNGP_URI_FRAGMENT=1117\nRNGP_URI_NOT_ABSOLUTE=1118\nRNGP_VALUE_EMPTY=1119\nRNGP_VALUE_NO_CONTENT=1120\nRNGP_XMLNS_NAME=1121\nRNGP_XML_NS=1122\nXPATH_EXPRESSION_OK=1200\nXPATH_NUMBER_ERROR=1201\nXPATH_UNFINISHED_LITERAL_ERROR=1202\nXPATH_START_LITERAL_ERROR=1203\nXPATH_VARIABLE_REF_ERROR=1204\nXPATH_UNDEF_VARIABLE_ERROR=1205\nXPATH_INVALID_PREDICATE_ERROR=1206\nXPATH_EXPR_ERROR=1207\nXPATH_UNCLOSED_ERROR=1208\nXPATH_UNKNOWN_FUNC_ERROR=1209\nXPATH_INVALID_OPERAND=1210\nXPATH_INVALID_TYPE=1211\nXPATH_INVALID_ARITY=1212\nXPATH_INVALID_CTXT_SIZE=1213\nXPATH_INVALID_CTXT_POSITION=1214\nXPATH_MEMORY_ERROR=1215\nXPTR_SYNTAX_ERROR=1216\nXPTR_RESOURCE_ERROR=1217\nXPTR_SUB_RESOURCE_ERROR=1218\nXPATH_UNDEF_PREFIX_ERROR=1219\nXPATH_ENCODING_ERROR=1220\nXPATH_INVALID_CHAR_ERROR=1221\nTREE_INVALID_HEX=1300\nTREE_INVALID_DEC=1301\nTREE""_UNTERMINATED_ENTITY=1302\n";
static char __pyx_k_502[] = "TREE_NOT_UTF8=1303\nSAVE_NOT_UTF8=1400\nSAVE_CHAR_INVALID=1401\nSAVE_NO_DOCTYPE=1402\nSAVE_UNKNOWN_ENCODING=1403\nREGEXP_COMPILE_ERROR=1450\nIO_UNKNOWN=1500\nIO_EACCES=1501\nIO_EAGAIN=1502\nIO_EBADF=1503\nIO_EBADMSG=1504\nIO_EBUSY=1505\nIO_ECANCELED=1506\nIO_ECHILD=1507\nIO_EDEADLK=1508\nIO_EDOM=1509\nIO_EEXIST=1510\nIO_EFAULT=1511\nIO_EFBIG=1512\nIO_EINPROGRESS=1513\nIO_EINTR=1514\nIO_EINVAL=1515\nIO_EIO=1516\nIO_EISDIR=1517\nIO_EMFILE=1518\nIO_EMLINK=1519\nIO_EMSGSIZE=1520\nIO_ENAMETOOLONG=1521\nIO_ENFILE=1522\nIO_ENODEV=1523\nIO_ENOENT=1524\nIO_ENOEXEC=1525\nIO_ENOLCK=1526\nIO_ENOMEM=1527\nIO_ENOSPC=1528\nIO_ENOSYS=1529\nIO_ENOTDIR=1530\nIO_ENOTEMPTY=1531\nIO_ENOTSUP=1532\nIO_ENOTTY=1533\nIO_ENXIO=1534\nIO_EPERM=1535\nIO_EPIPE=1536\nIO_ERANGE=1537\nIO_EROFS=1538\nIO_ESPIPE=1539\nIO_ESRCH=1540\nIO_ETIMEDOUT=1541\nIO_EXDEV=1542\nIO_NETWORK_ATTEMPT=1543\nIO_ENCODER=1544\nIO_FLUSH=1545\nIO_WRITE=1546\nIO_NO_INPUT=1547\nIO_BUFFER_FULL=1548\nIO_LOAD_ERROR=1549\nIO_ENOTSOCK=1550\nIO_EISCONN=1551\nIO_ECONNREFUSED=1552\nIO_ENETUNREACH=1553\nIO_EADDRINUSE=1554\nIO_EALREADY=1555\nIO_EAFNOSUPPORT=1556\nXINCLUDE_RECURSION=1600\nXINCLUDE_PARSE_VALUE=1601\nXINCLUDE_ENTITY_DEF_MISMATCH=1602\nXINCLUDE_NO_HREF=1603\nXINCLUDE_NO_FALLBACK=1604\nXINCLUDE_HREF_URI=1605\nXINCLUDE_TEXT_FRAGMENT=1606\nXINCLUDE_TEXT_DOCUMENT=1607\nXINCLUDE_INVALID_CHAR=1608\nXINCLUDE_BUILD_FAILED=1609\nXINCLUDE_UNKNOWN_ENCODING=1610\nXINCLUDE_MULTIPLE_ROOT=1611\nXINCLUDE_XPTR_FAILED=1612\nXINCLUDE_XPTR_RESULT=1613\nXINCLUDE_INCLUDE_IN_INCLUDE=1614\nXINCLUDE_FALLBACKS_IN_INCLUDE=1615\nXINCLUDE_FALLBACK_NOT_IN_INCLUDE=1616\nXINCLUDE_DEPRECATED_NS=1617\nXINCLUDE_FRAGMENT_ID=1618\nCATALOG_MISSING_ATTR=1650\nCATALOG_ENTRY_BROKEN=1651\nCATALOG_PREFER_VALUE=1652\nCATALOG_NOT_CATALOG=1653\nCATALOG_RECURSION=1654\nSCHEMAP_PREFIX_UNDEFINED=1700\nSCHEMAP_ATTRFORMDEFAULT_VALUE=1701\nSCHEMAP_ATTRGRP_NONAME_NOREF=1702\nSCHEMAP_ATTR_NONAME_NOREF=1703\nSCHEMAP_COMPLEXTYPE_NONAME_NOREF=1704\nSCHEMAP_ELEMFORMDEFAULT_VALUE=""1705\nSCHEMAP_ELEM_NONAME_NOREF=1706\n";
static char __pyx_k_503[] = "SCHEMAP_EXTENSION_NO_BASE=1707\nSCHEMAP_FACET_NO_VALUE=1708\nSCHEMAP_FAILED_BUILD_IMPORT=1709\nSCHEMAP_GROUP_NONAME_NOREF=1710\nSCHEMAP_IMPORT_NAMESPACE_NOT_URI=1711\nSCHEMAP_IMPORT_REDEFINE_NSNAME=1712\nSCHEMAP_IMPORT_SCHEMA_NOT_URI=1713\nSCHEMAP_INVALID_BOOLEAN=1714\nSCHEMAP_INVALID_ENUM=1715\nSCHEMAP_INVALID_FACET=1716\nSCHEMAP_INVALID_FACET_VALUE=1717\nSCHEMAP_INVALID_MAXOCCURS=1718\nSCHEMAP_INVALID_MINOCCURS=1719\nSCHEMAP_INVALID_REF_AND_SUBTYPE=1720\nSCHEMAP_INVALID_WHITE_SPACE=1721\nSCHEMAP_NOATTR_NOREF=1722\nSCHEMAP_NOTATION_NO_NAME=1723\nSCHEMAP_NOTYPE_NOREF=1724\nSCHEMAP_REF_AND_SUBTYPE=1725\nSCHEMAP_RESTRICTION_NONAME_NOREF=1726\nSCHEMAP_SIMPLETYPE_NONAME=1727\nSCHEMAP_TYPE_AND_SUBTYPE=1728\nSCHEMAP_UNKNOWN_ALL_CHILD=1729\nSCHEMAP_UNKNOWN_ANYATTRIBUTE_CHILD=1730\nSCHEMAP_UNKNOWN_ATTR_CHILD=1731\nSCHEMAP_UNKNOWN_ATTRGRP_CHILD=1732\nSCHEMAP_UNKNOWN_ATTRIBUTE_GROUP=1733\nSCHEMAP_UNKNOWN_BASE_TYPE=1734\nSCHEMAP_UNKNOWN_CHOICE_CHILD=1735\nSCHEMAP_UNKNOWN_COMPLEXCONTENT_CHILD=1736\nSCHEMAP_UNKNOWN_COMPLEXTYPE_CHILD=1737\nSCHEMAP_UNKNOWN_ELEM_CHILD=1738\nSCHEMAP_UNKNOWN_EXTENSION_CHILD=1739\nSCHEMAP_UNKNOWN_FACET_CHILD=1740\nSCHEMAP_UNKNOWN_FACET_TYPE=1741\nSCHEMAP_UNKNOWN_GROUP_CHILD=1742\nSCHEMAP_UNKNOWN_IMPORT_CHILD=1743\nSCHEMAP_UNKNOWN_LIST_CHILD=1744\nSCHEMAP_UNKNOWN_NOTATION_CHILD=1745\nSCHEMAP_UNKNOWN_PROCESSCONTENT_CHILD=1746\nSCHEMAP_UNKNOWN_REF=1747\nSCHEMAP_UNKNOWN_RESTRICTION_CHILD=1748\nSCHEMAP_UNKNOWN_SCHEMAS_CHILD=1749\nSCHEMAP_UNKNOWN_SEQUENCE_CHILD=1750\nSCHEMAP_UNKNOWN_SIMPLECONTENT_CHILD=1751\nSCHEMAP_UNKNOWN_SIMPLETYPE_CHILD=1752\nSCHEMAP_UNKNOWN_TYPE=1753\nSCHEMAP_UNKNOWN_UNION_CHILD=1754\nSCHEMAP_ELEM_DEFAULT_FIXED=1755\nSCHEMAP_REGEXP_INVALID=1756\nSCHEMAP_FAILED_LOAD=1757\nSCHEMAP_NOTHING_TO_PARSE=1758\nSCHEMAP_NOROOT=1759\nSCHEMAP_REDEFINED_GROUP=1760\nSCHEMAP_REDEFINED_TYPE=1761\nSCHEMAP_REDEFINED_ELEMENT=1762\nSCHEMAP_REDEFINED_ATTRGROUP=1763\nSCHEMAP_REDEFINED_ATTR=1764\nSCHEMAP_REDEFINED_NOTATION=1765\nSCHEMAP_FAILED_PARSE=1766\nSCH""EMAP_UNKNOWN_PREFIX=1767\n";
static char __pyx_k_504[] = "SCHEMAP_DEF_AND_PREFIX=1768\nSCHEMAP_UNKNOWN_INCLUDE_CHILD=1769\nSCHEMAP_INCLUDE_SCHEMA_NOT_URI=1770\nSCHEMAP_INCLUDE_SCHEMA_NO_URI=1771\nSCHEMAP_NOT_SCHEMA=1772\nSCHEMAP_UNKNOWN_MEMBER_TYPE=1773\nSCHEMAP_INVALID_ATTR_USE=1774\nSCHEMAP_RECURSIVE=1775\nSCHEMAP_SUPERNUMEROUS_LIST_ITEM_TYPE=1776\nSCHEMAP_INVALID_ATTR_COMBINATION=1777\nSCHEMAP_INVALID_ATTR_INLINE_COMBINATION=1778\nSCHEMAP_MISSING_SIMPLETYPE_CHILD=1779\nSCHEMAP_INVALID_ATTR_NAME=1780\nSCHEMAP_REF_AND_CONTENT=1781\nSCHEMAP_CT_PROPS_CORRECT_1=1782\nSCHEMAP_CT_PROPS_CORRECT_2=1783\nSCHEMAP_CT_PROPS_CORRECT_3=1784\nSCHEMAP_CT_PROPS_CORRECT_4=1785\nSCHEMAP_CT_PROPS_CORRECT_5=1786\nSCHEMAP_DERIVATION_OK_RESTRICTION_1=1787\nSCHEMAP_DERIVATION_OK_RESTRICTION_2_1_1=1788\nSCHEMAP_DERIVATION_OK_RESTRICTION_2_1_2=1789\nSCHEMAP_DERIVATION_OK_RESTRICTION_2_2=1790\nSCHEMAP_DERIVATION_OK_RESTRICTION_3=1791\nSCHEMAP_WILDCARD_INVALID_NS_MEMBER=1792\nSCHEMAP_INTERSECTION_NOT_EXPRESSIBLE=1793\nSCHEMAP_UNION_NOT_EXPRESSIBLE=1794\nSCHEMAP_SRC_IMPORT_3_1=1795\nSCHEMAP_SRC_IMPORT_3_2=1796\nSCHEMAP_DERIVATION_OK_RESTRICTION_4_1=1797\nSCHEMAP_DERIVATION_OK_RESTRICTION_4_2=1798\nSCHEMAP_DERIVATION_OK_RESTRICTION_4_3=1799\nSCHEMAP_COS_CT_EXTENDS_1_3=1800\nSCHEMAV_NOROOT=1801\nSCHEMAV_UNDECLAREDELEM=1802\nSCHEMAV_NOTTOPLEVEL=1803\nSCHEMAV_MISSING=1804\nSCHEMAV_WRONGELEM=1805\nSCHEMAV_NOTYPE=1806\nSCHEMAV_NOROLLBACK=1807\nSCHEMAV_ISABSTRACT=1808\nSCHEMAV_NOTEMPTY=1809\nSCHEMAV_ELEMCONT=1810\nSCHEMAV_HAVEDEFAULT=1811\nSCHEMAV_NOTNILLABLE=1812\nSCHEMAV_EXTRACONTENT=1813\nSCHEMAV_INVALIDATTR=1814\nSCHEMAV_INVALIDELEM=1815\nSCHEMAV_NOTDETERMINIST=1816\nSCHEMAV_CONSTRUCT=1817\nSCHEMAV_INTERNAL=1818\nSCHEMAV_NOTSIMPLE=1819\nSCHEMAV_ATTRUNKNOWN=1820\nSCHEMAV_ATTRINVALID=1821\nSCHEMAV_VALUE=1822\nSCHEMAV_FACET=1823\nSCHEMAV_CVC_DATATYPE_VALID_1_2_1=1824\nSCHEMAV_CVC_DATATYPE_VALID_1_2_2=1825\nSCHEMAV_CVC_DATATYPE_VALID_1_2_3=1826\nSCHEMAV_CVC_TYPE_3_1_1=1827\nSCHEMAV_CVC_TYPE_3_1_2=1828\nSCHEMAV_CVC_FACET_VALID=1829\nSCHEMAV_CVC_LENGTH_VALID""=1830\n";
static char __pyx_k_505[] = "SCHEMAV_CVC_MINLENGTH_VALID=1831\nSCHEMAV_CVC_MAXLENGTH_VALID=1832\nSCHEMAV_CVC_MININCLUSIVE_VALID=1833\nSCHEMAV_CVC_MAXINCLUSIVE_VALID=1834\nSCHEMAV_CVC_MINEXCLUSIVE_VALID=1835\nSCHEMAV_CVC_MAXEXCLUSIVE_VALID=1836\nSCHEMAV_CVC_TOTALDIGITS_VALID=1837\nSCHEMAV_CVC_FRACTIONDIGITS_VALID=1838\nSCHEMAV_CVC_PATTERN_VALID=1839\nSCHEMAV_CVC_ENUMERATION_VALID=1840\nSCHEMAV_CVC_COMPLEX_TYPE_2_1=1841\nSCHEMAV_CVC_COMPLEX_TYPE_2_2=1842\nSCHEMAV_CVC_COMPLEX_TYPE_2_3=1843\nSCHEMAV_CVC_COMPLEX_TYPE_2_4=1844\nSCHEMAV_CVC_ELT_1=1845\nSCHEMAV_CVC_ELT_2=1846\nSCHEMAV_CVC_ELT_3_1=1847\nSCHEMAV_CVC_ELT_3_2_1=1848\nSCHEMAV_CVC_ELT_3_2_2=1849\nSCHEMAV_CVC_ELT_4_1=1850\nSCHEMAV_CVC_ELT_4_2=1851\nSCHEMAV_CVC_ELT_4_3=1852\nSCHEMAV_CVC_ELT_5_1_1=1853\nSCHEMAV_CVC_ELT_5_1_2=1854\nSCHEMAV_CVC_ELT_5_2_1=1855\nSCHEMAV_CVC_ELT_5_2_2_1=1856\nSCHEMAV_CVC_ELT_5_2_2_2_1=1857\nSCHEMAV_CVC_ELT_5_2_2_2_2=1858\nSCHEMAV_CVC_ELT_6=1859\nSCHEMAV_CVC_ELT_7=1860\nSCHEMAV_CVC_ATTRIBUTE_1=1861\nSCHEMAV_CVC_ATTRIBUTE_2=1862\nSCHEMAV_CVC_ATTRIBUTE_3=1863\nSCHEMAV_CVC_ATTRIBUTE_4=1864\nSCHEMAV_CVC_COMPLEX_TYPE_3_1=1865\nSCHEMAV_CVC_COMPLEX_TYPE_3_2_1=1866\nSCHEMAV_CVC_COMPLEX_TYPE_3_2_2=1867\nSCHEMAV_CVC_COMPLEX_TYPE_4=1868\nSCHEMAV_CVC_COMPLEX_TYPE_5_1=1869\nSCHEMAV_CVC_COMPLEX_TYPE_5_2=1870\nSCHEMAV_ELEMENT_CONTENT=1871\nSCHEMAV_DOCUMENT_ELEMENT_MISSING=1872\nSCHEMAV_CVC_COMPLEX_TYPE_1=1873\nSCHEMAV_CVC_AU=1874\nSCHEMAV_CVC_TYPE_1=1875\nSCHEMAV_CVC_TYPE_2=1876\nSCHEMAV_CVC_IDC=1877\nSCHEMAV_CVC_WILDCARD=1878\nSCHEMAV_MISC=1879\nXPTR_UNKNOWN_SCHEME=1900\nXPTR_CHILDSEQ_START=1901\nXPTR_EVAL_FAILED=1902\nXPTR_EXTRA_OBJECTS=1903\nC14N_CREATE_CTXT=1950\nC14N_REQUIRES_UTF8=1951\nC14N_CREATE_STACK=1952\nC14N_INVALID_NODE=1953\nC14N_UNKNOW_NODE=1954\nC14N_RELATIVE_NAMESPACE=1955\nFTP_PASV_ANSWER=2000\nFTP_EPSV_ANSWER=2001\nFTP_ACCNT=2002\nFTP_URL_SYNTAX=2003\nHTTP_URL_SYNTAX=2020\nHTTP_USE_IP=2021\nHTTP_UNKNOWN_HOST=2022\nSCHEMAP_SRC_SIMPLE_TYPE_1=3000\nSCHEMAP_SRC_SIMPLE_TYPE_2=3001\nSCHEMAP_SRC_SIMPLE_TYPE_3=3002\nSCHE""MAP_SRC_SIMPLE_TYPE_4=3003\n";
static char __pyx_k_506[] = "SCHEMAP_SRC_RESOLVE=3004\nSCHEMAP_SRC_RESTRICTION_BASE_OR_SIMPLETYPE=3005\nSCHEMAP_SRC_LIST_ITEMTYPE_OR_SIMPLETYPE=3006\nSCHEMAP_SRC_UNION_MEMBERTYPES_OR_SIMPLETYPES=3007\nSCHEMAP_ST_PROPS_CORRECT_1=3008\nSCHEMAP_ST_PROPS_CORRECT_2=3009\nSCHEMAP_ST_PROPS_CORRECT_3=3010\nSCHEMAP_COS_ST_RESTRICTS_1_1=3011\nSCHEMAP_COS_ST_RESTRICTS_1_2=3012\nSCHEMAP_COS_ST_RESTRICTS_1_3_1=3013\nSCHEMAP_COS_ST_RESTRICTS_1_3_2=3014\nSCHEMAP_COS_ST_RESTRICTS_2_1=3015\nSCHEMAP_COS_ST_RESTRICTS_2_3_1_1=3016\nSCHEMAP_COS_ST_RESTRICTS_2_3_1_2=3017\nSCHEMAP_COS_ST_RESTRICTS_2_3_2_1=3018\nSCHEMAP_COS_ST_RESTRICTS_2_3_2_2=3019\nSCHEMAP_COS_ST_RESTRICTS_2_3_2_3=3020\nSCHEMAP_COS_ST_RESTRICTS_2_3_2_4=3021\nSCHEMAP_COS_ST_RESTRICTS_2_3_2_5=3022\nSCHEMAP_COS_ST_RESTRICTS_3_1=3023\nSCHEMAP_COS_ST_RESTRICTS_3_3_1=3024\nSCHEMAP_COS_ST_RESTRICTS_3_3_1_2=3025\nSCHEMAP_COS_ST_RESTRICTS_3_3_2_2=3026\nSCHEMAP_COS_ST_RESTRICTS_3_3_2_1=3027\nSCHEMAP_COS_ST_RESTRICTS_3_3_2_3=3028\nSCHEMAP_COS_ST_RESTRICTS_3_3_2_4=3029\nSCHEMAP_COS_ST_RESTRICTS_3_3_2_5=3030\nSCHEMAP_COS_ST_DERIVED_OK_2_1=3031\nSCHEMAP_COS_ST_DERIVED_OK_2_2=3032\nSCHEMAP_S4S_ELEM_NOT_ALLOWED=3033\nSCHEMAP_S4S_ELEM_MISSING=3034\nSCHEMAP_S4S_ATTR_NOT_ALLOWED=3035\nSCHEMAP_S4S_ATTR_MISSING=3036\nSCHEMAP_S4S_ATTR_INVALID_VALUE=3037\nSCHEMAP_SRC_ELEMENT_1=3038\nSCHEMAP_SRC_ELEMENT_2_1=3039\nSCHEMAP_SRC_ELEMENT_2_2=3040\nSCHEMAP_SRC_ELEMENT_3=3041\nSCHEMAP_P_PROPS_CORRECT_1=3042\nSCHEMAP_P_PROPS_CORRECT_2_1=3043\nSCHEMAP_P_PROPS_CORRECT_2_2=3044\nSCHEMAP_E_PROPS_CORRECT_2=3045\nSCHEMAP_E_PROPS_CORRECT_3=3046\nSCHEMAP_E_PROPS_CORRECT_4=3047\nSCHEMAP_E_PROPS_CORRECT_5=3048\nSCHEMAP_E_PROPS_CORRECT_6=3049\nSCHEMAP_SRC_INCLUDE=3050\nSCHEMAP_SRC_ATTRIBUTE_1=3051\nSCHEMAP_SRC_ATTRIBUTE_2=3052\nSCHEMAP_SRC_ATTRIBUTE_3_1=3053\nSCHEMAP_SRC_ATTRIBUTE_3_2=3054\nSCHEMAP_SRC_ATTRIBUTE_4=3055\nSCHEMAP_NO_XMLNS=3056\nSCHEMAP_NO_XSI=3057\nSCHEMAP_COS_VALID_DEFAULT_1=3058\nSCHEMAP_COS_VALID_DEFAULT_2_1=3059\nSCHEMAP_COS_VALID_DEFAULT_2_2_1=3060\nSCHEMAP_COS_VALID_DEFA""ULT_2_2_2=3061\n";
static char __pyx_k_507[] = "SCHEMAP_CVC_SIMPLE_TYPE=3062\nSCHEMAP_COS_CT_EXTENDS_1_1=3063\nSCHEMAP_SRC_IMPORT_1_1=3064\nSCHEMAP_SRC_IMPORT_1_2=3065\nSCHEMAP_SRC_IMPORT_2=3066\nSCHEMAP_SRC_IMPORT_2_1=3067\nSCHEMAP_SRC_IMPORT_2_2=3068\nSCHEMAP_INTERNAL=3069\nSCHEMAP_NOT_DETERMINISTIC=3070\nSCHEMAP_SRC_ATTRIBUTE_GROUP_1=3071\nSCHEMAP_SRC_ATTRIBUTE_GROUP_2=3072\nSCHEMAP_SRC_ATTRIBUTE_GROUP_3=3073\nSCHEMAP_MG_PROPS_CORRECT_1=3074\nSCHEMAP_MG_PROPS_CORRECT_2=3075\nSCHEMAP_SRC_CT_1=3076\nSCHEMAP_DERIVATION_OK_RESTRICTION_2_1_3=3077\nSCHEMAP_AU_PROPS_CORRECT_2=3078\nSCHEMAP_A_PROPS_CORRECT_2=3079\nSCHEMAP_C_PROPS_CORRECT=3080\nSCHEMAP_SRC_REDEFINE=3081\nSCHEMAP_SRC_IMPORT=3082\nSCHEMAP_WARN_SKIP_SCHEMA=3083\nSCHEMAP_WARN_UNLOCATED_SCHEMA=3084\nSCHEMAP_WARN_ATTR_REDECL_PROH=3085\nSCHEMAP_WARN_ATTR_POINTLESS_PROH=3086\nSCHEMAP_AG_PROPS_CORRECT=3087\nSCHEMAP_COS_CT_EXTENDS_1_2=3088\nSCHEMAP_AU_PROPS_CORRECT=3089\nSCHEMAP_A_PROPS_CORRECT_3=3090\nSCHEMAP_COS_ALL_LIMITED=3091\nSCHEMATRONV_ASSERT=4000\nSCHEMATRONV_REPORT=4001\nMODULE_OPEN=4900\nMODULE_CLOSE=4901\nCHECK_FOUND_ELEMENT=5000\nCHECK_FOUND_ATTRIBUTE=5001\nCHECK_FOUND_TEXT=5002\nCHECK_FOUND_CDATA=5003\nCHECK_FOUND_ENTITYREF=5004\nCHECK_FOUND_ENTITY=5005\nCHECK_FOUND_PI=5006\nCHECK_FOUND_COMMENT=5007\nCHECK_FOUND_DOCTYPE=5008\nCHECK_FOUND_FRAGMENT=5009\nCHECK_FOUND_NOTATION=5010\nCHECK_UNKNOWN_NODE=5011\nCHECK_ENTITY_TYPE=5012\nCHECK_NO_PARENT=5013\nCHECK_NO_DOC=5014\nCHECK_NO_NAME=5015\nCHECK_NO_ELEM=5016\nCHECK_WRONG_DOC=5017\nCHECK_NO_PREV=5018\nCHECK_WRONG_PREV=5019\nCHECK_NO_NEXT=5020\nCHECK_WRONG_NEXT=5021\nCHECK_NOT_DTD=5022\nCHECK_NOT_ATTR=5023\nCHECK_NOT_ATTR_DECL=5024\nCHECK_NOT_ELEM_DECL=5025\nCHECK_NOT_ENTITY_DECL=5026\nCHECK_NOT_NS_DECL=5027\nCHECK_NO_HREF=5028\nCHECK_WRONG_PARENT=5029\nCHECK_NS_SCOPE=5030\nCHECK_NS_ANCESTOR=5031\nCHECK_NOT_UTF8=5032\nCHECK_NO_DICT=5033\nCHECK_NOT_NCNAME=5034\nCHECK_OUTSIDE_DICT=5035\nCHECK_WRONG_NAME=5036\nCHECK_NAME_NOT_NULL=5037\nI18N_NO_NAME=6000\nI18N_NO_HANDLER=6001\nI18N_EXCESS_HANDLER=6002\nI18N""_CONV_FAILED=6003\n";
static char __pyx_k_508[] = "I18N_NO_OUTPUT=6004\nCHECK_=6005\nCHECK_X=6006\n";
static char __pyx_k_510[] = "RELAXNG_OK=0\nRELAXNG_ERR_MEMORY=1\nRELAXNG_ERR_TYPE=2\nRELAXNG_ERR_TYPEVAL=3\nRELAXNG_ERR_DUPID=4\nRELAXNG_ERR_TYPECMP=5\nRELAXNG_ERR_NOSTATE=6\nRELAXNG_ERR_NODEFINE=7\nRELAXNG_ERR_LISTEXTRA=8\nRELAXNG_ERR_LISTEMPTY=9\nRELAXNG_ERR_INTERNODATA=10\nRELAXNG_ERR_INTERSEQ=11\nRELAXNG_ERR_INTEREXTRA=12\nRELAXNG_ERR_ELEMNAME=13\nRELAXNG_ERR_ATTRNAME=14\nRELAXNG_ERR_ELEMNONS=15\nRELAXNG_ERR_ATTRNONS=16\nRELAXNG_ERR_ELEMWRONGNS=17\nRELAXNG_ERR_ATTRWRONGNS=18\nRELAXNG_ERR_ELEMEXTRANS=19\nRELAXNG_ERR_ATTREXTRANS=20\nRELAXNG_ERR_ELEMNOTEMPTY=21\nRELAXNG_ERR_NOELEM=22\nRELAXNG_ERR_NOTELEM=23\nRELAXNG_ERR_ATTRVALID=24\nRELAXNG_ERR_CONTENTVALID=25\nRELAXNG_ERR_EXTRACONTENT=26\nRELAXNG_ERR_INVALIDATTR=27\nRELAXNG_ERR_DATAELEM=28\nRELAXNG_ERR_VALELEM=29\nRELAXNG_ERR_LISTELEM=30\nRELAXNG_ERR_DATATYPE=31\nRELAXNG_ERR_VALUE=32\nRELAXNG_ERR_LIST=33\nRELAXNG_ERR_NOGRAMMAR=34\nRELAXNG_ERR_EXTRADATA=35\nRELAXNG_ERR_LACKDATA=36\nRELAXNG_ERR_INTERNAL=37\nRELAXNG_ERR_ELEMWRONG=38\nRELAXNG_ERR_TEXTWRONG=39\n";
static char __pyx_k_512[] = "Base class of lxml registry errors.\n    ";
static char __pyx_k_513[] = "Error registering a namespace extension.\n    ";
static char __pyx_k_514[] = "Syntax error while parsing an XML document.\n\n    For compatibility with ElementTree 1.3 and later.\n    ";
static char __pyx_k_515[] = "Syntax error while parsing an XML document.\n    ";
static char __pyx_k_516[] = "Internal lxml parser error.\n    ";
static char __pyx_k_517[] = "initMainParserContext";
static char __pyx_k_518[] = "A libxml2 error that occurred during serialisation.\n    ";
static char __pyx_k_519[] = "Error during XInclude processing.\n    ";
static char __pyx_k_520[] = "Base class of all XPath errors.\n    ";
static char __pyx_k_521[] = "Error during XPath evaluation.\n    ";
static char __pyx_k_522[] = "Internal error looking up an XPath extension function.\n    ";
static char __pyx_k_523[] = "Error handling an XPath result.\n    ";
static char __pyx_k_524[] = "(\"[^\"]*\")|('[^']*')";
static char __pyx_k_526[] = "({[^}]+})";
static char __pyx_k_528[] = "Base class of all XSLT errors.\n    ";
static char __pyx_k_529[] = "Error parsing a stylesheet document.\n    ";
static char __pyx_k_530[] = "Error running an XSL transformation.\n    ";
static char __pyx_k_531[] = "Error serialising an XSLT result.\n    ";
static char __pyx_k_532[] = "Error registering an XSLT extension.\n    ";
static char __pyx_k_533[] = "\\s+(\\w+)\\s*=\\s*[\"\\']([^\"\\']+)[\"\\']";
static char __pyx_k_534[] = "\\s+href\\s*=\\s*[\"\\']([^\"\\']+)[\"\\']";
static char __pyx_k_536[] = "Validation error.\n\n    Raised by all document validators when their ``assertValid(tree)``\n    method fails.\n    ";
static char __pyx_k_537[] = "Base class for DTD errors.\n    ";
static char __pyx_k_538[] = "Error while parsing a DTD.\n    ";
static char __pyx_k_539[] = "Error while validating an XML document with a DTD.\n    ";
static char __pyx_k_540[] = "Base class for RelaxNG errors.\n    ";
static char __pyx_k_541[] = "Error while parsing an XML document as RelaxNG.\n    ";
static char __pyx_k_542[] = "Error while validating an XML document with a RelaxNG schema.\n    ";
static char __pyx_k_543[] = "Base class of all XML Schema errors\n    ";
static char __pyx_k_544[] = "Error while parsing an XML document as XML Schema.\n    ";
static char __pyx_k_545[] = "Error while validating an XML document with an XML Schema.\n    ";
static char __pyx_k_546[] = "boolean(//xs:attribute[@default or @fixed][1])";
static char __pyx_k_548[] = "Base class of all Schematron errors.\n    ";
static char __pyx_k_549[] = "Error while parsing an XML document as Schematron schema.\n    ";
static char __pyx_k_550[] = "Error while validating an XML document with a Schematron schema.\n    ";
static char __pyx_k_551[] = "XML (line 2700)";
static char __pyx_k_552[] = "XML(text, parser=None, base_url=None)\n\n    Parses an XML document or fragment from a string constant.\n    Returns the root node (or the result returned by a parser target).\n    This function can be used to embed \"XML literals\" in Python code,\n    like in\n\n       >>> root = etree.XML(\"<root><test/></root>\")\n\n    To override the parser with a different ``XMLParser`` you can pass it to\n    the ``parser`` keyword argument.\n\n    The ``base_url`` keyword argument allows to set the original base URL of\n    the document to support relative Paths when looking up external entities\n    (DTD, XInclude, ...).\n    ";
static char __pyx_k__PI[] = "PI";
static char __pyx_k__dc[] = "dc";
static char __pyx_k__id[] = "id";
static char __pyx_k__io[] = "io";
static char __pyx_k__ns[] = "ns";
static char __pyx_k__pi[] = "pi";
static char __pyx_k__py[] = "py";
static char __pyx_k__rb[] = "rb";
static char __pyx_k__re[] = "re";
static char __pyx_k__wb[] = "wb";
static char __pyx_k__xs[] = "xs";
static char __pyx_k__DTD[] = "DTD";
static char __pyx_k__TAG[] = "TAG";
static char __pyx_k__URL[] = "URL";
static char __pyx_k__XML[] = "XML";
static char __pyx_k__add[] = "add";
static char __pyx_k__buf[] = "buf";
static char __pyx_k__cur[] = "cur";
static char __pyx_k__dev[] = "dev";
static char __pyx_k__doc[] = "doc";
static char __pyx_k__end[] = "end";
static char __pyx_k__get[] = "get";
static char __pyx_k__ids[] = "ids";
static char __pyx_k__key[] = "key";
static char __pyx_k__len[] = "len";
static char __pyx_k__log[] = "log";
static char __pyx_k__new[] = "new";
static char __pyx_k__old[] = "old";
static char __pyx_k__pop[] = "pop";
static char __pyx_k__rdf[] = "rdf";
static char __pyx_k__sax[] = "sax";
static char __pyx_k__str[] = "str";
static char __pyx_k__sub[] = "sub";
static char __pyx_k__sys[] = "sys";
static char __pyx_k__tag[] = "tag";
static char __pyx_k__uri[] = "uri";
static char __pyx_k__url[] = "url";
static char __pyx_k__xml[] = "xml";
static char __pyx_k__xsi[] = "xsi";
static char __pyx_k__xsl[] = "xsl";
static char __pyx_k__HTML[] = "HTML";
static char __pyx_k__UTF8[] = "UTF8";
static char __pyx_k__XSLT[] = "XSLT";
static char __pyx_k___doc[] = "_doc";
static char __pyx_k___exc[] = "_exc";
static char __pyx_k___get[] = "_get";
static char __pyx_k___log[] = "_log";
static char __pyx_k___tag[] = "_tag";
static char __pyx_k___url[] = "_url";
static char __pyx_k__attr[] = "attr";
static char __pyx_k__base[] = "base";
static char __pyx_k__beta[] = "beta";
static char __pyx_k__c14n[] = "c14n";
static char __pyx_k__code[] = "code";
static char __pyx_k__conv[] = "conv";
static char __pyx_k__copy[] = "copy";
static char __pyx_k__ctxt[] = "ctxt";
static char __pyx_k__data[] = "data";
static char __pyx_k__dict[] = "dict";
static char __pyx_k__dump[] = "dump";
static char __pyx_k__elem[] = "elem";
static char __pyx_k__feed[] = "feed";
static char __pyx_k__file[] = "file";
static char __pyx_k__find[] = "find";
static char __pyx_k__gzip[] = "gzip";
static char __pyx_k__href[] = "href";
static char __pyx_k__html[] = "html";
static char __pyx_k__inst[] = "inst";
static char __pyx_k__int2[] = "int2";
static char __pyx_k__iter[] = "iter";
static char __pyx_k__join[] = "join";
static char __pyx_k__last[] = "last";
static char __pyx_k__line[] = "line";
static char __pyx_k__mode[] = "mode";
static char __pyx_k__name[] = "name";
static char __pyx_k__ndim[] = "ndim";
static char __pyx_k__next[] = "next";
static char __pyx_k__node[] = "node";
static char __pyx_k__open[] = "open";
static char __pyx_k__path[] = "path";
static char __pyx_k__prev[] = "prev";
static char __pyx_k__read[] = "read";
static char __pyx_k__rexp[] = "rexp";
static char __pyx_k__root[] = "root";
static char __pyx_k__self[] = "self";
static char __pyx_k__size[] = "size";
static char __pyx_k__sort[] = "sort";
static char __pyx_k__step[] = "step";
static char __pyx_k__stop[] = "stop";
static char __pyx_k__tail[] = "tail";
static char __pyx_k__tell[] = "tell";
static char __pyx_k__test[] = "test";
static char __pyx_k__text[] = "text";
static char __pyx_k__tree[] = "tree";
static char __pyx_k__type[] = "type";
static char __pyx_k__warn[] = "warn";
static char __pyx_k__wsdl[] = "wsdl";
static char __pyx_k__ASCII[] = "ASCII";
static char __pyx_k__CDATA[] = "CDATA";
static char __pyx_k__DEBUG[] = "DEBUG";
static char __pyx_k__ERROR[] = "ERROR";
static char __pyx_k__Error[] = "Error";
static char __pyx_k__FATAL[] = "FATAL";
static char __pyx_k__QName[] = "QName";
static char __pyx_k__XMLID[] = "XMLID";
static char __pyx_k__XPath[] = "XPath";
static char __pyx_k___c_ns[] = "_c_ns";
static char __pyx_k___copy[] = "_copy";
static char __pyx_k___data[] = "_data";
static char __pyx_k___file[] = "_file";
static char __pyx_k___hold[] = "_hold";
static char __pyx_k___href[] = "_href";
static char __pyx_k___init[] = "_init";
static char __pyx_k___keys[] = "_keys";
static char __pyx_k___last[] = "_last";
static char __pyx_k___lock[] = "_lock";
static char __pyx_k___name[] = "_name";
static char __pyx_k___node[] = "_node";
static char __pyx_k___path[] = "_path";
static char __pyx_k___root[] = "_root";
static char __pyx_k___type[] = "_type";
static char __pyx_k___xslt[] = "_xslt";
static char __pyx_k__alpha[] = "alpha";
static char __pyx_k__ascii[] = "ascii";
static char __pyx_k__attrs[] = "attrs";
static char __pyx_k__child[] = "child";
static char __pyx_k__clear[] = "clear";
static char __pyx_k__close[] = "close";
static char __pyx_k__dummy[] = "dummy";
static char __pyx_k__errNo[] = "errNo";
static char __pyx_k__error[] = "error";
static char __pyx_k__etree[] = "etree";
static char __pyx_k__flags[] = "flags";
static char __pyx_k__group[] = "group";
static char __pyx_k__index[] = "index";
static char __pyx_k__input[] = "input";
static char __pyx_k__items[] = "items";
static char __pyx_k__level[] = "level";
static char __pyx_k__lower[] = "lower";
static char __pyx_k__match[] = "match";
static char __pyx_k__myDoc[] = "myDoc";
static char __pyx_k__nsDef[] = "nsDef";
static char __pyx_k__nsmap[] = "nsmap";
static char __pyx_k__parse[] = "parse";
static char __pyx_k__range[] = "range";
static char __pyx_k__shape[] = "shape";
static char __pyx_k__split[] = "split";
static char __pyx_k__start[] = "start";
static char __pyx_k__state[] = "state";
static char __pyx_k__strip[] = "strip";
static char __pyx_k__super[] = "super";
static char __pyx_k__upper[] = "upper";
static char __pyx_k__value[] = "value";
static char __pyx_k__write[] = "write";
static char __pyx_k__Entity[] = "Entity";
static char __pyx_k__PARSER[] = "PARSER";
static char __pyx_k__PIBase[] = "PIBase";
static char __pyx_k___bytes[] = "_bytes";
static char __pyx_k___c_doc[] = "_c_doc";
static char __pyx_k___c_dtd[] = "_c_dtd";
static char __pyx_k___c_url[] = "_c_url";
static char __pyx_k___flush[] = "_flush";
static char __pyx_k___index[] = "_index";
static char __pyx_k___input[] = "_input";
static char __pyx_k___items[] = "_items";
static char __pyx_k___names[] = "_names";
static char __pyx_k___prefs[] = "_prefs";
static char __pyx_k___pytag[] = "_pytag";
static char __pyx_k___xpath[] = "_xpath";
static char __pyx_k__append[] = "append";
static char __pyx_k__attrib[] = "attrib";
static char __pyx_k__buffer[] = "buffer";
static char __pyx_k__column[] = "column";
static char __pyx_k__decode[] = "decode";
static char __pyx_k__domain[] = "domain";
static char __pyx_k__encode[] = "encode";
static char __pyx_k__entity[] = "entity";
static char __pyx_k__events[] = "events";
static char __pyx_k__extend[] = "extend";
static char __pyx_k__format[] = "format";
static char __pyx_k__geturl[] = "geturl";
static char __pyx_k__groups[] = "groups";
static char __pyx_k__insert[] = "insert";
static char __pyx_k__length[] = "length";
static char __pyx_k__logger[] = "logger";
static char __pyx_k__lookup[] = "lookup";
static char __pyx_k__method[] = "method";
static char __pyx_k__module[] = "module";
static char __pyx_k__nodeNr[] = "nodeNr";
static char __pyx_k__nsHash[] = "nsHash";
static char __pyx_k__ns_uri[] = "ns_uri";
static char __pyx_k__object[] = "object";
static char __pyx_k__output[] = "output";
static char __pyx_k__parent[] = "parent";
static char __pyx_k__parser[] = "parser";
static char __pyx_k__prefix[] = "prefix";
static char __pyx_k__python[] = "python";
static char __pyx_k__regexp[] = "regexp";
static char __pyx_k__remove[] = "remove";
static char __pyx_k__result[] = "result";
static char __pyx_k__schema[] = "schema";
static char __pyx_k__search[] = "search";
static char __pyx_k__source[] = "source";
static char __pyx_k__stdout[] = "stdout";
static char __pyx_k__strict[] = "strict";
static char __pyx_k__string[] = "string";
static char __pyx_k__strval[] = "strval";
static char __pyx_k__target[] = "target";
static char __pyx_k__update[] = "update";
static char __pyx_k__values[] = "values";
static char __pyx_k__BytesIO[] = "BytesIO";
static char __pyx_k__Comment[] = "Comment";
static char __pyx_k__ETXPath[] = "ETXPath";
static char __pyx_k__Element[] = "Element";
static char __pyx_k__IOError[] = "IOError";
static char __pyx_k__RelaxNG[] = "RelaxNG";
static char __pyx_k__UNICODE[] = "UNICODE";
static char __pyx_k__WARNING[] = "WARNING";
static char __pyx_k____all__[] = "__all__";
static char __pyx_k___buffer[] = "_buffer";
static char __pyx_k___c_attr[] = "_c_attr";
static char __pyx_k___c_ctxt[] = "_c_ctxt";
static char __pyx_k___c_dict[] = "_c_dict";
static char __pyx_k___c_name[] = "_c_name";
static char __pyx_k___c_node[] = "_c_node";
static char __pyx_k___events[] = "_events";
static char __pyx_k___gc_doc[] = "_gc_doc";
static char __pyx_k___ns_uri[] = "_ns_uri";
static char __pyx_k___optval[] = "_optval";
static char __pyx_k___parent[] = "_parent";
static char __pyx_k___parser[] = "_parser";
static char __pyx_k___pop_ns[] = "_pop_ns";
static char __pyx_k___prefix[] = "_prefix";
static char __pyx_k___schema[] = "_schema";
static char __pyx_k___source[] = "_source";
static char __pyx_k___target[] = "_target";
static char __pyx_k___to_utf[] = "_to_utf";
static char __pyx_k___unlock[] = "_unlock";
static char __pyx_k__abspath[] = "abspath";
static char __pyx_k__boolval[] = "boolval";
static char __pyx_k__cleanup[] = "cleanup";
static char __pyx_k__comment[] = "comment";
static char __pyx_k__compact[] = "compact";
static char __pyx_k__compile[] = "compile";
static char __pyx_k__connect[] = "connect";
static char __pyx_k__content[] = "content";
static char __pyx_k__context[] = "context";
static char __pyx_k__default[] = "default";
static char __pyx_k__discard[] = "discard";
static char __pyx_k__doctype[] = "doctype";
static char __pyx_k__domains[] = "domains";
static char __pyx_k__element[] = "element";
static char __pyx_k__endNode[] = "endNode";
static char __pyx_k__entries[] = "entries";
static char __pyx_k__execute[] = "execute";
static char __pyx_k__fileobj[] = "fileobj";
static char __pyx_k__findall[] = "findall";
static char __pyx_k__getnext[] = "getnext";
static char __pyx_k__getroot[] = "getroot";
static char __pyx_k__inspect[] = "inspect";
static char __pyx_k__is_tail[] = "is_tail";
static char __pyx_k__is_text[] = "is_text";
static char __pyx_k__isvalid[] = "isvalid";
static char __pyx_k__logging[] = "logging";
static char __pyx_k__matches[] = "matches";
static char __pyx_k__max_len[] = "max_len";
static char __pyx_k__message[] = "message";
static char __pyx_k__nodeTab[] = "nodeTab";
static char __pyx_k__options[] = "options";
static char __pyx_k__parseid[] = "parseid";
static char __pyx_k__prepare[] = "prepare";
static char __pyx_k__profile[] = "profile";
static char __pyx_k__receive[] = "receive";
static char __pyx_k__recover[] = "recover";
static char __pyx_k__replace[] = "replace";
static char __pyx_k__resolve[] = "resolve";
static char __pyx_k__reverse[] = "reverse";
static char __pyx_k__strides[] = "strides";
static char __pyx_k__strings[] = "strings";
static char __pyx_k__unicode[] = "unicode";
static char __pyx_k__unknown[] = "unknown";
static char __pyx_k__version[] = "version";
static char __pyx_k__CRITICAL[] = "CRITICAL";
static char __pyx_k__DENY_ALL[] = "DENY_ALL";
static char __pyx_k__DTDError[] = "DTDError";
static char __pyx_k__GzipFile[] = "GzipFile";
static char __pyx_k__KeyError[] = "KeyError";
static char __pyx_k__RELAXNGV[] = "RELAXNGV";
static char __pyx_k__Resolver[] = "Resolver";
static char __pyx_k__StringIO[] = "StringIO";
static char __pyx_k__SystemID[] = "SystemID";
static char __pyx_k__XInclude[] = "XInclude";
static char __pyx_k__XMLDTDID[] = "XMLDTDID";
static char __pyx_k____copy__[] = "__copy__";
static char __pyx_k____dict__[] = "__dict__";
static char __pyx_k____hash__[] = "__hash__";
static char __pyx_k____init__[] = "__init__";
static char __pyx_k____main__[] = "__main__";
static char __pyx_k____name__[] = "__name__";
static char __pyx_k____next__[] = "__next__";
static char __pyx_k____test__[] = "__test__";
static char __pyx_k___c_style[] = "_c_style";
static char __pyx_k___compile[] = "_compile";
static char __pyx_k___context[] = "_context";
static char __pyx_k___element[] = "_element";
static char __pyx_k___entries[] = "_entries";
static char __pyx_k___factory[] = "_factory";
static char __pyx_k___getName[] = "_getName";
static char __pyx_k___in_tail[] = "_in_tail";
static char __pyx_k___max_len[] = "_max_len";
static char __pyx_k___private[] = "_private";
static char __pyx_k___profile[] = "_profile";
static char __pyx_k___readDoc[] = "_readDoc";
static char __pyx_k___readDtd[] = "_readDtd";
static char __pyx_k___receive[] = "_receive";
static char __pyx_k___storage[] = "_storage";
static char __pyx_k__attrname[] = "attrname";
static char __pyx_k__base_url[] = "base_url";
static char __pyx_k__builtins[] = "builtins";
static char __pyx_k__children[] = "children";
static char __pyx_k__elements[] = "elements";
static char __pyx_k__encoding[] = "encoding";
static char __pyx_k__entities[] = "entities";
static char __pyx_k__exc_info[] = "exc_info";
static char __pyx_k__fallback[] = "fallback";
static char __pyx_k__filelike[] = "filelike";
static char __pyx_k__filename[] = "filename";
static char __pyx_k__findtext[] = "findtext";
static char __pyx_k__floatval[] = "floatval";
static char __pyx_k__for_html[] = "for_html";
static char __pyx_k__function[] = "function";
static char __pyx_k__getvalue[] = "getvalue";
static char __pyx_k__inSubset[] = "inSubset";
static char __pyx_k__internal[] = "internal";
static char __pyx_k__itemsize[] = "itemsize";
static char __pyx_k__iterfind[] = "iterfind";
static char __pyx_k__iterwalk[] = "iterwalk";
static char __pyx_k__load_dtd[] = "load_dtd";
static char __pyx_k__ns_clean[] = "ns_clean";
static char __pyx_k__pi_class[] = "pi_class";
static char __pyx_k__position[] = "position";
static char __pyx_k__readonly[] = "readonly";
static char __pyx_k__reversed[] = "reversed";
static char __pyx_k__spaceMax[] = "spaceMax";
static char __pyx_k__spaceTab[] = "spaceTab";
static char __pyx_k__strparam[] = "strparam";
static char __pyx_k__tostring[] = "tostring";
static char __pyx_k__userData[] = "userData";
static char __pyx_k__validate[] = "validate";
static char __pyx_k__warnings[] = "warnings";
static char __pyx_k__C14NError[] = "C14NError";
static char __pyx_k__Exception[] = "Exception";
static char __pyx_k__Extension[] = "Extension";
static char __pyx_k__LxmlError[] = "LxmlError";
static char __pyx_k__NAMESPACE[] = "NAMESPACE";
static char __pyx_k__TypeError[] = "TypeError";
static char __pyx_k__XMLParser[] = "XMLParser";
static char __pyx_k__XMLSchema[] = "XMLSchema";
static char __pyx_k__XSLTError[] = "XSLTError";
static char __pyx_k____class__[] = "__class__";
static char __pyx_k___c_schema[] = "_c_schema";
static char __pyx_k___encoding[] = "_encoding";
static char __pyx_k___end_node[] = "_end_node";
static char __pyx_k___eval_arg[] = "_eval_arg";
static char __pyx_k___exc_info[] = "_exc_info";
static char __pyx_k___filelike[] = "_filelike";
static char __pyx_k___filename[] = "_filename";
static char __pyx_k___for_html[] = "_for_html";
static char __pyx_k___ns_stack[] = "_ns_stack";
static char __pyx_k___parseDoc[] = "_parseDoc";
static char __pyx_k___pop_node[] = "_pop_node";
static char __pyx_k___sax_plug[] = "_sax_plug";
static char __pyx_k___setError[] = "_setError";
static char __pyx_k___tag_href[] = "_tag_href";
static char __pyx_k___tag_name[] = "_tag_name";
static char __pyx_k___top_node[] = "_top_node";
static char __pyx_k___utf_refs[] = "_utf_refs";
static char __pyx_k___xsltCtxt[] = "_xsltCtxt";
static char __pyx_k__docstring[] = "docstring";
static char __pyx_k__enumerate[] = "enumerate";
static char __pyx_k__error_log[] = "error_log";
static char __pyx_k__exclusive[] = "exclusive";
static char __pyx_k__extSubset[] = "extSubset";
static char __pyx_k__getLogger[] = "getLogger";
static char __pyx_k__getparent[] = "getparent";
static char __pyx_k__huge_tree[] = "huge_tree";
static char __pyx_k__inclusive[] = "inclusive";
static char __pyx_k__intSubset[] = "intSubset";
static char __pyx_k__iselement[] = "iselement";
static char __pyx_k__iteritems[] = "iteritems";
static char __pyx_k__iterparse[] = "iterparse";
static char __pyx_k__lastError[] = "lastError";
static char __pyx_k__level_map[] = "level_map";
static char __pyx_k__localname[] = "localname";
static char __pyx_k__log_entry[] = "log_entry";
static char __pyx_k__namespace[] = "namespace";
static char __pyx_k__notations[] = "notations";
static char __pyx_k__pentities[] = "pentities";
static char __pyx_k__preceding[] = "preceding";
static char __pyx_k__public_id[] = "public_id";
static char __pyx_k__pushEvent[] = "pushEvent";
static char __pyx_k__read_file[] = "read_file";
static char __pyx_k__reference[] = "reference";
static char __pyx_k__resolvers[] = "resolvers";
static char __pyx_k__self_node[] = "self_node";
static char __pyx_k__startNode[] = "startNode";
static char __pyx_k__stringval[] = "stringval";
static char __pyx_k__tounicode[] = "tounicode";
static char __pyx_k__type_name[] = "type_name";
static char __pyx_k__variables[] = "variables";
static char __pyx_k__with_tail[] = "with_tail";
static char __pyx_k__xpathCtxt[] = "xpathCtxt";
static char __pyx_k__DENY_WRITE[] = "DENY_WRITE";
static char __pyx_k__EntityBase[] = "EntityBase";
static char __pyx_k__ErrorTypes[] = "ErrorTypes";
static char __pyx_k__ExternalID[] = "ExternalID";
static char __pyx_k__HTMLParser[] = "HTMLParser";
static char __pyx_k__IGNORECASE[] = "IGNORECASE";
static char __pyx_k__IndexError[] = "IndexError";
static char __pyx_k__ParseError[] = "ParseError";
static char __pyx_k__PyErrorLog[] = "PyErrorLog";
static char __pyx_k__Schematron[] = "Schematron";
static char __pyx_k__SubElement[] = "SubElement";
static char __pyx_k__ValueError[] = "ValueError";
static char __pyx_k__XPathError[] = "XPathError";
static char __pyx_k___error_log[] = "_error_log";
static char __pyx_k___eval_lock[] = "_eval_lock";
static char __pyx_k___map_level[] = "_map_level";
static char __pyx_k___nextEvent[] = "_nextEvent";
static char __pyx_k___next_node[] = "_next_node";
static char __pyx_k___node_type[] = "_node_type";
static char __pyx_k___origSaxPI[] = "_origSaxPI";
static char __pyx_k___origSaxPi[] = "_origSaxPi";
static char __pyx_k___pop_event[] = "_pop_event";
static char __pyx_k___pystrings[] = "_pystrings";
static char __pyx_k___resolvers[] = "_resolvers";
static char __pyx_k___setAccess[] = "_setAccess";
static char __pyx_k___setNodeNs[] = "_setNodeNs";
static char __pyx_k___setTarget[] = "_setTarget";
static char __pyx_k___setupDict[] = "_setupDict";
static char __pyx_k___storeNext[] = "_storeNext";
static char __pyx_k___tag_tuple[] = "_tag_tuple";
static char __pyx_k___target_pi[] = "_target_pi";
static char __pyx_k___temp_refs[] = "_temp_refs";
static char __pyx_k___utf8_data[] = "_utf8_data";
static char __pyx_k___validator[] = "_validator";
static char __pyx_k___variables[] = "_variables";
static char __pyx_k___xpathCtxt[] = "_xpathCtxt";
static char __pyx_k__attributes[] = "attributes";
static char __pyx_k__cdataBlock[] = "cdataBlock";
static char __pyx_k__characters[] = "characters";
static char __pyx_k__create_dir[] = "create_dir";
static char __pyx_k__disableSAX[] = "disableSAX";
static char __pyx_k__disconnect[] = "disconnect";
static char __pyx_k__endElement[] = "endElement";
static char __pyx_k__extensions[] = "extensions";
static char __pyx_k__fromstring[] = "fromstring";
static char __pyx_k__getargspec[] = "getargspec";
static char __pyx_k__getdoctype[] = "getdoctype";
static char __pyx_k__getxmlinfo[] = "getxmlinfo";
static char __pyx_k__hasdoctype[] = "hasdoctype";
static char __pyx_k__input_node[] = "input_node";
static char __pyx_k__last_error[] = "last_error";
static char __pyx_k__level_name[] = "level_name";
static char __pyx_k__loadsubset[] = "loadsubset";
static char __pyx_k__namespaces[] = "namespaces";
static char __pyx_k__no_network[] = "no_network";
static char __pyx_k__nodesetval[] = "nodesetval";
static char __pyx_k__properties[] = "properties";
static char __pyx_k__remove_pis[] = "remove_pis";
static char __pyx_k__standalone[] = "standalone";
static char __pyx_k__startswith[] = "startswith";
static char __pyx_k__strip_tags[] = "strip_tags";
static char __pyx_k__suboffsets[] = "suboffsets";
static char __pyx_k__system_url[] = "system_url";
static char __pyx_k__wellFormed[] = "wellFormed";
static char __pyx_k__write_file[] = "write_file";
static char __pyx_k__xslt_input[] = "xslt_input";
static char __pyx_k__CommentBase[] = "CommentBase";
static char __pyx_k__ElementBase[] = "ElementBase";
static char __pyx_k__ElementTree[] = "ElementTree";
static char __pyx_k__ErrorLevels[] = "ErrorLevels";
static char __pyx_k__ImportError[] = "ImportError";
static char __pyx_k__LookupError[] = "LookupError";
static char __pyx_k__ParserError[] = "ParserError";
static char __pyx_k__SyntaxError[] = "SyntaxError";
static char __pyx_k__TreeBuilder[] = "TreeBuilder";
static char __pyx_k__XPATH_POINT[] = "XPATH_POINT";
static char __pyx_k__XPATH_RANGE[] = "XPATH_RANGE";
static char __pyx_k__XPATH_USERS[] = "XPATH_USERS";
static char __pyx_k____builtin__[] = "__builtin__";
static char __pyx_k____unicode__[] = "__unicode__";
static char __pyx_k____version__[] = "__version__";
static char __pyx_k___assertNode[] = "_assertNode";
static char __pyx_k___buffer_len[] = "_buffer_len";
static char __pyx_k___build_keys[] = "_build_keys";
static char __pyx_k___bytes_read[] = "_bytes_read";
static char __pyx_k___close_file[] = "_close_file";
static char __pyx_k___data_bytes[] = "_data_bytes";
static char __pyx_k___extensions[] = "_extensions";
static char __pyx_k___has_raised[] = "_has_raised";
static char __pyx_k___keysvalues[] = "_keysvalues";
static char __pyx_k___namespaces[] = "_namespaces";
static char __pyx_k___node_stack[] = "_node_stack";
static char __pyx_k___ns_counter[] = "_ns_counter";
static char __pyx_k___ns_uri_utf[] = "_ns_uri_utf";
static char __pyx_k___origSaxEnd[] = "_origSaxEnd";
static char __pyx_k___prefix_utf[] = "_prefix_utf";
static char __pyx_k___remove_pis[] = "_remove_pis";
static char __pyx_k___setGeneric[] = "_setGeneric";
static char __pyx_k___start_node[] = "_start_node";
static char __pyx_k___target_end[] = "_target_end";
static char __pyx_k___valid_ctxt[] = "_valid_ctxt";
static char __pyx_k__compression[] = "compression";
static char __pyx_k__domain_name[] = "domain_name";
static char __pyx_k__exc_context[] = "exc_context";
static char __pyx_k__external_id[] = "external_id";
static char __pyx_k__first_error[] = "first_error";
static char __pyx_k__functionURI[] = "functionURI";
static char __pyx_k__getchildren[] = "getchildren";
static char __pyx_k__getiterator[] = "getiterator";
static char __pyx_k__initDocDict[] = "initDocDict";
static char __pyx_k__initialized[] = "initialized";
static char __pyx_k__logger_name[] = "logger_name";
static char __pyx_k__new_element[] = "new_element";
static char __pyx_k__old_element[] = "old_element";
static char __pyx_k__profile_run[] = "profile_run";
static char __pyx_k__progressive[] = "progressive";
static char __pyx_k__replacement[] = "replacement";
static char __pyx_k__set_context[] = "set_context";
static char __pyx_k__strip_cdata[] = "strip_cdata";
static char __pyx_k__ErrorDomains[] = "ErrorDomains";
static char __pyx_k__LXML_VERSION[] = "LXML_VERSION";
static char __pyx_k__RelaxNGError[] = "RelaxNGError";
static char __pyx_k___build_items[] = "_build_items";
static char __pyx_k___c_style_doc[] = "_c_style_doc";
static char __pyx_k___compile_map[] = "_compile_map";
static char __pyx_k___elementpath[] = "_elementpath";
static char __pyx_k___event_index[] = "_event_index";
static char __pyx_k___exc_context[] = "_exc_context";
static char __pyx_k___first_error[] = "_first_error";
static char __pyx_k___handleSaxPi[] = "_handleSaxPi";
static char __pyx_k___make_string[] = "_make_string";
static char __pyx_k___origSaxData[] = "_origSaxData";
static char __pyx_k___parse_chunk[] = "_parse_chunk";
static char __pyx_k___prefix_tail[] = "_prefix_tail";
static char __pyx_k___setFallback[] = "_setFallback";
static char __pyx_k___strip_cdata[] = "_strip_cdata";
static char __pyx_k___target_data[] = "_target_data";
static char __pyx_k__addNamespace[] = "addNamespace";
static char __pyx_k__copyToBuffer[] = "copyToBuffer";
static char __pyx_k__endElementNs[] = "endElementNs";
static char __pyx_k__entity_class[] = "entity_class";
static char __pyx_k__filter_types[] = "filter_types";
static char __pyx_k__free_context[] = "free_context";
static char __pyx_k__is_attribute[] = "is_attribute";
static char __pyx_k__isstandalone[] = "isstandalone";
static char __pyx_k__pretty_print[] = "pretty_print";
static char __pyx_k__read_network[] = "read_network";
static char __pyx_k__readcallback[] = "readcallback";
static char __pyx_k__startElement[] = "startElement";
static char __pyx_k__tostringlist[] = "tostringlist";
static char __pyx_k__DTDParseError[] = "DTDParseError";
static char __pyx_k__FutureWarning[] = "FutureWarning";
static char __pyx_k__StopIteration[] = "StopIteration";
static char __pyx_k__XIncludeError[] = "XIncludeError";
static char __pyx_k__XSLTExtension[] = "XSLTExtension";
static char __pyx_k__XSLTSaveError[] = "XSLTSaveError";
static char __pyx_k____docformat__[] = "__docformat__";
static char __pyx_k___c_ns_uri_utf[] = "_c_ns_uri_utf";
static char __pyx_k___c_schema_doc[] = "_c_schema_doc";
static char __pyx_k___class_lookup[] = "_class_lookup";
static char __pyx_k___close_source[] = "_close_source";
static char __pyx_k___context_node[] = "_context_node";
static char __pyx_k___event_filter[] = "_event_filter";
static char __pyx_k___handleSaxEnd[] = "_handleSaxEnd";
static char __pyx_k___initTagMatch[] = "_initTagMatch";
static char __pyx_k___next_element[] = "_next_element";
static char __pyx_k___origSaxCData[] = "_origSaxCData";
static char __pyx_k___origSaxStart[] = "_origSaxStart";
static char __pyx_k___setTagFilter[] = "_setTagFilter";
static char __pyx_k___source_proxy[] = "_source_proxy";
static char __pyx_k___store_raised[] = "_store_raised";
static char __pyx_k___target_start[] = "_target_start";
static char __pyx_k__class_mapping[] = "class_mapping";
static char __pyx_k__comment_class[] = "comment_class";
static char __pyx_k__compresslevel[] = "compresslevel";
static char __pyx_k__element_class[] = "element_class";
static char __pyx_k__enable_regexp[] = "enable_regexp";
static char __pyx_k__output_parent[] = "output_parent";
static char __pyx_k__parse_options[] = "parse_options";
static char __pyx_k__smart_strings[] = "smart_strings";
static char __pyx_k__with_comments[] = "with_comments";
static char __pyx_k__write_network[] = "write_network";
static char __pyx_k__AssertionError[] = "AssertionError";
static char __pyx_k__AttributeError[] = "AttributeError";
static char __pyx_k__LIBXML_VERSION[] = "LIBXML_VERSION";
static char __pyx_k__XMLSchemaError[] = "XMLSchemaError";
static char __pyx_k__XMLSyntaxError[] = "XMLSyntaxError";
static char __pyx_k__XMLTreeBuilder[] = "XMLTreeBuilder";
static char __pyx_k__XPathEvalError[] = "XPathEvalError";
static char __pyx_k__XPathEvaluator[] = "XPathEvaluator";
static char __pyx_k__XSLTApplyError[] = "XSLTApplyError";
static char __pyx_k__XSLTParseError[] = "XSLTParseError";
static char __pyx_k___assertHasRoot[] = "_assertHasRoot";
static char __pyx_k___buffer_refcnt[] = "_buffer_refcnt";
static char __pyx_k___class_mapping[] = "_class_mapping";
static char __pyx_k___createContext[] = "_createContext";
static char __pyx_k___element_stack[] = "_element_stack";
static char __pyx_k___getThreadDict[] = "_getThreadDict";
static char __pyx_k___handleSaxData[] = "_handleSaxData";
static char __pyx_k___handle_result[] = "_handle_result";
static char __pyx_k___newParserCtxt[] = "_newParserCtxt";
static char __pyx_k___parse_options[] = "_parse_options";
static char __pyx_k___python_target[] = "_python_target";
static char __pyx_k___run_transform[] = "_run_transform";
static char __pyx_k___start_element[] = "_start_element";
static char __pyx_k__access_control[] = "access_control";
static char __pyx_k__attribute_name[] = "attribute_name";
static char __pyx_k__buildNewPrefix[] = "buildNewPrefix";
static char __pyx_k__dtd_validation[] = "dtd_validation";
static char __pyx_k__free_after_use[] = "free_after_use";
static char __pyx_k__fromstringlist[] = "fromstringlist";
static char __pyx_k__initParserDict[] = "initParserDict";
static char __pyx_k__internalSubset[] = "internalSubset";
static char __pyx_k__startElementNs[] = "startElementNs";
static char __pyx_k__strip_elements[] = "strip_elements";
static char __pyx_k__DocumentInvalid[] = "DocumentInvalid";
static char __pyx_k__LIBXSLT_VERSION[] = "LIBXSLT_VERSION";
static char __pyx_k__LxmlSyntaxError[] = "LxmlSyntaxError";
static char __pyx_k__SchematronError[] = "SchematronError";
static char __pyx_k___GlobalErrorLog[] = "_GlobalErrorLog";
static char __pyx_k___access_control[] = "_access_control";
static char __pyx_k___close_filelike[] = "_close_filelike";
static char __pyx_k___default_parser[] = "_default_parser";
static char __pyx_k___free_after_use[] = "_free_after_use";
static char __pyx_k___function_cache[] = "_function_cache";
static char __pyx_k___handleSaxStart[] = "_handleSaxStart";
static char __pyx_k___nextNodeAnyTag[] = "_nextNodeAnyTag";
static char __pyx_k___nsextract_path[] = "_nsextract_path";
static char __pyx_k___origSaxComment[] = "_origSaxComment";
static char __pyx_k___origSaxDoctype[] = "_origSaxDoctype";
static char __pyx_k___origSaxEndNoNs[] = "_origSaxEndNoNs";
static char __pyx_k___parser_context[] = "_parser_context";
static char __pyx_k___raiseImmutable[] = "_raiseImmutable";
static char __pyx_k___receiveGeneric[] = "_receiveGeneric";
static char __pyx_k___setEventFilter[] = "_setEventFilter";
static char __pyx_k___target_comment[] = "_target_comment";
static char __pyx_k___target_doctype[] = "_target_doctype";
static char __pyx_k___temp_documents[] = "_temp_documents";
static char __pyx_k__clear_error_log[] = "clear_error_log";
static char __pyx_k__element_factory[] = "element_factory";
static char __pyx_k__element_or_tree[] = "element_or_tree";
static char __pyx_k__remove_comments[] = "remove_comments";
static char __pyx_k__replaceEntities[] = "replaceEntities";
static char __pyx_k__tree_or_element[] = "tree_or_element";
static char __pyx_k__xml_declaration[] = "xml_declaration";
static char __pyx_k__DTDValidateError[] = "DTDValidateError";
static char __pyx_k__XPathResultError[] = "XPathResultError";
static char __pyx_k__XPathSyntaxError[] = "XPathSyntaxError";
static char __pyx_k____getattribute__[] = "__getattribute__";
static char __pyx_k___cleanup_context[] = "_cleanup_context";
static char __pyx_k___clear_error_log[] = "_clear_error_log";
static char __pyx_k___lookup_function[] = "_lookup_function";
static char __pyx_k___newSaxValidator[] = "_newSaxValidator";
static char __pyx_k___parseUnicodeDoc[] = "_parseUnicodeDoc";
static char __pyx_k___raise_if_stored[] = "_raise_if_stored";
static char __pyx_k___release_context[] = "_release_context";
static char __pyx_k___remove_comments[] = "_remove_comments";
static char __pyx_k___store_exception[] = "_store_exception";
static char __pyx_k__backslashreplace[] = "backslashreplace";
static char __pyx_k__default_resolver[] = "default_resolver";
static char __pyx_k__etree_or_element[] = "etree_or_element";
static char __pyx_k__function_mapping[] = "function_mapping";
static char __pyx_k__getDefaultParser[] = "getDefaultParser";
static char __pyx_k__register_context[] = "register_context";
static char __pyx_k__resolve_entities[] = "resolve_entities";
static char __pyx_k__setDefaultParser[] = "setDefaultParser";
static char __pyx_k__strip_attributes[] = "strip_attributes";
static char __pyx_k__ETCompatXMLParser[] = "ETCompatXMLParser";
static char __pyx_k__FunctionNamespace[] = "FunctionNamespace";
static char __pyx_k__LxmlRegistryError[] = "LxmlRegistryError";
static char __pyx_k__RelaxNGErrorTypes[] = "RelaxNGErrorTypes";
static char __pyx_k__RelaxNGParseError[] = "RelaxNGParseError";
static char __pyx_k__XPATH_LOCATIONSET[] = "XPATH_LOCATIONSET";
static char __pyx_k__XSLTAccessControl[] = "XSLTAccessControl";
static char __pyx_k___accepted_domains[] = "_accepted_domains";
static char __pyx_k___default_encoding[] = "_default_encoding";
static char __pyx_k___default_resolver[] = "_default_resolver";
static char __pyx_k___etree_or_element[] = "_etree_or_element";
static char __pyx_k___getParserContext[] = "_getParserContext";
static char __pyx_k___handleSaxComment[] = "_handleSaxComment";
static char __pyx_k___handleSaxDoctype[] = "_handleSaxDoctype";
static char __pyx_k___nextNodeMatchTag[] = "_nextNodeMatchTag";
static char __pyx_k___origSaxStartNoNs[] = "_origSaxStartNoNs";
static char __pyx_k___parseDocFromFile[] = "_parseDocFromFile";
static char __pyx_k___raise_eval_error[] = "_raise_eval_error";
static char __pyx_k___read_more_events[] = "_read_more_events";
static char __pyx_k___register_context[] = "_register_context";
static char __pyx_k___sax_event_filter[] = "_sax_event_filter";
static char __pyx_k__filter_from_level[] = "filter_from_level";
static char __pyx_k__initThreadDictRef[] = "initThreadDictRef";
static char __pyx_k__popImpliedContext[] = "popImpliedContext";
static char __pyx_k__registerVariables[] = "registerVariables";
static char __pyx_k__remove_blank_text[] = "remove_blank_text";
static char __pyx_k__ElementClassLookup[] = "ElementClassLookup";
static char __pyx_k__SerialisationError[] = "SerialisationError";
static char __pyx_k__UnicodeDecodeError[] = "UnicodeDecodeError";
static char __pyx_k__UnicodeEncodeError[] = "UnicodeEncodeError";
static char __pyx_k__XPathFunctionError[] = "XPathFunctionError";
static char __pyx_k__XSLTExtensionError[] = "XSLTExtensionError";
static char __pyx_k___createParserInput[] = "_createParserInput";
static char __pyx_k___dependent_proxies[] = "_dependent_proxies";
static char __pyx_k___element_stack_pop[] = "_element_stack_pop";
static char __pyx_k___eval_context_dict[] = "_eval_context_dict";
static char __pyx_k___fallback_function[] = "_fallback_function";
static char __pyx_k___findOrBuildNodeNs[] = "_findOrBuildNodeNs";
static char __pyx_k___global_namespaces[] = "_global_namespaces";
static char __pyx_k___handleParseResult[] = "_handleParseResult";
static char __pyx_k___initParserContext[] = "_initParserContext";
static char __pyx_k___newPushParserCtxt[] = "_newPushParserCtxt";
static char __pyx_k___raise_parse_error[] = "_raise_parse_error";
static char __pyx_k___release_temp_refs[] = "_release_temp_refs";
static char __pyx_k___set_xpath_context[] = "_set_xpath_context";
static char __pyx_k___start_takes_nsmap[] = "_start_takes_nsmap";
static char __pyx_k__attribute_defaults[] = "attribute_defaults";
static char __pyx_k__cleanup_namespaces[] = "cleanup_namespaces";
static char __pyx_k__filter_from_errors[] = "filter_from_errors";
static char __pyx_k__findImpliedContext[] = "findImpliedContext";
static char __pyx_k__get_default_parser[] = "get_default_parser";
static char __pyx_k__getdefaultencoding[] = "getdefaultencoding";
static char __pyx_k__pushImpliedContext[] = "pushImpliedContext";
static char __pyx_k__register_namespace[] = "register_namespace";
static char __pyx_k__set_default_parser[] = "set_default_parser";
static char __pyx_k__unregister_context[] = "unregister_context";
static char __pyx_k__NotImplementedError[] = "NotImplementedError";
static char __pyx_k__XMLSchemaParseError[] = "XMLSchemaParseError";
static char __pyx_k___TargetParserResult[] = "_TargetParserResult";
static char __pyx_k___append_log_message[] = "_append_log_message";
static char __pyx_k___assureDocGetsFreed[] = "_assureDocGetsFreed";
static char __pyx_k___createOutputBuffer[] = "_createOutputBuffer";
static char __pyx_k___extension_elements[] = "_extension_elements";
static char __pyx_k___handleSaxException[] = "_handleSaxException";
static char __pyx_k___resetParserContext[] = "_resetParserContext";
static char __pyx_k___setSaxParserTarget[] = "_setSaxParserTarget";
static char __pyx_k__build_smart_strings[] = "build_smart_strings";
static char __pyx_k__initXPathParserDict[] = "initXPathParserDict";
static PyObject *__pyx_kp_s_1;
static PyObject *__pyx_kp_u_100;
static PyObject *__pyx_kp_u_101;
static PyObject *__pyx_kp_b_102;
static PyObject *__pyx_kp_u_102;
static PyObject *__pyx_kp_u_106;
static PyObject *__pyx_kp_u_11;
static PyObject *__pyx_kp_u_113;
static PyObject *__pyx_kp_u_114;
static PyObject *__pyx_kp_u_12;
static PyObject *__pyx_kp_u_124;
static PyObject *__pyx_kp_u_125;
static PyObject *__pyx_kp_u_128;
static PyObject *__pyx_kp_s_129;
static PyObject *__pyx_kp_u_13;
static PyObject *__pyx_n_s_130;
static PyObject *__pyx_kp_b_132;
static PyObject *__pyx_kp_s_132;
static PyObject *__pyx_kp_u_132;
static PyObject *__pyx_kp_s_133;
static PyObject *__pyx_kp_u_134;
static PyObject *__pyx_kp_u_135;
static PyObject *__pyx_kp_u_136;
static PyObject *__pyx_kp_u_137;
static PyObject *__pyx_kp_u_138;
static PyObject *__pyx_kp_u_14;
static PyObject *__pyx_kp_s_140;
static PyObject *__pyx_kp_u_141;
static PyObject *__pyx_kp_u_142;
static PyObject *__pyx_kp_u_143;
static PyObject *__pyx_kp_u_144;
static PyObject *__pyx_kp_u_148;
static PyObject *__pyx_kp_u_149;
static PyObject *__pyx_kp_u_15;
static PyObject *__pyx_n_s_150;
static PyObject *__pyx_kp_u_151;
static PyObject *__pyx_kp_u_152;
static PyObject *__pyx_n_s_153;
static PyObject *__pyx_kp_u_154;
static PyObject *__pyx_kp_u_155;
static PyObject *__pyx_kp_u_156;
static PyObject *__pyx_kp_s_157;
static PyObject *__pyx_kp_u_158;
static PyObject *__pyx_n_s_159;
static PyObject *__pyx_kp_u_16;
static PyObject *__pyx_n_u_160;
static PyObject *__pyx_n_s_161;
static PyObject *__pyx_n_s_167;
static PyObject *__pyx_kp_u_168;
static PyObject *__pyx_kp_u_169;
static PyObject *__pyx_kp_u_17;
static PyObject *__pyx_kp_u_170;
static PyObject *__pyx_kp_u_171;
static PyObject *__pyx_n_s_172;
static PyObject *__pyx_kp_u_173;
static PyObject *__pyx_kp_u_174;
static PyObject *__pyx_n_s_175;
static PyObject *__pyx_n_s_176;
static PyObject *__pyx_n_s_177;
static PyObject *__pyx_n_s_178;
static PyObject *__pyx_kp_u_179;
static PyObject *__pyx_kp_u_18;
static PyObject *__pyx_kp_u_180;
static PyObject *__pyx_n_s_181;
static PyObject *__pyx_n_s_182;
static PyObject *__pyx_kp_u_183;
static PyObject *__pyx_n_s_184;
static PyObject *__pyx_n_s_185;
static PyObject *__pyx_kp_u_186;
static PyObject *__pyx_n_s_187;
static PyObject *__pyx_kp_u_188;
static PyObject *__pyx_kp_u_189;
static PyObject *__pyx_kp_u_19;
static PyObject *__pyx_n_s_190;
static PyObject *__pyx_kp_u_191;
static PyObject *__pyx_kp_u_20;
static PyObject *__pyx_kp_s_21;
static PyObject *__pyx_kp_s_22;
static PyObject *__pyx_n_s_225;
static PyObject *__pyx_kp_u_226;
static PyObject *__pyx_kp_u_227;
static PyObject *__pyx_kp_u_228;
static PyObject *__pyx_n_s_229;
static PyObject *__pyx_kp_u_230;
static PyObject *__pyx_kp_u_231;
static PyObject *__pyx_kp_u_232;
static PyObject *__pyx_kp_u_233;
static PyObject *__pyx_kp_u_234;
static PyObject *__pyx_n_s_235;
static PyObject *__pyx_kp_u_236;
static PyObject *__pyx_kp_u_237;
static PyObject *__pyx_kp_u_239;
static PyObject *__pyx_kp_s_24;
static PyObject *__pyx_kp_u_240;
static PyObject *__pyx_kp_b_25;
static PyObject *__pyx_kp_s_25;
static PyObject *__pyx_kp_u_25;
static PyObject *__pyx_kp_u_251;
static PyObject *__pyx_kp_u_255;
static PyObject *__pyx_kp_u_256;
static PyObject *__pyx_kp_u_258;
static PyObject *__pyx_kp_u_259;
static PyObject *__pyx_kp_u_260;
static PyObject *__pyx_kp_u_261;
static PyObject *__pyx_kp_u_262;
static PyObject *__pyx_kp_u_27;
static PyObject *__pyx_kp_u_278;
static PyObject *__pyx_kp_u_28;
static PyObject *__pyx_kp_u_280;
static PyObject *__pyx_kp_u_286;
static PyObject *__pyx_kp_u_289;
static PyObject *__pyx_kp_u_29;
static PyObject *__pyx_kp_u_290;
static PyObject *__pyx_kp_u_291;
static PyObject *__pyx_kp_s_292;
static PyObject *__pyx_kp_s_293;
static PyObject *__pyx_n_s_294;
static PyObject *__pyx_n_s_295;
static PyObject *__pyx_kp_u_296;
static PyObject *__pyx_kp_u_297;
static PyObject *__pyx_kp_u_298;
static PyObject *__pyx_n_s_299;
static PyObject *__pyx_kp_u_30;
static PyObject *__pyx_n_s_300;
static PyObject *__pyx_kp_u_301;
static PyObject *__pyx_kp_u_302;
static PyObject *__pyx_kp_u_303;
static PyObject *__pyx_kp_u_304;
static PyObject *__pyx_kp_u_305;
static PyObject *__pyx_kp_b_309;
static PyObject *__pyx_kp_u_31;
static PyObject *__pyx_n_s_310;
static PyObject *__pyx_kp_u_311;
static PyObject *__pyx_kp_s_312;
static PyObject *__pyx_kp_u_313;
static PyObject *__pyx_kp_u_314;
static PyObject *__pyx_kp_u_315;
static PyObject *__pyx_kp_u_316;
static PyObject *__pyx_kp_u_317;
static PyObject *__pyx_n_s_318;
static PyObject *__pyx_n_s_319;
static PyObject *__pyx_kp_u_32;
static PyObject *__pyx_n_s_320;
static PyObject *__pyx_kp_u_321;
static PyObject *__pyx_n_s_322;
static PyObject *__pyx_n_s_323;
static PyObject *__pyx_n_s_324;
static PyObject *__pyx_n_s_325;
static PyObject *__pyx_n_s_326;
static PyObject *__pyx_n_s_327;
static PyObject *__pyx_n_s_328;
static PyObject *__pyx_kp_u_329;
static PyObject *__pyx_kp_u_33;
static PyObject *__pyx_kp_u_331;
static PyObject *__pyx_kp_u_332;
static PyObject *__pyx_kp_s_335;
static PyObject *__pyx_kp_u_34;
static PyObject *__pyx_kp_b_346;
static PyObject *__pyx_kp_u_348;
static PyObject *__pyx_kp_u_35;
static PyObject *__pyx_kp_u_354;
static PyObject *__pyx_kp_u_356;
static PyObject *__pyx_kp_u_357;
static PyObject *__pyx_kp_u_358;
static PyObject *__pyx_kp_u_36;
static PyObject *__pyx_kp_u_360;
static PyObject *__pyx_n_s_361;
static PyObject *__pyx_kp_u_362;
static PyObject *__pyx_kp_s_365;
static PyObject *__pyx_kp_u_366;
static PyObject *__pyx_kp_u_367;
static PyObject *__pyx_n_s_368;
static PyObject *__pyx_kp_u_369;
static PyObject *__pyx_kp_u_37;
static PyObject *__pyx_kp_b_371;
static PyObject *__pyx_kp_u_371;
static PyObject *__pyx_kp_u_372;
static PyObject *__pyx_kp_u_373;
static PyObject *__pyx_kp_u_374;
static PyObject *__pyx_kp_u_375;
static PyObject *__pyx_kp_u_376;
static PyObject *__pyx_kp_u_377;
static PyObject *__pyx_kp_u_378;
static PyObject *__pyx_kp_u_379;
static PyObject *__pyx_kp_u_38;
static PyObject *__pyx_kp_s_380;
static PyObject *__pyx_n_s_382;
static PyObject *__pyx_n_s_383;
static PyObject *__pyx_kp_u_384;
static PyObject *__pyx_kp_u_385;
static PyObject *__pyx_kp_u_39;
static PyObject *__pyx_kp_u_390;
static PyObject *__pyx_kp_u_391;
static PyObject *__pyx_kp_u_392;
static PyObject *__pyx_kp_u_393;
static PyObject *__pyx_kp_s_394;
static PyObject *__pyx_kp_u_395;
static PyObject *__pyx_kp_u_396;
static PyObject *__pyx_kp_u_398;
static PyObject *__pyx_kp_u_399;
static PyObject *__pyx_kp_u_4;
static PyObject *__pyx_kp_u_40;
static PyObject *__pyx_kp_u_400;
static PyObject *__pyx_kp_u_401;
static PyObject *__pyx_kp_s_402;
static PyObject *__pyx_n_s_403;
static PyObject *__pyx_kp_u_404;
static PyObject *__pyx_n_s_405;
static PyObject *__pyx_n_s_406;
static PyObject *__pyx_kp_b_408;
static PyObject *__pyx_kp_u_408;
static PyObject *__pyx_kp_u_409;
static PyObject *__pyx_n_s_41;
static PyObject *__pyx_kp_u_410;
static PyObject *__pyx_kp_s_411;
static PyObject *__pyx_n_s_412;
static PyObject *__pyx_kp_u_413;
static PyObject *__pyx_kp_s_414;
static PyObject *__pyx_kp_u_415;
static PyObject *__pyx_n_s_416;
static PyObject *__pyx_kp_u_417;
static PyObject *__pyx_kp_s_418;
static PyObject *__pyx_n_s_419;
static PyObject *__pyx_kp_u_42;
static PyObject *__pyx_kp_u_420;
static PyObject *__pyx_kp_u_43;
static PyObject *__pyx_kp_u_44;
static PyObject *__pyx_kp_u_45;
static PyObject *__pyx_kp_u_457;
static PyObject *__pyx_n_s_458;
static PyObject *__pyx_n_s_459;
static PyObject *__pyx_kp_u_46;
static PyObject *__pyx_n_s_460;
static PyObject *__pyx_n_s_461;
static PyObject *__pyx_n_s_462;
static PyObject *__pyx_n_s_463;
static PyObject *__pyx_n_s_464;
static PyObject *__pyx_n_s_465;
static PyObject *__pyx_n_s_466;
static PyObject *__pyx_n_s_467;
static PyObject *__pyx_n_s_468;
static PyObject *__pyx_n_s_469;
static PyObject *__pyx_kp_u_47;
static PyObject *__pyx_n_s_470;
static PyObject *__pyx_kp_b_472;
static PyObject *__pyx_kp_b_473;
static PyObject *__pyx_kp_b_474;
static PyObject *__pyx_kp_b_475;
static PyObject *__pyx_kp_b_476;
static PyObject *__pyx_kp_b_477;
static PyObject *__pyx_kp_b_478;
static PyObject *__pyx_kp_b_479;
static PyObject *__pyx_n_s_481;
static PyObject *__pyx_kp_s_482;
static PyObject *__pyx_kp_s_483;
static PyObject *__pyx_kp_s_484;
static PyObject *__pyx_kp_u_485;
static PyObject *__pyx_kp_u_487;
static PyObject *__pyx_kp_u_488;
static PyObject *__pyx_kp_s_490;
static PyObject *__pyx_kp_s_491;
static PyObject *__pyx_kp_s_492;
static PyObject *__pyx_kp_s_493;
static PyObject *__pyx_kp_u_494;
static PyObject *__pyx_kp_u_496;
static PyObject *__pyx_kp_u_498;
static PyObject *__pyx_kp_u_499;
static PyObject *__pyx_kp_b_5;
static PyObject *__pyx_kp_u_5;
static PyObject *__pyx_kp_u_500;
static PyObject *__pyx_kp_u_501;
static PyObject *__pyx_kp_u_502;
static PyObject *__pyx_kp_u_503;
static PyObject *__pyx_kp_u_504;
static PyObject *__pyx_kp_u_505;
static PyObject *__pyx_kp_u_506;
static PyObject *__pyx_kp_u_507;
static PyObject *__pyx_kp_u_508;
static PyObject *__pyx_kp_u_510;
static PyObject *__pyx_kp_s_512;
static PyObject *__pyx_kp_s_513;
static PyObject *__pyx_kp_s_514;
static PyObject *__pyx_kp_s_515;
static PyObject *__pyx_kp_s_516;
static PyObject *__pyx_n_s_517;
static PyObject *__pyx_kp_s_518;
static PyObject *__pyx_kp_s_519;
static PyObject *__pyx_kp_s_520;
static PyObject *__pyx_kp_s_521;
static PyObject *__pyx_kp_s_522;
static PyObject *__pyx_kp_s_523;
static PyObject *__pyx_kp_b_524;
static PyObject *__pyx_kp_b_526;
static PyObject *__pyx_kp_s_528;
static PyObject *__pyx_kp_s_529;
static PyObject *__pyx_kp_s_530;
static PyObject *__pyx_kp_s_531;
static PyObject *__pyx_kp_s_532;
static PyObject *__pyx_kp_u_533;
static PyObject *__pyx_kp_u_534;
static PyObject *__pyx_kp_s_536;
static PyObject *__pyx_kp_s_537;
static PyObject *__pyx_kp_s_538;
static PyObject *__pyx_kp_s_539;
static PyObject *__pyx_kp_s_540;
static PyObject *__pyx_kp_s_541;
static PyObject *__pyx_kp_s_542;
static PyObject *__pyx_kp_s_543;
static PyObject *__pyx_kp_s_544;
static PyObject *__pyx_kp_s_545;
static PyObject *__pyx_kp_u_546;
static PyObject *__pyx_kp_s_548;
static PyObject *__pyx_kp_s_549;
static PyObject *__pyx_kp_u_55;
static PyObject *__pyx_kp_s_550;
static PyObject *__pyx_kp_u_551;
static PyObject *__pyx_kp_u_552;
static PyObject *__pyx_kp_u_58;
static PyObject *__pyx_kp_u_59;
static PyObject *__pyx_kp_u_60;
static PyObject *__pyx_kp_u_61;
static PyObject *__pyx_kp_u_62;
static PyObject *__pyx_kp_u_63;
static PyObject *__pyx_kp_u_64;
static PyObject *__pyx_kp_u_65;
static PyObject *__pyx_kp_u_66;
static PyObject *__pyx_kp_u_67;
static PyObject *__pyx_kp_u_68;
static PyObject *__pyx_kp_u_69;
static PyObject *__pyx_kp_u_70;
static PyObject *__pyx_kp_u_71;
static PyObject *__pyx_kp_u_72;
static PyObject *__pyx_kp_u_77;
static PyObject *__pyx_kp_u_78;
static PyObject *__pyx_n_s_79;
static PyObject *__pyx_kp_u_80;
static PyObject *__pyx_kp_u_81;
static PyObject *__pyx_kp_u_82;
static PyObject *__pyx_kp_u_83;
static PyObject *__pyx_kp_u_84;
static PyObject *__pyx_kp_u_85;
static PyObject *__pyx_n_s_86;
static PyObject *__pyx_kp_u_87;
static PyObject *__pyx_kp_u_88;
static PyObject *__pyx_kp_u_89;
static PyObject *__pyx_kp_s_94;
static PyObject *__pyx_kp_s_96;
static PyObject *__pyx_kp_s_98;
static PyObject *__pyx_n_b__A;
static PyObject *__pyx_n_u__ASCII;
static PyObject *__pyx_n_s__AssertionError;
static PyObject *__pyx_n_s__AttributeError;
static PyObject *__pyx_n_s__BytesIO;
static PyObject *__pyx_n_s__C14NError;
static PyObject *__pyx_n_s__CDATA;
static PyObject *__pyx_n_s__CRITICAL;
static PyObject *__pyx_n_s__Comment;
static PyObject *__pyx_n_s__CommentBase;
static PyObject *__pyx_n_s__DEBUG;
static PyObject *__pyx_n_s__DENY_ALL;
static PyObject *__pyx_n_s__DENY_WRITE;
static PyObject *__pyx_n_s__DTD;
static PyObject *__pyx_n_s__DTDError;
static PyObject *__pyx_n_s__DTDParseError;
static PyObject *__pyx_n_s__DTDValidateError;
static PyObject *__pyx_n_s__DocumentInvalid;
static PyObject *__pyx_n_s__ERROR;
static PyObject *__pyx_n_s__ETCompatXMLParser;
static PyObject *__pyx_n_s__ETXPath;
static PyObject *__pyx_n_s__Element;
static PyObject *__pyx_n_s__ElementBase;
static PyObject *__pyx_n_s__ElementClassLookup;
static PyObject *__pyx_n_s__ElementTree;
static PyObject *__pyx_n_s__Entity;
static PyObject *__pyx_n_s__EntityBase;
static PyObject *__pyx_n_s__Error;
static PyObject *__pyx_n_s__ErrorDomains;
static PyObject *__pyx_n_s__ErrorLevels;
static PyObject *__pyx_n_s__ErrorTypes;
static PyObject *__pyx_n_s__Exception;
static PyObject *__pyx_n_s__Extension;
static PyObject *__pyx_n_s__ExternalID;
static PyObject *__pyx_n_s__FATAL;
static PyObject *__pyx_n_s__FunctionNamespace;
static PyObject *__pyx_n_s__FutureWarning;
static PyObject *__pyx_n_s__GzipFile;
static PyObject *__pyx_n_s__HTML;
static PyObject *__pyx_n_s__HTMLParser;
static PyObject *__pyx_n_s__IGNORECASE;
static PyObject *__pyx_n_s__IOError;
static PyObject *__pyx_n_s__ImportError;
static PyObject *__pyx_n_s__IndexError;
static PyObject *__pyx_n_s__KeyError;
static PyObject *__pyx_n_s__LIBXML_VERSION;
static PyObject *__pyx_n_s__LIBXSLT_VERSION;
static PyObject *__pyx_n_s__LXML_VERSION;
static PyObject *__pyx_n_s__LookupError;
static PyObject *__pyx_n_s__LxmlError;
static PyObject *__pyx_n_s__LxmlRegistryError;
static PyObject *__pyx_n_s__LxmlSyntaxError;
static PyObject *__pyx_n_s__NAMESPACE;
static PyObject *__pyx_n_s__NotImplementedError;
static PyObject *__pyx_n_s__PARSER;
static PyObject *__pyx_n_s__PI;
static PyObject *__pyx_n_u__PI;
static PyObject *__pyx_n_s__PIBase;
static PyObject *__pyx_n_s__ParseError;
static PyObject *__pyx_n_s__ParserError;
static PyObject *__pyx_n_s__PyErrorLog;
static PyObject *__pyx_n_s__QName;
static PyObject *__pyx_n_s__RELAXNGV;
static PyObject *__pyx_n_s__RelaxNG;
static PyObject *__pyx_n_s__RelaxNGError;
static PyObject *__pyx_n_s__RelaxNGErrorTypes;
static PyObject *__pyx_n_s__RelaxNGParseError;
static PyObject *__pyx_n_s__Resolver;
static PyObject *__pyx_n_s__Schematron;
static PyObject *__pyx_n_s__SchematronError;
static PyObject *__pyx_n_s__SerialisationError;
static PyObject *__pyx_n_s__StopIteration;
static PyObject *__pyx_n_s__StringIO;
static PyObject *__pyx_n_s__SubElement;
static PyObject *__pyx_n_s__SyntaxError;
static PyObject *__pyx_n_s__SystemID;
static PyObject *__pyx_n_s__TAG;
static PyObject *__pyx_n_s__TreeBuilder;
static PyObject *__pyx_n_s__TypeError;
static PyObject *__pyx_n_s__U;
static PyObject *__pyx_n_s__UNICODE;
static PyObject *__pyx_n_s__URL;
static PyObject *__pyx_n_u__UTF8;
static PyObject *__pyx_n_s__UnicodeDecodeError;
static PyObject *__pyx_n_s__UnicodeEncodeError;
static PyObject *__pyx_n_s__ValueError;
static PyObject *__pyx_n_s__WARNING;
static PyObject *__pyx_n_s__XInclude;
static PyObject *__pyx_n_s__XIncludeError;
static PyObject *__pyx_n_s__XML;
static PyObject *__pyx_n_s__XMLDTDID;
static PyObject *__pyx_n_s__XMLID;
static PyObject *__pyx_n_s__XMLParser;
static PyObject *__pyx_n_s__XMLSchema;
static PyObject *__pyx_n_s__XMLSchemaError;
static PyObject *__pyx_n_s__XMLSchemaParseError;
static PyObject *__pyx_n_s__XMLSyntaxError;
static PyObject *__pyx_n_s__XMLTreeBuilder;
static PyObject *__pyx_n_u__XPATH_LOCATIONSET;
static PyObject *__pyx_n_u__XPATH_POINT;
static PyObject *__pyx_n_u__XPATH_RANGE;
static PyObject *__pyx_n_u__XPATH_USERS;
static PyObject *__pyx_n_s__XPath;
static PyObject *__pyx_n_s__XPathError;
static PyObject *__pyx_n_s__XPathEvalError;
static PyObject *__pyx_n_s__XPathEvaluator;
static PyObject *__pyx_n_s__XPathFunctionError;
static PyObject *__pyx_n_s__XPathResultError;
static PyObject *__pyx_n_s__XPathSyntaxError;
static PyObject *__pyx_n_s__XSLT;
static PyObject *__pyx_n_s__XSLTAccessControl;
static PyObject *__pyx_n_s__XSLTApplyError;
static PyObject *__pyx_n_s__XSLTError;
static PyObject *__pyx_n_s__XSLTExtension;
static PyObject *__pyx_n_s__XSLTExtensionError;
static PyObject *__pyx_n_s__XSLTParseError;
static PyObject *__pyx_n_s__XSLTSaveError;
static PyObject *__pyx_n_u___;
static PyObject *__pyx_n_u___GlobalErrorLog;
static PyObject *__pyx_n_s___TargetParserResult;
static PyObject *__pyx_n_s____all__;
static PyObject *__pyx_n_s____builtin__;
static PyObject *__pyx_n_s____class__;
static PyObject *__pyx_n_s____copy__;
static PyObject *__pyx_n_u____dict__;
static PyObject *__pyx_n_s____docformat__;
static PyObject *__pyx_n_s____getattribute__;
static PyObject *__pyx_n_s____hash__;
static PyObject *__pyx_n_s____init__;
static PyObject *__pyx_n_s____main__;
static PyObject *__pyx_n_s____name__;
static PyObject *__pyx_n_s____next__;
static PyObject *__pyx_n_s____test__;
static PyObject *__pyx_n_s____unicode__;
static PyObject *__pyx_n_s____version__;
static PyObject *__pyx_n_s___accepted_domains;
static PyObject *__pyx_n_s___access_control;
static PyObject *__pyx_n_s___append_log_message;
static PyObject *__pyx_n_s___assertHasRoot;
static PyObject *__pyx_n_s___assertNode;
static PyObject *__pyx_n_s___assureDocGetsFreed;
static PyObject *__pyx_n_s___buffer;
static PyObject *__pyx_n_s___buffer_len;
static PyObject *__pyx_n_s___buffer_refcnt;
static PyObject *__pyx_n_s___build_items;
static PyObject *__pyx_n_s___build_keys;
static PyObject *__pyx_n_s___bytes;
static PyObject *__pyx_n_s___bytes_read;
static PyObject *__pyx_n_s___c_attr;
static PyObject *__pyx_n_s___c_ctxt;
static PyObject *__pyx_n_s___c_dict;
static PyObject *__pyx_n_s___c_doc;
static PyObject *__pyx_n_s___c_dtd;
static PyObject *__pyx_n_s___c_name;
static PyObject *__pyx_n_s___c_node;
static PyObject *__pyx_n_s___c_ns;
static PyObject *__pyx_n_s___c_ns_uri_utf;
static PyObject *__pyx_n_s___c_schema;
static PyObject *__pyx_n_s___c_schema_doc;
static PyObject *__pyx_n_s___c_style;
static PyObject *__pyx_n_s___c_style_doc;
static PyObject *__pyx_n_s___c_url;
static PyObject *__pyx_n_s___class_lookup;
static PyObject *__pyx_n_s___class_mapping;
static PyObject *__pyx_n_s___cleanup_context;
static PyObject *__pyx_n_s___clear_error_log;
static PyObject *__pyx_n_s___close_file;
static PyObject *__pyx_n_s___close_filelike;
static PyObject *__pyx_n_s___close_source;
static PyObject *__pyx_n_s___compile;
static PyObject *__pyx_n_s___compile_map;
static PyObject *__pyx_n_s___context;
static PyObject *__pyx_n_s___context_node;
static PyObject *__pyx_n_s___copy;
static PyObject *__pyx_n_s___createContext;
static PyObject *__pyx_n_s___createOutputBuffer;
static PyObject *__pyx_n_s___createParserInput;
static PyObject *__pyx_n_s___data;
static PyObject *__pyx_n_s___data_bytes;
static PyObject *__pyx_n_s___default_encoding;
static PyObject *__pyx_n_s___default_parser;
static PyObject *__pyx_n_s___default_resolver;
static PyObject *__pyx_n_s___dependent_proxies;
static PyObject *__pyx_n_s___doc;
static PyObject *__pyx_n_s___element;
static PyObject *__pyx_n_s___element_stack;
static PyObject *__pyx_n_s___element_stack_pop;
static PyObject *__pyx_n_s___elementpath;
static PyObject *__pyx_n_s___encoding;
static PyObject *__pyx_n_s___end_node;
static PyObject *__pyx_n_s___entries;
static PyObject *__pyx_n_s___error_log;
static PyObject *__pyx_n_s___etree_or_element;
static PyObject *__pyx_n_s___eval_arg;
static PyObject *__pyx_n_s___eval_context_dict;
static PyObject *__pyx_n_s___eval_lock;
static PyObject *__pyx_n_s___event_filter;
static PyObject *__pyx_n_s___event_index;
static PyObject *__pyx_n_s___events;
static PyObject *__pyx_n_s___exc;
static PyObject *__pyx_n_s___exc_context;
static PyObject *__pyx_n_s___exc_info;
static PyObject *__pyx_n_s___extension_elements;
static PyObject *__pyx_n_s___extensions;
static PyObject *__pyx_n_s___factory;
static PyObject *__pyx_n_s___fallback_function;
static PyObject *__pyx_n_s___file;
static PyObject *__pyx_n_s___filelike;
static PyObject *__pyx_n_s___filename;
static PyObject *__pyx_n_s___findOrBuildNodeNs;
static PyObject *__pyx_n_s___first_error;
static PyObject *__pyx_n_s___flush;
static PyObject *__pyx_n_s___for_html;
static PyObject *__pyx_n_s___free_after_use;
static PyObject *__pyx_n_s___function_cache;
static PyObject *__pyx_n_s___gc_doc;
static PyObject *__pyx_n_s___get;
static PyObject *__pyx_n_s___getName;
static PyObject *__pyx_n_s___getParserContext;
static PyObject *__pyx_n_s___getThreadDict;
static PyObject *__pyx_n_s___global_namespaces;
static PyObject *__pyx_n_s___handleParseResult;
static PyObject *__pyx_n_s___handleSaxComment;
static PyObject *__pyx_n_s___handleSaxData;
static PyObject *__pyx_n_s___handleSaxDoctype;
static PyObject *__pyx_n_s___handleSaxEnd;
static PyObject *__pyx_n_s___handleSaxException;
static PyObject *__pyx_n_s___handleSaxPi;
static PyObject *__pyx_n_s___handleSaxStart;
static PyObject *__pyx_n_s___handle_result;
static PyObject *__pyx_n_s___has_raised;
static PyObject *__pyx_n_s___hold;
static PyObject *__pyx_n_s___href;
static PyObject *__pyx_n_s___in_tail;
static PyObject *__pyx_n_s___index;
static PyObject *__pyx_n_s___init;
static PyObject *__pyx_n_s___initParserContext;
static PyObject *__pyx_n_s___initTagMatch;
static PyObject *__pyx_n_s___input;
static PyObject *__pyx_n_s___items;
static PyObject *__pyx_n_s___keys;
static PyObject *__pyx_n_s___keysvalues;
static PyObject *__pyx_n_s___last;
static PyObject *__pyx_n_s___lock;
static PyObject *__pyx_n_s___log;
static PyObject *__pyx_n_s___lookup_function;
static PyObject *__pyx_n_s___make_string;
static PyObject *__pyx_n_s___map_level;
static PyObject *__pyx_n_s___max_len;
static PyObject *__pyx_n_s___name;
static PyObject *__pyx_n_s___names;
static PyObject *__pyx_n_s___namespaces;
static PyObject *__pyx_n_s___newParserCtxt;
static PyObject *__pyx_n_s___newPushParserCtxt;
static PyObject *__pyx_n_s___newSaxValidator;
static PyObject *__pyx_n_s___nextEvent;
static PyObject *__pyx_n_s___nextNodeAnyTag;
static PyObject *__pyx_n_s___nextNodeMatchTag;
static PyObject *__pyx_n_s___next_element;
static PyObject *__pyx_n_s___next_node;
static PyObject *__pyx_n_s___node;
static PyObject *__pyx_n_s___node_stack;
static PyObject *__pyx_n_s___node_type;
static PyObject *__pyx_n_s___ns_counter;
static PyObject *__pyx_n_s___ns_stack;
static PyObject *__pyx_n_s___ns_uri;
static PyObject *__pyx_n_s___ns_uri_utf;
static PyObject *__pyx_n_s___nsextract_path;
static PyObject *__pyx_n_s___optval;
static PyObject *__pyx_n_s___origSaxCData;
static PyObject *__pyx_n_s___origSaxComment;
static PyObject *__pyx_n_s___origSaxData;
static PyObject *__pyx_n_s___origSaxDoctype;
static PyObject *__pyx_n_s___origSaxEnd;
static PyObject *__pyx_n_s___origSaxEndNoNs;
static PyObject *__pyx_n_s___origSaxPI;
static PyObject *__pyx_n_s___origSaxPi;
static PyObject *__pyx_n_s___origSaxStart;
static PyObject *__pyx_n_s___origSaxStartNoNs;
static PyObject *__pyx_n_s___parent;
static PyObject *__pyx_n_s___parseDoc;
static PyObject *__pyx_n_s___parseDocFromFile;
static PyObject *__pyx_n_s___parseUnicodeDoc;
static PyObject *__pyx_n_s___parse_chunk;
static PyObject *__pyx_n_s___parse_options;
static PyObject *__pyx_n_s___parser;
static PyObject *__pyx_n_s___parser_context;
static PyObject *__pyx_n_s___path;
static PyObject *__pyx_n_s___pop_event;
static PyObject *__pyx_n_s___pop_node;
static PyObject *__pyx_n_s___pop_ns;
static PyObject *__pyx_n_s___prefix;
static PyObject *__pyx_n_s___prefix_tail;
static PyObject *__pyx_n_s___prefix_utf;
static PyObject *__pyx_n_s___prefs;
static PyObject *__pyx_n_s___private;
static PyObject *__pyx_n_s___profile;
static PyObject *__pyx_n_s___pystrings;
static PyObject *__pyx_n_s___pytag;
static PyObject *__pyx_n_s___python_target;
static PyObject *__pyx_n_s___raiseImmutable;
static PyObject *__pyx_n_s___raise_eval_error;
static PyObject *__pyx_n_s___raise_if_stored;
static PyObject *__pyx_n_s___raise_parse_error;
static PyObject *__pyx_n_s___readDoc;
static PyObject *__pyx_n_s___readDtd;
static PyObject *__pyx_n_s___read_more_events;
static PyObject *__pyx_n_s___receive;
static PyObject *__pyx_n_s___receiveGeneric;
static PyObject *__pyx_n_s___register_context;
static PyObject *__pyx_n_s___release_context;
static PyObject *__pyx_n_s___release_temp_refs;
static PyObject *__pyx_n_s___remove_comments;
static PyObject *__pyx_n_s___remove_pis;
static PyObject *__pyx_n_s___resetParserContext;
static PyObject *__pyx_n_s___resolvers;
static PyObject *__pyx_n_s___root;
static PyObject *__pyx_n_s___run_transform;
static PyObject *__pyx_n_s___sax_event_filter;
static PyObject *__pyx_n_s___sax_plug;
static PyObject *__pyx_n_s___schema;
static PyObject *__pyx_n_s___setAccess;
static PyObject *__pyx_n_s___setError;
static PyObject *__pyx_n_s___setEventFilter;
static PyObject *__pyx_n_s___setFallback;
static PyObject *__pyx_n_s___setGeneric;
static PyObject *__pyx_n_s___setNodeNs;
static PyObject *__pyx_n_s___setSaxParserTarget;
static PyObject *__pyx_n_s___setTagFilter;
static PyObject *__pyx_n_s___setTarget;
static PyObject *__pyx_n_s___set_xpath_context;
static PyObject *__pyx_n_s___setupDict;
static PyObject *__pyx_n_s___source;
static PyObject *__pyx_n_s___source_proxy;
static PyObject *__pyx_n_s___start_element;
static PyObject *__pyx_n_s___start_node;
static PyObject *__pyx_n_s___start_takes_nsmap;
static PyObject *__pyx_n_s___storage;
static PyObject *__pyx_n_s___storeNext;
static PyObject *__pyx_n_s___store_exception;
static PyObject *__pyx_n_s___store_raised;
static PyObject *__pyx_n_s___strip_cdata;
static PyObject *__pyx_n_s___tag;
static PyObject *__pyx_n_s___tag_href;
static PyObject *__pyx_n_s___tag_name;
static PyObject *__pyx_n_s___tag_tuple;
static PyObject *__pyx_n_s___target;
static PyObject *__pyx_n_s___target_comment;
static PyObject *__pyx_n_s___target_data;
static PyObject *__pyx_n_s___target_doctype;
static PyObject *__pyx_n_s___target_end;
static PyObject *__pyx_n_s___target_pi;
static PyObject *__pyx_n_s___target_start;
static PyObject *__pyx_n_s___temp_documents;
static PyObject *__pyx_n_s___temp_refs;
static PyObject *__pyx_n_s___to_utf;
static PyObject *__pyx_n_s___top_node;
static PyObject *__pyx_n_s___type;
static PyObject *__pyx_n_s___unlock;
static PyObject *__pyx_n_s___url;
static PyObject *__pyx_n_s___utf8_data;
static PyObject *__pyx_n_s___utf_refs;
static PyObject *__pyx_n_s___valid_ctxt;
static PyObject *__pyx_n_s___validator;
static PyObject *__pyx_n_s___variables;
static PyObject *__pyx_n_s___xpath;
static PyObject *__pyx_n_s___xpathCtxt;
static PyObject *__pyx_n_s___xslt;
static PyObject *__pyx_n_s___xsltCtxt;
static PyObject *__pyx_n_s__abspath;
static PyObject *__pyx_n_s__access_control;
static PyObject *__pyx_n_s__add;
static PyObject *__pyx_n_s__addNamespace;
static PyObject *__pyx_n_u__alpha;
static PyObject *__pyx_n_s__append;
static PyObject *__pyx_n_b__ascii;
static PyObject *__pyx_n_s__attr;
static PyObject *__pyx_n_s__attrib;
static PyObject *__pyx_n_s__attribute_defaults;
static PyObject *__pyx_n_s__attribute_name;
static PyObject *__pyx_n_s__attributes;
static PyObject *__pyx_n_s__attrname;
static PyObject *__pyx_n_s__attrs;
static PyObject *__pyx_n_s__backslashreplace;
static PyObject *__pyx_n_s__base;
static PyObject *__pyx_n_s__base_url;
static PyObject *__pyx_n_u__beta;
static PyObject *__pyx_n_s__boolval;
static PyObject *__pyx_n_s__buf;
static PyObject *__pyx_n_s__buffer;
static PyObject *__pyx_n_s__buildNewPrefix;
static PyObject *__pyx_n_s__build_smart_strings;
static PyObject *__pyx_n_s__builtins;
static PyObject *__pyx_n_s__c14n;
static PyObject *__pyx_n_s__cdataBlock;
static PyObject *__pyx_n_s__characters;
static PyObject *__pyx_n_s__child;
static PyObject *__pyx_n_s__children;
static PyObject *__pyx_n_s__class_mapping;
static PyObject *__pyx_n_s__cleanup;
static PyObject *__pyx_n_s__cleanup_namespaces;
static PyObject *__pyx_n_s__clear;
static PyObject *__pyx_n_s__clear_error_log;
static PyObject *__pyx_n_s__close;
static PyObject *__pyx_n_s__code;
static PyObject *__pyx_n_s__column;
static PyObject *__pyx_n_s__comment;
static PyObject *__pyx_n_u__comment;
static PyObject *__pyx_n_s__comment_class;
static PyObject *__pyx_n_s__compact;
static PyObject *__pyx_n_s__compile;
static PyObject *__pyx_n_s__compression;
static PyObject *__pyx_n_s__compresslevel;
static PyObject *__pyx_n_s__connect;
static PyObject *__pyx_n_s__content;
static PyObject *__pyx_n_s__context;
static PyObject *__pyx_n_s__conv;
static PyObject *__pyx_n_s__copy;
static PyObject *__pyx_n_s__copyToBuffer;
static PyObject *__pyx_n_s__create_dir;
static PyObject *__pyx_n_u__create_dir;
static PyObject *__pyx_n_s__ctxt;
static PyObject *__pyx_n_s__cur;
static PyObject *__pyx_n_s__data;
static PyObject *__pyx_n_b__dc;
static PyObject *__pyx_n_s__decode;
static PyObject *__pyx_n_s__default;
static PyObject *__pyx_n_s__default_resolver;
static PyObject *__pyx_n_u__dev;
static PyObject *__pyx_n_s__dict;
static PyObject *__pyx_n_s__disableSAX;
static PyObject *__pyx_n_s__discard;
static PyObject *__pyx_n_s__disconnect;
static PyObject *__pyx_n_s__doc;
static PyObject *__pyx_n_s__docstring;
static PyObject *__pyx_n_s__doctype;
static PyObject *__pyx_n_s__domain;
static PyObject *__pyx_n_s__domain_name;
static PyObject *__pyx_n_s__domains;
static PyObject *__pyx_n_s__dtd_validation;
static PyObject *__pyx_n_s__dump;
static PyObject *__pyx_n_s__elem;
static PyObject *__pyx_n_s__element;
static PyObject *__pyx_n_u__element;
static PyObject *__pyx_n_s__element_class;
static PyObject *__pyx_n_s__element_factory;
static PyObject *__pyx_n_s__element_or_tree;
static PyObject *__pyx_n_s__elements;
static PyObject *__pyx_n_s__enable_regexp;
static PyObject *__pyx_n_s__encode;
static PyObject *__pyx_n_s__encoding;
static PyObject *__pyx_n_s__end;
static PyObject *__pyx_n_u__end;
static PyObject *__pyx_n_s__endElement;
static PyObject *__pyx_n_s__endElementNs;
static PyObject *__pyx_n_s__endNode;
static PyObject *__pyx_n_s__entities;
static PyObject *__pyx_n_s__entity;
static PyObject *__pyx_n_u__entity;
static PyObject *__pyx_n_s__entity_class;
static PyObject *__pyx_n_s__entries;
static PyObject *__pyx_n_s__enumerate;
static PyObject *__pyx_n_s__errNo;
static PyObject *__pyx_n_s__error;
static PyObject *__pyx_n_s__error_log;
static PyObject *__pyx_n_s__etree;
static PyObject *__pyx_n_s__etree_or_element;
static PyObject *__pyx_n_s__events;
static PyObject *__pyx_n_s__exc_context;
static PyObject *__pyx_n_s__exc_info;
static PyObject *__pyx_n_s__exclusive;
static PyObject *__pyx_n_s__execute;
static PyObject *__pyx_n_s__extSubset;
static PyObject *__pyx_n_s__extend;
static PyObject *__pyx_n_s__extensions;
static PyObject *__pyx_n_s__external_id;
static PyObject *__pyx_n_s__f;
static PyObject *__pyx_n_s__fallback;
static PyObject *__pyx_n_s__feed;
static PyObject *__pyx_n_s__file;
static PyObject *__pyx_n_s__filelike;
static PyObject *__pyx_n_s__filename;
static PyObject *__pyx_n_s__fileobj;
static PyObject *__pyx_n_s__filter_from_errors;
static PyObject *__pyx_n_s__filter_from_level;
static PyObject *__pyx_n_s__filter_types;
static PyObject *__pyx_n_s__find;
static PyObject *__pyx_n_s__findImpliedContext;
static PyObject *__pyx_n_s__findall;
static PyObject *__pyx_n_s__findtext;
static PyObject *__pyx_n_s__first_error;
static PyObject *__pyx_n_s__flags;
static PyObject *__pyx_n_s__floatval;
static PyObject *__pyx_n_s__for_html;
static PyObject *__pyx_n_s__format;
static PyObject *__pyx_n_s__free_after_use;
static PyObject *__pyx_n_s__free_context;
static PyObject *__pyx_n_s__fromstring;
static PyObject *__pyx_n_s__fromstringlist;
static PyObject *__pyx_n_s__function;
static PyObject *__pyx_n_s__functionURI;
static PyObject *__pyx_n_s__function_mapping;
static PyObject *__pyx_n_u__g;
static PyObject *__pyx_n_s__get;
static PyObject *__pyx_n_s__getDefaultParser;
static PyObject *__pyx_n_s__getLogger;
static PyObject *__pyx_n_s__get_default_parser;
static PyObject *__pyx_n_s__getargspec;
static PyObject *__pyx_n_s__getchildren;
static PyObject *__pyx_n_s__getdefaultencoding;
static PyObject *__pyx_n_s__getdoctype;
static PyObject *__pyx_n_s__getiterator;
static PyObject *__pyx_n_s__getnext;
static PyObject *__pyx_n_s__getparent;
static PyObject *__pyx_n_s__getroot;
static PyObject *__pyx_n_s__geturl;
static PyObject *__pyx_n_s__getvalue;
static PyObject *__pyx_n_u__getvalue;
static PyObject *__pyx_n_s__getxmlinfo;
static PyObject *__pyx_n_s__group;
static PyObject *__pyx_n_s__groups;
static PyObject *__pyx_n_s__gzip;
static PyObject *__pyx_n_s__hasdoctype;
static PyObject *__pyx_n_s__href;
static PyObject *__pyx_n_u__href;
static PyObject *__pyx_n_b__html;
static PyObject *__pyx_n_s__html;
static PyObject *__pyx_n_u__html;
static PyObject *__pyx_n_s__huge_tree;
static PyObject *__pyx_n_u__i;
static PyObject *__pyx_n_s__id;
static PyObject *__pyx_n_u__id;
static PyObject *__pyx_n_s__ids;
static PyObject *__pyx_n_s__inSubset;
static PyObject *__pyx_n_s__inclusive;
static PyObject *__pyx_n_s__index;
static PyObject *__pyx_n_s__initDocDict;
static PyObject *__pyx_n_s__initParserDict;
static PyObject *__pyx_n_s__initThreadDictRef;
static PyObject *__pyx_n_s__initXPathParserDict;
static PyObject *__pyx_n_s__initialized;
static PyObject *__pyx_n_s__input;
static PyObject *__pyx_n_s__input_node;
static PyObject *__pyx_n_s__insert;
static PyObject *__pyx_n_s__inspect;
static PyObject *__pyx_n_s__inst;
static PyObject *__pyx_n_s__int2;
static PyObject *__pyx_n_s__intSubset;
static PyObject *__pyx_n_s__internal;
static PyObject *__pyx_n_s__internalSubset;
static PyObject *__pyx_n_s__io;
static PyObject *__pyx_n_s__is_attribute;
static PyObject *__pyx_n_s__is_tail;
static PyObject *__pyx_n_s__is_text;
static PyObject *__pyx_n_s__iselement;
static PyObject *__pyx_n_s__isstandalone;
static PyObject *__pyx_n_s__isvalid;
static PyObject *__pyx_n_s__items;
static PyObject *__pyx_n_u__items;
static PyObject *__pyx_n_s__itemsize;
static PyObject *__pyx_n_s__iter;
static PyObject *__pyx_n_s__iterfind;
static PyObject *__pyx_n_s__iteritems;
static PyObject *__pyx_n_s__iterparse;
static PyObject *__pyx_n_s__iterwalk;
static PyObject *__pyx_n_s__join;
static PyObject *__pyx_n_s__key;
static PyObject *__pyx_n_s__last;
static PyObject *__pyx_n_s__lastError;
static PyObject *__pyx_n_s__last_error;
static PyObject *__pyx_n_s__len;
static PyObject *__pyx_n_s__length;
static PyObject *__pyx_n_s__level;
static PyObject *__pyx_n_s__level_map;
static PyObject *__pyx_n_s__level_name;
static PyObject *__pyx_n_s__line;
static PyObject *__pyx_n_s__load_dtd;
static PyObject *__pyx_n_s__loadsubset;
static PyObject *__pyx_n_s__localname;
static PyObject *__pyx_n_s__log;
static PyObject *__pyx_n_s__log_entry;
static PyObject *__pyx_n_s__logger;
static PyObject *__pyx_n_s__logger_name;
static PyObject *__pyx_n_s__logging;
static PyObject *__pyx_n_s__lookup;
static PyObject *__pyx_n_s__lower;
static PyObject *__pyx_n_b__match;
static PyObject *__pyx_n_s__match;
static PyObject *__pyx_n_u__match;
static PyObject *__pyx_n_u__matches;
static PyObject *__pyx_n_s__max_len;
static PyObject *__pyx_n_s__message;
static PyObject *__pyx_n_s__method;
static PyObject *__pyx_n_s__mode;
static PyObject *__pyx_n_s__module;
static PyObject *__pyx_n_s__myDoc;
static PyObject *__pyx_n_s__name;
static PyObject *__pyx_n_s__namespace;
static PyObject *__pyx_n_s__namespaces;
static PyObject *__pyx_n_s__ndim;
static PyObject *__pyx_n_s__new;
static PyObject *__pyx_n_s__new_element;
static PyObject *__pyx_n_s__next;
static PyObject *__pyx_n_s__no_network;
static PyObject *__pyx_n_s__node;
static PyObject *__pyx_n_s__nodeNr;
static PyObject *__pyx_n_s__nodeTab;
static PyObject *__pyx_n_s__nodesetval;
static PyObject *__pyx_n_s__notations;
static PyObject *__pyx_n_s__ns;
static PyObject *__pyx_n_s__nsDef;
static PyObject *__pyx_n_s__nsHash;
static PyObject *__pyx_n_s__ns_clean;
static PyObject *__pyx_n_s__ns_uri;
static PyObject *__pyx_n_s__nsmap;
static PyObject *__pyx_n_s__object;
static PyObject *__pyx_n_s__old;
static PyObject *__pyx_n_s__old_element;
static PyObject *__pyx_n_s__open;
static PyObject *__pyx_n_s__options;
static PyObject *__pyx_n_s__output;
static PyObject *__pyx_n_s__output_parent;
static PyObject *__pyx_n_s__parent;
static PyObject *__pyx_n_s__parse;
static PyObject *__pyx_n_s__parse_options;
static PyObject *__pyx_n_s__parseid;
static PyObject *__pyx_n_s__parser;
static PyObject *__pyx_n_s__path;
static PyObject *__pyx_n_s__pentities;
static PyObject *__pyx_n_s__pi;
static PyObject *__pyx_n_u__pi;
static PyObject *__pyx_n_s__pi_class;
static PyObject *__pyx_n_s__pop;
static PyObject *__pyx_n_s__popImpliedContext;
static PyObject *__pyx_n_s__position;
static PyObject *__pyx_n_s__preceding;
static PyObject *__pyx_n_s__prefix;
static PyObject *__pyx_n_s__prepare;
static PyObject *__pyx_n_s__pretty_print;
static PyObject *__pyx_n_s__prev;
static PyObject *__pyx_n_s__profile;
static PyObject *__pyx_n_s__profile_run;
static PyObject *__pyx_n_s__progressive;
static PyObject *__pyx_n_s__properties;
static PyObject *__pyx_n_s__public_id;
static PyObject *__pyx_n_s__pushEvent;
static PyObject *__pyx_n_s__pushImpliedContext;
static PyObject *__pyx_n_b__py;
static PyObject *__pyx_n_s__python;
static PyObject *__pyx_n_s__range;
static PyObject *__pyx_n_u__rb;
static PyObject *__pyx_n_b__rdf;
static PyObject *__pyx_n_s__re;
static PyObject *__pyx_n_s__read;
static PyObject *__pyx_n_u__read;
static PyObject *__pyx_n_s__read_file;
static PyObject *__pyx_n_u__read_file;
static PyObject *__pyx_n_s__read_network;
static PyObject *__pyx_n_u__read_network;
static PyObject *__pyx_n_s__readcallback;
static PyObject *__pyx_n_s__readonly;
static PyObject *__pyx_n_s__receive;
static PyObject *__pyx_n_s__recover;
static PyObject *__pyx_n_s__reference;
static PyObject *__pyx_n_s__regexp;
static PyObject *__pyx_n_s__registerVariables;
static PyObject *__pyx_n_s__register_context;
static PyObject *__pyx_n_s__register_namespace;
static PyObject *__pyx_n_s__remove;
static PyObject *__pyx_n_s__remove_blank_text;
static PyObject *__pyx_n_s__remove_comments;
static PyObject *__pyx_n_s__remove_pis;
static PyObject *__pyx_n_b__replace;
static PyObject *__pyx_n_s__replace;
static PyObject *__pyx_n_s__replaceEntities;
static PyObject *__pyx_n_s__replacement;
static PyObject *__pyx_n_s__resolve;
static PyObject *__pyx_n_s__resolve_entities;
static PyObject *__pyx_n_s__resolvers;
static PyObject *__pyx_n_s__result;
static PyObject *__pyx_n_s__reverse;
static PyObject *__pyx_n_s__reversed;
static PyObject *__pyx_n_s__rexp;
static PyObject *__pyx_n_s__root;
static PyObject *__pyx_n_s__s;
static PyObject *__pyx_n_s__sax;
static PyObject *__pyx_n_s__schema;
static PyObject *__pyx_n_s__search;
static PyObject *__pyx_n_s__self;
static PyObject *__pyx_n_s__self_node;
static PyObject *__pyx_n_s__setDefaultParser;
static PyObject *__pyx_n_s__set_context;
static PyObject *__pyx_n_s__set_default_parser;
static PyObject *__pyx_n_s__shape;
static PyObject *__pyx_n_s__size;
static PyObject *__pyx_n_s__smart_strings;
static PyObject *__pyx_n_s__sort;
static PyObject *__pyx_n_s__source;
static PyObject *__pyx_n_s__spaceMax;
static PyObject *__pyx_n_s__spaceTab;
static PyObject *__pyx_n_s__split;
static PyObject *__pyx_n_s__standalone;
static PyObject *__pyx_n_s__start;
static PyObject *__pyx_n_u__start;
static PyObject *__pyx_n_s__startElement;
static PyObject *__pyx_n_s__startElementNs;
static PyObject *__pyx_n_s__startNode;
static PyObject *__pyx_n_s__startswith;
static PyObject *__pyx_n_s__state;
static PyObject *__pyx_n_s__stdout;
static PyObject *__pyx_n_s__step;
static PyObject *__pyx_n_s__stop;
static PyObject *__pyx_n_s__str;
static PyObject *__pyx_n_s__strides;
static PyObject *__pyx_n_s__string;
static PyObject *__pyx_n_s__strings;
static PyObject *__pyx_n_s__stringval;
static PyObject *__pyx_n_s__strip;
static PyObject *__pyx_n_s__strip_attributes;
static PyObject *__pyx_n_s__strip_cdata;
static PyObject *__pyx_n_s__strip_elements;
static PyObject *__pyx_n_s__strip_tags;
static PyObject *__pyx_n_s__strparam;
static PyObject *__pyx_n_s__strval;
static PyObject *__pyx_n_s__sub;
static PyObject *__pyx_n_s__suboffsets;
static PyObject *__pyx_n_s__super;
static PyObject *__pyx_n_s__sys;
static PyObject *__pyx_n_s__system_url;
static PyObject *__pyx_n_s__tag;
static PyObject *__pyx_n_s__tail;
static PyObject *__pyx_n_s__target;
static PyObject *__pyx_n_s__tell;
static PyObject *__pyx_n_u__tell;
static PyObject *__pyx_n_b__test;
static PyObject *__pyx_n_s__test;
static PyObject *__pyx_n_s__text;
static PyObject *__pyx_n_u__text;
static PyObject *__pyx_n_s__tostring;
static PyObject *__pyx_n_s__tostringlist;
static PyObject *__pyx_n_s__tounicode;
static PyObject *__pyx_n_s__tree;
static PyObject *__pyx_n_s__tree_or_element;
static PyObject *__pyx_n_s__type;
static PyObject *__pyx_n_s__type_name;
static PyObject *__pyx_n_s__unicode;
static PyObject *__pyx_n_u__unknown;
static PyObject *__pyx_n_s__unregister_context;
static PyObject *__pyx_n_s__update;
static PyObject *__pyx_n_s__upper;
static PyObject *__pyx_n_s__uri;
static PyObject *__pyx_n_s__url;
static PyObject *__pyx_n_s__userData;
static PyObject *__pyx_n_s__validate;
static PyObject *__pyx_n_s__value;
static PyObject *__pyx_n_s__values;
static PyObject *__pyx_n_s__variables;
static PyObject *__pyx_n_s__version;
static PyObject *__pyx_n_s__warn;
static PyObject *__pyx_n_s__warnings;
static PyObject *__pyx_n_u__wb;
static PyObject *__pyx_n_s__wellFormed;
static PyObject *__pyx_n_s__with_comments;
static PyObject *__pyx_n_s__with_tail;
static PyObject *__pyx_n_s__write;
static PyObject *__pyx_n_u__write;
static PyObject *__pyx_n_s__write_file;
static PyObject *__pyx_n_u__write_file;
static PyObject *__pyx_n_s__write_network;
static PyObject *__pyx_n_u__write_network;
static PyObject *__pyx_n_b__wsdl;
static PyObject *__pyx_n_b__xml;
static PyObject *__pyx_n_u__xml;
static PyObject *__pyx_n_s__xml_declaration;
static PyObject *__pyx_n_s__xpathCtxt;
static PyObject *__pyx_n_b__xs;
static PyObject *__pyx_n_u__xs;
static PyObject *__pyx_n_b__xsi;
static PyObject *__pyx_n_b__xsl;
static PyObject *__pyx_n_u__xsl;
static PyObject *__pyx_n_s__xslt_input;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_2;
static PyObject *__pyx_int_4;
static PyObject *__pyx_int_neg_1;
static PyObject *__pyx_int_100;
static PyObject *__pyx_int_neg_100;
static PyObject *__pyx_int_neg_200;
static PyObject *__pyx_int_neg_300;
static PyObject *__pyx_int_32768;
static PyObject *__pyx_k_73;
static PyObject *__pyx_k_74;
static PyObject *__pyx_k_75;
static PyObject *__pyx_k_76;
static PyObject *__pyx_k_90;
static PyObject *__pyx_k_91;
static PyObject *__pyx_k_92;
static PyObject *__pyx_k_93;
static PyObject *__pyx_k_103;
static PyObject *__pyx_k_104;
static PyObject *__pyx_k_105;
static PyObject *__pyx_k_107;
static PyObject *__pyx_k_108;
static PyObject *__pyx_k_109;
static PyObject *__pyx_k_110;
static PyObject *__pyx_k_115;
static PyObject *__pyx_k_116;
static PyObject *__pyx_k_117;
static PyObject *__pyx_k_118;
static PyObject *__pyx_k_119;
static PyObject *__pyx_k_120;
static PyObject *__pyx_k_126;
static PyObject *__pyx_k_127;
static PyObject *__pyx_k_131;
static PyObject *__pyx_k_192;
static PyObject *__pyx_k_193;
static PyObject *__pyx_k_194;
static PyObject *__pyx_k_195;
static PyObject *__pyx_k_196;
static PyObject *__pyx_k_197;
static PyObject *__pyx_k_198;
static PyObject *__pyx_k_199;
static PyObject *__pyx_k_200;
static PyObject *__pyx_k_201;
static PyObject *__pyx_k_202;
static PyObject *__pyx_k_203;
static PyObject *__pyx_k_204;
static PyObject *__pyx_k_205;
static PyObject *__pyx_k_206;
static PyObject *__pyx_k_207;
static PyObject *__pyx_k_208;
static PyObject *__pyx_k_209;
static PyObject *__pyx_k_210;
static PyObject *__pyx_k_211;
static PyObject *__pyx_k_212;
static PyObject *__pyx_k_213;
static PyObject *__pyx_k_214;
static PyObject *__pyx_k_215;
static PyObject *__pyx_k_216;
static PyObject *__pyx_k_217;
static PyObject *__pyx_k_218;
static PyObject *__pyx_k_219;
static PyObject *__pyx_k_220;
static PyObject *__pyx_k_221;
static PyObject *__pyx_k_222;
static PyObject *__pyx_k_223;
static PyObject *__pyx_k_224;
static PyObject *__pyx_k_265;
static PyObject *__pyx_k_266;
static PyObject *__pyx_k_267;
static PyObject *__pyx_k_268;
static PyObject *__pyx_k_269;
static PyObject *__pyx_k_270;
static PyObject *__pyx_k_271;
static PyObject *__pyx_k_272;
static PyObject *__pyx_k_273;
static PyObject *__pyx_k_274;
static PyObject *__pyx_k_275;
static PyObject *__pyx_k_276;
static PyObject *__pyx_k_333;
static PyObject *__pyx_k_334;
static PyObject *__pyx_k_336;
static PyObject *__pyx_k_337;
static PyObject *__pyx_k_338;
static PyObject *__pyx_k_339;
static PyObject *__pyx_k_340;
static PyObject *__pyx_k_341;
static PyObject *__pyx_k_343;
static PyObject *__pyx_k_344;
static PyObject *__pyx_k_349;
static PyObject *__pyx_k_350;
static PyObject *__pyx_k_351;
static PyObject *__pyx_k_352;
static PyObject *__pyx_k_353;
static PyObject *__pyx_k_359;
static PyObject *__pyx_k_363;
static PyObject *__pyx_k_364;
static PyObject *__pyx_k_407;
static PyObject *__pyx_k_tuple_2;
static PyObject *__pyx_k_tuple_3;
static PyObject *__pyx_k_tuple_6;
static PyObject *__pyx_k_tuple_7;
static PyObject *__pyx_k_tuple_8;
static PyObject *__pyx_k_tuple_9;
static PyObject *__pyx_k_tuple_10;
static PyObject *__pyx_k_tuple_23;
static PyObject *__pyx_k_tuple_48;
static PyObject *__pyx_k_tuple_56;
static PyObject *__pyx_k_tuple_95;
static PyObject *__pyx_k_tuple_97;
static PyObject *__pyx_k_tuple_99;
static PyObject *__pyx_k_tuple_111;
static PyObject *__pyx_k_tuple_112;
static PyObject *__pyx_k_tuple_121;
static PyObject *__pyx_k_tuple_122;
static PyObject *__pyx_k_tuple_123;
static PyObject *__pyx_k_tuple_139;
static PyObject *__pyx_k_tuple_238;
static PyObject *__pyx_k_tuple_257;
static PyObject *__pyx_k_tuple_263;
static PyObject *__pyx_k_tuple_264;
static PyObject *__pyx_k_tuple_277;
static PyObject *__pyx_k_tuple_279;
static PyObject *__pyx_k_tuple_281;
static PyObject *__pyx_k_tuple_282;
static PyObject *__pyx_k_tuple_283;
static PyObject *__pyx_k_tuple_284;
static PyObject *__pyx_k_tuple_285;
static PyObject *__pyx_k_tuple_287;
static PyObject *__pyx_k_tuple_288;
static PyObject *__pyx_k_tuple_306;
static PyObject *__pyx_k_tuple_307;
static PyObject *__pyx_k_tuple_308;
static PyObject *__pyx_k_tuple_330;
static PyObject *__pyx_k_tuple_342;
static PyObject *__pyx_k_tuple_355;
static PyObject *__pyx_k_tuple_370;
static PyObject *__pyx_k_tuple_386;
static PyObject *__pyx_k_tuple_471;
static PyObject *__pyx_k_tuple_480;
static PyObject *__pyx_k_tuple_486;
static PyObject *__pyx_k_tuple_489;
static PyObject *__pyx_k_tuple_495;
static PyObject *__pyx_k_tuple_497;
static PyObject *__pyx_k_tuple_509;
static PyObject *__pyx_k_tuple_511;
static PyObject *__pyx_k_tuple_525;
static PyObject *__pyx_k_tuple_527;
static PyObject *__pyx_k_tuple_535;
static PyObject *__pyx_k_tuple_547;

/* "src/lxml/lxml.etree.pyx":146
 * cdef object _check_internal_prefix = re.compile(b"ns\d+$").match
 * 
 * def register_namespace(prefix, uri):             # <<<<<<<<<<<<<<
 *     u"""Registers a namespace prefix that newly created Elements in that
 *     namespace will use.  The registry is global, and any existing
 */

static PyObject *__pyx_pf_4lxml_5etree_register_namespace(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_register_namespace[] = "Registers a namespace prefix that newly created Elements in that\n    namespace will use.  The registry is global, and any existing\n    mapping for either the given prefix or the namespace URI will be\n    removed.\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_register_namespace = {__Pyx_NAMESTR("register_namespace"), (PyCFunction)__pyx_pf_4lxml_5etree_register_namespace, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_register_namespace)};
static PyObject *__pyx_pf_4lxml_5etree_register_namespace(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_prefix = 0;
  PyObject *__pyx_v_uri = 0;
  PyObject *__pyx_v_prefix_utf;
  PyObject *__pyx_v_uri_utf;
  PyObject *__pyx_v_k;
  PyObject *__pyx_v_v;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_t_10;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__prefix,&__pyx_n_s__uri,0};
  __Pyx_RefNannySetupContext("register_namespace");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__prefix);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__uri);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("register_namespace", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "register_namespace") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_prefix = values[0];
    __pyx_v_uri = values[1];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_prefix = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_uri = PyTuple_GET_ITEM(__pyx_args, 1);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("register_namespace", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.register_namespace");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_prefix_utf = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_uri_utf = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_k = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_v = Py_None; __Pyx_INCREF(Py_None);

  /* "src/lxml/lxml.etree.pyx":152
 *     removed.
 *     """
 *     prefix_utf, uri_utf = _utf8(prefix), _utf8(uri)             # <<<<<<<<<<<<<<
 *     if _check_internal_prefix(prefix_utf):
 *         raise ValueError("Prefix format reserved for internal use")
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_v_prefix)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_v_uri)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_v_prefix_utf));
  __pyx_v_prefix_utf = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_v_uri_utf));
  __pyx_v_uri_utf = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/lxml.etree.pyx":153
 *     """
 *     prefix_utf, uri_utf = _utf8(prefix), _utf8(uri)
 *     if _check_internal_prefix(prefix_utf):             # <<<<<<<<<<<<<<
 *         raise ValueError("Prefix format reserved for internal use")
 *     _tagValidOrRaise(prefix_utf)
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(((PyObject *)__pyx_v_prefix_utf));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_prefix_utf));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_prefix_utf));
  __pyx_t_1 = PyObject_Call(__pyx_v_4lxml_5etree__check_internal_prefix, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_3) {

    /* "src/lxml/lxml.etree.pyx":154
 *     prefix_utf, uri_utf = _utf8(prefix), _utf8(uri)
 *     if _check_internal_prefix(prefix_utf):
 *         raise ValueError("Prefix format reserved for internal use")             # <<<<<<<<<<<<<<
 *     _tagValidOrRaise(prefix_utf)
 *     _uriValidOrRaise(uri_utf)
 */
    __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "src/lxml/lxml.etree.pyx":155
 *     if _check_internal_prefix(prefix_utf):
 *         raise ValueError("Prefix format reserved for internal use")
 *     _tagValidOrRaise(prefix_utf)             # <<<<<<<<<<<<<<
 *     _uriValidOrRaise(uri_utf)
 *     for k, v in _DEFAULT_NAMESPACE_PREFIXES.items():
 */
  __pyx_t_4 = __pyx_f_4lxml_5etree__tagValidOrRaise(((PyObject *)__pyx_v_prefix_utf)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":156
 *         raise ValueError("Prefix format reserved for internal use")
 *     _tagValidOrRaise(prefix_utf)
 *     _uriValidOrRaise(uri_utf)             # <<<<<<<<<<<<<<
 *     for k, v in _DEFAULT_NAMESPACE_PREFIXES.items():
 *         if k == uri_utf or v == prefix_utf:
 */
  __pyx_t_4 = __pyx_f_4lxml_5etree__uriValidOrRaise(((PyObject *)__pyx_v_uri_utf)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":157
 *     _tagValidOrRaise(prefix_utf)
 *     _uriValidOrRaise(uri_utf)
 *     for k, v in _DEFAULT_NAMESPACE_PREFIXES.items():             # <<<<<<<<<<<<<<
 *         if k == uri_utf or v == prefix_utf:
 *             del _DEFAULT_NAMESPACE_PREFIXES[k]
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES, __pyx_n_s__items); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
    __pyx_t_5 = 0; __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1);
  } else {
    __pyx_t_5 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  for (;;) {
    if (likely(PyList_CheckExact(__pyx_t_1))) {
      if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_1)) break;
      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++;
    } else if (likely(PyTuple_CheckExact(__pyx_t_1))) {
      if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++;
    } else {
      __pyx_t_2 = PyIter_Next(__pyx_t_1);
      if (!__pyx_t_2) {
        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    if (PyTuple_CheckExact(__pyx_t_2) && likely(PyTuple_GET_SIZE(__pyx_t_2) == 2)) {
      PyObject* tuple = __pyx_t_2;
      __pyx_t_6 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_6);
      __pyx_t_7 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_v_k);
      __pyx_v_k = __pyx_t_6;
      __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_v_v);
      __pyx_v_v = __pyx_t_7;
      __pyx_t_7 = 0;
    } else {
      __pyx_t_8 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_6 = __Pyx_UnpackItem(__pyx_t_8, 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_UnpackItem(__pyx_t_8, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      if (__Pyx_EndUnpack(__pyx_t_8, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_v_k);
      __pyx_v_k = __pyx_t_6;
      __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_v_v);
      __pyx_v_v = __pyx_t_7;
      __pyx_t_7 = 0;
    }

    /* "src/lxml/lxml.etree.pyx":158
 *     _uriValidOrRaise(uri_utf)
 *     for k, v in _DEFAULT_NAMESPACE_PREFIXES.items():
 *         if k == uri_utf or v == prefix_utf:             # <<<<<<<<<<<<<<
 *             del _DEFAULT_NAMESPACE_PREFIXES[k]
 *     _DEFAULT_NAMESPACE_PREFIXES[uri_utf] = prefix_utf
 */
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_k, ((PyObject *)__pyx_v_uri_utf), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!__pyx_t_3) {
      __pyx_t_2 = PyObject_RichCompare(__pyx_v_v, ((PyObject *)__pyx_v_prefix_utf), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_10 = __pyx_t_9;
    } else {
      __pyx_t_10 = __pyx_t_3;
    }
    if (__pyx_t_10) {

      /* "src/lxml/lxml.etree.pyx":159
 *     for k, v in _DEFAULT_NAMESPACE_PREFIXES.items():
 *         if k == uri_utf or v == prefix_utf:
 *             del _DEFAULT_NAMESPACE_PREFIXES[k]             # <<<<<<<<<<<<<<
 *     _DEFAULT_NAMESPACE_PREFIXES[uri_utf] = prefix_utf
 * 
 */
      if (PyObject_DelItem(__pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES, __pyx_v_k) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L9;
    }
    __pyx_L9:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/lxml.etree.pyx":160
 *         if k == uri_utf or v == prefix_utf:
 *             del _DEFAULT_NAMESPACE_PREFIXES[k]
 *     _DEFAULT_NAMESPACE_PREFIXES[uri_utf] = prefix_utf             # <<<<<<<<<<<<<<
 * 
 * 
 */
  if (PyObject_SetItem(__pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES, ((PyObject *)__pyx_v_uri_utf), ((PyObject *)__pyx_v_prefix_utf)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("lxml.etree.register_namespace");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_prefix_utf);
  __Pyx_DECREF(__pyx_v_uri_utf);
  __Pyx_DECREF(__pyx_v_k);
  __Pyx_DECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":172
 *     this one.
 *     """
 *     def __init__(self, message, error_log=None):             # <<<<<<<<<<<<<<
 *         if python.PY_VERSION_HEX >= 0x02050000:
 *             # Python >= 2.5 uses new style class exceptions
 */

static PyObject *__pyx_pf_4lxml_5etree_9LxmlError___init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_9LxmlError___init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pf_4lxml_5etree_9LxmlError___init__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pf_4lxml_5etree_9LxmlError___init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_message = 0;
  PyObject *__pyx_v_error_log = 0;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__message,&__pyx_n_s__error_log,0};
  __Pyx_RefNannySetupContext("__init__");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    values[2] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__message);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__error_log);
        if (value) { values[2] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_self = values[0];
    __pyx_v_message = values[1];
    __pyx_v_error_log = values[2];
  } else {
    __pyx_v_error_log = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3:
      __pyx_v_error_log = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2:
      __pyx_v_message = PyTuple_GET_ITEM(__pyx_args, 1);
      __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.LxmlError.__init__");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "src/lxml/lxml.etree.pyx":173
 *     """
 *     def __init__(self, message, error_log=None):
 *         if python.PY_VERSION_HEX >= 0x02050000:             # <<<<<<<<<<<<<<
 *             # Python >= 2.5 uses new style class exceptions
 *             super(_Error, self).__init__(message)
 */
  __pyx_t_1 = (PY_VERSION_HEX >= 0x02050000);
  if (__pyx_t_1) {

    /* "src/lxml/lxml.etree.pyx":175
 *         if python.PY_VERSION_HEX >= 0x02050000:
 *             # Python >= 2.5 uses new style class exceptions
 *             super(_Error, self).__init__(message)             # <<<<<<<<<<<<<<
 *         else:
 *             error_super_init(self, message)
 */
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __Pyx_INCREF(__pyx_v_4lxml_5etree__Error);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_4lxml_5etree__Error);
    __Pyx_GIVEREF(__pyx_v_4lxml_5etree__Error);
    __Pyx_INCREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    __pyx_t_3 = PyObject_Call(__pyx_builtin_super, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s____init__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_INCREF(__pyx_v_message);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_message);
    __Pyx_GIVEREF(__pyx_v_message);
    __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "src/lxml/lxml.etree.pyx":177
 *             super(_Error, self).__init__(message)
 *         else:
 *             error_super_init(self, message)             # <<<<<<<<<<<<<<
 *         if error_log is None:
 *             self.error_log = __copyGlobalErrorLog()
 */
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_INCREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    __Pyx_INCREF(__pyx_v_message);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_message);
    __Pyx_GIVEREF(__pyx_v_message);
    __pyx_t_3 = PyObject_Call(__pyx_v_4lxml_5etree_error_super_init, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_L6:;

  /* "src/lxml/lxml.etree.pyx":178
 *         else:
 *             error_super_init(self, message)
 *         if error_log is None:             # <<<<<<<<<<<<<<
 *             self.error_log = __copyGlobalErrorLog()
 *         else:
 */
  __pyx_t_1 = (__pyx_v_error_log == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/lxml.etree.pyx":179
 *             error_super_init(self, message)
 *         if error_log is None:
 *             self.error_log = __copyGlobalErrorLog()             # <<<<<<<<<<<<<<
 *         else:
 *             self.error_log = error_log.copy()
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree___copyGlobalErrorLog(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__error_log, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L7;
  }
  /*else*/ {

    /* "src/lxml/lxml.etree.pyx":181
 *             self.error_log = __copyGlobalErrorLog()
 *         else:
 *             self.error_log = error_log.copy()             # <<<<<<<<<<<<<<
 * 
 * cdef object _Error = Error if python.PY_VERSION_HEX >= 0x02050000 else None
 */
    __pyx_t_3 = PyObject_GetAttr(__pyx_v_error_log, __pyx_n_s__copy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__error_log, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_L7:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.LxmlError.__init__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":199
 * 
 * # version information
 * cdef __unpackDottedVersion(version):             # <<<<<<<<<<<<<<
 *     cdef list version_list = []
 *     l = (version.decode(u"ASCII").replace(u'-', u'.').split(u'.') + [0]*4)[:4]
 */

static  PyObject *__pyx_f_4lxml_5etree___unpackDottedVersion(PyObject *__pyx_v_version) {
  PyObject *__pyx_v_version_list = 0;
  PyObject *__pyx_v_l;
  PyObject *__pyx_v_item;
  PyObject *__pyx_v_count;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  __Pyx_RefNannySetupContext("__unpackDottedVersion");
  __pyx_v_l = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_item = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_count = Py_None; __Pyx_INCREF(Py_None);

  /* "src/lxml/lxml.etree.pyx":200
 * # version information
 * cdef __unpackDottedVersion(version):
 *     cdef list version_list = []             # <<<<<<<<<<<<<<
 *     l = (version.decode(u"ASCII").replace(u'-', u'.').split(u'.') + [0]*4)[:4]
 *     for item in l:
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_version_list = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/lxml.etree.pyx":201
 * cdef __unpackDottedVersion(version):
 *     cdef list version_list = []
 *     l = (version.decode(u"ASCII").replace(u'-', u'.').split(u'.') + [0]*4)[:4]             # <<<<<<<<<<<<<<
 *     for item in l:
 *         try:
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_version, __pyx_n_s__decode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__replace); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_7), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_int_0);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __pyx_t_3 = PyNumber_Multiply(((PyObject *)__pyx_t_1), __pyx_int_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PySequence_GetSlice(__pyx_t_1, 0, 4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_v_l);
  __pyx_v_l = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":202
 *     cdef list version_list = []
 *     l = (version.decode(u"ASCII").replace(u'-', u'.').split(u'.') + [0]*4)[:4]
 *     for item in l:             # <<<<<<<<<<<<<<
 *         try:
 *             item = int(item)
 */
  if (PyList_CheckExact(__pyx_v_l) || PyTuple_CheckExact(__pyx_v_l)) {
    __pyx_t_4 = 0; __pyx_t_3 = __pyx_v_l; __Pyx_INCREF(__pyx_t_3);
  } else {
    __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_l); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
  }
  for (;;) {
    if (likely(PyList_CheckExact(__pyx_t_3))) {
      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
      __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++;
    } else if (likely(PyTuple_CheckExact(__pyx_t_3))) {
      if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
      __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++;
    } else {
      __pyx_t_1 = PyIter_Next(__pyx_t_3);
      if (!__pyx_t_1) {
        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_v_item);
    __pyx_v_item = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "src/lxml/lxml.etree.pyx":203
 *     l = (version.decode(u"ASCII").replace(u'-', u'.').split(u'.') + [0]*4)[:4]
 *     for item in l:
 *         try:             # <<<<<<<<<<<<<<
 *             item = int(item)
 *         except ValueError:
 */
    {
      PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
      __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
      __Pyx_XGOTREF(__pyx_save_exc_type);
      __Pyx_XGOTREF(__pyx_save_exc_value);
      __Pyx_XGOTREF(__pyx_save_exc_tb);
      /*try:*/ {

        /* "src/lxml/lxml.etree.pyx":204
 *     for item in l:
 *         try:
 *             item = int(item)             # <<<<<<<<<<<<<<
 *         except ValueError:
 *             if item.startswith(u'dev'):
 */
        __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_1));
        __Pyx_INCREF(__pyx_v_item);
        PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_item);
        __Pyx_GIVEREF(__pyx_v_item);
        __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_v_item);
        __pyx_v_item = __pyx_t_2;
        __pyx_t_2 = 0;
      }
      __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
      __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
      __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
      goto __pyx_L12_try_end;
      __pyx_L5_error:;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "src/lxml/lxml.etree.pyx":205
 *         try:
 *             item = int(item)
 *         except ValueError:             # <<<<<<<<<<<<<<
 *             if item.startswith(u'dev'):
 *                 count = item[3:]
 */
      __pyx_t_5 = PyErr_ExceptionMatches(__pyx_builtin_ValueError);
      if (__pyx_t_5) {
        __Pyx_AddTraceback("lxml.etree.__unpackDottedVersion");
        if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GOTREF(__pyx_t_6);

        /* "src/lxml/lxml.etree.pyx":206
 *             item = int(item)
 *         except ValueError:
 *             if item.startswith(u'dev'):             # <<<<<<<<<<<<<<
 *                 count = item[3:]
 *                 item = -300
 */
        __pyx_t_7 = PyObject_GetAttr(__pyx_v_item, __pyx_n_s__startswith); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_8 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (__pyx_t_9) {

          /* "src/lxml/lxml.etree.pyx":207
 *         except ValueError:
 *             if item.startswith(u'dev'):
 *                 count = item[3:]             # <<<<<<<<<<<<<<
 *                 item = -300
 *             elif item.startswith(u'alpha'):
 */
          __pyx_t_8 = __Pyx_PySequence_GetSlice(__pyx_v_item, 3, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_v_count);
          __pyx_v_count = __pyx_t_8;
          __pyx_t_8 = 0;

          /* "src/lxml/lxml.etree.pyx":208
 *             if item.startswith(u'dev'):
 *                 count = item[3:]
 *                 item = -300             # <<<<<<<<<<<<<<
 *             elif item.startswith(u'alpha'):
 *                 count = item[5:]
 */
          __Pyx_INCREF(__pyx_int_neg_300);
          __Pyx_DECREF(__pyx_v_item);
          __pyx_v_item = __pyx_int_neg_300;
          goto __pyx_L15;
        }

        /* "src/lxml/lxml.etree.pyx":209
 *                 count = item[3:]
 *                 item = -300
 *             elif item.startswith(u'alpha'):             # <<<<<<<<<<<<<<
 *                 count = item[5:]
 *                 item = -200
 */
        __pyx_t_8 = PyObject_GetAttr(__pyx_v_item, __pyx_n_s__startswith); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_7 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_k_tuple_9), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (__pyx_t_9) {

          /* "src/lxml/lxml.etree.pyx":210
 *                 item = -300
 *             elif item.startswith(u'alpha'):
 *                 count = item[5:]             # <<<<<<<<<<<<<<
 *                 item = -200
 *             elif item.startswith(u'beta'):
 */
          __pyx_t_7 = __Pyx_PySequence_GetSlice(__pyx_v_item, 5, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_v_count);
          __pyx_v_count = __pyx_t_7;
          __pyx_t_7 = 0;

          /* "src/lxml/lxml.etree.pyx":211
 *             elif item.startswith(u'alpha'):
 *                 count = item[5:]
 *                 item = -200             # <<<<<<<<<<<<<<
 *             elif item.startswith(u'beta'):
 *                 count = item[4:]
 */
          __Pyx_INCREF(__pyx_int_neg_200);
          __Pyx_DECREF(__pyx_v_item);
          __pyx_v_item = __pyx_int_neg_200;
          goto __pyx_L15;
        }

        /* "src/lxml/lxml.etree.pyx":212
 *                 count = item[5:]
 *                 item = -200
 *             elif item.startswith(u'beta'):             # <<<<<<<<<<<<<<
 *                 count = item[4:]
 *                 item = -100
 */
        __pyx_t_7 = PyObject_GetAttr(__pyx_v_item, __pyx_n_s__startswith); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_8 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (__pyx_t_9) {

          /* "src/lxml/lxml.etree.pyx":213
 *                 item = -200
 *             elif item.startswith(u'beta'):
 *                 count = item[4:]             # <<<<<<<<<<<<<<
 *                 item = -100
 *             else:
 */
          __pyx_t_8 = __Pyx_PySequence_GetSlice(__pyx_v_item, 4, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_v_count);
          __pyx_v_count = __pyx_t_8;
          __pyx_t_8 = 0;

          /* "src/lxml/lxml.etree.pyx":214
 *             elif item.startswith(u'beta'):
 *                 count = item[4:]
 *                 item = -100             # <<<<<<<<<<<<<<
 *             else:
 *                 count = 0
 */
          __Pyx_INCREF(__pyx_int_neg_100);
          __Pyx_DECREF(__pyx_v_item);
          __pyx_v_item = __pyx_int_neg_100;
          goto __pyx_L15;
        }
        /*else*/ {

          /* "src/lxml/lxml.etree.pyx":216
 *                 item = -100
 *             else:
 *                 count = 0             # <<<<<<<<<<<<<<
 *             if count:
 *                 item = item + int(count)
 */
          __Pyx_INCREF(__pyx_int_0);
          __Pyx_DECREF(__pyx_v_count);
          __pyx_v_count = __pyx_int_0;
        }
        __pyx_L15:;

        /* "src/lxml/lxml.etree.pyx":217
 *             else:
 *                 count = 0
 *             if count:             # <<<<<<<<<<<<<<
 *                 item = item + int(count)
 *         version_list.append(item)
 */
        __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_count); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        if (__pyx_t_9) {

          /* "src/lxml/lxml.etree.pyx":218
 *                 count = 0
 *             if count:
 *                 item = item + int(count)             # <<<<<<<<<<<<<<
 *         version_list.append(item)
 *     return tuple(version_list)
 */
          __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
          __Pyx_GOTREF(((PyObject *)__pyx_t_8));
          __Pyx_INCREF(__pyx_v_count);
          PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_count);
          __Pyx_GIVEREF(__pyx_v_count);
          __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
          __pyx_t_8 = PyNumber_Add(__pyx_v_item, __pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_v_item);
          __pyx_v_item = __pyx_t_8;
          __pyx_t_8 = 0;
          goto __pyx_L16;
        }
        __pyx_L16:;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        goto __pyx_L6_exception_handled;
      }
      __pyx_L7_except_error:;
      __Pyx_XGIVEREF(__pyx_save_exc_type);
      __Pyx_XGIVEREF(__pyx_save_exc_value);
      __Pyx_XGIVEREF(__pyx_save_exc_tb);
      __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
      goto __pyx_L1_error;
      __pyx_L6_exception_handled:;
      __Pyx_XGIVEREF(__pyx_save_exc_type);
      __Pyx_XGIVEREF(__pyx_save_exc_value);
      __Pyx_XGIVEREF(__pyx_save_exc_tb);
      __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
      __pyx_L12_try_end:;
    }

    /* "src/lxml/lxml.etree.pyx":219
 *             if count:
 *                 item = item + int(count)
 *         version_list.append(item)             # <<<<<<<<<<<<<<
 *     return tuple(version_list)
 * 
 */
    if (unlikely(__pyx_v_version_list == Py_None)) {
      PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_5 = PyList_Append(__pyx_v_version_list, __pyx_v_item); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":220
 *                 item = item + int(count)
 *         version_list.append(item)
 *     return tuple(version_list)             # <<<<<<<<<<<<<<
 * 
 * cdef __unpackIntVersion(int c_version):
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(__pyx_v_version_list == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_3 = ((PyObject *)PyList_AsTuple(__pyx_v_version_list)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __pyx_r = ((PyObject *)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("lxml.etree.__unpackDottedVersion");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_version_list);
  __Pyx_DECREF(__pyx_v_l);
  __Pyx_DECREF(__pyx_v_item);
  __Pyx_DECREF(__pyx_v_count);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":222
 *     return tuple(version_list)
 * 
 * cdef __unpackIntVersion(int c_version):             # <<<<<<<<<<<<<<
 *     return (
 *         ((c_version / (100*100)) % 100),
 */

static  PyObject *__pyx_f_4lxml_5etree___unpackIntVersion(int __pyx_v_c_version) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("__unpackIntVersion");

  /* "src/lxml/lxml.etree.pyx":223
 * 
 * cdef __unpackIntVersion(int c_version):
 *     return (             # <<<<<<<<<<<<<<
 *         ((c_version / (100*100)) % 100),
 *         ((c_version / 100)       % 100),
 */
  __Pyx_XDECREF(__pyx_r);

  /* "src/lxml/lxml.etree.pyx":224
 * cdef __unpackIntVersion(int c_version):
 *     return (
 *         ((c_version / (100*100)) % 100),             # <<<<<<<<<<<<<<
 *         ((c_version / 100)       % 100),
 *         (c_version               % 100)
 */
  __pyx_t_1 = PyInt_FromLong(__Pyx_mod_long(__Pyx_div_long(__pyx_v_c_version, 10000), 100)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);

  /* "src/lxml/lxml.etree.pyx":225
 *     return (
 *         ((c_version / (100*100)) % 100),
 *         ((c_version / 100)       % 100),             # <<<<<<<<<<<<<<
 *         (c_version               % 100)
 *         )
 */
  __pyx_t_2 = PyInt_FromLong(__Pyx_mod_long(__Pyx_div_long(__pyx_v_c_version, 100), 100)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);

  /* "src/lxml/lxml.etree.pyx":226
 *         ((c_version / (100*100)) % 100),
 *         ((c_version / 100)       % 100),
 *         (c_version               % 100)             # <<<<<<<<<<<<<<
 *         )
 * 
 */
  __pyx_t_3 = PyInt_FromLong(__Pyx_mod_long(__pyx_v_c_version, 100)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_r = ((PyObject *)__pyx_t_4);
  __pyx_t_4 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.__unpackIntVersion");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":248
 * cdef class _TempStore:
 *     cdef list _storage
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self._storage = []
 * 
 */

static int __pyx_pf_4lxml_5etree_10_TempStore___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_10_TempStore___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__init__");
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;

  /* "src/lxml/lxml.etree.pyx":249
 *     cdef list _storage
 *     def __init__(self):
 *         self._storage = []             # <<<<<<<<<<<<<<
 * 
 *     cdef int add(self, obj) except -1:
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__TempStore *)__pyx_v_self)->_storage);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__TempStore *)__pyx_v_self)->_storage));
  ((struct __pyx_obj_4lxml_5etree__TempStore *)__pyx_v_self)->_storage = __pyx_t_1;
  __pyx_t_1 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._TempStore.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":251
 *         self._storage = []
 * 
 *     cdef int add(self, obj) except -1:             # <<<<<<<<<<<<<<
 *         self._storage.append(obj)
 *         return 0
 */

static  int __pyx_f_4lxml_5etree_10_TempStore_add(struct __pyx_obj_4lxml_5etree__TempStore *__pyx_v_self, PyObject *__pyx_v_obj) {
  int __pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("add");

  /* "src/lxml/lxml.etree.pyx":252
 * 
 *     cdef int add(self, obj) except -1:
 *         self._storage.append(obj)             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  if (unlikely(__pyx_v_self->_storage == Py_None)) {
    PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_1 = PyList_Append(__pyx_v_self->_storage, __pyx_v_obj); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":253
 *     cdef int add(self, obj) except -1:
 *         self._storage.append(obj)
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cdef int clear(self) except -1:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._TempStore.add");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":255
 *         return 0
 * 
 *     cdef int clear(self) except -1:             # <<<<<<<<<<<<<<
 *         del self._storage[:]
 *         return 0
 */

static  int __pyx_f_4lxml_5etree_10_TempStore_clear(struct __pyx_obj_4lxml_5etree__TempStore *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("clear");

  /* "src/lxml/lxml.etree.pyx":256
 * 
 *     cdef int clear(self) except -1:
 *         del self._storage[:]             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  if (__Pyx_PySequence_DelSlice(((PyObject *)__pyx_v_self->_storage), 0, PY_SSIZE_T_MAX) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":257
 *     cdef int clear(self) except -1:
 *         del self._storage[:]
 *         return 0             # <<<<<<<<<<<<<<
 * 
 * # class for temporarily storing exceptions raised in extensions
 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._TempStore.clear");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":262
 * cdef class _ExceptionContext:
 *     cdef object _exc_info
 *     cdef void clear(self):             # <<<<<<<<<<<<<<
 *         self._exc_info = None
 * 
 */

static  void __pyx_f_4lxml_5etree_17_ExceptionContext_clear(struct __pyx_obj_4lxml_5etree__ExceptionContext *__pyx_v_self) {
  __Pyx_RefNannySetupContext("clear");

  /* "src/lxml/lxml.etree.pyx":263
 *     cdef object _exc_info
 *     cdef void clear(self):
 *         self._exc_info = None             # <<<<<<<<<<<<<<
 * 
 *     cdef void _store_raised(self):
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_exc_info);
  __Pyx_DECREF(__pyx_v_self->_exc_info);
  __pyx_v_self->_exc_info = Py_None;

  __Pyx_RefNannyFinishContext();
}

/* "src/lxml/lxml.etree.pyx":265
 *         self._exc_info = None
 * 
 *     cdef void _store_raised(self):             # <<<<<<<<<<<<<<
 *         self._exc_info = sys.exc_info()
 * 
 */

static  void __pyx_f_4lxml_5etree_17_ExceptionContext__store_raised(struct __pyx_obj_4lxml_5etree__ExceptionContext *__pyx_v_self) {
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_store_raised");

  /* "src/lxml/lxml.etree.pyx":266
 * 
 *     cdef void _store_raised(self):
 *         self._exc_info = sys.exc_info()             # <<<<<<<<<<<<<<
 * 
 *     cdef void _store_exception(self, exception):
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_4lxml_5etree_sys, __pyx_n_s__exc_info); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_self->_exc_info);
  __Pyx_DECREF(__pyx_v_self->_exc_info);
  __pyx_v_self->_exc_info = __pyx_t_2;
  __pyx_t_2 = 0;

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_WriteUnraisable("lxml.etree._ExceptionContext._store_raised");
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "src/lxml/lxml.etree.pyx":268
 *         self._exc_info = sys.exc_info()
 * 
 *     cdef void _store_exception(self, exception):             # <<<<<<<<<<<<<<
 *         self._exc_info = (exception, None, None)
 * 
 */

static  void __pyx_f_4lxml_5etree_17_ExceptionContext__store_exception(struct __pyx_obj_4lxml_5etree__ExceptionContext *__pyx_v_self, PyObject *__pyx_v_exception) {
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("_store_exception");

  /* "src/lxml/lxml.etree.pyx":269
 * 
 *     cdef void _store_exception(self, exception):
 *         self._exc_info = (exception, None, None)             # <<<<<<<<<<<<<<
 * 
 *     cdef bint _has_raised(self):
 */
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_exception);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_exception);
  __Pyx_GIVEREF(__pyx_v_exception);
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_1, 1, Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __Pyx_GOTREF(__pyx_v_self->_exc_info);
  __Pyx_DECREF(__pyx_v_self->_exc_info);
  __pyx_v_self->_exc_info = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_WriteUnraisable("lxml.etree._ExceptionContext._store_exception");
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "src/lxml/lxml.etree.pyx":271
 *         self._exc_info = (exception, None, None)
 * 
 *     cdef bint _has_raised(self):             # <<<<<<<<<<<<<<
 *         return self._exc_info is not None
 * 
 */

static  int __pyx_f_4lxml_5etree_17_ExceptionContext__has_raised(struct __pyx_obj_4lxml_5etree__ExceptionContext *__pyx_v_self) {
  int __pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_has_raised");

  /* "src/lxml/lxml.etree.pyx":272
 * 
 *     cdef bint _has_raised(self):
 *         return self._exc_info is not None             # <<<<<<<<<<<<<<
 * 
 *     cdef int _raise_if_stored(self) except -1:
 */
  __pyx_t_1 = (__pyx_v_self->_exc_info != Py_None);
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":274
 *         return self._exc_info is not None
 * 
 *     cdef int _raise_if_stored(self) except -1:             # <<<<<<<<<<<<<<
 *         if self._exc_info is None:
 *             return 0
 */

static  int __pyx_f_4lxml_5etree_17_ExceptionContext__raise_if_stored(struct __pyx_obj_4lxml_5etree__ExceptionContext *__pyx_v_self) {
  PyObject *__pyx_v_type;
  PyObject *__pyx_v_value;
  PyObject *__pyx_v_traceback;
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  __Pyx_RefNannySetupContext("_raise_if_stored");
  __pyx_v_type = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_value = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_traceback = Py_None; __Pyx_INCREF(Py_None);

  /* "src/lxml/lxml.etree.pyx":275
 * 
 *     cdef int _raise_if_stored(self) except -1:
 *         if self._exc_info is None:             # <<<<<<<<<<<<<<
 *             return 0
 *         type, value, traceback = self._exc_info
 */
  __pyx_t_1 = (__pyx_v_self->_exc_info == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/lxml.etree.pyx":276
 *     cdef int _raise_if_stored(self) except -1:
 *         if self._exc_info is None:
 *             return 0             # <<<<<<<<<<<<<<
 *         type, value, traceback = self._exc_info
 *         self._exc_info = None
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "src/lxml/lxml.etree.pyx":277
 *         if self._exc_info is None:
 *             return 0
 *         type, value, traceback = self._exc_info             # <<<<<<<<<<<<<<
 *         self._exc_info = None
 *         if value is None and traceback is None:
 */
  if (PyTuple_CheckExact(__pyx_v_self->_exc_info) && likely(PyTuple_GET_SIZE(__pyx_v_self->_exc_info) == 3)) {
    PyObject* tuple = __pyx_v_self->_exc_info;
    __pyx_t_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_GET_ITEM(tuple, 2); __Pyx_INCREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_v_type);
    __pyx_v_type = __pyx_t_2;
    __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_v_value);
    __pyx_v_value = __pyx_t_3;
    __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_v_traceback);
    __pyx_v_traceback = __pyx_t_4;
    __pyx_t_4 = 0;
  } else {
    __pyx_t_5 = PyObject_GetIter(__pyx_v_self->_exc_info); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_5, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_5, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_UnpackItem(__pyx_t_5, 2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_EndUnpack(__pyx_t_5, 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_v_type);
    __pyx_v_type = __pyx_t_2;
    __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_v_value);
    __pyx_v_value = __pyx_t_3;
    __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_v_traceback);
    __pyx_v_traceback = __pyx_t_4;
    __pyx_t_4 = 0;
  }

  /* "src/lxml/lxml.etree.pyx":278
 *             return 0
 *         type, value, traceback = self._exc_info
 *         self._exc_info = None             # <<<<<<<<<<<<<<
 *         if value is None and traceback is None:
 *             raise type
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_exc_info);
  __Pyx_DECREF(__pyx_v_self->_exc_info);
  __pyx_v_self->_exc_info = Py_None;

  /* "src/lxml/lxml.etree.pyx":279
 *         type, value, traceback = self._exc_info
 *         self._exc_info = None
 *         if value is None and traceback is None:             # <<<<<<<<<<<<<<
 *             raise type
 *         else:
 */
  __pyx_t_1 = (__pyx_v_value == Py_None);
  if (__pyx_t_1) {
    __pyx_t_6 = (__pyx_v_traceback == Py_None);
    __pyx_t_7 = __pyx_t_6;
  } else {
    __pyx_t_7 = __pyx_t_1;
  }
  if (__pyx_t_7) {

    /* "src/lxml/lxml.etree.pyx":280
 *         self._exc_info = None
 *         if value is None and traceback is None:
 *             raise type             # <<<<<<<<<<<<<<
 *         else:
 *             raise type, value, traceback
 */
    __Pyx_Raise(__pyx_v_type, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L4;
  }
  /*else*/ {

    /* "src/lxml/lxml.etree.pyx":282
 *             raise type
 *         else:
 *             raise type, value, traceback             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_Raise(__pyx_v_type, __pyx_v_value, __pyx_v_traceback);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L4:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._ExceptionContext._raise_if_stored");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_type);
  __Pyx_DECREF(__pyx_v_value);
  __Pyx_DECREF(__pyx_v_traceback);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":7
 * # the Python class
 * 
 * cdef inline _Element getProxy(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     u"""Get a proxy for a given node.
 *     """
 */

static CYTHON_INLINE struct LxmlElement *__pyx_f_4lxml_5etree_getProxy(xmlNode *__pyx_v_c_node) {
  struct LxmlElement *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("getProxy");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":11
 *     """
 *     #print "getProxy for:", <int>c_node
 *     if c_node is not NULL and c_node._private is not NULL:             # <<<<<<<<<<<<<<
 *         return <_Element>c_node._private
 *     else:
 */
  __pyx_t_1 = (__pyx_v_c_node != NULL);
  if (__pyx_t_1) {
    __pyx_t_2 = (__pyx_v_c_node->_private != NULL);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":12
 *     #print "getProxy for:", <int>c_node
 *     if c_node is not NULL and c_node._private is not NULL:
 *         return <_Element>c_node._private             # <<<<<<<<<<<<<<
 *     else:
 *         return None
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __Pyx_INCREF(((PyObject *)((struct LxmlElement *)__pyx_v_c_node->_private)));
    __pyx_r = ((struct LxmlElement *)__pyx_v_c_node->_private);
    goto __pyx_L0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":14
 *         return <_Element>c_node._private
 *     else:
 *         return None             # <<<<<<<<<<<<<<
 * 
 * cdef inline int hasProxy(xmlNode* c_node):
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __Pyx_INCREF(Py_None);
    __pyx_r = ((struct LxmlElement *)Py_None);
    goto __pyx_L0;
  }
  __pyx_L3:;

  __pyx_r = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":16
 *         return None
 * 
 * cdef inline int hasProxy(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     return c_node._private is not NULL
 * 
 */

static CYTHON_INLINE int __pyx_f_4lxml_5etree_hasProxy(xmlNode *__pyx_v_c_node) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("hasProxy");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":17
 * 
 * cdef inline int hasProxy(xmlNode* c_node):
 *     return c_node._private is not NULL             # <<<<<<<<<<<<<<
 * 
 * cdef inline int _registerProxy(_Element proxy, _Document doc,
 */
  __pyx_r = (__pyx_v_c_node->_private != NULL);
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":19
 *     return c_node._private is not NULL
 * 
 * cdef inline int _registerProxy(_Element proxy, _Document doc,             # <<<<<<<<<<<<<<
 *                                xmlNode* c_node) except -1:
 *     u"""Register a proxy and type for the node it's proxying for.
 */

static CYTHON_INLINE int __pyx_f_4lxml_5etree__registerProxy(struct LxmlElement *__pyx_v_proxy, struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("_registerProxy");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":24
 *     """
 *     #print "registering for:", <int>proxy._c_node
 *     assert c_node._private is NULL, u"double registering proxy!"             # <<<<<<<<<<<<<<
 *     proxy._doc = doc
 *     proxy._c_node = c_node
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!(__pyx_v_c_node->_private == NULL))) {
    PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_u_11));
    {__pyx_filename = __pyx_f[7]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":25
 *     #print "registering for:", <int>proxy._c_node
 *     assert c_node._private is NULL, u"double registering proxy!"
 *     proxy._doc = doc             # <<<<<<<<<<<<<<
 *     proxy._c_node = c_node
 *     c_node._private = <void*>proxy
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_doc));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_doc));
  __Pyx_GOTREF(__pyx_v_proxy->_doc);
  __Pyx_DECREF(((PyObject *)__pyx_v_proxy->_doc));
  __pyx_v_proxy->_doc = __pyx_v_doc;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":26
 *     assert c_node._private is NULL, u"double registering proxy!"
 *     proxy._doc = doc
 *     proxy._c_node = c_node             # <<<<<<<<<<<<<<
 *     c_node._private = <void*>proxy
 *     # additional INCREF to make sure _Document is GC-ed LAST!
 */
  __pyx_v_proxy->_c_node = __pyx_v_c_node;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":27
 *     proxy._doc = doc
 *     proxy._c_node = c_node
 *     c_node._private = <void*>proxy             # <<<<<<<<<<<<<<
 *     # additional INCREF to make sure _Document is GC-ed LAST!
 *     proxy._gc_doc = <python.PyObject*>doc
 */
  __pyx_v_c_node->_private = ((void *)__pyx_v_proxy);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":29
 *     c_node._private = <void*>proxy
 *     # additional INCREF to make sure _Document is GC-ed LAST!
 *     proxy._gc_doc = <python.PyObject*>doc             # <<<<<<<<<<<<<<
 *     python.Py_INCREF(doc)
 * 
 */
  __pyx_v_proxy->_gc_doc = ((PyObject *)__pyx_v_doc);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":30
 *     # additional INCREF to make sure _Document is GC-ed LAST!
 *     proxy._gc_doc = <python.PyObject*>doc
 *     python.Py_INCREF(doc)             # <<<<<<<<<<<<<<
 * 
 * cdef inline int _unregisterProxy(_Element proxy) except -1:
 */
  Py_INCREF(((PyObject *)__pyx_v_doc));

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._registerProxy");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":32
 *     python.Py_INCREF(doc)
 * 
 * cdef inline int _unregisterProxy(_Element proxy) except -1:             # <<<<<<<<<<<<<<
 *     u"""Unregister a proxy for the node it's proxying for.
 *     """
 */

static CYTHON_INLINE int __pyx_f_4lxml_5etree__unregisterProxy(struct LxmlElement *__pyx_v_proxy) {
  xmlNode *__pyx_v_c_node;
  int __pyx_r;
  __Pyx_RefNannySetupContext("_unregisterProxy");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":36
 *     """
 *     cdef xmlNode* c_node
 *     c_node = proxy._c_node             # <<<<<<<<<<<<<<
 *     assert c_node._private is <void*>proxy, u"Tried to unregister unknown proxy"
 *     c_node._private = NULL
 */
  __pyx_v_c_node = __pyx_v_proxy->_c_node;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":37
 *     cdef xmlNode* c_node
 *     c_node = proxy._c_node
 *     assert c_node._private is <void*>proxy, u"Tried to unregister unknown proxy"             # <<<<<<<<<<<<<<
 *     c_node._private = NULL
 *     return 0
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!(__pyx_v_c_node->_private == ((void *)__pyx_v_proxy)))) {
    PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_u_12));
    {__pyx_filename = __pyx_f[7]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":38
 *     c_node = proxy._c_node
 *     assert c_node._private is <void*>proxy, u"Tried to unregister unknown proxy"
 *     c_node._private = NULL             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_v_c_node->_private = NULL;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":39
 *     assert c_node._private is <void*>proxy, u"Tried to unregister unknown proxy"
 *     c_node._private = NULL
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef inline void _releaseProxy(_Element proxy):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._unregisterProxy");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":41
 *     return 0
 * 
 * cdef inline void _releaseProxy(_Element proxy):             # <<<<<<<<<<<<<<
 *     u"""An additional DECREF for the document.
 *     """
 */

static CYTHON_INLINE void __pyx_f_4lxml_5etree__releaseProxy(struct LxmlElement *__pyx_v_proxy) {
  __Pyx_RefNannySetupContext("_releaseProxy");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":44
 *     u"""An additional DECREF for the document.
 *     """
 *     python.Py_XDECREF(proxy._gc_doc)             # <<<<<<<<<<<<<<
 *     proxy._gc_doc = NULL
 * 
 */
  Py_XDECREF(__pyx_v_proxy->_gc_doc);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":45
 *     """
 *     python.Py_XDECREF(proxy._gc_doc)
 *     proxy._gc_doc = NULL             # <<<<<<<<<<<<<<
 * 
 * cdef inline void _updateProxyDocument(xmlNode* c_node, _Document doc):
 */
  __pyx_v_proxy->_gc_doc = NULL;

  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":47
 *     proxy._gc_doc = NULL
 * 
 * cdef inline void _updateProxyDocument(xmlNode* c_node, _Document doc):             # <<<<<<<<<<<<<<
 *     u"""Replace the document reference of a proxy and return the old one
 *     iff it was replaced (None otherwise).
 */

static CYTHON_INLINE void __pyx_f_4lxml_5etree__updateProxyDocument(xmlNode *__pyx_v_c_node, struct LxmlDocument *__pyx_v_doc) {
  struct LxmlDocument *__pyx_v_old_doc;
  struct LxmlElement *__pyx_v_element = 0;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_updateProxyDocument");
  __pyx_v_old_doc = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":52
 *     """
 *     cdef _Document old_doc
 *     cdef _Element element = <_Element>c_node._private             # <<<<<<<<<<<<<<
 *     if element._doc is not doc:
 *         old_doc = element._doc
 */
  __Pyx_INCREF(((PyObject *)((struct LxmlElement *)__pyx_v_c_node->_private)));
  __pyx_v_element = ((struct LxmlElement *)__pyx_v_c_node->_private);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":53
 *     cdef _Document old_doc
 *     cdef _Element element = <_Element>c_node._private
 *     if element._doc is not doc:             # <<<<<<<<<<<<<<
 *         old_doc = element._doc
 *         element._doc = doc
 */
  __pyx_t_1 = (__pyx_v_element->_doc != __pyx_v_doc);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":54
 *     cdef _Element element = <_Element>c_node._private
 *     if element._doc is not doc:
 *         old_doc = element._doc             # <<<<<<<<<<<<<<
 *         element._doc = doc
 *         python.Py_INCREF(doc)
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_element->_doc));
    __Pyx_DECREF(((PyObject *)__pyx_v_old_doc));
    __pyx_v_old_doc = __pyx_v_element->_doc;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":55
 *     if element._doc is not doc:
 *         old_doc = element._doc
 *         element._doc = doc             # <<<<<<<<<<<<<<
 *         python.Py_INCREF(doc)
 *         element._gc_doc = <python.PyObject*>doc
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_doc));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_doc));
    __Pyx_GOTREF(__pyx_v_element->_doc);
    __Pyx_DECREF(((PyObject *)__pyx_v_element->_doc));
    __pyx_v_element->_doc = __pyx_v_doc;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":56
 *         old_doc = element._doc
 *         element._doc = doc
 *         python.Py_INCREF(doc)             # <<<<<<<<<<<<<<
 *         element._gc_doc = <python.PyObject*>doc
 *         python.Py_DECREF(old_doc)
 */
    Py_INCREF(((PyObject *)__pyx_v_doc));

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":57
 *         element._doc = doc
 *         python.Py_INCREF(doc)
 *         element._gc_doc = <python.PyObject*>doc             # <<<<<<<<<<<<<<
 *         python.Py_DECREF(old_doc)
 * 
 */
    __pyx_v_element->_gc_doc = ((PyObject *)__pyx_v_doc);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":58
 *         python.Py_INCREF(doc)
 *         element._gc_doc = <python.PyObject*>doc
 *         python.Py_DECREF(old_doc)             # <<<<<<<<<<<<<<
 * 
 * ################################################################################
 */
    Py_DECREF(((PyObject *)__pyx_v_old_doc));
    goto __pyx_L3;
  }
  __pyx_L3:;

  __Pyx_DECREF((PyObject *)__pyx_v_old_doc);
  __Pyx_XDECREF((PyObject *)__pyx_v_element);
  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":63
 * # temporarily make a node the root node of its document
 * 
 * cdef xmlDoc* _fakeRootDoc(xmlDoc* c_base_doc, xmlNode* c_node) except NULL:             # <<<<<<<<<<<<<<
 *     return _plainFakeRootDoc(c_base_doc, c_node, 1)
 * 
 */

static  xmlDoc *__pyx_f_4lxml_5etree__fakeRootDoc(xmlDoc *__pyx_v_c_base_doc, xmlNode *__pyx_v_c_node) {
  xmlDoc *__pyx_r;
  xmlDoc *__pyx_t_1;
  __Pyx_RefNannySetupContext("_fakeRootDoc");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":64
 * 
 * cdef xmlDoc* _fakeRootDoc(xmlDoc* c_base_doc, xmlNode* c_node) except NULL:
 *     return _plainFakeRootDoc(c_base_doc, c_node, 1)             # <<<<<<<<<<<<<<
 * 
 * cdef xmlDoc* _plainFakeRootDoc(xmlDoc* c_base_doc, xmlNode* c_node,
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__plainFakeRootDoc(__pyx_v_c_base_doc, __pyx_v_c_node, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._fakeRootDoc");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":66
 *     return _plainFakeRootDoc(c_base_doc, c_node, 1)
 * 
 * cdef xmlDoc* _plainFakeRootDoc(xmlDoc* c_base_doc, xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                                bint with_siblings) except NULL:
 *     # build a temporary document that has the given node as root node
 */

static  xmlDoc *__pyx_f_4lxml_5etree__plainFakeRootDoc(xmlDoc *__pyx_v_c_base_doc, xmlNode *__pyx_v_c_node, int __pyx_v_with_siblings) {
  xmlNode *__pyx_v_c_child;
  xmlNode *__pyx_v_c_root;
  xmlNode *__pyx_v_c_new_root;
  xmlDoc *__pyx_v_c_doc;
  xmlDoc *__pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  xmlDoc *__pyx_t_4;
  __Pyx_RefNannySetupContext("_plainFakeRootDoc");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":75
 *     cdef xmlNode* c_new_root
 *     cdef xmlDoc*  c_doc
 *     if with_siblings or (c_node.prev is NULL and c_node.next is NULL):             # <<<<<<<<<<<<<<
 *         c_root = tree.xmlDocGetRootElement(c_base_doc)
 *         if c_root is c_node:
 */
  if (!__pyx_v_with_siblings) {
    __pyx_t_1 = (__pyx_v_c_node->prev == NULL);
    if (__pyx_t_1) {
      __pyx_t_2 = (__pyx_v_c_node->next == NULL);
      __pyx_t_3 = __pyx_t_2;
    } else {
      __pyx_t_3 = __pyx_t_1;
    }
    __pyx_t_1 = __pyx_t_3;
  } else {
    __pyx_t_1 = __pyx_v_with_siblings;
  }
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":76
 *     cdef xmlDoc*  c_doc
 *     if with_siblings or (c_node.prev is NULL and c_node.next is NULL):
 *         c_root = tree.xmlDocGetRootElement(c_base_doc)             # <<<<<<<<<<<<<<
 *         if c_root is c_node:
 *             # already the root node, no siblings
 */
    __pyx_v_c_root = xmlDocGetRootElement(__pyx_v_c_base_doc);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":77
 *     if with_siblings or (c_node.prev is NULL and c_node.next is NULL):
 *         c_root = tree.xmlDocGetRootElement(c_base_doc)
 *         if c_root is c_node:             # <<<<<<<<<<<<<<
 *             # already the root node, no siblings
 *             return c_base_doc
 */
    __pyx_t_1 = (__pyx_v_c_root == __pyx_v_c_node);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":79
 *         if c_root is c_node:
 *             # already the root node, no siblings
 *             return c_base_doc             # <<<<<<<<<<<<<<
 * 
 *     c_doc  = _copyDoc(c_base_doc, 0)                   # non recursive!
 */
      __pyx_r = __pyx_v_c_base_doc;
      goto __pyx_L0;
      goto __pyx_L4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":81
 *             return c_base_doc
 * 
 *     c_doc  = _copyDoc(c_base_doc, 0)                   # non recursive!             # <<<<<<<<<<<<<<
 *     c_new_root = tree.xmlDocCopyNode(c_node, c_doc, 2) # non recursive!
 *     tree.xmlDocSetRootElement(c_doc, c_new_root)
 */
  __pyx_t_4 = __pyx_f_4lxml_5etree__copyDoc(__pyx_v_c_base_doc, 0); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_doc = __pyx_t_4;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":82
 * 
 *     c_doc  = _copyDoc(c_base_doc, 0)                   # non recursive!
 *     c_new_root = tree.xmlDocCopyNode(c_node, c_doc, 2) # non recursive!             # <<<<<<<<<<<<<<
 *     tree.xmlDocSetRootElement(c_doc, c_new_root)
 *     _copyParentNamespaces(c_node, c_new_root)
 */
  __pyx_v_c_new_root = xmlDocCopyNode(__pyx_v_c_node, __pyx_v_c_doc, 2);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":83
 *     c_doc  = _copyDoc(c_base_doc, 0)                   # non recursive!
 *     c_new_root = tree.xmlDocCopyNode(c_node, c_doc, 2) # non recursive!
 *     tree.xmlDocSetRootElement(c_doc, c_new_root)             # <<<<<<<<<<<<<<
 *     _copyParentNamespaces(c_node, c_new_root)
 * 
 */
  xmlDocSetRootElement(__pyx_v_c_doc, __pyx_v_c_new_root);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":84
 *     c_new_root = tree.xmlDocCopyNode(c_node, c_doc, 2) # non recursive!
 *     tree.xmlDocSetRootElement(c_doc, c_new_root)
 *     _copyParentNamespaces(c_node, c_new_root)             # <<<<<<<<<<<<<<
 * 
 *     c_new_root.children = c_node.children
 */
  __pyx_f_4lxml_5etree__copyParentNamespaces(__pyx_v_c_node, __pyx_v_c_new_root);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":86
 *     _copyParentNamespaces(c_node, c_new_root)
 * 
 *     c_new_root.children = c_node.children             # <<<<<<<<<<<<<<
 *     c_new_root.last = c_node.last
 *     c_new_root.next = c_new_root.prev = NULL
 */
  __pyx_v_c_new_root->children = __pyx_v_c_node->children;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":87
 * 
 *     c_new_root.children = c_node.children
 *     c_new_root.last = c_node.last             # <<<<<<<<<<<<<<
 *     c_new_root.next = c_new_root.prev = NULL
 * 
 */
  __pyx_v_c_new_root->last = __pyx_v_c_node->last;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":88
 *     c_new_root.children = c_node.children
 *     c_new_root.last = c_node.last
 *     c_new_root.next = c_new_root.prev = NULL             # <<<<<<<<<<<<<<
 * 
 *     # store original node
 */
  __pyx_v_c_new_root->next = NULL;
  __pyx_v_c_new_root->prev = NULL;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":91
 * 
 *     # store original node
 *     c_doc._private = c_node             # <<<<<<<<<<<<<<
 * 
 *     # divert parent pointers of children
 */
  __pyx_v_c_doc->_private = __pyx_v_c_node;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":94
 * 
 *     # divert parent pointers of children
 *     c_child = c_new_root.children             # <<<<<<<<<<<<<<
 *     while c_child is not NULL:
 *         c_child.parent = c_new_root
 */
  __pyx_v_c_child = __pyx_v_c_new_root->children;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":95
 *     # divert parent pointers of children
 *     c_child = c_new_root.children
 *     while c_child is not NULL:             # <<<<<<<<<<<<<<
 *         c_child.parent = c_new_root
 *         c_child = c_child.next
 */
  while (1) {
    __pyx_t_1 = (__pyx_v_c_child != NULL);
    if (!__pyx_t_1) break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":96
 *     c_child = c_new_root.children
 *     while c_child is not NULL:
 *         c_child.parent = c_new_root             # <<<<<<<<<<<<<<
 *         c_child = c_child.next
 * 
 */
    __pyx_v_c_child->parent = __pyx_v_c_new_root;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":97
 *     while c_child is not NULL:
 *         c_child.parent = c_new_root
 *         c_child = c_child.next             # <<<<<<<<<<<<<<
 * 
 *     c_doc.children = c_new_root
 */
    __pyx_v_c_child = __pyx_v_c_child->next;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":99
 *         c_child = c_child.next
 * 
 *     c_doc.children = c_new_root             # <<<<<<<<<<<<<<
 *     return c_doc
 * 
 */
  __pyx_v_c_doc->children = __pyx_v_c_new_root;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":100
 * 
 *     c_doc.children = c_new_root
 *     return c_doc             # <<<<<<<<<<<<<<
 * 
 * cdef void _destroyFakeDoc(xmlDoc* c_base_doc, xmlDoc* c_doc):
 */
  __pyx_r = __pyx_v_c_doc;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._plainFakeRootDoc");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":102
 *     return c_doc
 * 
 * cdef void _destroyFakeDoc(xmlDoc* c_base_doc, xmlDoc* c_doc):             # <<<<<<<<<<<<<<
 *     # delete a temporary document
 *     cdef xmlNode* c_child
 */

static  void __pyx_f_4lxml_5etree__destroyFakeDoc(xmlDoc *__pyx_v_c_base_doc, xmlDoc *__pyx_v_c_doc) {
  xmlNode *__pyx_v_c_child;
  xmlNode *__pyx_v_c_parent;
  xmlNode *__pyx_v_c_root;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_destroyFakeDoc");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":107
 *     cdef xmlNode* c_parent
 *     cdef xmlNode* c_root
 *     if c_doc is c_base_doc:             # <<<<<<<<<<<<<<
 *         return
 *     c_root = tree.xmlDocGetRootElement(c_doc)
 */
  __pyx_t_1 = (__pyx_v_c_doc == __pyx_v_c_base_doc);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":108
 *     cdef xmlNode* c_root
 *     if c_doc is c_base_doc:
 *         return             # <<<<<<<<<<<<<<
 *     c_root = tree.xmlDocGetRootElement(c_doc)
 * 
 */
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":109
 *     if c_doc is c_base_doc:
 *         return
 *     c_root = tree.xmlDocGetRootElement(c_doc)             # <<<<<<<<<<<<<<
 * 
 *     # restore parent pointers of children
 */
  __pyx_v_c_root = xmlDocGetRootElement(__pyx_v_c_doc);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":112
 * 
 *     # restore parent pointers of children
 *     c_parent = <xmlNode*>c_doc._private             # <<<<<<<<<<<<<<
 *     c_child = c_root.children
 *     while c_child is not NULL:
 */
  __pyx_v_c_parent = ((xmlNode *)__pyx_v_c_doc->_private);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":113
 *     # restore parent pointers of children
 *     c_parent = <xmlNode*>c_doc._private
 *     c_child = c_root.children             # <<<<<<<<<<<<<<
 *     while c_child is not NULL:
 *         c_child.parent = c_parent
 */
  __pyx_v_c_child = __pyx_v_c_root->children;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":114
 *     c_parent = <xmlNode*>c_doc._private
 *     c_child = c_root.children
 *     while c_child is not NULL:             # <<<<<<<<<<<<<<
 *         c_child.parent = c_parent
 *         c_child = c_child.next
 */
  while (1) {
    __pyx_t_1 = (__pyx_v_c_child != NULL);
    if (!__pyx_t_1) break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":115
 *     c_child = c_root.children
 *     while c_child is not NULL:
 *         c_child.parent = c_parent             # <<<<<<<<<<<<<<
 *         c_child = c_child.next
 * 
 */
    __pyx_v_c_child->parent = __pyx_v_c_parent;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":116
 *     while c_child is not NULL:
 *         c_child.parent = c_parent
 *         c_child = c_child.next             # <<<<<<<<<<<<<<
 * 
 *     # prevent recursive removal of children
 */
    __pyx_v_c_child = __pyx_v_c_child->next;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":119
 * 
 *     # prevent recursive removal of children
 *     c_root.children = c_root.last = NULL             # <<<<<<<<<<<<<<
 *     tree.xmlFreeDoc(c_doc)
 * 
 */
  __pyx_v_c_root->children = NULL;
  __pyx_v_c_root->last = NULL;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":120
 *     # prevent recursive removal of children
 *     c_root.children = c_root.last = NULL
 *     tree.xmlFreeDoc(c_doc)             # <<<<<<<<<<<<<<
 * 
 * cdef _Element _fakeDocElementFactory(_Document doc, xmlNode* c_element):
 */
  xmlFreeDoc(__pyx_v_c_doc);

  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":122
 *     tree.xmlFreeDoc(c_doc)
 * 
 * cdef _Element _fakeDocElementFactory(_Document doc, xmlNode* c_element):             # <<<<<<<<<<<<<<
 *     u"""Special element factory for cases where we need to create a fake
 *     root document, but still need to instantiate arbitrary nodes from
 */

static  struct LxmlElement *__pyx_f_4lxml_5etree__fakeDocElementFactory(struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_element) {
  struct LxmlElement *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_fakeDocElementFactory");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":131
 *     instantiate the original node instead.
 *     """
 *     if c_element.doc is not doc._c_doc:             # <<<<<<<<<<<<<<
 *         if c_element.doc._private is not NULL:
 *             if c_element is c_element.doc.children:
 */
  __pyx_t_1 = (__pyx_v_c_element->doc != __pyx_v_doc->_c_doc);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":132
 *     """
 *     if c_element.doc is not doc._c_doc:
 *         if c_element.doc._private is not NULL:             # <<<<<<<<<<<<<<
 *             if c_element is c_element.doc.children:
 *                 c_element = <xmlNode*>c_element.doc._private
 */
    __pyx_t_1 = (__pyx_v_c_element->doc->_private != NULL);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":133
 *     if c_element.doc is not doc._c_doc:
 *         if c_element.doc._private is not NULL:
 *             if c_element is c_element.doc.children:             # <<<<<<<<<<<<<<
 *                 c_element = <xmlNode*>c_element.doc._private
 *                 #assert c_element.type == tree.XML_ELEMENT_NODE
 */
      __pyx_t_1 = (__pyx_v_c_element == __pyx_v_c_element->doc->children);
      if (__pyx_t_1) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":134
 *         if c_element.doc._private is not NULL:
 *             if c_element is c_element.doc.children:
 *                 c_element = <xmlNode*>c_element.doc._private             # <<<<<<<<<<<<<<
 *                 #assert c_element.type == tree.XML_ELEMENT_NODE
 *     return _elementFactory(doc, c_element)
 */
        __pyx_v_c_element = ((xmlNode *)__pyx_v_c_element->doc->_private);
        goto __pyx_L5;
      }
      __pyx_L5:;
      goto __pyx_L4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":136
 *                 c_element = <xmlNode*>c_element.doc._private
 *                 #assert c_element.type == tree.XML_ELEMENT_NODE
 *     return _elementFactory(doc, c_element)             # <<<<<<<<<<<<<<
 * 
 * ################################################################################
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(__pyx_v_doc, __pyx_v_c_element)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = ((struct LxmlElement *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._fakeDocElementFactory");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":141
 * # support for freeing tree elements when proxy objects are destroyed
 * 
 * cdef int attemptDeallocation(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     u"""Attempt deallocation of c_node (or higher up in tree).
 *     """
 */

static  int __pyx_f_4lxml_5etree_attemptDeallocation(xmlNode *__pyx_v_c_node) {
  xmlNode *__pyx_v_c_top;
  int __pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("attemptDeallocation");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":146
 *     cdef xmlNode* c_top
 *     # could be we actually aren't referring to the tree at all
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         #print "not freeing, node is NULL"
 *         return 0
 */
  __pyx_t_1 = (__pyx_v_c_node == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":148
 *     if c_node is NULL:
 *         #print "not freeing, node is NULL"
 *         return 0             # <<<<<<<<<<<<<<
 *     c_top = getDeallocationTop(c_node)
 *     if c_top is not NULL:
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":149
 *         #print "not freeing, node is NULL"
 *         return 0
 *     c_top = getDeallocationTop(c_node)             # <<<<<<<<<<<<<<
 *     if c_top is not NULL:
 *         #print "freeing:", c_top.name
 */
  __pyx_v_c_top = __pyx_f_4lxml_5etree_getDeallocationTop(__pyx_v_c_node);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":150
 *         return 0
 *     c_top = getDeallocationTop(c_node)
 *     if c_top is not NULL:             # <<<<<<<<<<<<<<
 *         #print "freeing:", c_top.name
 *         _removeText(c_top.next) # tail
 */
  __pyx_t_1 = (__pyx_v_c_top != NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":152
 *     if c_top is not NULL:
 *         #print "freeing:", c_top.name
 *         _removeText(c_top.next) # tail             # <<<<<<<<<<<<<<
 *         tree.xmlFreeNode(c_top)
 *         return 1
 */
    __pyx_f_4lxml_5etree__removeText(__pyx_v_c_top->next);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":153
 *         #print "freeing:", c_top.name
 *         _removeText(c_top.next) # tail
 *         tree.xmlFreeNode(c_top)             # <<<<<<<<<<<<<<
 *         return 1
 *     return 0
 */
    xmlFreeNode(__pyx_v_c_top);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":154
 *         _removeText(c_top.next) # tail
 *         tree.xmlFreeNode(c_top)
 *         return 1             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    __pyx_r = 1;
    goto __pyx_L0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":155
 *         tree.xmlFreeNode(c_top)
 *         return 1
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef xmlNode* getDeallocationTop(xmlNode* c_node):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":157
 *     return 0
 * 
 * cdef xmlNode* getDeallocationTop(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     u"""Return the top of the tree that can be deallocated, or NULL.
 *     """
 */

static  xmlNode *__pyx_f_4lxml_5etree_getDeallocationTop(xmlNode *__pyx_v_c_node) {
  xmlNode *__pyx_v_c_current;
  xmlNode *__pyx_v_c_top;
  xmlNode *__pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("getDeallocationTop");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":163
 *     cdef xmlNode* c_top
 *     #print "trying to do deallocating:", c_node.type
 *     if c_node._private is not NULL:             # <<<<<<<<<<<<<<
 *         #print "Not freeing: proxies still exist"
 *         return NULL
 */
  __pyx_t_1 = (__pyx_v_c_node->_private != NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":165
 *     if c_node._private is not NULL:
 *         #print "Not freeing: proxies still exist"
 *         return NULL             # <<<<<<<<<<<<<<
 *     c_current = c_node.parent
 *     c_top = c_node
 */
    __pyx_r = NULL;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":166
 *         #print "Not freeing: proxies still exist"
 *         return NULL
 *     c_current = c_node.parent             # <<<<<<<<<<<<<<
 *     c_top = c_node
 *     while c_current is not NULL:
 */
  __pyx_v_c_current = __pyx_v_c_node->parent;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":167
 *         return NULL
 *     c_current = c_node.parent
 *     c_top = c_node             # <<<<<<<<<<<<<<
 *     while c_current is not NULL:
 *         #print "checking:", c_current.type
 */
  __pyx_v_c_top = __pyx_v_c_node;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":168
 *     c_current = c_node.parent
 *     c_top = c_node
 *     while c_current is not NULL:             # <<<<<<<<<<<<<<
 *         #print "checking:", c_current.type
 *         if c_current.type == tree.XML_DOCUMENT_NODE or \
 */
  while (1) {
    __pyx_t_1 = (__pyx_v_c_current != NULL);
    if (!__pyx_t_1) break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":170
 *     while c_current is not NULL:
 *         #print "checking:", c_current.type
 *         if c_current.type == tree.XML_DOCUMENT_NODE or \             # <<<<<<<<<<<<<<
 *                c_current.type == tree.XML_HTML_DOCUMENT_NODE:
 *             #print "not freeing: still in doc"
 */
    __pyx_t_1 = (__pyx_v_c_current->type == XML_DOCUMENT_NODE);
    if (!__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":171
 *         #print "checking:", c_current.type
 *         if c_current.type == tree.XML_DOCUMENT_NODE or \
 *                c_current.type == tree.XML_HTML_DOCUMENT_NODE:             # <<<<<<<<<<<<<<
 *             #print "not freeing: still in doc"
 *             return NULL
 */
      __pyx_t_2 = (__pyx_v_c_current->type == XML_HTML_DOCUMENT_NODE);
      __pyx_t_3 = __pyx_t_2;
    } else {
      __pyx_t_3 = __pyx_t_1;
    }
    if (__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":173
 *                c_current.type == tree.XML_HTML_DOCUMENT_NODE:
 *             #print "not freeing: still in doc"
 *             return NULL             # <<<<<<<<<<<<<<
 *         # if we're still attached to the document, don't deallocate
 *         if c_current._private is not NULL:
 */
      __pyx_r = NULL;
      goto __pyx_L0;
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":175
 *             return NULL
 *         # if we're still attached to the document, don't deallocate
 *         if c_current._private is not NULL:             # <<<<<<<<<<<<<<
 *             #print "Not freeing: proxies still exist"
 *             return NULL
 */
    __pyx_t_3 = (__pyx_v_c_current->_private != NULL);
    if (__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":177
 *         if c_current._private is not NULL:
 *             #print "Not freeing: proxies still exist"
 *             return NULL             # <<<<<<<<<<<<<<
 *         c_top = c_current
 *         c_current = c_current.parent
 */
      __pyx_r = NULL;
      goto __pyx_L0;
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":178
 *             #print "Not freeing: proxies still exist"
 *             return NULL
 *         c_top = c_current             # <<<<<<<<<<<<<<
 *         c_current = c_current.parent
 *     # see whether we have children to deallocate
 */
    __pyx_v_c_top = __pyx_v_c_current;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":179
 *             return NULL
 *         c_top = c_current
 *         c_current = c_current.parent             # <<<<<<<<<<<<<<
 *     # see whether we have children to deallocate
 *     if canDeallocateChildNodes(c_top):
 */
    __pyx_v_c_current = __pyx_v_c_current->parent;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":181
 *         c_current = c_current.parent
 *     # see whether we have children to deallocate
 *     if canDeallocateChildNodes(c_top):             # <<<<<<<<<<<<<<
 *         return c_top
 *     else:
 */
  __pyx_t_4 = __pyx_f_4lxml_5etree_canDeallocateChildNodes(__pyx_v_c_top);
  if (__pyx_t_4) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":182
 *     # see whether we have children to deallocate
 *     if canDeallocateChildNodes(c_top):
 *         return c_top             # <<<<<<<<<<<<<<
 *     else:
 *         return NULL
 */
    __pyx_r = __pyx_v_c_top;
    goto __pyx_L0;
    goto __pyx_L8;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":184
 *         return c_top
 *     else:
 *         return NULL             # <<<<<<<<<<<<<<
 * 
 * cdef int canDeallocateChildNodes(xmlNode* c_parent):
 */
    __pyx_r = NULL;
    goto __pyx_L0;
  }
  __pyx_L8:;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":186
 *         return NULL
 * 
 * cdef int canDeallocateChildNodes(xmlNode* c_parent):             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     c_node = c_parent.children
 */

static  int __pyx_f_4lxml_5etree_canDeallocateChildNodes(xmlNode *__pyx_v_c_parent) {
  xmlNode *__pyx_v_c_node;
  int __pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("canDeallocateChildNodes");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":188
 * cdef int canDeallocateChildNodes(xmlNode* c_parent):
 *     cdef xmlNode* c_node
 *     c_node = c_parent.children             # <<<<<<<<<<<<<<
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_parent, c_node, 1)
 *     if c_node._private is not NULL:
 */
  __pyx_v_c_node = __pyx_v_c_parent->children;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":189
 *     cdef xmlNode* c_node
 *     c_node = c_parent.children
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_parent, c_node, 1)             # <<<<<<<<<<<<<<
 *     if c_node._private is not NULL:
 *         return 0
 */
  BEGIN_FOR_EACH_ELEMENT_FROM(__pyx_v_c_parent, __pyx_v_c_node, 1);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":190
 *     c_node = c_parent.children
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_parent, c_node, 1)
 *     if c_node._private is not NULL:             # <<<<<<<<<<<<<<
 *         return 0
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 */
  __pyx_t_1 = (__pyx_v_c_node->_private != NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":191
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_parent, c_node, 1)
 *     if c_node._private is not NULL:
 *         return 0             # <<<<<<<<<<<<<<
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 *     return 1
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":192
 *     if c_node._private is not NULL:
 *         return 0
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)             # <<<<<<<<<<<<<<
 *     return 1
 * 
 */
  END_FOR_EACH_ELEMENT_FROM(__pyx_v_c_node);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":193
 *         return 0
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 *     return 1             # <<<<<<<<<<<<<<
 * 
 * ################################################################################
 */
  __pyx_r = 1;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":198
 * # fix _Document references and namespaces when a node changes documents
 * 
 * cdef void _copyParentNamespaces(xmlNode* c_from_node, xmlNode* c_to_node) nogil:             # <<<<<<<<<<<<<<
 *     u"""Copy the namespaces of all ancestors of c_from_node to c_to_node.
 *     """
 */

static  void __pyx_f_4lxml_5etree__copyParentNamespaces(xmlNode *__pyx_v_c_from_node, xmlNode *__pyx_v_c_to_node) {
  xmlNode *__pyx_v_c_parent;
  xmlNs *__pyx_v_c_new_ns;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":205
 *     cdef xmlNs* c_new_ns
 *     cdef int prefix_known
 *     c_parent = c_from_node.parent             # <<<<<<<<<<<<<<
 *     while c_parent is not NULL and (tree._isElementOrXInclude(c_parent) or
 *                                     c_parent.type == tree.XML_DOCUMENT_NODE):
 */
  __pyx_v_c_parent = __pyx_v_c_from_node->parent;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":206
 *     cdef int prefix_known
 *     c_parent = c_from_node.parent
 *     while c_parent is not NULL and (tree._isElementOrXInclude(c_parent) or             # <<<<<<<<<<<<<<
 *                                     c_parent.type == tree.XML_DOCUMENT_NODE):
 *         c_new_ns = c_parent.nsDef
 */
  while (1) {
    __pyx_t_1 = (__pyx_v_c_parent != NULL);
    if (__pyx_t_1) {
      __pyx_t_2 = _isElementOrXInclude(__pyx_v_c_parent);
      if (!__pyx_t_2) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":207
 *     c_parent = c_from_node.parent
 *     while c_parent is not NULL and (tree._isElementOrXInclude(c_parent) or
 *                                     c_parent.type == tree.XML_DOCUMENT_NODE):             # <<<<<<<<<<<<<<
 *         c_new_ns = c_parent.nsDef
 *         while c_new_ns is not NULL:
 */
        __pyx_t_3 = (__pyx_v_c_parent->type == XML_DOCUMENT_NODE);
        __pyx_t_4 = __pyx_t_3;
      } else {
        __pyx_t_4 = __pyx_t_2;
      }
      __pyx_t_2 = __pyx_t_4;
    } else {
      __pyx_t_2 = __pyx_t_1;
    }
    if (!__pyx_t_2) break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":208
 *     while c_parent is not NULL and (tree._isElementOrXInclude(c_parent) or
 *                                     c_parent.type == tree.XML_DOCUMENT_NODE):
 *         c_new_ns = c_parent.nsDef             # <<<<<<<<<<<<<<
 *         while c_new_ns is not NULL:
 *             # libxml2 will check if the prefix is already defined
 */
    __pyx_v_c_new_ns = __pyx_v_c_parent->nsDef;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":209
 *                                     c_parent.type == tree.XML_DOCUMENT_NODE):
 *         c_new_ns = c_parent.nsDef
 *         while c_new_ns is not NULL:             # <<<<<<<<<<<<<<
 *             # libxml2 will check if the prefix is already defined
 *             tree.xmlNewNs(c_to_node, c_new_ns.href, c_new_ns.prefix)
 */
    while (1) {
      __pyx_t_2 = (__pyx_v_c_new_ns != NULL);
      if (!__pyx_t_2) break;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":211
 *         while c_new_ns is not NULL:
 *             # libxml2 will check if the prefix is already defined
 *             tree.xmlNewNs(c_to_node, c_new_ns.href, c_new_ns.prefix)             # <<<<<<<<<<<<<<
 *             c_new_ns = c_new_ns.next
 *         c_parent = c_parent.parent
 */
      xmlNewNs(__pyx_v_c_to_node, __pyx_v_c_new_ns->href, __pyx_v_c_new_ns->prefix);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":212
 *             # libxml2 will check if the prefix is already defined
 *             tree.xmlNewNs(c_to_node, c_new_ns.href, c_new_ns.prefix)
 *             c_new_ns = c_new_ns.next             # <<<<<<<<<<<<<<
 *         c_parent = c_parent.parent
 * 
 */
      __pyx_v_c_new_ns = __pyx_v_c_new_ns->next;
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":213
 *             tree.xmlNewNs(c_to_node, c_new_ns.href, c_new_ns.prefix)
 *             c_new_ns = c_new_ns.next
 *         c_parent = c_parent.parent             # <<<<<<<<<<<<<<
 * 
 * ctypedef struct _nscache:
 */
    __pyx_v_c_parent = __pyx_v_c_parent->parent;
  }

}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":221
 *     size_t last
 * 
 * cdef int _growNsCache(_nscache* c_ns_cache) except -1:             # <<<<<<<<<<<<<<
 *     cdef xmlNs** c_ns_ptr
 *     if c_ns_cache.size == 0:
 */

static  int __pyx_f_4lxml_5etree__growNsCache(__pyx_t_4lxml_5etree__nscache *__pyx_v_c_ns_cache) {
  xmlNs **__pyx_v_c_ns_ptr;
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_growNsCache");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":223
 * cdef int _growNsCache(_nscache* c_ns_cache) except -1:
 *     cdef xmlNs** c_ns_ptr
 *     if c_ns_cache.size == 0:             # <<<<<<<<<<<<<<
 *         c_ns_cache.size = 20
 *     else:
 */
  __pyx_t_1 = (__pyx_v_c_ns_cache->size == 0);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":224
 *     cdef xmlNs** c_ns_ptr
 *     if c_ns_cache.size == 0:
 *         c_ns_cache.size = 20             # <<<<<<<<<<<<<<
 *     else:
 *         c_ns_cache.size *= 2
 */
    __pyx_v_c_ns_cache->size = 20;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":226
 *         c_ns_cache.size = 20
 *     else:
 *         c_ns_cache.size *= 2             # <<<<<<<<<<<<<<
 *     c_ns_ptr = <xmlNs**> cstd.realloc(
 *         c_ns_cache.new, c_ns_cache.size * sizeof(xmlNs*))
 */
    __pyx_v_c_ns_cache->size = (__pyx_v_c_ns_cache->size * 2);
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":228
 *         c_ns_cache.size *= 2
 *     c_ns_ptr = <xmlNs**> cstd.realloc(
 *         c_ns_cache.new, c_ns_cache.size * sizeof(xmlNs*))             # <<<<<<<<<<<<<<
 *     if c_ns_ptr is not NULL:
 *         c_ns_cache.new = c_ns_ptr
 */
  __pyx_v_c_ns_ptr = ((xmlNs **)realloc(__pyx_v_c_ns_cache->new, (__pyx_v_c_ns_cache->size * (sizeof(xmlNs *)))));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":229
 *     c_ns_ptr = <xmlNs**> cstd.realloc(
 *         c_ns_cache.new, c_ns_cache.size * sizeof(xmlNs*))
 *     if c_ns_ptr is not NULL:             # <<<<<<<<<<<<<<
 *         c_ns_cache.new = c_ns_ptr
 *         c_ns_ptr = <xmlNs**> cstd.realloc(
 */
  __pyx_t_1 = (__pyx_v_c_ns_ptr != NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":230
 *         c_ns_cache.new, c_ns_cache.size * sizeof(xmlNs*))
 *     if c_ns_ptr is not NULL:
 *         c_ns_cache.new = c_ns_ptr             # <<<<<<<<<<<<<<
 *         c_ns_ptr = <xmlNs**> cstd.realloc(
 *             c_ns_cache.old, c_ns_cache.size * sizeof(xmlNs*))
 */
    __pyx_v_c_ns_cache->new = __pyx_v_c_ns_ptr;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":232
 *         c_ns_cache.new = c_ns_ptr
 *         c_ns_ptr = <xmlNs**> cstd.realloc(
 *             c_ns_cache.old, c_ns_cache.size * sizeof(xmlNs*))             # <<<<<<<<<<<<<<
 *     if c_ns_ptr is not NULL:
 *         c_ns_cache.old = c_ns_ptr
 */
    __pyx_v_c_ns_ptr = ((xmlNs **)realloc(__pyx_v_c_ns_cache->old, (__pyx_v_c_ns_cache->size * (sizeof(xmlNs *)))));
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":233
 *         c_ns_ptr = <xmlNs**> cstd.realloc(
 *             c_ns_cache.old, c_ns_cache.size * sizeof(xmlNs*))
 *     if c_ns_ptr is not NULL:             # <<<<<<<<<<<<<<
 *         c_ns_cache.old = c_ns_ptr
 *     else:
 */
  __pyx_t_1 = (__pyx_v_c_ns_ptr != NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":234
 *             c_ns_cache.old, c_ns_cache.size * sizeof(xmlNs*))
 *     if c_ns_ptr is not NULL:
 *         c_ns_cache.old = c_ns_ptr             # <<<<<<<<<<<<<<
 *     else:
 *         cstd.free(c_ns_cache.new)
 */
    __pyx_v_c_ns_cache->old = __pyx_v_c_ns_ptr;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":236
 *         c_ns_cache.old = c_ns_ptr
 *     else:
 *         cstd.free(c_ns_cache.new)             # <<<<<<<<<<<<<<
 *         cstd.free(c_ns_cache.old)
 *         python.PyErr_NoMemory()
 */
    free(__pyx_v_c_ns_cache->new);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":237
 *     else:
 *         cstd.free(c_ns_cache.new)
 *         cstd.free(c_ns_cache.old)             # <<<<<<<<<<<<<<
 *         python.PyErr_NoMemory()
 *         return -1
 */
    free(__pyx_v_c_ns_cache->old);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":238
 *         cstd.free(c_ns_cache.new)
 *         cstd.free(c_ns_cache.old)
 *         python.PyErr_NoMemory()             # <<<<<<<<<<<<<<
 *         return -1
 *     return 0
 */
    __pyx_t_2 = PyErr_NoMemory(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":239
 *         cstd.free(c_ns_cache.old)
 *         python.PyErr_NoMemory()
 *         return -1             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    __pyx_r = -1;
    goto __pyx_L0;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":240
 *         python.PyErr_NoMemory()
 *         return -1
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef inline int _appendToNsCache(_nscache* c_ns_cache,
 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._growNsCache");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":242
 *     return 0
 * 
 * cdef inline int _appendToNsCache(_nscache* c_ns_cache,             # <<<<<<<<<<<<<<
 *                                  xmlNs* c_old_ns, xmlNs* c_new_ns) except -1:
 *     if c_ns_cache.last >= c_ns_cache.size:
 */

static CYTHON_INLINE int __pyx_f_4lxml_5etree__appendToNsCache(__pyx_t_4lxml_5etree__nscache *__pyx_v_c_ns_cache, xmlNs *__pyx_v_c_old_ns, xmlNs *__pyx_v_c_new_ns) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("_appendToNsCache");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":244
 * cdef inline int _appendToNsCache(_nscache* c_ns_cache,
 *                                  xmlNs* c_old_ns, xmlNs* c_new_ns) except -1:
 *     if c_ns_cache.last >= c_ns_cache.size:             # <<<<<<<<<<<<<<
 *         _growNsCache(c_ns_cache)
 *     c_ns_cache.old[c_ns_cache.last] = c_old_ns
 */
  __pyx_t_1 = (__pyx_v_c_ns_cache->last >= __pyx_v_c_ns_cache->size);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":245
 *                                  xmlNs* c_old_ns, xmlNs* c_new_ns) except -1:
 *     if c_ns_cache.last >= c_ns_cache.size:
 *         _growNsCache(c_ns_cache)             # <<<<<<<<<<<<<<
 *     c_ns_cache.old[c_ns_cache.last] = c_old_ns
 *     c_ns_cache.new[c_ns_cache.last] = c_new_ns
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree__growNsCache(__pyx_v_c_ns_cache); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":246
 *     if c_ns_cache.last >= c_ns_cache.size:
 *         _growNsCache(c_ns_cache)
 *     c_ns_cache.old[c_ns_cache.last] = c_old_ns             # <<<<<<<<<<<<<<
 *     c_ns_cache.new[c_ns_cache.last] = c_new_ns
 *     c_ns_cache.last += 1
 */
  (__pyx_v_c_ns_cache->old[__pyx_v_c_ns_cache->last]) = __pyx_v_c_old_ns;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":247
 *         _growNsCache(c_ns_cache)
 *     c_ns_cache.old[c_ns_cache.last] = c_old_ns
 *     c_ns_cache.new[c_ns_cache.last] = c_new_ns             # <<<<<<<<<<<<<<
 *     c_ns_cache.last += 1
 * 
 */
  (__pyx_v_c_ns_cache->new[__pyx_v_c_ns_cache->last]) = __pyx_v_c_new_ns;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":248
 *     c_ns_cache.old[c_ns_cache.last] = c_old_ns
 *     c_ns_cache.new[c_ns_cache.last] = c_new_ns
 *     c_ns_cache.last += 1             # <<<<<<<<<<<<<<
 * 
 * cdef int _stripRedundantNamespaceDeclarations(
 */
  __pyx_v_c_ns_cache->last = (__pyx_v_c_ns_cache->last + 1);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._appendToNsCache");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":250
 *     c_ns_cache.last += 1
 * 
 * cdef int _stripRedundantNamespaceDeclarations(             # <<<<<<<<<<<<<<
 *     xmlNode* c_element, _nscache* c_ns_cache, xmlNs** c_del_ns_list) except -1:
 *     u"""Removes namespace declarations from an element that are already
 */

static  int __pyx_f_4lxml_5etree__stripRedundantNamespaceDeclarations(xmlNode *__pyx_v_c_element, __pyx_t_4lxml_5etree__nscache *__pyx_v_c_ns_cache, xmlNs **__pyx_v_c_del_ns_list) {
  xmlNs *__pyx_v_c_ns;
  xmlNs *__pyx_v_c_ns_next;
  xmlNs **__pyx_v_c_nsdef;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("_stripRedundantNamespaceDeclarations");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":260
 *     cdef xmlNs** c_nsdef
 *     # use a xmlNs** to handle assignments to "c_element.nsDef" correctly
 *     c_nsdef = &c_element.nsDef             # <<<<<<<<<<<<<<
 *     while c_nsdef[0] is not NULL:
 *         c_ns = tree.xmlSearchNsByHref(
 */
  __pyx_v_c_nsdef = (&__pyx_v_c_element->nsDef);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":261
 *     # use a xmlNs** to handle assignments to "c_element.nsDef" correctly
 *     c_nsdef = &c_element.nsDef
 *     while c_nsdef[0] is not NULL:             # <<<<<<<<<<<<<<
 *         c_ns = tree.xmlSearchNsByHref(
 *             c_element.doc, c_element.parent, c_nsdef[0].href)
 */
  while (1) {
    __pyx_t_1 = ((__pyx_v_c_nsdef[0]) != NULL);
    if (!__pyx_t_1) break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":263
 *     while c_nsdef[0] is not NULL:
 *         c_ns = tree.xmlSearchNsByHref(
 *             c_element.doc, c_element.parent, c_nsdef[0].href)             # <<<<<<<<<<<<<<
 *         if c_ns is NULL:
 *             # new namespace href => keep and cache the ns declaration
 */
    __pyx_v_c_ns = xmlSearchNsByHref(__pyx_v_c_element->doc, __pyx_v_c_element->parent, (__pyx_v_c_nsdef[0])->href);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":264
 *         c_ns = tree.xmlSearchNsByHref(
 *             c_element.doc, c_element.parent, c_nsdef[0].href)
 *         if c_ns is NULL:             # <<<<<<<<<<<<<<
 *             # new namespace href => keep and cache the ns declaration
 *             _appendToNsCache(c_ns_cache, c_nsdef[0], c_nsdef[0])
 */
    __pyx_t_1 = (__pyx_v_c_ns == NULL);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":266
 *         if c_ns is NULL:
 *             # new namespace href => keep and cache the ns declaration
 *             _appendToNsCache(c_ns_cache, c_nsdef[0], c_nsdef[0])             # <<<<<<<<<<<<<<
 *             c_nsdef = &c_nsdef[0].next
 *         else:
 */
      __pyx_t_2 = __pyx_f_4lxml_5etree__appendToNsCache(__pyx_v_c_ns_cache, (__pyx_v_c_nsdef[0]), (__pyx_v_c_nsdef[0])); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":267
 *             # new namespace href => keep and cache the ns declaration
 *             _appendToNsCache(c_ns_cache, c_nsdef[0], c_nsdef[0])
 *             c_nsdef = &c_nsdef[0].next             # <<<<<<<<<<<<<<
 *         else:
 *             # known namespace href => cache mapping and strip old ns
 */
      __pyx_v_c_nsdef = (&(__pyx_v_c_nsdef[0])->next);
      goto __pyx_L5;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":270
 *         else:
 *             # known namespace href => cache mapping and strip old ns
 *             _appendToNsCache(c_ns_cache, c_nsdef[0], c_ns)             # <<<<<<<<<<<<<<
 *             # cut out c_nsdef.next and prepend it to garbage chain
 *             c_ns_next = c_nsdef[0].next
 */
      __pyx_t_2 = __pyx_f_4lxml_5etree__appendToNsCache(__pyx_v_c_ns_cache, (__pyx_v_c_nsdef[0]), __pyx_v_c_ns); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":272
 *             _appendToNsCache(c_ns_cache, c_nsdef[0], c_ns)
 *             # cut out c_nsdef.next and prepend it to garbage chain
 *             c_ns_next = c_nsdef[0].next             # <<<<<<<<<<<<<<
 *             c_nsdef[0].next = c_del_ns_list[0]
 *             c_del_ns_list[0] = c_nsdef[0]
 */
      __pyx_v_c_ns_next = (__pyx_v_c_nsdef[0])->next;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":273
 *             # cut out c_nsdef.next and prepend it to garbage chain
 *             c_ns_next = c_nsdef[0].next
 *             c_nsdef[0].next = c_del_ns_list[0]             # <<<<<<<<<<<<<<
 *             c_del_ns_list[0] = c_nsdef[0]
 *             c_nsdef[0] = c_ns_next
 */
      (__pyx_v_c_nsdef[0])->next = (__pyx_v_c_del_ns_list[0]);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":274
 *             c_ns_next = c_nsdef[0].next
 *             c_nsdef[0].next = c_del_ns_list[0]
 *             c_del_ns_list[0] = c_nsdef[0]             # <<<<<<<<<<<<<<
 *             c_nsdef[0] = c_ns_next
 *     return 0
 */
      (__pyx_v_c_del_ns_list[0]) = (__pyx_v_c_nsdef[0]);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":275
 *             c_nsdef[0].next = c_del_ns_list[0]
 *             c_del_ns_list[0] = c_nsdef[0]
 *             c_nsdef[0] = c_ns_next             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
      (__pyx_v_c_nsdef[0]) = __pyx_v_c_ns_next;
    }
    __pyx_L5:;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":276
 *             c_del_ns_list[0] = c_nsdef[0]
 *             c_nsdef[0] = c_ns_next
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int moveNodeToDocument(_Document doc, xmlDoc* c_source_doc,
 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._stripRedundantNamespaceDeclarations");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":278
 *     return 0
 * 
 * cdef int moveNodeToDocument(_Document doc, xmlDoc* c_source_doc,             # <<<<<<<<<<<<<<
 *                             xmlNode* c_element) except -1:
 *     u"""Fix the xmlNs pointers of a node and its subtree that were moved.
 */

static  int __pyx_f_4lxml_5etree_moveNodeToDocument(struct LxmlDocument *__pyx_v_doc, xmlDoc *__pyx_v_c_source_doc, xmlNode *__pyx_v_c_element) {
  xmlNode *__pyx_v_c_start_node;
  xmlNode *__pyx_v_c_node;
  __pyx_t_4lxml_5etree__nscache __pyx_v_c_ns_cache;
  xmlNs *__pyx_v_c_ns;
  xmlNs *__pyx_v_c_del_ns_list;
  size_t __pyx_v_i;
  size_t __pyx_v_proxy_count;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  size_t __pyx_t_3;
  xmlNs *__pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("moveNodeToDocument");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":317
 *     cdef xmlNs* c_nsdef
 *     cdef xmlNs* c_del_ns_list
 *     cdef size_t i, proxy_count = 0             # <<<<<<<<<<<<<<
 * 
 *     if not tree._isElementOrXInclude(c_element):
 */
  __pyx_v_proxy_count = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":319
 *     cdef size_t i, proxy_count = 0
 * 
 *     if not tree._isElementOrXInclude(c_element):             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  __pyx_t_1 = (!_isElementOrXInclude(__pyx_v_c_element));
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":320
 * 
 *     if not tree._isElementOrXInclude(c_element):
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     c_start_node = c_element
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":322
 *         return 0
 * 
 *     c_start_node = c_element             # <<<<<<<<<<<<<<
 *     c_del_ns_list = NULL
 * 
 */
  __pyx_v_c_start_node = __pyx_v_c_element;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":323
 * 
 *     c_start_node = c_element
 *     c_del_ns_list = NULL             # <<<<<<<<<<<<<<
 * 
 *     c_ns_cache.new = NULL
 */
  __pyx_v_c_del_ns_list = NULL;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":325
 *     c_del_ns_list = NULL
 * 
 *     c_ns_cache.new = NULL             # <<<<<<<<<<<<<<
 *     c_ns_cache.old = NULL
 *     c_ns_cache.size = 0
 */
  __pyx_v_c_ns_cache.new = NULL;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":326
 * 
 *     c_ns_cache.new = NULL
 *     c_ns_cache.old = NULL             # <<<<<<<<<<<<<<
 *     c_ns_cache.size = 0
 *     c_ns_cache.last = 0
 */
  __pyx_v_c_ns_cache.old = NULL;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":327
 *     c_ns_cache.new = NULL
 *     c_ns_cache.old = NULL
 *     c_ns_cache.size = 0             # <<<<<<<<<<<<<<
 *     c_ns_cache.last = 0
 * 
 */
  __pyx_v_c_ns_cache.size = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":328
 *     c_ns_cache.old = NULL
 *     c_ns_cache.size = 0
 *     c_ns_cache.last = 0             # <<<<<<<<<<<<<<
 * 
 *     tree.BEGIN_FOR_EACH_FROM(c_element, c_element, 1)
 */
  __pyx_v_c_ns_cache.last = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":330
 *     c_ns_cache.last = 0
 * 
 *     tree.BEGIN_FOR_EACH_FROM(c_element, c_element, 1)             # <<<<<<<<<<<<<<
 *     if tree._isElementOrXInclude(c_element):
 *         if c_element._private is not NULL:
 */
  BEGIN_FOR_EACH_FROM(__pyx_v_c_element, __pyx_v_c_element, 1);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":331
 * 
 *     tree.BEGIN_FOR_EACH_FROM(c_element, c_element, 1)
 *     if tree._isElementOrXInclude(c_element):             # <<<<<<<<<<<<<<
 *         if c_element._private is not NULL:
 *             proxy_count += 1
 */
  __pyx_t_1 = _isElementOrXInclude(__pyx_v_c_element);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":332
 *     tree.BEGIN_FOR_EACH_FROM(c_element, c_element, 1)
 *     if tree._isElementOrXInclude(c_element):
 *         if c_element._private is not NULL:             # <<<<<<<<<<<<<<
 *             proxy_count += 1
 * 
 */
    __pyx_t_1 = (__pyx_v_c_element->_private != NULL);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":333
 *     if tree._isElementOrXInclude(c_element):
 *         if c_element._private is not NULL:
 *             proxy_count += 1             # <<<<<<<<<<<<<<
 * 
 *         # 1) cut out namespaces defined here that are already known by
 */
      __pyx_v_proxy_count = (__pyx_v_proxy_count + 1);
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":337
 *         # 1) cut out namespaces defined here that are already known by
 *         #    the ancestors
 *         if c_element.nsDef is not NULL:             # <<<<<<<<<<<<<<
 *             _stripRedundantNamespaceDeclarations(
 *                 c_element, &c_ns_cache, &c_del_ns_list)
 */
    __pyx_t_1 = (__pyx_v_c_element->nsDef != NULL);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":339
 *         if c_element.nsDef is not NULL:
 *             _stripRedundantNamespaceDeclarations(
 *                 c_element, &c_ns_cache, &c_del_ns_list)             # <<<<<<<<<<<<<<
 * 
 *         # 2) make sure the namespaces of an element and its attributes
 */
      __pyx_t_2 = __pyx_f_4lxml_5etree__stripRedundantNamespaceDeclarations(__pyx_v_c_element, (&__pyx_v_c_ns_cache), (&__pyx_v_c_del_ns_list)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":343
 *         # 2) make sure the namespaces of an element and its attributes
 *         #    are declared in this document (i.e. on the node or its parents)
 *         c_node = c_element             # <<<<<<<<<<<<<<
 *         while c_node is not NULL:
 *             if c_node.ns is not NULL:
 */
    __pyx_v_c_node = __pyx_v_c_element;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":344
 *         #    are declared in this document (i.e. on the node or its parents)
 *         c_node = c_element
 *         while c_node is not NULL:             # <<<<<<<<<<<<<<
 *             if c_node.ns is not NULL:
 *                 for i from 0 <= i < c_ns_cache.last:
 */
    while (1) {
      __pyx_t_1 = (__pyx_v_c_node != NULL);
      if (!__pyx_t_1) break;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":345
 *         c_node = c_element
 *         while c_node is not NULL:
 *             if c_node.ns is not NULL:             # <<<<<<<<<<<<<<
 *                 for i from 0 <= i < c_ns_cache.last:
 *                     if c_node.ns is c_ns_cache.old[i]:
 */
      __pyx_t_1 = (__pyx_v_c_node->ns != NULL);
      if (__pyx_t_1) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":346
 *         while c_node is not NULL:
 *             if c_node.ns is not NULL:
 *                 for i from 0 <= i < c_ns_cache.last:             # <<<<<<<<<<<<<<
 *                     if c_node.ns is c_ns_cache.old[i]:
 *                         c_node.ns = c_ns_cache.new[i]
 */
        __pyx_t_3 = __pyx_v_c_ns_cache.last;
        for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":347
 *             if c_node.ns is not NULL:
 *                 for i from 0 <= i < c_ns_cache.last:
 *                     if c_node.ns is c_ns_cache.old[i]:             # <<<<<<<<<<<<<<
 *                         c_node.ns = c_ns_cache.new[i]
 *                         break
 */
          __pyx_t_1 = (__pyx_v_c_node->ns == (__pyx_v_c_ns_cache.old[__pyx_v_i]));
          if (__pyx_t_1) {

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":348
 *                 for i from 0 <= i < c_ns_cache.last:
 *                     if c_node.ns is c_ns_cache.old[i]:
 *                         c_node.ns = c_ns_cache.new[i]             # <<<<<<<<<<<<<<
 *                         break
 *                 else:
 */
            __pyx_v_c_node->ns = (__pyx_v_c_ns_cache.new[__pyx_v_i]);

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":349
 *                     if c_node.ns is c_ns_cache.old[i]:
 *                         c_node.ns = c_ns_cache.new[i]
 *                         break             # <<<<<<<<<<<<<<
 *                 else:
 *                     # not in cache => find a replacement from this document
 */
            goto __pyx_L11_break;
            goto __pyx_L12;
          }
          __pyx_L12:;
        }
        /*else*/ {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":354
 *                     c_ns = doc._findOrBuildNodeNs(
 *                         c_start_node, c_node.ns.href, c_node.ns.prefix,
 *                         c_node.type == tree.XML_ATTRIBUTE_NODE)             # <<<<<<<<<<<<<<
 *                     _appendToNsCache(&c_ns_cache, c_node.ns, c_ns)
 *                     c_node.ns = c_ns
 */
          __pyx_t_4 = ((struct __pyx_vtabstruct_4lxml_5etree__Document *)__pyx_v_doc->__pyx_vtab)->_findOrBuildNodeNs(__pyx_v_doc, __pyx_v_c_start_node, __pyx_v_c_node->ns->href, __pyx_v_c_node->ns->prefix, (__pyx_v_c_node->type == XML_ATTRIBUTE_NODE)); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __pyx_v_c_ns = __pyx_t_4;

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":355
 *                         c_start_node, c_node.ns.href, c_node.ns.prefix,
 *                         c_node.type == tree.XML_ATTRIBUTE_NODE)
 *                     _appendToNsCache(&c_ns_cache, c_node.ns, c_ns)             # <<<<<<<<<<<<<<
 *                     c_node.ns = c_ns
 * 
 */
          __pyx_t_2 = __pyx_f_4lxml_5etree__appendToNsCache((&__pyx_v_c_ns_cache), __pyx_v_c_node->ns, __pyx_v_c_ns); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":356
 *                         c_node.type == tree.XML_ATTRIBUTE_NODE)
 *                     _appendToNsCache(&c_ns_cache, c_node.ns, c_ns)
 *                     c_node.ns = c_ns             # <<<<<<<<<<<<<<
 * 
 *             if c_node is c_element:
 */
          __pyx_v_c_node->ns = __pyx_v_c_ns;
        }
        __pyx_L11_break:;
        goto __pyx_L9;
      }
      __pyx_L9:;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":358
 *                     c_node.ns = c_ns
 * 
 *             if c_node is c_element:             # <<<<<<<<<<<<<<
 *                 # after the element, continue with its attributes
 *                 c_node = <xmlNode*>c_element.properties
 */
      __pyx_t_1 = (__pyx_v_c_node == __pyx_v_c_element);
      if (__pyx_t_1) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":360
 *             if c_node is c_element:
 *                 # after the element, continue with its attributes
 *                 c_node = <xmlNode*>c_element.properties             # <<<<<<<<<<<<<<
 *             else:
 *                 c_node = c_node.next
 */
        __pyx_v_c_node = ((xmlNode *)__pyx_v_c_element->properties);
        goto __pyx_L13;
      }
      /*else*/ {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":362
 *                 c_node = <xmlNode*>c_element.properties
 *             else:
 *                 c_node = c_node.next             # <<<<<<<<<<<<<<
 *     tree.END_FOR_EACH_FROM(c_element)
 * 
 */
        __pyx_v_c_node = __pyx_v_c_node->next;
      }
      __pyx_L13:;
    }
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":363
 *             else:
 *                 c_node = c_node.next
 *     tree.END_FOR_EACH_FROM(c_element)             # <<<<<<<<<<<<<<
 * 
 *     # free now unused namespace declarations
 */
  END_FOR_EACH_FROM(__pyx_v_c_element);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":366
 * 
 *     # free now unused namespace declarations
 *     if c_del_ns_list is not NULL:             # <<<<<<<<<<<<<<
 *         tree.xmlFreeNsList(c_del_ns_list)
 * 
 */
  __pyx_t_1 = (__pyx_v_c_del_ns_list != NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":367
 *     # free now unused namespace declarations
 *     if c_del_ns_list is not NULL:
 *         tree.xmlFreeNsList(c_del_ns_list)             # <<<<<<<<<<<<<<
 * 
 *     # cleanup
 */
    xmlFreeNsList(__pyx_v_c_del_ns_list);
    goto __pyx_L14;
  }
  __pyx_L14:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":370
 * 
 *     # cleanup
 *     if c_ns_cache.new is not NULL:             # <<<<<<<<<<<<<<
 *         cstd.free(c_ns_cache.new)
 *     if c_ns_cache.old is not NULL:
 */
  __pyx_t_1 = (__pyx_v_c_ns_cache.new != NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":371
 *     # cleanup
 *     if c_ns_cache.new is not NULL:
 *         cstd.free(c_ns_cache.new)             # <<<<<<<<<<<<<<
 *     if c_ns_cache.old is not NULL:
 *         cstd.free(c_ns_cache.old)
 */
    free(__pyx_v_c_ns_cache.new);
    goto __pyx_L15;
  }
  __pyx_L15:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":372
 *     if c_ns_cache.new is not NULL:
 *         cstd.free(c_ns_cache.new)
 *     if c_ns_cache.old is not NULL:             # <<<<<<<<<<<<<<
 *         cstd.free(c_ns_cache.old)
 * 
 */
  __pyx_t_1 = (__pyx_v_c_ns_cache.old != NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":373
 *         cstd.free(c_ns_cache.new)
 *     if c_ns_cache.old is not NULL:
 *         cstd.free(c_ns_cache.old)             # <<<<<<<<<<<<<<
 * 
 *     # 3) fix the names in the tree if we moved it from a different thread
 */
    free(__pyx_v_c_ns_cache.old);
    goto __pyx_L16;
  }
  __pyx_L16:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":376
 * 
 *     # 3) fix the names in the tree if we moved it from a different thread
 *     if doc._c_doc.dict is not c_source_doc.dict:             # <<<<<<<<<<<<<<
 *         fixThreadDictNames(c_start_node, c_source_doc.dict, doc._c_doc.dict)
 * 
 */
  __pyx_t_1 = (__pyx_v_doc->_c_doc->dict != __pyx_v_c_source_doc->dict);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":377
 *     # 3) fix the names in the tree if we moved it from a different thread
 *     if doc._c_doc.dict is not c_source_doc.dict:
 *         fixThreadDictNames(c_start_node, c_source_doc.dict, doc._c_doc.dict)             # <<<<<<<<<<<<<<
 * 
 *     # 4) fix _Document references
 */
    __pyx_f_4lxml_5etree_fixThreadDictNames(__pyx_v_c_start_node, __pyx_v_c_source_doc->dict, __pyx_v_doc->_c_doc->dict);
    goto __pyx_L17;
  }
  __pyx_L17:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":381
 *     # 4) fix _Document references
 *     #    (and potentially deallocate the source document)
 *     if proxy_count > 0:             # <<<<<<<<<<<<<<
 *         if proxy_count == 1 and c_start_node._private is not NULL:
 *             _updateProxyDocument(c_start_node, doc)
 */
  __pyx_t_1 = (__pyx_v_proxy_count > 0);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":382
 *     #    (and potentially deallocate the source document)
 *     if proxy_count > 0:
 *         if proxy_count == 1 and c_start_node._private is not NULL:             # <<<<<<<<<<<<<<
 *             _updateProxyDocument(c_start_node, doc)
 *         else:
 */
    __pyx_t_1 = (__pyx_v_proxy_count == 1);
    if (__pyx_t_1) {
      __pyx_t_5 = (__pyx_v_c_start_node->_private != NULL);
      __pyx_t_6 = __pyx_t_5;
    } else {
      __pyx_t_6 = __pyx_t_1;
    }
    if (__pyx_t_6) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":383
 *     if proxy_count > 0:
 *         if proxy_count == 1 and c_start_node._private is not NULL:
 *             _updateProxyDocument(c_start_node, doc)             # <<<<<<<<<<<<<<
 *         else:
 *             fixElementDocument(c_start_node, doc, proxy_count)
 */
      __pyx_f_4lxml_5etree__updateProxyDocument(__pyx_v_c_start_node, __pyx_v_doc);
      goto __pyx_L19;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":385
 *             _updateProxyDocument(c_start_node, doc)
 *         else:
 *             fixElementDocument(c_start_node, doc, proxy_count)             # <<<<<<<<<<<<<<
 * 
 *     return 0
 */
      __pyx_f_4lxml_5etree_fixElementDocument(__pyx_v_c_start_node, __pyx_v_doc, __pyx_v_proxy_count);
    }
    __pyx_L19:;
    goto __pyx_L18;
  }
  __pyx_L18:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":387
 *             fixElementDocument(c_start_node, doc, proxy_count)
 * 
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.moveNodeToDocument");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":390
 * 
 * 
 * cdef void fixElementDocument(xmlNode* c_element, _Document doc,             # <<<<<<<<<<<<<<
 *                              size_t proxy_count):
 *     cdef xmlNode* c_node = c_element
 */

static  void __pyx_f_4lxml_5etree_fixElementDocument(xmlNode *__pyx_v_c_element, struct LxmlDocument *__pyx_v_doc, size_t __pyx_v_proxy_count) {
  xmlNode *__pyx_v_c_node;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("fixElementDocument");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":392
 * cdef void fixElementDocument(xmlNode* c_element, _Document doc,
 *                              size_t proxy_count):
 *     cdef xmlNode* c_node = c_element             # <<<<<<<<<<<<<<
 *     tree.BEGIN_FOR_EACH_FROM(c_element, c_node, 1)
 *     if c_node._private is not NULL:
 */
  __pyx_v_c_node = __pyx_v_c_element;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":393
 *                              size_t proxy_count):
 *     cdef xmlNode* c_node = c_element
 *     tree.BEGIN_FOR_EACH_FROM(c_element, c_node, 1)             # <<<<<<<<<<<<<<
 *     if c_node._private is not NULL:
 *         _updateProxyDocument(c_node, doc)
 */
  BEGIN_FOR_EACH_FROM(__pyx_v_c_element, __pyx_v_c_node, 1);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":394
 *     cdef xmlNode* c_node = c_element
 *     tree.BEGIN_FOR_EACH_FROM(c_element, c_node, 1)
 *     if c_node._private is not NULL:             # <<<<<<<<<<<<<<
 *         _updateProxyDocument(c_node, doc)
 *         proxy_count -= 1
 */
  __pyx_t_1 = (__pyx_v_c_node->_private != NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":395
 *     tree.BEGIN_FOR_EACH_FROM(c_element, c_node, 1)
 *     if c_node._private is not NULL:
 *         _updateProxyDocument(c_node, doc)             # <<<<<<<<<<<<<<
 *         proxy_count -= 1
 *         if proxy_count == 0:
 */
    __pyx_f_4lxml_5etree__updateProxyDocument(__pyx_v_c_node, __pyx_v_doc);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":396
 *     if c_node._private is not NULL:
 *         _updateProxyDocument(c_node, doc)
 *         proxy_count -= 1             # <<<<<<<<<<<<<<
 *         if proxy_count == 0:
 *             return
 */
    __pyx_v_proxy_count = (__pyx_v_proxy_count - 1);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":397
 *         _updateProxyDocument(c_node, doc)
 *         proxy_count -= 1
 *         if proxy_count == 0:             # <<<<<<<<<<<<<<
 *             return
 *     tree.END_FOR_EACH_FROM(c_node)
 */
    __pyx_t_1 = (__pyx_v_proxy_count == 0);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":398
 *         proxy_count -= 1
 *         if proxy_count == 0:
 *             return             # <<<<<<<<<<<<<<
 *     tree.END_FOR_EACH_FROM(c_node)
 * 
 */
      goto __pyx_L0;
      goto __pyx_L4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":399
 *         if proxy_count == 0:
 *             return
 *     tree.END_FOR_EACH_FROM(c_node)             # <<<<<<<<<<<<<<
 * 
 * cdef void fixThreadDictNames(xmlNode* c_element,
 */
  END_FOR_EACH_FROM(__pyx_v_c_node);

  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":401
 *     tree.END_FOR_EACH_FROM(c_node)
 * 
 * cdef void fixThreadDictNames(xmlNode* c_element,             # <<<<<<<<<<<<<<
 *                              tree.xmlDict* c_src_dict,
 *                              tree.xmlDict* c_dict) nogil:
 */

static  void __pyx_f_4lxml_5etree_fixThreadDictNames(xmlNode *__pyx_v_c_element, xmlDict *__pyx_v_c_src_dict, xmlDict *__pyx_v_c_dict) {
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":408
 *     # this should only be called when the element is based on a
 *     # different libxml2 tag name dictionary
 *     if c_element.type == tree.XML_DOCUMENT_NODE or \             # <<<<<<<<<<<<<<
 *             c_element.type == tree.XML_HTML_DOCUMENT_NODE:
 *         # may define "xml" namespace
 */
  __pyx_t_1 = (__pyx_v_c_element->type == XML_DOCUMENT_NODE);
  if (!__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":409
 *     # different libxml2 tag name dictionary
 *     if c_element.type == tree.XML_DOCUMENT_NODE or \
 *             c_element.type == tree.XML_HTML_DOCUMENT_NODE:             # <<<<<<<<<<<<<<
 *         # may define "xml" namespace
 *         fixThreadDictNsForNode(c_element, c_src_dict, c_dict)
 */
    __pyx_t_2 = (__pyx_v_c_element->type == XML_HTML_DOCUMENT_NODE);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":411
 *             c_element.type == tree.XML_HTML_DOCUMENT_NODE:
 *         # may define "xml" namespace
 *         fixThreadDictNsForNode(c_element, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *         c_element = c_element.children
 *         while c_element is not NULL:
 */
    __pyx_f_4lxml_5etree_fixThreadDictNsForNode(__pyx_v_c_element, __pyx_v_c_src_dict, __pyx_v_c_dict);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":412
 *         # may define "xml" namespace
 *         fixThreadDictNsForNode(c_element, c_src_dict, c_dict)
 *         c_element = c_element.children             # <<<<<<<<<<<<<<
 *         while c_element is not NULL:
 *             fixThreadDictNamesForNode(c_element, c_src_dict, c_dict)
 */
    __pyx_v_c_element = __pyx_v_c_element->children;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":413
 *         fixThreadDictNsForNode(c_element, c_src_dict, c_dict)
 *         c_element = c_element.children
 *         while c_element is not NULL:             # <<<<<<<<<<<<<<
 *             fixThreadDictNamesForNode(c_element, c_src_dict, c_dict)
 *             c_element = c_element.next
 */
    while (1) {
      __pyx_t_3 = (__pyx_v_c_element != NULL);
      if (!__pyx_t_3) break;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":414
 *         c_element = c_element.children
 *         while c_element is not NULL:
 *             fixThreadDictNamesForNode(c_element, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *             c_element = c_element.next
 *     elif tree._isElementOrXInclude(c_element):
 */
      __pyx_f_4lxml_5etree_fixThreadDictNamesForNode(__pyx_v_c_element, __pyx_v_c_src_dict, __pyx_v_c_dict);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":415
 *         while c_element is not NULL:
 *             fixThreadDictNamesForNode(c_element, c_src_dict, c_dict)
 *             c_element = c_element.next             # <<<<<<<<<<<<<<
 *     elif tree._isElementOrXInclude(c_element):
 *         fixThreadDictNamesForNode(c_element, c_src_dict, c_dict)
 */
      __pyx_v_c_element = __pyx_v_c_element->next;
    }
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":416
 *             fixThreadDictNamesForNode(c_element, c_src_dict, c_dict)
 *             c_element = c_element.next
 *     elif tree._isElementOrXInclude(c_element):             # <<<<<<<<<<<<<<
 *         fixThreadDictNamesForNode(c_element, c_src_dict, c_dict)
 * 
 */
  __pyx_t_3 = _isElementOrXInclude(__pyx_v_c_element);
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":417
 *             c_element = c_element.next
 *     elif tree._isElementOrXInclude(c_element):
 *         fixThreadDictNamesForNode(c_element, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 * 
 * cdef void fixThreadDictNamesForNode(xmlNode* c_element,
 */
    __pyx_f_4lxml_5etree_fixThreadDictNamesForNode(__pyx_v_c_element, __pyx_v_c_src_dict, __pyx_v_c_dict);
    goto __pyx_L3;
  }
  __pyx_L3:;

}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":419
 *         fixThreadDictNamesForNode(c_element, c_src_dict, c_dict)
 * 
 * cdef void fixThreadDictNamesForNode(xmlNode* c_element,             # <<<<<<<<<<<<<<
 *                                     tree.xmlDict* c_src_dict,
 *                                     tree.xmlDict* c_dict) nogil:
 */

static  void __pyx_f_4lxml_5etree_fixThreadDictNamesForNode(xmlNode *__pyx_v_c_element, xmlDict *__pyx_v_c_src_dict, xmlDict *__pyx_v_c_dict) {
  xmlNode *__pyx_v_c_node;
  int __pyx_t_1;
  xmlElementType __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":422
 *                                     tree.xmlDict* c_src_dict,
 *                                     tree.xmlDict* c_dict) nogil:
 *     cdef xmlNode* c_node = c_element             # <<<<<<<<<<<<<<
 *     tree.BEGIN_FOR_EACH_FROM(c_element, c_node, 1)
 *     if c_node.name is not NULL:
 */
  __pyx_v_c_node = __pyx_v_c_element;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":423
 *                                     tree.xmlDict* c_dict) nogil:
 *     cdef xmlNode* c_node = c_element
 *     tree.BEGIN_FOR_EACH_FROM(c_element, c_node, 1)             # <<<<<<<<<<<<<<
 *     if c_node.name is not NULL:
 *         fixThreadDictNameForNode(c_node, c_src_dict, c_dict)
 */
  BEGIN_FOR_EACH_FROM(__pyx_v_c_element, __pyx_v_c_node, 1);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":424
 *     cdef xmlNode* c_node = c_element
 *     tree.BEGIN_FOR_EACH_FROM(c_element, c_node, 1)
 *     if c_node.name is not NULL:             # <<<<<<<<<<<<<<
 *         fixThreadDictNameForNode(c_node, c_src_dict, c_dict)
 *     if c_node.type in (tree.XML_ELEMENT_NODE, tree.XML_XINCLUDE_START):
 */
  __pyx_t_1 = (__pyx_v_c_node->name != NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":425
 *     tree.BEGIN_FOR_EACH_FROM(c_element, c_node, 1)
 *     if c_node.name is not NULL:
 *         fixThreadDictNameForNode(c_node, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *     if c_node.type in (tree.XML_ELEMENT_NODE, tree.XML_XINCLUDE_START):
 *         fixThreadDictNamesForAttributes(
 */
    __pyx_f_4lxml_5etree_fixThreadDictNameForNode(__pyx_v_c_node, __pyx_v_c_src_dict, __pyx_v_c_dict);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":426
 *     if c_node.name is not NULL:
 *         fixThreadDictNameForNode(c_node, c_src_dict, c_dict)
 *     if c_node.type in (tree.XML_ELEMENT_NODE, tree.XML_XINCLUDE_START):             # <<<<<<<<<<<<<<
 *         fixThreadDictNamesForAttributes(
 *             c_node.properties, c_src_dict, c_dict)
 */
  __pyx_t_2 = __pyx_v_c_node->type;
  __pyx_t_1 = (__pyx_t_2 == XML_ELEMENT_NODE);
  if (!__pyx_t_1) {
    __pyx_t_3 = (__pyx_t_2 == XML_XINCLUDE_START);
    __pyx_t_4 = __pyx_t_3;
  } else {
    __pyx_t_4 = __pyx_t_1;
  }
  __pyx_t_1 = __pyx_t_4;
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":428
 *     if c_node.type in (tree.XML_ELEMENT_NODE, tree.XML_XINCLUDE_START):
 *         fixThreadDictNamesForAttributes(
 *             c_node.properties, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *         fixThreadDictNsForNode(c_node, c_src_dict, c_dict)
 *     elif c_node.type == tree.XML_TEXT_NODE:
 */
    __pyx_f_4lxml_5etree_fixThreadDictNamesForAttributes(__pyx_v_c_node->properties, __pyx_v_c_src_dict, __pyx_v_c_dict);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":429
 *         fixThreadDictNamesForAttributes(
 *             c_node.properties, c_src_dict, c_dict)
 *         fixThreadDictNsForNode(c_node, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *     elif c_node.type == tree.XML_TEXT_NODE:
 *         # libxml2's SAX2 parser interns some indentation space
 */
    __pyx_f_4lxml_5etree_fixThreadDictNsForNode(__pyx_v_c_node, __pyx_v_c_src_dict, __pyx_v_c_dict);
    goto __pyx_L4;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":430
 *             c_node.properties, c_src_dict, c_dict)
 *         fixThreadDictNsForNode(c_node, c_src_dict, c_dict)
 *     elif c_node.type == tree.XML_TEXT_NODE:             # <<<<<<<<<<<<<<
 *         # libxml2's SAX2 parser interns some indentation space
 *         fixThreadDictContentForNode(c_node, c_src_dict, c_dict)
 */
  __pyx_t_1 = (__pyx_v_c_node->type == XML_TEXT_NODE);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":432
 *     elif c_node.type == tree.XML_TEXT_NODE:
 *         # libxml2's SAX2 parser interns some indentation space
 *         fixThreadDictContentForNode(c_node, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *     tree.END_FOR_EACH_FROM(c_node)
 * 
 */
    __pyx_f_4lxml_5etree_fixThreadDictContentForNode(__pyx_v_c_node, __pyx_v_c_src_dict, __pyx_v_c_dict);
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":433
 *         # libxml2's SAX2 parser interns some indentation space
 *         fixThreadDictContentForNode(c_node, c_src_dict, c_dict)
 *     tree.END_FOR_EACH_FROM(c_node)             # <<<<<<<<<<<<<<
 * 
 * cdef inline void fixThreadDictNamesForAttributes(tree.xmlAttr* c_attr,
 */
  END_FOR_EACH_FROM(__pyx_v_c_node);

}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":435
 *     tree.END_FOR_EACH_FROM(c_node)
 * 
 * cdef inline void fixThreadDictNamesForAttributes(tree.xmlAttr* c_attr,             # <<<<<<<<<<<<<<
 *                                                  tree.xmlDict* c_src_dict,
 *                                                  tree.xmlDict* c_dict) nogil:
 */

static CYTHON_INLINE void __pyx_f_4lxml_5etree_fixThreadDictNamesForAttributes(xmlAttr *__pyx_v_c_attr, xmlDict *__pyx_v_c_src_dict, xmlDict *__pyx_v_c_dict) {
  xmlNode *__pyx_v_c_child;
  xmlNode *__pyx_v_c_node;
  int __pyx_t_1;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":439
 *                                                  tree.xmlDict* c_dict) nogil:
 *     cdef xmlNode* c_child
 *     cdef xmlNode* c_node = <xmlNode*>c_attr             # <<<<<<<<<<<<<<
 *     while c_node is not NULL:
 *         fixThreadDictNameForNode(c_node, c_src_dict, c_dict)
 */
  __pyx_v_c_node = ((xmlNode *)__pyx_v_c_attr);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":440
 *     cdef xmlNode* c_child
 *     cdef xmlNode* c_node = <xmlNode*>c_attr
 *     while c_node is not NULL:             # <<<<<<<<<<<<<<
 *         fixThreadDictNameForNode(c_node, c_src_dict, c_dict)
 *         # libxml2 keeps some (!) attribute values in the dict
 */
  while (1) {
    __pyx_t_1 = (__pyx_v_c_node != NULL);
    if (!__pyx_t_1) break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":441
 *     cdef xmlNode* c_node = <xmlNode*>c_attr
 *     while c_node is not NULL:
 *         fixThreadDictNameForNode(c_node, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *         # libxml2 keeps some (!) attribute values in the dict
 *         c_child = c_node.children
 */
    __pyx_f_4lxml_5etree_fixThreadDictNameForNode(__pyx_v_c_node, __pyx_v_c_src_dict, __pyx_v_c_dict);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":443
 *         fixThreadDictNameForNode(c_node, c_src_dict, c_dict)
 *         # libxml2 keeps some (!) attribute values in the dict
 *         c_child = c_node.children             # <<<<<<<<<<<<<<
 *         while c_child is not NULL:
 *             fixThreadDictContentForNode(c_child, c_src_dict, c_dict)
 */
    __pyx_v_c_child = __pyx_v_c_node->children;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":444
 *         # libxml2 keeps some (!) attribute values in the dict
 *         c_child = c_node.children
 *         while c_child is not NULL:             # <<<<<<<<<<<<<<
 *             fixThreadDictContentForNode(c_child, c_src_dict, c_dict)
 *             c_child = c_child.next
 */
    while (1) {
      __pyx_t_1 = (__pyx_v_c_child != NULL);
      if (!__pyx_t_1) break;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":445
 *         c_child = c_node.children
 *         while c_child is not NULL:
 *             fixThreadDictContentForNode(c_child, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *             c_child = c_child.next
 *         c_node = c_node.next
 */
      __pyx_f_4lxml_5etree_fixThreadDictContentForNode(__pyx_v_c_child, __pyx_v_c_src_dict, __pyx_v_c_dict);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":446
 *         while c_child is not NULL:
 *             fixThreadDictContentForNode(c_child, c_src_dict, c_dict)
 *             c_child = c_child.next             # <<<<<<<<<<<<<<
 *         c_node = c_node.next
 * 
 */
      __pyx_v_c_child = __pyx_v_c_child->next;
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":447
 *             fixThreadDictContentForNode(c_child, c_src_dict, c_dict)
 *             c_child = c_child.next
 *         c_node = c_node.next             # <<<<<<<<<<<<<<
 * 
 * cdef inline void fixThreadDictNameForNode(xmlNode* c_node,
 */
    __pyx_v_c_node = __pyx_v_c_node->next;
  }

}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":449
 *         c_node = c_node.next
 * 
 * cdef inline void fixThreadDictNameForNode(xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                                           tree.xmlDict* c_src_dict,
 *                                           tree.xmlDict* c_dict) nogil:
 */

static CYTHON_INLINE void __pyx_f_4lxml_5etree_fixThreadDictNameForNode(xmlNode *__pyx_v_c_node, xmlDict *__pyx_v_c_src_dict, xmlDict *__pyx_v_c_dict) {
  char *__pyx_v_c_name;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":452
 *                                           tree.xmlDict* c_src_dict,
 *                                           tree.xmlDict* c_dict) nogil:
 *     cdef char* c_name = c_node.name             # <<<<<<<<<<<<<<
 *     if c_name is not NULL and \
 *            c_node.type != tree.XML_TEXT_NODE and \
 */
  __pyx_v_c_name = __pyx_v_c_node->name;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":453
 *                                           tree.xmlDict* c_dict) nogil:
 *     cdef char* c_name = c_node.name
 *     if c_name is not NULL and \             # <<<<<<<<<<<<<<
 *            c_node.type != tree.XML_TEXT_NODE and \
 *            c_node.type != tree.XML_COMMENT_NODE:
 */
  __pyx_t_1 = (__pyx_v_c_name != NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":454
 *     cdef char* c_name = c_node.name
 *     if c_name is not NULL and \
 *            c_node.type != tree.XML_TEXT_NODE and \             # <<<<<<<<<<<<<<
 *            c_node.type != tree.XML_COMMENT_NODE:
 *         if tree.xmlDictOwns(c_src_dict, c_node.name):
 */
    __pyx_t_2 = (__pyx_v_c_node->type != XML_TEXT_NODE);
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":455
 *     if c_name is not NULL and \
 *            c_node.type != tree.XML_TEXT_NODE and \
 *            c_node.type != tree.XML_COMMENT_NODE:             # <<<<<<<<<<<<<<
 *         if tree.xmlDictOwns(c_src_dict, c_node.name):
 *             # c_name can be NULL on memory error, but we don't handle that here
 */
      __pyx_t_3 = (__pyx_v_c_node->type != XML_COMMENT_NODE);
      __pyx_t_4 = __pyx_t_3;
    } else {
      __pyx_t_4 = __pyx_t_2;
    }
    __pyx_t_2 = __pyx_t_4;
  } else {
    __pyx_t_2 = __pyx_t_1;
  }
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":456
 *            c_node.type != tree.XML_TEXT_NODE and \
 *            c_node.type != tree.XML_COMMENT_NODE:
 *         if tree.xmlDictOwns(c_src_dict, c_node.name):             # <<<<<<<<<<<<<<
 *             # c_name can be NULL on memory error, but we don't handle that here
 *             c_name = tree.xmlDictLookup(c_dict, c_name, -1)
 */
    __pyx_t_5 = xmlDictOwns(__pyx_v_c_src_dict, __pyx_v_c_node->name);
    if (__pyx_t_5) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":458
 *         if tree.xmlDictOwns(c_src_dict, c_node.name):
 *             # c_name can be NULL on memory error, but we don't handle that here
 *             c_name = tree.xmlDictLookup(c_dict, c_name, -1)             # <<<<<<<<<<<<<<
 *             if c_name is not NULL:
 *                 c_node.name = c_name
 */
      __pyx_v_c_name = xmlDictLookup(__pyx_v_c_dict, __pyx_v_c_name, -1);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":459
 *             # c_name can be NULL on memory error, but we don't handle that here
 *             c_name = tree.xmlDictLookup(c_dict, c_name, -1)
 *             if c_name is not NULL:             # <<<<<<<<<<<<<<
 *                 c_node.name = c_name
 * 
 */
      __pyx_t_2 = (__pyx_v_c_name != NULL);
      if (__pyx_t_2) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":460
 *             c_name = tree.xmlDictLookup(c_dict, c_name, -1)
 *             if c_name is not NULL:
 *                 c_node.name = c_name             # <<<<<<<<<<<<<<
 * 
 * cdef inline void fixThreadDictContentForNode(xmlNode* c_node,
 */
        __pyx_v_c_node->name = __pyx_v_c_name;
        goto __pyx_L5;
      }
      __pyx_L5:;
      goto __pyx_L4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  __pyx_L3:;

}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":462
 *                 c_node.name = c_name
 * 
 * cdef inline void fixThreadDictContentForNode(xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                                              tree.xmlDict* c_src_dict,
 *                                              tree.xmlDict* c_dict) nogil:
 */

static CYTHON_INLINE void __pyx_f_4lxml_5etree_fixThreadDictContentForNode(xmlNode *__pyx_v_c_node, xmlDict *__pyx_v_c_src_dict, xmlDict *__pyx_v_c_dict) {
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":465
 *                                              tree.xmlDict* c_src_dict,
 *                                              tree.xmlDict* c_dict) nogil:
 *     if c_node.content is not NULL and \             # <<<<<<<<<<<<<<
 *            c_node.content is not <char*>&c_node.properties:
 *         if tree.xmlDictOwns(c_src_dict, c_node.content):
 */
  __pyx_t_1 = (__pyx_v_c_node->content != NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":466
 *                                              tree.xmlDict* c_dict) nogil:
 *     if c_node.content is not NULL and \
 *            c_node.content is not <char*>&c_node.properties:             # <<<<<<<<<<<<<<
 *         if tree.xmlDictOwns(c_src_dict, c_node.content):
 *             # result can be NULL on memory error, but we don't handle that here
 */
    __pyx_t_2 = (__pyx_v_c_node->content != ((char *)(&__pyx_v_c_node->properties)));
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":467
 *     if c_node.content is not NULL and \
 *            c_node.content is not <char*>&c_node.properties:
 *         if tree.xmlDictOwns(c_src_dict, c_node.content):             # <<<<<<<<<<<<<<
 *             # result can be NULL on memory error, but we don't handle that here
 *             c_node.content = tree.xmlDictLookup(c_dict, c_node.content, -1)
 */
    __pyx_t_4 = xmlDictOwns(__pyx_v_c_src_dict, __pyx_v_c_node->content);
    if (__pyx_t_4) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":469
 *         if tree.xmlDictOwns(c_src_dict, c_node.content):
 *             # result can be NULL on memory error, but we don't handle that here
 *             c_node.content = tree.xmlDictLookup(c_dict, c_node.content, -1)             # <<<<<<<<<<<<<<
 * 
 * cdef inline void fixThreadDictNsForNode(xmlNode* c_node,
 */
      __pyx_v_c_node->content = xmlDictLookup(__pyx_v_c_dict, __pyx_v_c_node->content, -1);
      goto __pyx_L4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  __pyx_L3:;

}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":471
 *             c_node.content = tree.xmlDictLookup(c_dict, c_node.content, -1)
 * 
 * cdef inline void fixThreadDictNsForNode(xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                                         tree.xmlDict* c_src_dict,
 *                                         tree.xmlDict* c_dict) nogil:
 */

static CYTHON_INLINE void __pyx_f_4lxml_5etree_fixThreadDictNsForNode(xmlNode *__pyx_v_c_node, xmlDict *__pyx_v_c_src_dict, xmlDict *__pyx_v_c_dict) {
  xmlNs *__pyx_v_c_ns;
  int __pyx_t_1;
  int __pyx_t_2;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":474
 *                                         tree.xmlDict* c_src_dict,
 *                                         tree.xmlDict* c_dict) nogil:
 *     cdef xmlNs* c_ns = c_node.nsDef             # <<<<<<<<<<<<<<
 *     while c_ns is not NULL:
 *         if c_ns.href is not NULL:
 */
  __pyx_v_c_ns = __pyx_v_c_node->nsDef;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":475
 *                                         tree.xmlDict* c_dict) nogil:
 *     cdef xmlNs* c_ns = c_node.nsDef
 *     while c_ns is not NULL:             # <<<<<<<<<<<<<<
 *         if c_ns.href is not NULL:
 *             if tree.xmlDictOwns(c_src_dict, c_ns.href):
 */
  while (1) {
    __pyx_t_1 = (__pyx_v_c_ns != NULL);
    if (!__pyx_t_1) break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":476
 *     cdef xmlNs* c_ns = c_node.nsDef
 *     while c_ns is not NULL:
 *         if c_ns.href is not NULL:             # <<<<<<<<<<<<<<
 *             if tree.xmlDictOwns(c_src_dict, c_ns.href):
 *                 c_ns.href = tree.xmlDictLookup(c_dict, c_ns.href, -1)
 */
    __pyx_t_1 = (__pyx_v_c_ns->href != NULL);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":477
 *     while c_ns is not NULL:
 *         if c_ns.href is not NULL:
 *             if tree.xmlDictOwns(c_src_dict, c_ns.href):             # <<<<<<<<<<<<<<
 *                 c_ns.href = tree.xmlDictLookup(c_dict, c_ns.href, -1)
 *         if c_ns.prefix is not NULL:
 */
      __pyx_t_2 = xmlDictOwns(__pyx_v_c_src_dict, __pyx_v_c_ns->href);
      if (__pyx_t_2) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":478
 *         if c_ns.href is not NULL:
 *             if tree.xmlDictOwns(c_src_dict, c_ns.href):
 *                 c_ns.href = tree.xmlDictLookup(c_dict, c_ns.href, -1)             # <<<<<<<<<<<<<<
 *         if c_ns.prefix is not NULL:
 *             if tree.xmlDictOwns(c_src_dict, c_ns.prefix):
 */
        __pyx_v_c_ns->href = xmlDictLookup(__pyx_v_c_dict, __pyx_v_c_ns->href, -1);
        goto __pyx_L6;
      }
      __pyx_L6:;
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":479
 *             if tree.xmlDictOwns(c_src_dict, c_ns.href):
 *                 c_ns.href = tree.xmlDictLookup(c_dict, c_ns.href, -1)
 *         if c_ns.prefix is not NULL:             # <<<<<<<<<<<<<<
 *             if tree.xmlDictOwns(c_src_dict, c_ns.prefix):
 *                 c_ns.prefix = tree.xmlDictLookup(c_dict, c_ns.prefix, -1)
 */
    __pyx_t_1 = (__pyx_v_c_ns->prefix != NULL);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":480
 *                 c_ns.href = tree.xmlDictLookup(c_dict, c_ns.href, -1)
 *         if c_ns.prefix is not NULL:
 *             if tree.xmlDictOwns(c_src_dict, c_ns.prefix):             # <<<<<<<<<<<<<<
 *                 c_ns.prefix = tree.xmlDictLookup(c_dict, c_ns.prefix, -1)
 *         c_ns = c_ns.next
 */
      __pyx_t_2 = xmlDictOwns(__pyx_v_c_src_dict, __pyx_v_c_ns->prefix);
      if (__pyx_t_2) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":481
 *         if c_ns.prefix is not NULL:
 *             if tree.xmlDictOwns(c_src_dict, c_ns.prefix):
 *                 c_ns.prefix = tree.xmlDictLookup(c_dict, c_ns.prefix, -1)             # <<<<<<<<<<<<<<
 *         c_ns = c_ns.next
 */
        __pyx_v_c_ns->prefix = xmlDictLookup(__pyx_v_c_dict, __pyx_v_c_ns->prefix, -1);
        goto __pyx_L8;
      }
      __pyx_L8:;
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/proxy.pxi":482
 *             if tree.xmlDictOwns(c_src_dict, c_ns.prefix):
 *                 c_ns.prefix = tree.xmlDictLookup(c_dict, c_ns.prefix, -1)
 *         c_ns = c_ns.next             # <<<<<<<<<<<<<<
 */
    __pyx_v_c_ns = __pyx_v_c_ns->next;
  }

}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":5
 * cimport uri
 * 
 * cdef void displayNode(xmlNode* c_node, indent):             # <<<<<<<<<<<<<<
 *     # to help with debugging
 *     cdef xmlNode* c_child
 */

static  void __pyx_f_4lxml_5etree_displayNode(xmlNode *__pyx_v_c_node, PyObject *__pyx_v_indent) {
  xmlNode *__pyx_v_c_child;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("displayNode");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":8
 *     # to help with debugging
 *     cdef xmlNode* c_child
 *     print indent * u' ', <long>c_node             # <<<<<<<<<<<<<<
 *     c_child = c_node.children
 *     while c_child is not NULL:
 */
  __pyx_t_1 = PyNumber_Multiply(__pyx_v_indent, ((PyObject *)__pyx_kp_u_13)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyInt_FromLong(((long)__pyx_v_c_node)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  if (__Pyx_Print(0, ((PyObject *)__pyx_t_3), 1) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":9
 *     cdef xmlNode* c_child
 *     print indent * u' ', <long>c_node
 *     c_child = c_node.children             # <<<<<<<<<<<<<<
 *     while c_child is not NULL:
 *         displayNode(c_child, indent + 1)
 */
  __pyx_v_c_child = __pyx_v_c_node->children;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":10
 *     print indent * u' ', <long>c_node
 *     c_child = c_node.children
 *     while c_child is not NULL:             # <<<<<<<<<<<<<<
 *         displayNode(c_child, indent + 1)
 *         c_child = c_child.next
 */
  while (1) {
    __pyx_t_4 = (__pyx_v_c_child != NULL);
    if (!__pyx_t_4) break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":11
 *     c_child = c_node.children
 *     while c_child is not NULL:
 *         displayNode(c_child, indent + 1)             # <<<<<<<<<<<<<<
 *         c_child = c_child.next
 * 
 */
    __pyx_t_3 = PyNumber_Add(__pyx_v_indent, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_f_4lxml_5etree_displayNode(__pyx_v_c_child, __pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":12
 *     while c_child is not NULL:
 *         displayNode(c_child, indent + 1)
 *         c_child = c_child.next             # <<<<<<<<<<<<<<
 * 
 * cdef inline int _assertValidNode(_Element element) except -1:
 */
    __pyx_v_c_child = __pyx_v_c_child->next;
  }

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_WriteUnraisable("lxml.etree.displayNode");
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":14
 *         c_child = c_child.next
 * 
 * cdef inline int _assertValidNode(_Element element) except -1:             # <<<<<<<<<<<<<<
 *     assert element._c_node is not NULL, u"invalid Element proxy at %s" % id(element)
 * 
 */

static CYTHON_INLINE int __pyx_f_4lxml_5etree__assertValidNode(struct LxmlElement *__pyx_v_element) {
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_assertValidNode");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":15
 * 
 * cdef inline int _assertValidNode(_Element element) except -1:
 *     assert element._c_node is not NULL, u"invalid Element proxy at %s" % id(element)             # <<<<<<<<<<<<<<
 * 
 * cdef inline int _assertValidDoc(_Document doc) except -1:
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!(__pyx_v_element->_c_node != NULL))) {
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __Pyx_INCREF(((PyObject *)__pyx_v_element));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_element));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_element));
    __pyx_t_2 = PyObject_Call(__pyx_builtin_id, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_14), __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_t_1));
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[2]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._assertValidNode");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":17
 *     assert element._c_node is not NULL, u"invalid Element proxy at %s" % id(element)
 * 
 * cdef inline int _assertValidDoc(_Document doc) except -1:             # <<<<<<<<<<<<<<
 *     assert doc._c_doc is not NULL, u"invalid Document proxy at %s" % id(doc)
 * 
 */

static CYTHON_INLINE int __pyx_f_4lxml_5etree__assertValidDoc(struct LxmlDocument *__pyx_v_doc) {
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_assertValidDoc");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":18
 * 
 * cdef inline int _assertValidDoc(_Document doc) except -1:
 *     assert doc._c_doc is not NULL, u"invalid Document proxy at %s" % id(doc)             # <<<<<<<<<<<<<<
 * 
 * cdef _Document _documentOrRaise(object input):
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!(__pyx_v_doc->_c_doc != NULL))) {
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __Pyx_INCREF(((PyObject *)__pyx_v_doc));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_doc));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_doc));
    __pyx_t_2 = PyObject_Call(__pyx_builtin_id, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_15), __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_t_1));
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[2]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._assertValidDoc");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":20
 *     assert doc._c_doc is not NULL, u"invalid Document proxy at %s" % id(doc)
 * 
 * cdef _Document _documentOrRaise(object input):             # <<<<<<<<<<<<<<
 *     u"""Call this to get the document of a _Document, _ElementTree or _Element
 *     object, or to raise an exception if it can't be determined.
 */

static  struct LxmlDocument *__pyx_f_4lxml_5etree__documentOrRaise(PyObject *__pyx_v_input) {
  struct LxmlDocument *__pyx_v_doc;
  struct LxmlElement *__pyx_v_element;
  struct LxmlDocument *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("_documentOrRaise");
  __pyx_v_doc = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_element = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":28
 *     cdef _Document doc
 *     cdef _Element element
 *     if isinstance(input, _ElementTree):             # <<<<<<<<<<<<<<
 *         element = (<_ElementTree>input)._context_node
 *         if element is not None:
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_input, ((PyObject*)__pyx_ptype_4lxml_5etree__ElementTree)); 
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":29
 *     cdef _Element element
 *     if isinstance(input, _ElementTree):
 *         element = (<_ElementTree>input)._context_node             # <<<<<<<<<<<<<<
 *         if element is not None:
 *             doc = element._doc
 */
    __Pyx_INCREF(((PyObject *)((struct LxmlElementTree *)__pyx_v_input)->_context_node));
    __Pyx_DECREF(((PyObject *)__pyx_v_element));
    __pyx_v_element = ((struct LxmlElementTree *)__pyx_v_input)->_context_node;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":30
 *     if isinstance(input, _ElementTree):
 *         element = (<_ElementTree>input)._context_node
 *         if element is not None:             # <<<<<<<<<<<<<<
 *             doc = element._doc
 *     elif isinstance(input, _Element):
 */
    __pyx_t_1 = (((PyObject *)__pyx_v_element) != Py_None);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":31
 *         element = (<_ElementTree>input)._context_node
 *         if element is not None:
 *             doc = element._doc             # <<<<<<<<<<<<<<
 *     elif isinstance(input, _Element):
 *         doc = (<_Element>input)._doc
 */
      __Pyx_INCREF(((PyObject *)__pyx_v_element->_doc));
      __Pyx_DECREF(((PyObject *)__pyx_v_doc));
      __pyx_v_doc = __pyx_v_element->_doc;
      goto __pyx_L4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":32
 *         if element is not None:
 *             doc = element._doc
 *     elif isinstance(input, _Element):             # <<<<<<<<<<<<<<
 *         doc = (<_Element>input)._doc
 *     elif isinstance(input, _Document):
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_input, ((PyObject*)__pyx_ptype_4lxml_5etree__Element)); 
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":33
 *             doc = element._doc
 *     elif isinstance(input, _Element):
 *         doc = (<_Element>input)._doc             # <<<<<<<<<<<<<<
 *     elif isinstance(input, _Document):
 *         doc = <_Document>input
 */
    __Pyx_INCREF(((PyObject *)((struct LxmlElement *)__pyx_v_input)->_doc));
    __Pyx_DECREF(((PyObject *)__pyx_v_doc));
    __pyx_v_doc = ((struct LxmlElement *)__pyx_v_input)->_doc;
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":34
 *     elif isinstance(input, _Element):
 *         doc = (<_Element>input)._doc
 *     elif isinstance(input, _Document):             # <<<<<<<<<<<<<<
 *         doc = <_Document>input
 *     else:
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_input, ((PyObject*)__pyx_ptype_4lxml_5etree__Document)); 
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":35
 *         doc = (<_Element>input)._doc
 *     elif isinstance(input, _Document):
 *         doc = <_Document>input             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError, u"Invalid input object: %s" % \
 */
    __Pyx_INCREF(((PyObject *)((struct LxmlDocument *)__pyx_v_input)));
    __Pyx_DECREF(((PyObject *)__pyx_v_doc));
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_v_input);
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":38
 *     else:
 *         raise TypeError, u"Invalid input object: %s" % \
 *             python._fqtypename(input)             # <<<<<<<<<<<<<<
 *     if doc is None:
 *         raise ValueError, u"Input object has no document: %s" % \
 */
    __pyx_t_2 = PyBytes_FromString(_fqtypename(__pyx_v_input)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_16), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_3), 0);
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[2]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":39
 *         raise TypeError, u"Invalid input object: %s" % \
 *             python._fqtypename(input)
 *     if doc is None:             # <<<<<<<<<<<<<<
 *         raise ValueError, u"Input object has no document: %s" % \
 *             python._fqtypename(input)
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_doc) == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":41
 *     if doc is None:
 *         raise ValueError, u"Input object has no document: %s" % \
 *             python._fqtypename(input)             # <<<<<<<<<<<<<<
 *     _assertValidDoc(doc)
 *     return doc
 */
    __pyx_t_3 = PyBytes_FromString(_fqtypename(__pyx_v_input)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_17), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), 0);
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[2]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":42
 *         raise ValueError, u"Input object has no document: %s" % \
 *             python._fqtypename(input)
 *     _assertValidDoc(doc)             # <<<<<<<<<<<<<<
 *     return doc
 * 
 */
  __pyx_t_4 = __pyx_f_4lxml_5etree__assertValidDoc(__pyx_v_doc); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":43
 *             python._fqtypename(input)
 *     _assertValidDoc(doc)
 *     return doc             # <<<<<<<<<<<<<<
 * 
 * cdef _Element _rootNodeOrRaise(object input):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_doc));
  __pyx_r = __pyx_v_doc;
  goto __pyx_L0;

  __pyx_r = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._documentOrRaise");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_doc);
  __Pyx_DECREF((PyObject *)__pyx_v_element);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":45
 *     return doc
 * 
 * cdef _Element _rootNodeOrRaise(object input):             # <<<<<<<<<<<<<<
 *     u"""Call this to get the root node of a _Document, _ElementTree or
 *      _Element object, or to raise an exception if it can't be determined.
 */

static  struct LxmlElement *__pyx_f_4lxml_5etree__rootNodeOrRaise(PyObject *__pyx_v_input) {
  struct LxmlElement *__pyx_v_node;
  struct LxmlElement *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("_rootNodeOrRaise");
  __pyx_v_node = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":52
 *      """
 *     cdef _Element node
 *     if isinstance(input, _ElementTree):             # <<<<<<<<<<<<<<
 *         node = (<_ElementTree>input)._context_node
 *     elif isinstance(input, _Element):
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_input, ((PyObject*)__pyx_ptype_4lxml_5etree__ElementTree)); 
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":53
 *     cdef _Element node
 *     if isinstance(input, _ElementTree):
 *         node = (<_ElementTree>input)._context_node             # <<<<<<<<<<<<<<
 *     elif isinstance(input, _Element):
 *         node = <_Element>input
 */
    __Pyx_INCREF(((PyObject *)((struct LxmlElementTree *)__pyx_v_input)->_context_node));
    __Pyx_DECREF(((PyObject *)__pyx_v_node));
    __pyx_v_node = ((struct LxmlElementTree *)__pyx_v_input)->_context_node;
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":54
 *     if isinstance(input, _ElementTree):
 *         node = (<_ElementTree>input)._context_node
 *     elif isinstance(input, _Element):             # <<<<<<<<<<<<<<
 *         node = <_Element>input
 *     elif isinstance(input, _Document):
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_input, ((PyObject*)__pyx_ptype_4lxml_5etree__Element)); 
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":55
 *         node = (<_ElementTree>input)._context_node
 *     elif isinstance(input, _Element):
 *         node = <_Element>input             # <<<<<<<<<<<<<<
 *     elif isinstance(input, _Document):
 *         node = (<_Document>input).getroot()
 */
    __Pyx_INCREF(((PyObject *)((struct LxmlElement *)__pyx_v_input)));
    __Pyx_DECREF(((PyObject *)__pyx_v_node));
    __pyx_v_node = ((struct LxmlElement *)__pyx_v_input);
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":56
 *     elif isinstance(input, _Element):
 *         node = <_Element>input
 *     elif isinstance(input, _Document):             # <<<<<<<<<<<<<<
 *         node = (<_Document>input).getroot()
 *     else:
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_input, ((PyObject*)__pyx_ptype_4lxml_5etree__Document)); 
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":57
 *         node = <_Element>input
 *     elif isinstance(input, _Document):
 *         node = (<_Document>input).getroot()             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError, u"Invalid input object: %s" % \
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__Document *)((struct LxmlDocument *)__pyx_v_input)->__pyx_vtab)->getroot(((struct LxmlDocument *)__pyx_v_input)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_v_node));
    __pyx_v_node = ((struct LxmlElement *)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":60
 *     else:
 *         raise TypeError, u"Invalid input object: %s" % \
 *             python._fqtypename(input)             # <<<<<<<<<<<<<<
 *     if node is None:
 *         raise ValueError, u"Input object has no element: %s" % \
 */
    __pyx_t_2 = PyBytes_FromString(_fqtypename(__pyx_v_input)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_16), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_3), 0);
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[2]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":61
 *         raise TypeError, u"Invalid input object: %s" % \
 *             python._fqtypename(input)
 *     if node is None:             # <<<<<<<<<<<<<<
 *         raise ValueError, u"Input object has no element: %s" % \
 *             python._fqtypename(input)
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_node) == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":63
 *     if node is None:
 *         raise ValueError, u"Input object has no element: %s" % \
 *             python._fqtypename(input)             # <<<<<<<<<<<<<<
 *     _assertValidNode(node)
 *     return node
 */
    __pyx_t_3 = PyBytes_FromString(_fqtypename(__pyx_v_input)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_18), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), 0);
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[2]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":64
 *         raise ValueError, u"Input object has no element: %s" % \
 *             python._fqtypename(input)
 *     _assertValidNode(node)             # <<<<<<<<<<<<<<
 *     return node
 * 
 */
  __pyx_t_4 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_node); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":65
 *             python._fqtypename(input)
 *     _assertValidNode(node)
 *     return node             # <<<<<<<<<<<<<<
 * 
 * cdef _Document _documentOf(object input):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_node));
  __pyx_r = __pyx_v_node;
  goto __pyx_L0;

  __pyx_r = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._rootNodeOrRaise");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_node);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":67
 *     return node
 * 
 * cdef _Document _documentOf(object input):             # <<<<<<<<<<<<<<
 *     # call this to get the document of a
 *     # _Document, _ElementTree or _Element object
 */

static  struct LxmlDocument *__pyx_f_4lxml_5etree__documentOf(PyObject *__pyx_v_input) {
  struct LxmlElement *__pyx_v_element;
  struct LxmlDocument *__pyx_v_doc = 0;
  struct LxmlDocument *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("_documentOf");
  __pyx_v_element = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":72
 *     # may return None!
 *     cdef _Element element
 *     cdef _Document doc = None             # <<<<<<<<<<<<<<
 *     if isinstance(input, _ElementTree):
 *         element = (<_ElementTree>input)._context_node
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_doc = ((struct LxmlDocument *)Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":73
 *     cdef _Element element
 *     cdef _Document doc = None
 *     if isinstance(input, _ElementTree):             # <<<<<<<<<<<<<<
 *         element = (<_ElementTree>input)._context_node
 *         if element is not None:
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_input, ((PyObject*)__pyx_ptype_4lxml_5etree__ElementTree)); 
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":74
 *     cdef _Document doc = None
 *     if isinstance(input, _ElementTree):
 *         element = (<_ElementTree>input)._context_node             # <<<<<<<<<<<<<<
 *         if element is not None:
 *             doc = element._doc
 */
    __Pyx_INCREF(((PyObject *)((struct LxmlElementTree *)__pyx_v_input)->_context_node));
    __Pyx_DECREF(((PyObject *)__pyx_v_element));
    __pyx_v_element = ((struct LxmlElementTree *)__pyx_v_input)->_context_node;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":75
 *     if isinstance(input, _ElementTree):
 *         element = (<_ElementTree>input)._context_node
 *         if element is not None:             # <<<<<<<<<<<<<<
 *             doc = element._doc
 *     elif isinstance(input, _Element):
 */
    __pyx_t_1 = (((PyObject *)__pyx_v_element) != Py_None);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":76
 *         element = (<_ElementTree>input)._context_node
 *         if element is not None:
 *             doc = element._doc             # <<<<<<<<<<<<<<
 *     elif isinstance(input, _Element):
 *         doc = (<_Element>input)._doc
 */
      __Pyx_INCREF(((PyObject *)__pyx_v_element->_doc));
      __Pyx_DECREF(((PyObject *)__pyx_v_doc));
      __pyx_v_doc = __pyx_v_element->_doc;
      goto __pyx_L4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":77
 *         if element is not None:
 *             doc = element._doc
 *     elif isinstance(input, _Element):             # <<<<<<<<<<<<<<
 *         doc = (<_Element>input)._doc
 *     elif isinstance(input, _Document):
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_input, ((PyObject*)__pyx_ptype_4lxml_5etree__Element)); 
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":78
 *             doc = element._doc
 *     elif isinstance(input, _Element):
 *         doc = (<_Element>input)._doc             # <<<<<<<<<<<<<<
 *     elif isinstance(input, _Document):
 *         doc = <_Document>input
 */
    __Pyx_INCREF(((PyObject *)((struct LxmlElement *)__pyx_v_input)->_doc));
    __Pyx_DECREF(((PyObject *)__pyx_v_doc));
    __pyx_v_doc = ((struct LxmlElement *)__pyx_v_input)->_doc;
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":79
 *     elif isinstance(input, _Element):
 *         doc = (<_Element>input)._doc
 *     elif isinstance(input, _Document):             # <<<<<<<<<<<<<<
 *         doc = <_Document>input
 *     if doc is not None:
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_input, ((PyObject*)__pyx_ptype_4lxml_5etree__Document)); 
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":80
 *         doc = (<_Element>input)._doc
 *     elif isinstance(input, _Document):
 *         doc = <_Document>input             # <<<<<<<<<<<<<<
 *     if doc is not None:
 *         _assertValidDoc(doc)
 */
    __Pyx_INCREF(((PyObject *)((struct LxmlDocument *)__pyx_v_input)));
    __Pyx_DECREF(((PyObject *)__pyx_v_doc));
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_v_input);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":81
 *     elif isinstance(input, _Document):
 *         doc = <_Document>input
 *     if doc is not None:             # <<<<<<<<<<<<<<
 *         _assertValidDoc(doc)
 *     return doc
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_doc) != Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":82
 *         doc = <_Document>input
 *     if doc is not None:
 *         _assertValidDoc(doc)             # <<<<<<<<<<<<<<
 *     return doc
 * 
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidDoc(__pyx_v_doc); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":83
 *     if doc is not None:
 *         _assertValidDoc(doc)
 *     return doc             # <<<<<<<<<<<<<<
 * 
 * cdef _Element _rootNodeOf(object input):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_doc));
  __pyx_r = __pyx_v_doc;
  goto __pyx_L0;

  __pyx_r = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._documentOf");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_element);
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":85
 *     return doc
 * 
 * cdef _Element _rootNodeOf(object input):             # <<<<<<<<<<<<<<
 *     # call this to get the root node of a
 *     # _Document, _ElementTree or _Element object
 */

static  struct LxmlElement *__pyx_f_4lxml_5etree__rootNodeOf(PyObject *__pyx_v_input) {
  struct LxmlElement *__pyx_v_element = 0;
  struct LxmlElement *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("_rootNodeOf");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":89
 *     # _Document, _ElementTree or _Element object
 *     # may return None!
 *     cdef _Element element = None             # <<<<<<<<<<<<<<
 *     if isinstance(input, _ElementTree):
 *         element = (<_ElementTree>input)._context_node
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_element = ((struct LxmlElement *)Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":90
 *     # may return None!
 *     cdef _Element element = None
 *     if isinstance(input, _ElementTree):             # <<<<<<<<<<<<<<
 *         element = (<_ElementTree>input)._context_node
 *     elif isinstance(input, _Element):
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_input, ((PyObject*)__pyx_ptype_4lxml_5etree__ElementTree)); 
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":91
 *     cdef _Element element = None
 *     if isinstance(input, _ElementTree):
 *         element = (<_ElementTree>input)._context_node             # <<<<<<<<<<<<<<
 *     elif isinstance(input, _Element):
 *         element = <_Element>input
 */
    __Pyx_INCREF(((PyObject *)((struct LxmlElementTree *)__pyx_v_input)->_context_node));
    __Pyx_DECREF(((PyObject *)__pyx_v_element));
    __pyx_v_element = ((struct LxmlElementTree *)__pyx_v_input)->_context_node;
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":92
 *     if isinstance(input, _ElementTree):
 *         element = (<_ElementTree>input)._context_node
 *     elif isinstance(input, _Element):             # <<<<<<<<<<<<<<
 *         element = <_Element>input
 *     elif isinstance(input, _Document):
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_input, ((PyObject*)__pyx_ptype_4lxml_5etree__Element)); 
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":93
 *         element = (<_ElementTree>input)._context_node
 *     elif isinstance(input, _Element):
 *         element = <_Element>input             # <<<<<<<<<<<<<<
 *     elif isinstance(input, _Document):
 *         element = (<_Document>input).getroot()
 */
    __Pyx_INCREF(((PyObject *)((struct LxmlElement *)__pyx_v_input)));
    __Pyx_DECREF(((PyObject *)__pyx_v_element));
    __pyx_v_element = ((struct LxmlElement *)__pyx_v_input);
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":94
 *     elif isinstance(input, _Element):
 *         element = <_Element>input
 *     elif isinstance(input, _Document):             # <<<<<<<<<<<<<<
 *         element = (<_Document>input).getroot()
 *     if element is not None:
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_input, ((PyObject*)__pyx_ptype_4lxml_5etree__Document)); 
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":95
 *         element = <_Element>input
 *     elif isinstance(input, _Document):
 *         element = (<_Document>input).getroot()             # <<<<<<<<<<<<<<
 *     if element is not None:
 *         _assertValidNode(element)
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__Document *)((struct LxmlDocument *)__pyx_v_input)->__pyx_vtab)->getroot(((struct LxmlDocument *)__pyx_v_input)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_v_element));
    __pyx_v_element = ((struct LxmlElement *)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":96
 *     elif isinstance(input, _Document):
 *         element = (<_Document>input).getroot()
 *     if element is not None:             # <<<<<<<<<<<<<<
 *         _assertValidNode(element)
 *     return element
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_element) != Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":97
 *         element = (<_Document>input).getroot()
 *     if element is not None:
 *         _assertValidNode(element)             # <<<<<<<<<<<<<<
 *     return element
 * 
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":98
 *     if element is not None:
 *         _assertValidNode(element)
 *     return element             # <<<<<<<<<<<<<<
 * 
 * cdef _Element _makeElement(tag, xmlDoc* c_doc, _Document doc,
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_element));
  __pyx_r = __pyx_v_element;
  goto __pyx_L0;

  __pyx_r = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._rootNodeOf");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_element);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":100
 *     return element
 * 
 * cdef _Element _makeElement(tag, xmlDoc* c_doc, _Document doc,             # <<<<<<<<<<<<<<
 *                            _BaseParser parser, text, tail, attrib, nsmap,
 *                            extra_attrs):
 */

static  struct LxmlElement *__pyx_f_4lxml_5etree__makeElement(PyObject *__pyx_v_tag, xmlDoc *__pyx_v_c_doc, struct LxmlDocument *__pyx_v_doc, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser, PyObject *__pyx_v_text, PyObject *__pyx_v_tail, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap, PyObject *__pyx_v_extra_attrs) {
  xmlNode *__pyx_v_c_node;
  PyObject *__pyx_v_ns_utf;
  PyObject *__pyx_v_name_utf;
  struct LxmlElement *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  xmlDoc *__pyx_t_7;
  xmlDoc *__pyx_t_8;
  xmlNode *__pyx_t_9;
  int __pyx_t_10;
  __Pyx_RefNannySetupContext("_makeElement");
  __Pyx_INCREF((PyObject *)__pyx_v_doc);
  __pyx_v_ns_utf = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_name_utf = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":118
 *     """
 *     cdef xmlNode* c_node
 *     if doc is not None:             # <<<<<<<<<<<<<<
 *         c_doc = doc._c_doc
 *     ns_utf, name_utf = _getNsTag(tag)
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_doc) != Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":119
 *     cdef xmlNode* c_node
 *     if doc is not None:
 *         c_doc = doc._c_doc             # <<<<<<<<<<<<<<
 *     ns_utf, name_utf = _getNsTag(tag)
 *     if parser is not None and parser._for_html:
 */
    __pyx_v_c_doc = __pyx_v_doc->_c_doc;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":120
 *     if doc is not None:
 *         c_doc = doc._c_doc
 *     ns_utf, name_utf = _getNsTag(tag)             # <<<<<<<<<<<<<<
 *     if parser is not None and parser._for_html:
 *         _htmlTagValidOrRaise(name_utf)
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__getNsTag(__pyx_v_tag)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (likely(__pyx_t_2 != Py_None) && likely(PyTuple_GET_SIZE(__pyx_t_2) == 2)) {
    PyObject* tuple = __pyx_t_2;
    __pyx_t_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_v_ns_utf);
    __pyx_v_ns_utf = __pyx_t_3;
    __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_v_name_utf);
    __pyx_v_name_utf = __pyx_t_4;
    __pyx_t_4 = 0;
  } else {
    __Pyx_UnpackTupleError(__pyx_t_2, 2);
    {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":121
 *         c_doc = doc._c_doc
 *     ns_utf, name_utf = _getNsTag(tag)
 *     if parser is not None and parser._for_html:             # <<<<<<<<<<<<<<
 *         _htmlTagValidOrRaise(name_utf)
 *         if c_doc is NULL:
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_parser) != Py_None);
  if (__pyx_t_1) {
    __pyx_t_5 = __pyx_v_parser->_for_html;
  } else {
    __pyx_t_5 = __pyx_t_1;
  }
  if (__pyx_t_5) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":122
 *     ns_utf, name_utf = _getNsTag(tag)
 *     if parser is not None and parser._for_html:
 *         _htmlTagValidOrRaise(name_utf)             # <<<<<<<<<<<<<<
 *         if c_doc is NULL:
 *             c_doc = _newHTMLDoc()
 */
    __pyx_t_6 = __pyx_f_4lxml_5etree__htmlTagValidOrRaise(__pyx_v_name_utf); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":123
 *     if parser is not None and parser._for_html:
 *         _htmlTagValidOrRaise(name_utf)
 *         if c_doc is NULL:             # <<<<<<<<<<<<<<
 *             c_doc = _newHTMLDoc()
 *     else:
 */
    __pyx_t_5 = (__pyx_v_c_doc == NULL);
    if (__pyx_t_5) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":124
 *         _htmlTagValidOrRaise(name_utf)
 *         if c_doc is NULL:
 *             c_doc = _newHTMLDoc()             # <<<<<<<<<<<<<<
 *     else:
 *         _tagValidOrRaise(name_utf)
 */
      __pyx_t_7 = __pyx_f_4lxml_5etree__newHTMLDoc(); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_c_doc = __pyx_t_7;
      goto __pyx_L5;
    }
    __pyx_L5:;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":126
 *             c_doc = _newHTMLDoc()
 *     else:
 *         _tagValidOrRaise(name_utf)             # <<<<<<<<<<<<<<
 *         if c_doc is NULL:
 *             c_doc = _newXMLDoc()
 */
    __pyx_t_6 = __pyx_f_4lxml_5etree__tagValidOrRaise(__pyx_v_name_utf); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":127
 *     else:
 *         _tagValidOrRaise(name_utf)
 *         if c_doc is NULL:             # <<<<<<<<<<<<<<
 *             c_doc = _newXMLDoc()
 *     c_node = _createElement(c_doc, name_utf)
 */
    __pyx_t_5 = (__pyx_v_c_doc == NULL);
    if (__pyx_t_5) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":128
 *         _tagValidOrRaise(name_utf)
 *         if c_doc is NULL:
 *             c_doc = _newXMLDoc()             # <<<<<<<<<<<<<<
 *     c_node = _createElement(c_doc, name_utf)
 *     if c_node is NULL:
 */
      __pyx_t_8 = __pyx_f_4lxml_5etree__newXMLDoc(); if (unlikely(__pyx_t_8 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_c_doc = __pyx_t_8;
      goto __pyx_L6;
    }
    __pyx_L6:;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":129
 *         if c_doc is NULL:
 *             c_doc = _newXMLDoc()
 *     c_node = _createElement(c_doc, name_utf)             # <<<<<<<<<<<<<<
 *     if c_node is NULL:
 *         if doc is None and c_doc is not NULL:
 */
  __pyx_t_9 = __pyx_f_4lxml_5etree__createElement(__pyx_v_c_doc, __pyx_v_name_utf); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_node = __pyx_t_9;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":130
 *             c_doc = _newXMLDoc()
 *     c_node = _createElement(c_doc, name_utf)
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         if doc is None and c_doc is not NULL:
 *             tree.xmlFreeDoc(c_doc)
 */
  __pyx_t_5 = (__pyx_v_c_node == NULL);
  if (__pyx_t_5) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":131
 *     c_node = _createElement(c_doc, name_utf)
 *     if c_node is NULL:
 *         if doc is None and c_doc is not NULL:             # <<<<<<<<<<<<<<
 *             tree.xmlFreeDoc(c_doc)
 *         return python.PyErr_NoMemory()
 */
    __pyx_t_5 = (((PyObject *)__pyx_v_doc) == Py_None);
    if (__pyx_t_5) {
      __pyx_t_1 = (__pyx_v_c_doc != NULL);
      __pyx_t_10 = __pyx_t_1;
    } else {
      __pyx_t_10 = __pyx_t_5;
    }
    if (__pyx_t_10) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":132
 *     if c_node is NULL:
 *         if doc is None and c_doc is not NULL:
 *             tree.xmlFreeDoc(c_doc)             # <<<<<<<<<<<<<<
 *         return python.PyErr_NoMemory()
 *     try:
 */
      xmlFreeDoc(__pyx_v_c_doc);
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":133
 *         if doc is None and c_doc is not NULL:
 *             tree.xmlFreeDoc(c_doc)
 *         return python.PyErr_NoMemory()             # <<<<<<<<<<<<<<
 *     try:
 *         if doc is None:
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __pyx_t_2 = PyErr_NoMemory(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_r = ((struct LxmlElement *)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L0;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":134
 *             tree.xmlFreeDoc(c_doc)
 *         return python.PyErr_NoMemory()
 *     try:             # <<<<<<<<<<<<<<
 *         if doc is None:
 *             tree.xmlDocSetRootElement(c_doc, c_node)
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":135
 *         return python.PyErr_NoMemory()
 *     try:
 *         if doc is None:             # <<<<<<<<<<<<<<
 *             tree.xmlDocSetRootElement(c_doc, c_node)
 *             doc = _documentFactory(c_doc, parser)
 */
      __pyx_t_10 = (((PyObject *)__pyx_v_doc) == Py_None);
      if (__pyx_t_10) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":136
 *     try:
 *         if doc is None:
 *             tree.xmlDocSetRootElement(c_doc, c_node)             # <<<<<<<<<<<<<<
 *             doc = _documentFactory(c_doc, parser)
 *         if text is not None:
 */
        xmlDocSetRootElement(__pyx_v_c_doc, __pyx_v_c_node);

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":137
 *         if doc is None:
 *             tree.xmlDocSetRootElement(c_doc, c_node)
 *             doc = _documentFactory(c_doc, parser)             # <<<<<<<<<<<<<<
 *         if text is not None:
 *             _setNodeText(c_node, text)
 */
        __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, __pyx_v_parser)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(((PyObject *)__pyx_v_doc));
        __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_2);
        __pyx_t_2 = 0;
        goto __pyx_L17;
      }
      __pyx_L17:;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":138
 *             tree.xmlDocSetRootElement(c_doc, c_node)
 *             doc = _documentFactory(c_doc, parser)
 *         if text is not None:             # <<<<<<<<<<<<<<
 *             _setNodeText(c_node, text)
 *         if tail is not None:
 */
      __pyx_t_10 = (__pyx_v_text != Py_None);
      if (__pyx_t_10) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":139
 *             doc = _documentFactory(c_doc, parser)
 *         if text is not None:
 *             _setNodeText(c_node, text)             # <<<<<<<<<<<<<<
 *         if tail is not None:
 *             _setTailText(c_node, tail)
 */
        __pyx_t_6 = __pyx_f_4lxml_5etree__setNodeText(__pyx_v_c_node, __pyx_v_text); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
        goto __pyx_L18;
      }
      __pyx_L18:;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":140
 *         if text is not None:
 *             _setNodeText(c_node, text)
 *         if tail is not None:             # <<<<<<<<<<<<<<
 *             _setTailText(c_node, tail)
 *         # add namespaces to node if necessary
 */
      __pyx_t_10 = (__pyx_v_tail != Py_None);
      if (__pyx_t_10) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":141
 *             _setNodeText(c_node, text)
 *         if tail is not None:
 *             _setTailText(c_node, tail)             # <<<<<<<<<<<<<<
 *         # add namespaces to node if necessary
 *         _initNodeNamespaces(c_node, doc, ns_utf, nsmap)
 */
        __pyx_t_6 = __pyx_f_4lxml_5etree__setTailText(__pyx_v_c_node, __pyx_v_tail); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
        goto __pyx_L19;
      }
      __pyx_L19:;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":143
 *             _setTailText(c_node, tail)
 *         # add namespaces to node if necessary
 *         _initNodeNamespaces(c_node, doc, ns_utf, nsmap)             # <<<<<<<<<<<<<<
 *         _initNodeAttributes(c_node, doc, attrib, extra_attrs)
 *         return _elementFactory(doc, c_node)
 */
      __pyx_t_6 = __pyx_f_4lxml_5etree__initNodeNamespaces(__pyx_v_c_node, __pyx_v_doc, __pyx_v_ns_utf, __pyx_v_nsmap); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L9_error;}

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":144
 *         # add namespaces to node if necessary
 *         _initNodeNamespaces(c_node, doc, ns_utf, nsmap)
 *         _initNodeAttributes(c_node, doc, attrib, extra_attrs)             # <<<<<<<<<<<<<<
 *         return _elementFactory(doc, c_node)
 *     except:
 */
      __pyx_t_2 = __pyx_f_4lxml_5etree__initNodeAttributes(__pyx_v_c_node, __pyx_v_doc, __pyx_v_attrib, __pyx_v_extra_attrs); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":145
 *         _initNodeNamespaces(c_node, doc, ns_utf, nsmap)
 *         _initNodeAttributes(c_node, doc, attrib, extra_attrs)
 *         return _elementFactory(doc, c_node)             # <<<<<<<<<<<<<<
 *     except:
 *         # free allocated c_node/c_doc unless Python does it for us
 */
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(__pyx_v_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = ((struct LxmlElement *)__pyx_t_2);
      __pyx_t_2 = 0;
      goto __pyx_L13_try_return;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L16_try_end;
    __pyx_L13_try_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;
    __pyx_L9_error:;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":146
 *         _initNodeAttributes(c_node, doc, attrib, extra_attrs)
 *         return _elementFactory(doc, c_node)
 *     except:             # <<<<<<<<<<<<<<
 *         # free allocated c_node/c_doc unless Python does it for us
 *         if c_node.doc is not c_doc:
 */
    /*except:*/ {
      __Pyx_AddTraceback("lxml.etree._makeElement");
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_4, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_3);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":148
 *     except:
 *         # free allocated c_node/c_doc unless Python does it for us
 *         if c_node.doc is not c_doc:             # <<<<<<<<<<<<<<
 *             # node not yet in document => will not be freed by document
 *             if tail is not None:
 */
      __pyx_t_10 = (__pyx_v_c_node->doc != __pyx_v_c_doc);
      if (__pyx_t_10) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":150
 *         if c_node.doc is not c_doc:
 *             # node not yet in document => will not be freed by document
 *             if tail is not None:             # <<<<<<<<<<<<<<
 *                 _removeText(c_node.next) # tail
 *             tree.xmlFreeNode(c_node)
 */
        __pyx_t_10 = (__pyx_v_tail != Py_None);
        if (__pyx_t_10) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":151
 *             # node not yet in document => will not be freed by document
 *             if tail is not None:
 *                 _removeText(c_node.next) # tail             # <<<<<<<<<<<<<<
 *             tree.xmlFreeNode(c_node)
 *         if doc is None:
 */
          __pyx_f_4lxml_5etree__removeText(__pyx_v_c_node->next);
          goto __pyx_L23;
        }
        __pyx_L23:;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":152
 *             if tail is not None:
 *                 _removeText(c_node.next) # tail
 *             tree.xmlFreeNode(c_node)             # <<<<<<<<<<<<<<
 *         if doc is None:
 *             # c_doc will not be freed by doc
 */
        xmlFreeNode(__pyx_v_c_node);
        goto __pyx_L22;
      }
      __pyx_L22:;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":153
 *                 _removeText(c_node.next) # tail
 *             tree.xmlFreeNode(c_node)
 *         if doc is None:             # <<<<<<<<<<<<<<
 *             # c_doc will not be freed by doc
 *             tree.xmlFreeDoc(c_doc)
 */
      __pyx_t_10 = (((PyObject *)__pyx_v_doc) == Py_None);
      if (__pyx_t_10) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":155
 *         if doc is None:
 *             # c_doc will not be freed by doc
 *             tree.xmlFreeDoc(c_doc)             # <<<<<<<<<<<<<<
 *         raise
 * 
 */
        xmlFreeDoc(__pyx_v_c_doc);
        goto __pyx_L24;
      }
      __pyx_L24:;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":156
 *             # c_doc will not be freed by doc
 *             tree.xmlFreeDoc(c_doc)
 *         raise             # <<<<<<<<<<<<<<
 * 
 * cdef int _initNewElement(_Element element, bint is_html, name_utf, ns_utf,
 */
      __Pyx_GIVEREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_3);
      __Pyx_ErrRestore(__pyx_t_2, __pyx_t_4, __pyx_t_3);
      __pyx_t_2 = 0; __pyx_t_4 = 0; __pyx_t_3 = 0; 
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L10_exception_handled;
    }
    __pyx_L11_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L10_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L16_try_end:;
  }

  __pyx_r = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._makeElement");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_ns_utf);
  __Pyx_DECREF(__pyx_v_name_utf);
  __Pyx_DECREF((PyObject *)__pyx_v_doc);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":158
 *         raise
 * 
 * cdef int _initNewElement(_Element element, bint is_html, name_utf, ns_utf,             # <<<<<<<<<<<<<<
 *                          _BaseParser parser, attrib, nsmap, extra_attrs) except -1:
 *     u"""Initialise a new Element object.
 */

static  int __pyx_f_4lxml_5etree__initNewElement(struct LxmlElement *__pyx_v_element, int __pyx_v_is_html, PyObject *__pyx_v_name_utf, PyObject *__pyx_v_ns_utf, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap, PyObject *__pyx_v_extra_attrs) {
  xmlDoc *__pyx_v_c_doc;
  xmlNode *__pyx_v_c_node;
  struct LxmlDocument *__pyx_v_doc;
  int __pyx_r;
  int __pyx_t_1;
  xmlDoc *__pyx_t_2;
  xmlDoc *__pyx_t_3;
  xmlNode *__pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("_initNewElement");
  __pyx_v_doc = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":168
 *     cdef xmlNode* c_node
 *     cdef _Document doc
 *     if is_html:             # <<<<<<<<<<<<<<
 *         _htmlTagValidOrRaise(name_utf)
 *         c_doc = _newHTMLDoc()
 */
  if (__pyx_v_is_html) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":169
 *     cdef _Document doc
 *     if is_html:
 *         _htmlTagValidOrRaise(name_utf)             # <<<<<<<<<<<<<<
 *         c_doc = _newHTMLDoc()
 *     else:
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree__htmlTagValidOrRaise(__pyx_v_name_utf); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":170
 *     if is_html:
 *         _htmlTagValidOrRaise(name_utf)
 *         c_doc = _newHTMLDoc()             # <<<<<<<<<<<<<<
 *     else:
 *         _tagValidOrRaise(name_utf)
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree__newHTMLDoc(); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_c_doc = __pyx_t_2;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":172
 *         c_doc = _newHTMLDoc()
 *     else:
 *         _tagValidOrRaise(name_utf)             # <<<<<<<<<<<<<<
 *         c_doc = _newXMLDoc()
 *     c_node = _createElement(c_doc, name_utf)
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree__tagValidOrRaise(__pyx_v_name_utf); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":173
 *     else:
 *         _tagValidOrRaise(name_utf)
 *         c_doc = _newXMLDoc()             # <<<<<<<<<<<<<<
 *     c_node = _createElement(c_doc, name_utf)
 *     if c_node is NULL:
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree__newXMLDoc(); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_c_doc = __pyx_t_3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":174
 *         _tagValidOrRaise(name_utf)
 *         c_doc = _newXMLDoc()
 *     c_node = _createElement(c_doc, name_utf)             # <<<<<<<<<<<<<<
 *     if c_node is NULL:
 *         if c_doc is not NULL:
 */
  __pyx_t_4 = __pyx_f_4lxml_5etree__createElement(__pyx_v_c_doc, __pyx_v_name_utf); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_node = __pyx_t_4;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":175
 *         c_doc = _newXMLDoc()
 *     c_node = _createElement(c_doc, name_utf)
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         if c_doc is not NULL:
 *             tree.xmlFreeDoc(c_doc)
 */
  __pyx_t_5 = (__pyx_v_c_node == NULL);
  if (__pyx_t_5) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":176
 *     c_node = _createElement(c_doc, name_utf)
 *     if c_node is NULL:
 *         if c_doc is not NULL:             # <<<<<<<<<<<<<<
 *             tree.xmlFreeDoc(c_doc)
 *         return python.PyErr_NoMemory()
 */
    __pyx_t_5 = (__pyx_v_c_doc != NULL);
    if (__pyx_t_5) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":177
 *     if c_node is NULL:
 *         if c_doc is not NULL:
 *             tree.xmlFreeDoc(c_doc)             # <<<<<<<<<<<<<<
 *         return python.PyErr_NoMemory()
 *     tree.xmlDocSetRootElement(c_doc, c_node)
 */
      xmlFreeDoc(__pyx_v_c_doc);
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":178
 *         if c_doc is not NULL:
 *             tree.xmlFreeDoc(c_doc)
 *         return python.PyErr_NoMemory()             # <<<<<<<<<<<<<<
 *     tree.xmlDocSetRootElement(c_doc, c_node)
 *     doc = _documentFactory(c_doc, parser)
 */
    __pyx_t_6 = PyErr_NoMemory(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_t_6); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_r = __pyx_t_1;
    goto __pyx_L0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":179
 *             tree.xmlFreeDoc(c_doc)
 *         return python.PyErr_NoMemory()
 *     tree.xmlDocSetRootElement(c_doc, c_node)             # <<<<<<<<<<<<<<
 *     doc = _documentFactory(c_doc, parser)
 *     # add namespaces to node if necessary
 */
  xmlDocSetRootElement(__pyx_v_c_doc, __pyx_v_c_node);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":180
 *         return python.PyErr_NoMemory()
 *     tree.xmlDocSetRootElement(c_doc, c_node)
 *     doc = _documentFactory(c_doc, parser)             # <<<<<<<<<<<<<<
 *     # add namespaces to node if necessary
 *     _initNodeNamespaces(c_node, doc, ns_utf, nsmap)
 */
  __pyx_t_6 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, __pyx_v_parser)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(((PyObject *)__pyx_v_doc));
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":182
 *     doc = _documentFactory(c_doc, parser)
 *     # add namespaces to node if necessary
 *     _initNodeNamespaces(c_node, doc, ns_utf, nsmap)             # <<<<<<<<<<<<<<
 *     _initNodeAttributes(c_node, doc, attrib, extra_attrs)
 *     _registerProxy(element, doc, c_node)
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__initNodeNamespaces(__pyx_v_c_node, __pyx_v_doc, __pyx_v_ns_utf, __pyx_v_nsmap); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":183
 *     # add namespaces to node if necessary
 *     _initNodeNamespaces(c_node, doc, ns_utf, nsmap)
 *     _initNodeAttributes(c_node, doc, attrib, extra_attrs)             # <<<<<<<<<<<<<<
 *     _registerProxy(element, doc, c_node)
 *     element._init()
 */
  __pyx_t_6 = __pyx_f_4lxml_5etree__initNodeAttributes(__pyx_v_c_node, __pyx_v_doc, __pyx_v_attrib, __pyx_v_extra_attrs); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":184
 *     _initNodeNamespaces(c_node, doc, ns_utf, nsmap)
 *     _initNodeAttributes(c_node, doc, attrib, extra_attrs)
 *     _registerProxy(element, doc, c_node)             # <<<<<<<<<<<<<<
 *     element._init()
 *     return 0
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__registerProxy(__pyx_v_element, __pyx_v_doc, __pyx_v_c_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":185
 *     _initNodeAttributes(c_node, doc, attrib, extra_attrs)
 *     _registerProxy(element, doc, c_node)
 *     element._init()             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_element), __pyx_n_s___init); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":186
 *     _registerProxy(element, doc, c_node)
 *     element._init()
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef _Element _makeSubElement(_Element parent, tag, text, tail,
 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree._initNewElement");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_doc);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":188
 *     return 0
 * 
 * cdef _Element _makeSubElement(_Element parent, tag, text, tail,             # <<<<<<<<<<<<<<
 *                               attrib, nsmap, extra_attrs):
 *     u"""Create a new child element and initialize text content, namespaces and
 */

static  struct LxmlElement *__pyx_f_4lxml_5etree__makeSubElement(struct LxmlElement *__pyx_v_parent, PyObject *__pyx_v_tag, PyObject *__pyx_v_text, PyObject *__pyx_v_tail, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap, PyObject *__pyx_v_extra_attrs) {
  xmlNode *__pyx_v_c_node;
  xmlDoc *__pyx_v_c_doc;
  PyObject *__pyx_v_ns_utf;
  PyObject *__pyx_v_name_utf;
  struct LxmlElement *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  xmlNode *__pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  __Pyx_RefNannySetupContext("_makeSubElement");
  __pyx_v_ns_utf = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_name_utf = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":195
 *     cdef xmlNode* c_node
 *     cdef xmlDoc* c_doc
 *     if parent is None or parent._doc is None:             # <<<<<<<<<<<<<<
 *         return None
 *     _assertValidNode(parent)
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_parent) == Py_None);
  if (!__pyx_t_1) {
    __pyx_t_2 = (((PyObject *)__pyx_v_parent->_doc) == Py_None);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":196
 *     cdef xmlDoc* c_doc
 *     if parent is None or parent._doc is None:
 *         return None             # <<<<<<<<<<<<<<
 *     _assertValidNode(parent)
 *     ns_utf, name_utf = _getNsTag(tag)
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __Pyx_INCREF(Py_None);
    __pyx_r = ((struct LxmlElement *)Py_None);
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":197
 *     if parent is None or parent._doc is None:
 *         return None
 *     _assertValidNode(parent)             # <<<<<<<<<<<<<<
 *     ns_utf, name_utf = _getNsTag(tag)
 *     c_doc = parent._doc._c_doc
 */
  __pyx_t_4 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_parent); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":198
 *         return None
 *     _assertValidNode(parent)
 *     ns_utf, name_utf = _getNsTag(tag)             # <<<<<<<<<<<<<<
 *     c_doc = parent._doc._c_doc
 * 
 */
  __pyx_t_5 = ((PyObject *)__pyx_f_4lxml_5etree__getNsTag(__pyx_v_tag)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if (likely(__pyx_t_5 != Py_None) && likely(PyTuple_GET_SIZE(__pyx_t_5) == 2)) {
    PyObject* tuple = __pyx_t_5;
    __pyx_t_6 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_6);
    __pyx_t_7 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_v_ns_utf);
    __pyx_v_ns_utf = __pyx_t_6;
    __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_v_name_utf);
    __pyx_v_name_utf = __pyx_t_7;
    __pyx_t_7 = 0;
  } else {
    __Pyx_UnpackTupleError(__pyx_t_5, 2);
    {__pyx_filename = __pyx_f[2]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":199
 *     _assertValidNode(parent)
 *     ns_utf, name_utf = _getNsTag(tag)
 *     c_doc = parent._doc._c_doc             # <<<<<<<<<<<<<<
 * 
 *     if parent._doc._parser is not None and parent._doc._parser._for_html:
 */
  __pyx_v_c_doc = __pyx_v_parent->_doc->_c_doc;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":201
 *     c_doc = parent._doc._c_doc
 * 
 *     if parent._doc._parser is not None and parent._doc._parser._for_html:             # <<<<<<<<<<<<<<
 *         _htmlTagValidOrRaise(name_utf)
 *     else:
 */
  __pyx_t_3 = (((PyObject *)__pyx_v_parent->_doc->_parser) != Py_None);
  if (__pyx_t_3) {
    __pyx_t_1 = __pyx_v_parent->_doc->_parser->_for_html;
  } else {
    __pyx_t_1 = __pyx_t_3;
  }
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":202
 * 
 *     if parent._doc._parser is not None and parent._doc._parser._for_html:
 *         _htmlTagValidOrRaise(name_utf)             # <<<<<<<<<<<<<<
 *     else:
 *         _tagValidOrRaise(name_utf)
 */
    __pyx_t_4 = __pyx_f_4lxml_5etree__htmlTagValidOrRaise(__pyx_v_name_utf); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L4;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":204
 *         _htmlTagValidOrRaise(name_utf)
 *     else:
 *         _tagValidOrRaise(name_utf)             # <<<<<<<<<<<<<<
 * 
 *     c_node = _createElement(c_doc, name_utf)
 */
    __pyx_t_4 = __pyx_f_4lxml_5etree__tagValidOrRaise(__pyx_v_name_utf); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":206
 *         _tagValidOrRaise(name_utf)
 * 
 *     c_node = _createElement(c_doc, name_utf)             # <<<<<<<<<<<<<<
 *     if c_node is NULL:
 *         return python.PyErr_NoMemory()
 */
  __pyx_t_8 = __pyx_f_4lxml_5etree__createElement(__pyx_v_c_doc, __pyx_v_name_utf); if (unlikely(__pyx_t_8 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_node = __pyx_t_8;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":207
 * 
 *     c_node = _createElement(c_doc, name_utf)
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         return python.PyErr_NoMemory()
 *     tree.xmlAddChild(parent._c_node, c_node)
 */
  __pyx_t_1 = (__pyx_v_c_node == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":208
 *     c_node = _createElement(c_doc, name_utf)
 *     if c_node is NULL:
 *         return python.PyErr_NoMemory()             # <<<<<<<<<<<<<<
 *     tree.xmlAddChild(parent._c_node, c_node)
 * 
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __pyx_t_5 = PyErr_NoMemory(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_r = ((struct LxmlElement *)__pyx_t_5);
    __pyx_t_5 = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":209
 *     if c_node is NULL:
 *         return python.PyErr_NoMemory()
 *     tree.xmlAddChild(parent._c_node, c_node)             # <<<<<<<<<<<<<<
 * 
 *     try:
 */
  xmlAddChild(__pyx_v_parent->_c_node, __pyx_v_c_node);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":211
 *     tree.xmlAddChild(parent._c_node, c_node)
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         if text is not None:
 *             _setNodeText(c_node, text)
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":212
 * 
 *     try:
 *         if text is not None:             # <<<<<<<<<<<<<<
 *             _setNodeText(c_node, text)
 *         if tail is not None:
 */
      __pyx_t_1 = (__pyx_v_text != Py_None);
      if (__pyx_t_1) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":213
 *     try:
 *         if text is not None:
 *             _setNodeText(c_node, text)             # <<<<<<<<<<<<<<
 *         if tail is not None:
 *             _setTailText(c_node, tail)
 */
        __pyx_t_4 = __pyx_f_4lxml_5etree__setNodeText(__pyx_v_c_node, __pyx_v_text); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        goto __pyx_L14;
      }
      __pyx_L14:;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":214
 *         if text is not None:
 *             _setNodeText(c_node, text)
 *         if tail is not None:             # <<<<<<<<<<<<<<
 *             _setTailText(c_node, tail)
 * 
 */
      __pyx_t_1 = (__pyx_v_tail != Py_None);
      if (__pyx_t_1) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":215
 *             _setNodeText(c_node, text)
 *         if tail is not None:
 *             _setTailText(c_node, tail)             # <<<<<<<<<<<<<<
 * 
 *         # add namespaces to node if necessary
 */
        __pyx_t_4 = __pyx_f_4lxml_5etree__setTailText(__pyx_v_c_node, __pyx_v_tail); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        goto __pyx_L15;
      }
      __pyx_L15:;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":218
 * 
 *         # add namespaces to node if necessary
 *         _initNodeNamespaces(c_node, parent._doc, ns_utf, nsmap)             # <<<<<<<<<<<<<<
 *         _initNodeAttributes(c_node, parent._doc, attrib, extra_attrs)
 *         return _elementFactory(parent._doc, c_node)
 */
      __pyx_t_5 = ((PyObject *)__pyx_v_parent->_doc);
      __Pyx_INCREF(__pyx_t_5);
      __pyx_t_4 = __pyx_f_4lxml_5etree__initNodeNamespaces(__pyx_v_c_node, ((struct LxmlDocument *)__pyx_t_5), __pyx_v_ns_utf, __pyx_v_nsmap); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":219
 *         # add namespaces to node if necessary
 *         _initNodeNamespaces(c_node, parent._doc, ns_utf, nsmap)
 *         _initNodeAttributes(c_node, parent._doc, attrib, extra_attrs)             # <<<<<<<<<<<<<<
 *         return _elementFactory(parent._doc, c_node)
 *     except:
 */
      __pyx_t_5 = ((PyObject *)__pyx_v_parent->_doc);
      __Pyx_INCREF(__pyx_t_5);
      __pyx_t_7 = __pyx_f_4lxml_5etree__initNodeAttributes(__pyx_v_c_node, ((struct LxmlDocument *)__pyx_t_5), __pyx_v_attrib, __pyx_v_extra_attrs); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":220
 *         _initNodeNamespaces(c_node, parent._doc, ns_utf, nsmap)
 *         _initNodeAttributes(c_node, parent._doc, attrib, extra_attrs)
 *         return _elementFactory(parent._doc, c_node)             # <<<<<<<<<<<<<<
 *     except:
 *         # make sure we clean up in case of an error
 */
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __pyx_t_7 = ((PyObject *)__pyx_v_parent->_doc);
      __Pyx_INCREF(__pyx_t_7);
      __pyx_t_5 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_7), __pyx_v_c_node)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_r = ((struct LxmlElement *)__pyx_t_5);
      __pyx_t_5 = 0;
      goto __pyx_L10_try_return;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L13_try_end;
    __pyx_L10_try_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;
    __pyx_L6_error:;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":221
 *         _initNodeAttributes(c_node, parent._doc, attrib, extra_attrs)
 *         return _elementFactory(parent._doc, c_node)
 *     except:             # <<<<<<<<<<<<<<
 *         # make sure we clean up in case of an error
 *         _removeNode(parent._doc, c_node)
 */
    /*except:*/ {
      __Pyx_AddTraceback("lxml.etree._makeSubElement");
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_7, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_6);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":223
 *     except:
 *         # make sure we clean up in case of an error
 *         _removeNode(parent._doc, c_node)             # <<<<<<<<<<<<<<
 *         raise
 * 
 */
      __pyx_t_9 = ((PyObject *)__pyx_v_parent->_doc);
      __Pyx_INCREF(__pyx_t_9);
      __pyx_t_4 = __pyx_f_4lxml_5etree__removeNode(((struct LxmlDocument *)__pyx_t_9), __pyx_v_c_node); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":224
 *         # make sure we clean up in case of an error
 *         _removeNode(parent._doc, c_node)
 *         raise             # <<<<<<<<<<<<<<
 * 
 * cdef int _initNodeNamespaces(xmlNode* c_node, _Document doc,
 */
      __Pyx_GIVEREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_6);
      __Pyx_ErrRestore(__pyx_t_5, __pyx_t_7, __pyx_t_6);
      __pyx_t_5 = 0; __pyx_t_7 = 0; __pyx_t_6 = 0; 
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L7_exception_handled;
    }
    __pyx_L8_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L7_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L13_try_end:;
  }

  __pyx_r = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("lxml.etree._makeSubElement");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_ns_utf);
  __Pyx_DECREF(__pyx_v_name_utf);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":226
 *         raise
 * 
 * cdef int _initNodeNamespaces(xmlNode* c_node, _Document doc,             # <<<<<<<<<<<<<<
 *                              object node_ns_utf, object nsmap) except -1:
 *     u"""Lookup current namespace prefixes, then set namespace structure for
 */

static  int __pyx_f_4lxml_5etree__initNodeNamespaces(xmlNode *__pyx_v_c_node, struct LxmlDocument *__pyx_v_doc, PyObject *__pyx_v_node_ns_utf, PyObject *__pyx_v_nsmap) {
  xmlNs *__pyx_v_c_ns;
  char *__pyx_v_c_prefix;
  char *__pyx_v_c_href;
  PyObject *__pyx_v_nsdefs;
  PyObject *__pyx_v_item;
  PyObject *__pyx_v_prefix;
  PyObject *__pyx_v_href;
  PyObject *__pyx_v_href_utf;
  PyObject *__pyx_v_prefix_utf;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  __Pyx_RefNannySetupContext("_initNodeNamespaces");
  __Pyx_INCREF(__pyx_v_node_ns_utf);
  __pyx_v_nsdefs = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_item = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_prefix = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_href = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_href_utf = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_prefix_utf = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":237
 *     cdef char*  c_href
 *     cdef list nsdefs
 *     if not nsmap:             # <<<<<<<<<<<<<<
 *         if node_ns_utf is not None:
 *             _uriValidOrRaise(node_ns_utf)
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_nsmap); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = (!__pyx_t_1);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":238
 *     cdef list nsdefs
 *     if not nsmap:
 *         if node_ns_utf is not None:             # <<<<<<<<<<<<<<
 *             _uriValidOrRaise(node_ns_utf)
 *             doc._setNodeNs(c_node, _cstr(node_ns_utf))
 */
    __pyx_t_2 = (__pyx_v_node_ns_utf != Py_None);
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":239
 *     if not nsmap:
 *         if node_ns_utf is not None:
 *             _uriValidOrRaise(node_ns_utf)             # <<<<<<<<<<<<<<
 *             doc._setNodeNs(c_node, _cstr(node_ns_utf))
 *         return 0
 */
      __pyx_t_3 = __pyx_f_4lxml_5etree__uriValidOrRaise(__pyx_v_node_ns_utf); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":240
 *         if node_ns_utf is not None:
 *             _uriValidOrRaise(node_ns_utf)
 *             doc._setNodeNs(c_node, _cstr(node_ns_utf))             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
      __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree__Document *)__pyx_v_doc->__pyx_vtab)->_setNodeNs(__pyx_v_doc, __pyx_v_c_node, PyBytes_AS_STRING(__pyx_v_node_ns_utf)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":241
 *             _uriValidOrRaise(node_ns_utf)
 *             doc._setNodeNs(c_node, _cstr(node_ns_utf))
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     nsdefs = list(nsmap.items())
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":243
 *         return 0
 * 
 *     nsdefs = list(nsmap.items())             # <<<<<<<<<<<<<<
 *     if None in nsmap and len(nsdefs) > 1:
 *         # Move the default namespace to the end.  This makes sure libxml2
 */
  __pyx_t_4 = PyObject_GetAttr(__pyx_v_nsmap, __pyx_n_s__items); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_v_nsdefs));
  __pyx_v_nsdefs = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":244
 * 
 *     nsdefs = list(nsmap.items())
 *     if None in nsmap and len(nsdefs) > 1:             # <<<<<<<<<<<<<<
 *         # Move the default namespace to the end.  This makes sure libxml2
 *         # prefers a prefix if the ns is defined redundantly on the same
 */
  __pyx_t_2 = ((PySequence_Contains(__pyx_v_nsmap, Py_None))); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_2) {
    if (unlikely(__pyx_v_nsdefs == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_6 = PyList_GET_SIZE(((PyObject *)__pyx_v_nsdefs)); 
    __pyx_t_1 = (__pyx_t_6 > 1);
    __pyx_t_7 = __pyx_t_1;
  } else {
    __pyx_t_7 = __pyx_t_2;
  }
  if (__pyx_t_7) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":251
 *         # elements serialise without prefix (i.e. into the non-default
 *         # namespace).
 *         item = (None, nsmap[None])             # <<<<<<<<<<<<<<
 *         nsdefs.remove(item)
 *         nsdefs.append(item)
 */
    __pyx_t_5 = PyObject_GetItem(__pyx_v_nsmap, Py_None); if (!__pyx_t_5) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_INCREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_4, 0, Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_v_item));
    __pyx_v_item = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":252
 *         # namespace).
 *         item = (None, nsmap[None])
 *         nsdefs.remove(item)             # <<<<<<<<<<<<<<
 *         nsdefs.append(item)
 * 
 */
    __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_nsdefs), __pyx_n_s__remove); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
    __Pyx_INCREF(((PyObject *)__pyx_v_item));
    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_item));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_item));
    __pyx_t_8 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":253
 *         item = (None, nsmap[None])
 *         nsdefs.remove(item)
 *         nsdefs.append(item)             # <<<<<<<<<<<<<<
 * 
 *     for prefix, href in nsdefs:
 */
    if (unlikely(__pyx_v_nsdefs == Py_None)) {
      PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_3 = PyList_Append(__pyx_v_nsdefs, ((PyObject *)__pyx_v_item)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":255
 *         nsdefs.append(item)
 * 
 *     for prefix, href in nsdefs:             # <<<<<<<<<<<<<<
 *         href_utf = _utf8(href)
 *         _uriValidOrRaise(href_utf)
 */
  if (unlikely(__pyx_v_nsdefs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_6 = 0; __pyx_t_8 = ((PyObject *)__pyx_v_nsdefs); __Pyx_INCREF(__pyx_t_8);
  for (;;) {
    if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_8)) break;
    __pyx_t_5 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++;
    if (PyTuple_CheckExact(__pyx_t_5) && likely(PyTuple_GET_SIZE(__pyx_t_5) == 2)) {
      PyObject* tuple = __pyx_t_5;
      __pyx_t_4 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_4);
      __pyx_t_9 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_v_prefix);
      __pyx_v_prefix = __pyx_t_4;
      __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_v_href);
      __pyx_v_href = __pyx_t_9;
      __pyx_t_9 = 0;
    } else {
      __pyx_t_10 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_4 = __Pyx_UnpackItem(__pyx_t_10, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_9 = __Pyx_UnpackItem(__pyx_t_10, 1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      if (__Pyx_EndUnpack(__pyx_t_10, 2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_v_prefix);
      __pyx_v_prefix = __pyx_t_4;
      __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_v_href);
      __pyx_v_href = __pyx_t_9;
      __pyx_t_9 = 0;
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":256
 * 
 *     for prefix, href in nsdefs:
 *         href_utf = _utf8(href)             # <<<<<<<<<<<<<<
 *         _uriValidOrRaise(href_utf)
 *         c_href = _cstr(href_utf)
 */
    __pyx_t_5 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_v_href)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(((PyObject *)__pyx_v_href_utf));
    __pyx_v_href_utf = ((PyObject*)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":257
 *     for prefix, href in nsdefs:
 *         href_utf = _utf8(href)
 *         _uriValidOrRaise(href_utf)             # <<<<<<<<<<<<<<
 *         c_href = _cstr(href_utf)
 *         if prefix is not None:
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree__uriValidOrRaise(((PyObject *)__pyx_v_href_utf)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":258
 *         href_utf = _utf8(href)
 *         _uriValidOrRaise(href_utf)
 *         c_href = _cstr(href_utf)             # <<<<<<<<<<<<<<
 *         if prefix is not None:
 *             prefix_utf = _utf8(prefix)
 */
    __pyx_v_c_href = PyBytes_AS_STRING(((PyObject *)__pyx_v_href_utf));

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":259
 *         _uriValidOrRaise(href_utf)
 *         c_href = _cstr(href_utf)
 *         if prefix is not None:             # <<<<<<<<<<<<<<
 *             prefix_utf = _utf8(prefix)
 *             _prefixValidOrRaise(prefix_utf)
 */
    __pyx_t_7 = (__pyx_v_prefix != Py_None);
    if (__pyx_t_7) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":260
 *         c_href = _cstr(href_utf)
 *         if prefix is not None:
 *             prefix_utf = _utf8(prefix)             # <<<<<<<<<<<<<<
 *             _prefixValidOrRaise(prefix_utf)
 *             c_prefix = _cstr(prefix_utf)
 */
      __pyx_t_5 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_v_prefix)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(((PyObject *)__pyx_v_prefix_utf));
      __pyx_v_prefix_utf = ((PyObject*)__pyx_t_5);
      __pyx_t_5 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":261
 *         if prefix is not None:
 *             prefix_utf = _utf8(prefix)
 *             _prefixValidOrRaise(prefix_utf)             # <<<<<<<<<<<<<<
 *             c_prefix = _cstr(prefix_utf)
 *         else:
 */
      __pyx_t_3 = __pyx_f_4lxml_5etree__prefixValidOrRaise(((PyObject *)__pyx_v_prefix_utf)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":262
 *             prefix_utf = _utf8(prefix)
 *             _prefixValidOrRaise(prefix_utf)
 *             c_prefix = _cstr(prefix_utf)             # <<<<<<<<<<<<<<
 *         else:
 *             c_prefix = NULL
 */
      __pyx_v_c_prefix = PyBytes_AS_STRING(((PyObject *)__pyx_v_prefix_utf));
      goto __pyx_L8;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":264
 *             c_prefix = _cstr(prefix_utf)
 *         else:
 *             c_prefix = NULL             # <<<<<<<<<<<<<<
 *         # add namespace with prefix if it is not already known
 *         c_ns = tree.xmlSearchNs(doc._c_doc, c_node, c_prefix)
 */
      __pyx_v_c_prefix = NULL;
    }
    __pyx_L8:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":266
 *             c_prefix = NULL
 *         # add namespace with prefix if it is not already known
 *         c_ns = tree.xmlSearchNs(doc._c_doc, c_node, c_prefix)             # <<<<<<<<<<<<<<
 *         if c_ns is NULL or \
 *                 c_ns.href is NULL or \
 */
    __pyx_v_c_ns = xmlSearchNs(__pyx_v_doc->_c_doc, __pyx_v_c_node, __pyx_v_c_prefix);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":267
 *         # add namespace with prefix if it is not already known
 *         c_ns = tree.xmlSearchNs(doc._c_doc, c_node, c_prefix)
 *         if c_ns is NULL or \             # <<<<<<<<<<<<<<
 *                 c_ns.href is NULL or \
 *                 cstd.strcmp(c_ns.href, c_href) != 0:
 */
    __pyx_t_7 = (__pyx_v_c_ns == NULL);
    if (!__pyx_t_7) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":268
 *         c_ns = tree.xmlSearchNs(doc._c_doc, c_node, c_prefix)
 *         if c_ns is NULL or \
 *                 c_ns.href is NULL or \             # <<<<<<<<<<<<<<
 *                 cstd.strcmp(c_ns.href, c_href) != 0:
 *             c_ns = tree.xmlNewNs(c_node, c_href, c_prefix)
 */
      __pyx_t_2 = (__pyx_v_c_ns->href == NULL);
      if (!__pyx_t_2) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":269
 *         if c_ns is NULL or \
 *                 c_ns.href is NULL or \
 *                 cstd.strcmp(c_ns.href, c_href) != 0:             # <<<<<<<<<<<<<<
 *             c_ns = tree.xmlNewNs(c_node, c_href, c_prefix)
 *         if href_utf == node_ns_utf:
 */
        __pyx_t_1 = (strcmp(__pyx_v_c_ns->href, __pyx_v_c_href) != 0);
        __pyx_t_11 = __pyx_t_1;
      } else {
        __pyx_t_11 = __pyx_t_2;
      }
      __pyx_t_2 = __pyx_t_11;
    } else {
      __pyx_t_2 = __pyx_t_7;
    }
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":270
 *                 c_ns.href is NULL or \
 *                 cstd.strcmp(c_ns.href, c_href) != 0:
 *             c_ns = tree.xmlNewNs(c_node, c_href, c_prefix)             # <<<<<<<<<<<<<<
 *         if href_utf == node_ns_utf:
 *             tree.xmlSetNs(c_node, c_ns)
 */
      __pyx_v_c_ns = xmlNewNs(__pyx_v_c_node, __pyx_v_c_href, __pyx_v_c_prefix);
      goto __pyx_L9;
    }
    __pyx_L9:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":271
 *                 cstd.strcmp(c_ns.href, c_href) != 0:
 *             c_ns = tree.xmlNewNs(c_node, c_href, c_prefix)
 *         if href_utf == node_ns_utf:             # <<<<<<<<<<<<<<
 *             tree.xmlSetNs(c_node, c_ns)
 *             node_ns_utf = None
 */
    __pyx_t_5 = PyObject_RichCompare(((PyObject *)__pyx_v_href_utf), __pyx_v_node_ns_utf, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":272
 *             c_ns = tree.xmlNewNs(c_node, c_href, c_prefix)
 *         if href_utf == node_ns_utf:
 *             tree.xmlSetNs(c_node, c_ns)             # <<<<<<<<<<<<<<
 *             node_ns_utf = None
 * 
 */
      xmlSetNs(__pyx_v_c_node, __pyx_v_c_ns);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":273
 *         if href_utf == node_ns_utf:
 *             tree.xmlSetNs(c_node, c_ns)
 *             node_ns_utf = None             # <<<<<<<<<<<<<<
 * 
 *     if node_ns_utf is not None:
 */
      __Pyx_INCREF(Py_None);
      __Pyx_DECREF(__pyx_v_node_ns_utf);
      __pyx_v_node_ns_utf = Py_None;
      goto __pyx_L10;
    }
    __pyx_L10:;
  }
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":275
 *             node_ns_utf = None
 * 
 *     if node_ns_utf is not None:             # <<<<<<<<<<<<<<
 *         doc._setNodeNs(c_node, _cstr(node_ns_utf))
 *     return 0
 */
  __pyx_t_2 = (__pyx_v_node_ns_utf != Py_None);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":276
 * 
 *     if node_ns_utf is not None:
 *         doc._setNodeNs(c_node, _cstr(node_ns_utf))             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree__Document *)__pyx_v_doc->__pyx_vtab)->_setNodeNs(__pyx_v_doc, __pyx_v_c_node, PyBytes_AS_STRING(__pyx_v_node_ns_utf)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L11;
  }
  __pyx_L11:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":277
 *     if node_ns_utf is not None:
 *         doc._setNodeNs(c_node, _cstr(node_ns_utf))
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef _initNodeAttributes(xmlNode* c_node, _Document doc, attrib, extra):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("lxml.etree._initNodeNamespaces");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_nsdefs);
  __Pyx_DECREF(__pyx_v_item);
  __Pyx_DECREF(__pyx_v_prefix);
  __Pyx_DECREF(__pyx_v_href);
  __Pyx_DECREF(__pyx_v_href_utf);
  __Pyx_DECREF(__pyx_v_prefix_utf);
  __Pyx_DECREF(__pyx_v_node_ns_utf);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":279
 *     return 0
 * 
 * cdef _initNodeAttributes(xmlNode* c_node, _Document doc, attrib, extra):             # <<<<<<<<<<<<<<
 *     u"""Initialise the attributes of an element node.
 *     """
 */

static  PyObject *__pyx_f_4lxml_5etree__initNodeAttributes(xmlNode *__pyx_v_c_node, struct LxmlDocument *__pyx_v_doc, PyObject *__pyx_v_attrib, PyObject *__pyx_v_extra) {
  int __pyx_v_is_html;
  xmlNs *__pyx_v_c_ns;
  PyObject *__pyx_v_name;
  PyObject *__pyx_v_value;
  PyObject *__pyx_v_attr_ns_utf;
  PyObject *__pyx_v_attr_name_utf;
  PyObject *__pyx_v_value_utf;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  xmlNs *__pyx_t_11;
  __Pyx_RefNannySetupContext("_initNodeAttributes");
  __Pyx_INCREF(__pyx_v_attrib);
  __pyx_v_name = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_value = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_attr_ns_utf = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_attr_name_utf = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_value_utf = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":285
 *     cdef xmlNs* c_ns
 *     # 'extra' is not checked here (expected to be a keyword dict)
 *     if attrib is not None and not hasattr(attrib, u'items'):             # <<<<<<<<<<<<<<
 *         raise TypeError, u"Invalid attribute dictionary: %s" % \
 *             python._fqtypename(attrib)
 */
  __pyx_t_1 = (__pyx_v_attrib != Py_None);
  if (__pyx_t_1) {
    __pyx_t_2 = PyObject_HasAttr(__pyx_v_attrib, ((PyObject *)__pyx_n_u__items)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = (!__pyx_t_2);
    __pyx_t_2 = __pyx_t_3;
  } else {
    __pyx_t_2 = __pyx_t_1;
  }
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":287
 *     if attrib is not None and not hasattr(attrib, u'items'):
 *         raise TypeError, u"Invalid attribute dictionary: %s" % \
 *             python._fqtypename(attrib)             # <<<<<<<<<<<<<<
 *     if extra is not None and extra:
 *         if attrib is None:
 */
    __pyx_t_4 = PyBytes_FromString(_fqtypename(__pyx_v_attrib)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_19), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_5), 0);
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    {__pyx_filename = __pyx_f[2]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":288
 *         raise TypeError, u"Invalid attribute dictionary: %s" % \
 *             python._fqtypename(attrib)
 *     if extra is not None and extra:             # <<<<<<<<<<<<<<
 *         if attrib is None:
 *             attrib = extra
 */
  __pyx_t_2 = (__pyx_v_extra != Py_None);
  if (__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_extra); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = __pyx_t_1;
  } else {
    __pyx_t_3 = __pyx_t_2;
  }
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":289
 *             python._fqtypename(attrib)
 *     if extra is not None and extra:
 *         if attrib is None:             # <<<<<<<<<<<<<<
 *             attrib = extra
 *         else:
 */
    __pyx_t_3 = (__pyx_v_attrib == Py_None);
    if (__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":290
 *     if extra is not None and extra:
 *         if attrib is None:
 *             attrib = extra             # <<<<<<<<<<<<<<
 *         else:
 *             attrib.update(extra)
 */
      __Pyx_INCREF(__pyx_v_extra);
      __Pyx_DECREF(__pyx_v_attrib);
      __pyx_v_attrib = __pyx_v_extra;
      goto __pyx_L5;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":292
 *             attrib = extra
 *         else:
 *             attrib.update(extra)             # <<<<<<<<<<<<<<
 *     if attrib:
 *         is_html = doc._parser._for_html
 */
      __pyx_t_5 = PyObject_GetAttr(__pyx_v_attrib, __pyx_n_s__update); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      __Pyx_INCREF(__pyx_v_extra);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_extra);
      __Pyx_GIVEREF(__pyx_v_extra);
      __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __pyx_L5:;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":293
 *         else:
 *             attrib.update(extra)
 *     if attrib:             # <<<<<<<<<<<<<<
 *         is_html = doc._parser._for_html
 *         for name, value in attrib.items():
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_attrib); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":294
 *             attrib.update(extra)
 *     if attrib:
 *         is_html = doc._parser._for_html             # <<<<<<<<<<<<<<
 *         for name, value in attrib.items():
 *             attr_ns_utf, attr_name_utf = _getNsTag(name)
 */
    __pyx_v_is_html = __pyx_v_doc->_parser->_for_html;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":295
 *     if attrib:
 *         is_html = doc._parser._for_html
 *         for name, value in attrib.items():             # <<<<<<<<<<<<<<
 *             attr_ns_utf, attr_name_utf = _getNsTag(name)
 *             if not is_html:
 */
    __pyx_t_6 = PyObject_GetAttr(__pyx_v_attrib, __pyx_n_s__items); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_4 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (PyList_CheckExact(__pyx_t_4) || PyTuple_CheckExact(__pyx_t_4)) {
      __pyx_t_7 = 0; __pyx_t_6 = __pyx_t_4; __Pyx_INCREF(__pyx_t_6);
    } else {
      __pyx_t_7 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    for (;;) {
      if (likely(PyList_CheckExact(__pyx_t_6))) {
        if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_6)) break;
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++;
      } else if (likely(PyTuple_CheckExact(__pyx_t_6))) {
        if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++;
      } else {
        __pyx_t_4 = PyIter_Next(__pyx_t_6);
        if (!__pyx_t_4) {
          if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          break;
        }
        __Pyx_GOTREF(__pyx_t_4);
      }
      if (PyTuple_CheckExact(__pyx_t_4) && likely(PyTuple_GET_SIZE(__pyx_t_4) == 2)) {
        PyObject* tuple = __pyx_t_4;
        __pyx_t_5 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_5);
        __pyx_t_8 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_v_name);
        __pyx_v_name = __pyx_t_5;
        __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_v_value);
        __pyx_v_value = __pyx_t_8;
        __pyx_t_8 = 0;
      } else {
        __pyx_t_9 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_5 = __Pyx_UnpackItem(__pyx_t_9, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_8 = __Pyx_UnpackItem(__pyx_t_9, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        if (__Pyx_EndUnpack(__pyx_t_9, 2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_v_name);
        __pyx_v_name = __pyx_t_5;
        __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_v_value);
        __pyx_v_value = __pyx_t_8;
        __pyx_t_8 = 0;
      }

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":296
 *         is_html = doc._parser._for_html
 *         for name, value in attrib.items():
 *             attr_ns_utf, attr_name_utf = _getNsTag(name)             # <<<<<<<<<<<<<<
 *             if not is_html:
 *                 _attributeValidOrRaise(attr_name_utf)
 */
      __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__getNsTag(__pyx_v_name)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      if (likely(__pyx_t_4 != Py_None) && likely(PyTuple_GET_SIZE(__pyx_t_4) == 2)) {
        PyObject* tuple = __pyx_t_4;
        __pyx_t_8 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_8);
        __pyx_t_5 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_v_attr_ns_utf);
        __pyx_v_attr_ns_utf = __pyx_t_8;
        __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_v_attr_name_utf);
        __pyx_v_attr_name_utf = __pyx_t_5;
        __pyx_t_5 = 0;
      } else {
        __Pyx_UnpackTupleError(__pyx_t_4, 2);
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":297
 *         for name, value in attrib.items():
 *             attr_ns_utf, attr_name_utf = _getNsTag(name)
 *             if not is_html:             # <<<<<<<<<<<<<<
 *                 _attributeValidOrRaise(attr_name_utf)
 *             value_utf = _utf8(value)
 */
      __pyx_t_3 = (!__pyx_v_is_html);
      if (__pyx_t_3) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":298
 *             attr_ns_utf, attr_name_utf = _getNsTag(name)
 *             if not is_html:
 *                 _attributeValidOrRaise(attr_name_utf)             # <<<<<<<<<<<<<<
 *             value_utf = _utf8(value)
 *             if attr_ns_utf is None:
 */
        __pyx_t_10 = __pyx_f_4lxml_5etree__attributeValidOrRaise(__pyx_v_attr_name_utf); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L9;
      }
      __pyx_L9:;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":299
 *             if not is_html:
 *                 _attributeValidOrRaise(attr_name_utf)
 *             value_utf = _utf8(value)             # <<<<<<<<<<<<<<
 *             if attr_ns_utf is None:
 *                 tree.xmlNewProp(c_node, _cstr(attr_name_utf), _cstr(value_utf))
 */
      __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_v_value)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(((PyObject *)__pyx_v_value_utf));
      __pyx_v_value_utf = ((PyObject*)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":300
 *                 _attributeValidOrRaise(attr_name_utf)
 *             value_utf = _utf8(value)
 *             if attr_ns_utf is None:             # <<<<<<<<<<<<<<
 *                 tree.xmlNewProp(c_node, _cstr(attr_name_utf), _cstr(value_utf))
 *             else:
 */
      __pyx_t_3 = (__pyx_v_attr_ns_utf == Py_None);
      if (__pyx_t_3) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":301
 *             value_utf = _utf8(value)
 *             if attr_ns_utf is None:
 *                 tree.xmlNewProp(c_node, _cstr(attr_name_utf), _cstr(value_utf))             # <<<<<<<<<<<<<<
 *             else:
 *                 _uriValidOrRaise(attr_ns_utf)
 */
        xmlNewProp(__pyx_v_c_node, PyBytes_AS_STRING(__pyx_v_attr_name_utf), PyBytes_AS_STRING(((PyObject *)__pyx_v_value_utf)));
        goto __pyx_L10;
      }
      /*else*/ {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":303
 *                 tree.xmlNewProp(c_node, _cstr(attr_name_utf), _cstr(value_utf))
 *             else:
 *                 _uriValidOrRaise(attr_ns_utf)             # <<<<<<<<<<<<<<
 *                 c_ns = doc._findOrBuildNodeNs(c_node, _cstr(attr_ns_utf), NULL, 1)
 *                 tree.xmlNewNsProp(c_node, c_ns,
 */
        __pyx_t_10 = __pyx_f_4lxml_5etree__uriValidOrRaise(__pyx_v_attr_ns_utf); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":304
 *             else:
 *                 _uriValidOrRaise(attr_ns_utf)
 *                 c_ns = doc._findOrBuildNodeNs(c_node, _cstr(attr_ns_utf), NULL, 1)             # <<<<<<<<<<<<<<
 *                 tree.xmlNewNsProp(c_node, c_ns,
 *                                   _cstr(attr_name_utf), _cstr(value_utf))
 */
        __pyx_t_11 = ((struct __pyx_vtabstruct_4lxml_5etree__Document *)__pyx_v_doc->__pyx_vtab)->_findOrBuildNodeNs(__pyx_v_doc, __pyx_v_c_node, PyBytes_AS_STRING(__pyx_v_attr_ns_utf), NULL, 1); if (unlikely(__pyx_t_11 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_v_c_ns = __pyx_t_11;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":306
 *                 c_ns = doc._findOrBuildNodeNs(c_node, _cstr(attr_ns_utf), NULL, 1)
 *                 tree.xmlNewNsProp(c_node, c_ns,
 *                                   _cstr(attr_name_utf), _cstr(value_utf))             # <<<<<<<<<<<<<<
 * 
 * ctypedef struct _ns_node_ref:
 */
        xmlNewNsProp(__pyx_v_c_node, __pyx_v_c_ns, PyBytes_AS_STRING(__pyx_v_attr_name_utf), PyBytes_AS_STRING(((PyObject *)__pyx_v_value_utf)));
      }
      __pyx_L10:;
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("lxml.etree._initNodeAttributes");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_name);
  __Pyx_DECREF(__pyx_v_value);
  __Pyx_DECREF(__pyx_v_attr_ns_utf);
  __Pyx_DECREF(__pyx_v_attr_name_utf);
  __Pyx_DECREF(__pyx_v_value_utf);
  __Pyx_DECREF(__pyx_v_attrib);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":312
 *     xmlNode* node
 * 
 * cdef int _removeUnusedNamespaceDeclarations(xmlNode* c_element) except -1:             # <<<<<<<<<<<<<<
 *     u"""Remove any namespace declarations from a subtree that are not used by
 *     any of its elements (or attributes).
 */

static  int __pyx_f_4lxml_5etree__removeUnusedNamespaceDeclarations(xmlNode *__pyx_v_c_element) {
  __pyx_t_4lxml_5etree__ns_node_ref *__pyx_v_c_ns_list;
  __pyx_t_4lxml_5etree__ns_node_ref *__pyx_v_c_nsref_ptr;
  xmlNs *__pyx_v_c_nsdef;
  xmlNode *__pyx_v_c_node;
  size_t __pyx_v_c_ns_list_size;
  size_t __pyx_v_c_ns_list_len;
  size_t __pyx_v_i;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  __Pyx_RefNannySetupContext("_removeUnusedNamespaceDeclarations");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":324
 *     cdef size_t i
 * 
 *     c_ns_list = NULL             # <<<<<<<<<<<<<<
 *     c_ns_list_size = 0
 *     c_ns_list_len  = 0
 */
  __pyx_v_c_ns_list = NULL;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":325
 * 
 *     c_ns_list = NULL
 *     c_ns_list_size = 0             # <<<<<<<<<<<<<<
 *     c_ns_list_len  = 0
 * 
 */
  __pyx_v_c_ns_list_size = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":326
 *     c_ns_list = NULL
 *     c_ns_list_size = 0
 *     c_ns_list_len  = 0             # <<<<<<<<<<<<<<
 * 
 *     if c_element.parent is not NULL and \
 */
  __pyx_v_c_ns_list_len = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":328
 *     c_ns_list_len  = 0
 * 
 *     if c_element.parent is not NULL and \             # <<<<<<<<<<<<<<
 *             c_element.parent.type == tree.XML_DOCUMENT_NODE:
 *         # include the document node
 */
  __pyx_t_1 = (__pyx_v_c_element->parent != NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":329
 * 
 *     if c_element.parent is not NULL and \
 *             c_element.parent.type == tree.XML_DOCUMENT_NODE:             # <<<<<<<<<<<<<<
 *         # include the document node
 *         c_nsdef = c_element.parent.nsDef
 */
    __pyx_t_2 = (__pyx_v_c_element->parent->type == XML_DOCUMENT_NODE);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":331
 *             c_element.parent.type == tree.XML_DOCUMENT_NODE:
 *         # include the document node
 *         c_nsdef = c_element.parent.nsDef             # <<<<<<<<<<<<<<
 *         while c_nsdef is not NULL:
 *             if c_ns_list_len >= c_ns_list_size:
 */
    __pyx_v_c_nsdef = __pyx_v_c_element->parent->nsDef;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":332
 *         # include the document node
 *         c_nsdef = c_element.parent.nsDef
 *         while c_nsdef is not NULL:             # <<<<<<<<<<<<<<
 *             if c_ns_list_len >= c_ns_list_size:
 *                 if c_ns_list is NULL:
 */
    while (1) {
      __pyx_t_3 = (__pyx_v_c_nsdef != NULL);
      if (!__pyx_t_3) break;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":333
 *         c_nsdef = c_element.parent.nsDef
 *         while c_nsdef is not NULL:
 *             if c_ns_list_len >= c_ns_list_size:             # <<<<<<<<<<<<<<
 *                 if c_ns_list is NULL:
 *                     c_ns_list_size = 20
 */
      __pyx_t_3 = (__pyx_v_c_ns_list_len >= __pyx_v_c_ns_list_size);
      if (__pyx_t_3) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":334
 *         while c_nsdef is not NULL:
 *             if c_ns_list_len >= c_ns_list_size:
 *                 if c_ns_list is NULL:             # <<<<<<<<<<<<<<
 *                     c_ns_list_size = 20
 *                 else:
 */
        __pyx_t_3 = (__pyx_v_c_ns_list == NULL);
        if (__pyx_t_3) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":335
 *             if c_ns_list_len >= c_ns_list_size:
 *                 if c_ns_list is NULL:
 *                     c_ns_list_size = 20             # <<<<<<<<<<<<<<
 *                 else:
 *                     c_ns_list_size *= 2
 */
          __pyx_v_c_ns_list_size = 20;
          goto __pyx_L7;
        }
        /*else*/ {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":337
 *                     c_ns_list_size = 20
 *                 else:
 *                     c_ns_list_size *= 2             # <<<<<<<<<<<<<<
 *                 c_nsref_ptr = <_ns_node_ref*> cstd.realloc(
 *                     c_ns_list, c_ns_list_size * sizeof(_ns_node_ref))
 */
          __pyx_v_c_ns_list_size = (__pyx_v_c_ns_list_size * 2);
        }
        __pyx_L7:;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":339
 *                     c_ns_list_size *= 2
 *                 c_nsref_ptr = <_ns_node_ref*> cstd.realloc(
 *                     c_ns_list, c_ns_list_size * sizeof(_ns_node_ref))             # <<<<<<<<<<<<<<
 *                 if c_nsref_ptr is NULL:
 *                     if c_ns_list is not NULL:
 */
        __pyx_v_c_nsref_ptr = ((__pyx_t_4lxml_5etree__ns_node_ref *)realloc(__pyx_v_c_ns_list, (__pyx_v_c_ns_list_size * (sizeof(__pyx_t_4lxml_5etree__ns_node_ref)))));

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":340
 *                 c_nsref_ptr = <_ns_node_ref*> cstd.realloc(
 *                     c_ns_list, c_ns_list_size * sizeof(_ns_node_ref))
 *                 if c_nsref_ptr is NULL:             # <<<<<<<<<<<<<<
 *                     if c_ns_list is not NULL:
 *                         cstd.free(c_ns_list)
 */
        __pyx_t_3 = (__pyx_v_c_nsref_ptr == NULL);
        if (__pyx_t_3) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":341
 *                     c_ns_list, c_ns_list_size * sizeof(_ns_node_ref))
 *                 if c_nsref_ptr is NULL:
 *                     if c_ns_list is not NULL:             # <<<<<<<<<<<<<<
 *                         cstd.free(c_ns_list)
 *                     python.PyErr_NoMemory()
 */
          __pyx_t_3 = (__pyx_v_c_ns_list != NULL);
          if (__pyx_t_3) {

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":342
 *                 if c_nsref_ptr is NULL:
 *                     if c_ns_list is not NULL:
 *                         cstd.free(c_ns_list)             # <<<<<<<<<<<<<<
 *                     python.PyErr_NoMemory()
 *                     return -1
 */
            free(__pyx_v_c_ns_list);
            goto __pyx_L9;
          }
          __pyx_L9:;

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":343
 *                     if c_ns_list is not NULL:
 *                         cstd.free(c_ns_list)
 *                     python.PyErr_NoMemory()             # <<<<<<<<<<<<<<
 *                     return -1
 *                 c_ns_list = c_nsref_ptr
 */
          __pyx_t_4 = PyErr_NoMemory(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":344
 *                         cstd.free(c_ns_list)
 *                     python.PyErr_NoMemory()
 *                     return -1             # <<<<<<<<<<<<<<
 *                 c_ns_list = c_nsref_ptr
 * 
 */
          __pyx_r = -1;
          goto __pyx_L0;
          goto __pyx_L8;
        }
        __pyx_L8:;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":345
 *                     python.PyErr_NoMemory()
 *                     return -1
 *                 c_ns_list = c_nsref_ptr             # <<<<<<<<<<<<<<
 * 
 *             c_ns_list[c_ns_list_len].ns   = c_nsdef
 */
        __pyx_v_c_ns_list = __pyx_v_c_nsref_ptr;
        goto __pyx_L6;
      }
      __pyx_L6:;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":347
 *                 c_ns_list = c_nsref_ptr
 * 
 *             c_ns_list[c_ns_list_len].ns   = c_nsdef             # <<<<<<<<<<<<<<
 *             c_ns_list[c_ns_list_len].node = c_element.parent
 *             c_ns_list_len += 1
 */
      (__pyx_v_c_ns_list[__pyx_v_c_ns_list_len]).ns = __pyx_v_c_nsdef;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":348
 * 
 *             c_ns_list[c_ns_list_len].ns   = c_nsdef
 *             c_ns_list[c_ns_list_len].node = c_element.parent             # <<<<<<<<<<<<<<
 *             c_ns_list_len += 1
 *             c_nsdef = c_nsdef.next
 */
      (__pyx_v_c_ns_list[__pyx_v_c_ns_list_len]).node = __pyx_v_c_element->parent;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":349
 *             c_ns_list[c_ns_list_len].ns   = c_nsdef
 *             c_ns_list[c_ns_list_len].node = c_element.parent
 *             c_ns_list_len += 1             # <<<<<<<<<<<<<<
 *             c_nsdef = c_nsdef.next
 * 
 */
      __pyx_v_c_ns_list_len = (__pyx_v_c_ns_list_len + 1);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":350
 *             c_ns_list[c_ns_list_len].node = c_element.parent
 *             c_ns_list_len += 1
 *             c_nsdef = c_nsdef.next             # <<<<<<<<<<<<<<
 * 
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_element, c_element, 1)
 */
      __pyx_v_c_nsdef = __pyx_v_c_nsdef->next;
    }
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":352
 *             c_nsdef = c_nsdef.next
 * 
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_element, c_element, 1)             # <<<<<<<<<<<<<<
 *     # collect all new namespace declarations into the ns list
 *     c_nsdef = c_element.nsDef
 */
  BEGIN_FOR_EACH_ELEMENT_FROM(__pyx_v_c_element, __pyx_v_c_element, 1);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":354
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_element, c_element, 1)
 *     # collect all new namespace declarations into the ns list
 *     c_nsdef = c_element.nsDef             # <<<<<<<<<<<<<<
 *     while c_nsdef is not NULL:
 *         if c_ns_list_len >= c_ns_list_size:
 */
  __pyx_v_c_nsdef = __pyx_v_c_element->nsDef;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":355
 *     # collect all new namespace declarations into the ns list
 *     c_nsdef = c_element.nsDef
 *     while c_nsdef is not NULL:             # <<<<<<<<<<<<<<
 *         if c_ns_list_len >= c_ns_list_size:
 *             if c_ns_list is NULL:
 */
  while (1) {
    __pyx_t_3 = (__pyx_v_c_nsdef != NULL);
    if (!__pyx_t_3) break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":356
 *     c_nsdef = c_element.nsDef
 *     while c_nsdef is not NULL:
 *         if c_ns_list_len >= c_ns_list_size:             # <<<<<<<<<<<<<<
 *             if c_ns_list is NULL:
 *                 c_ns_list_size = 20
 */
    __pyx_t_3 = (__pyx_v_c_ns_list_len >= __pyx_v_c_ns_list_size);
    if (__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":357
 *     while c_nsdef is not NULL:
 *         if c_ns_list_len >= c_ns_list_size:
 *             if c_ns_list is NULL:             # <<<<<<<<<<<<<<
 *                 c_ns_list_size = 20
 *             else:
 */
      __pyx_t_3 = (__pyx_v_c_ns_list == NULL);
      if (__pyx_t_3) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":358
 *         if c_ns_list_len >= c_ns_list_size:
 *             if c_ns_list is NULL:
 *                 c_ns_list_size = 20             # <<<<<<<<<<<<<<
 *             else:
 *                 c_ns_list_size *= 2
 */
        __pyx_v_c_ns_list_size = 20;
        goto __pyx_L13;
      }
      /*else*/ {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":360
 *                 c_ns_list_size = 20
 *             else:
 *                 c_ns_list_size *= 2             # <<<<<<<<<<<<<<
 *             c_nsref_ptr = <_ns_node_ref*> cstd.realloc(
 *                 c_ns_list, c_ns_list_size * sizeof(_ns_node_ref))
 */
        __pyx_v_c_ns_list_size = (__pyx_v_c_ns_list_size * 2);
      }
      __pyx_L13:;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":362
 *                 c_ns_list_size *= 2
 *             c_nsref_ptr = <_ns_node_ref*> cstd.realloc(
 *                 c_ns_list, c_ns_list_size * sizeof(_ns_node_ref))             # <<<<<<<<<<<<<<
 *             if c_nsref_ptr is NULL:
 *                 if c_ns_list is not NULL:
 */
      __pyx_v_c_nsref_ptr = ((__pyx_t_4lxml_5etree__ns_node_ref *)realloc(__pyx_v_c_ns_list, (__pyx_v_c_ns_list_size * (sizeof(__pyx_t_4lxml_5etree__ns_node_ref)))));

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":363
 *             c_nsref_ptr = <_ns_node_ref*> cstd.realloc(
 *                 c_ns_list, c_ns_list_size * sizeof(_ns_node_ref))
 *             if c_nsref_ptr is NULL:             # <<<<<<<<<<<<<<
 *                 if c_ns_list is not NULL:
 *                     cstd.free(c_ns_list)
 */
      __pyx_t_3 = (__pyx_v_c_nsref_ptr == NULL);
      if (__pyx_t_3) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":364
 *                 c_ns_list, c_ns_list_size * sizeof(_ns_node_ref))
 *             if c_nsref_ptr is NULL:
 *                 if c_ns_list is not NULL:             # <<<<<<<<<<<<<<
 *                     cstd.free(c_ns_list)
 *                 python.PyErr_NoMemory()
 */
        __pyx_t_3 = (__pyx_v_c_ns_list != NULL);
        if (__pyx_t_3) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":365
 *             if c_nsref_ptr is NULL:
 *                 if c_ns_list is not NULL:
 *                     cstd.free(c_ns_list)             # <<<<<<<<<<<<<<
 *                 python.PyErr_NoMemory()
 *                 return -1
 */
          free(__pyx_v_c_ns_list);
          goto __pyx_L15;
        }
        __pyx_L15:;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":366
 *                 if c_ns_list is not NULL:
 *                     cstd.free(c_ns_list)
 *                 python.PyErr_NoMemory()             # <<<<<<<<<<<<<<
 *                 return -1
 *             c_ns_list = c_nsref_ptr
 */
        __pyx_t_4 = PyErr_NoMemory(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":367
 *                     cstd.free(c_ns_list)
 *                 python.PyErr_NoMemory()
 *                 return -1             # <<<<<<<<<<<<<<
 *             c_ns_list = c_nsref_ptr
 * 
 */
        __pyx_r = -1;
        goto __pyx_L0;
        goto __pyx_L14;
      }
      __pyx_L14:;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":368
 *                 python.PyErr_NoMemory()
 *                 return -1
 *             c_ns_list = c_nsref_ptr             # <<<<<<<<<<<<<<
 * 
 *         c_ns_list[c_ns_list_len].ns   = c_nsdef
 */
      __pyx_v_c_ns_list = __pyx_v_c_nsref_ptr;
      goto __pyx_L12;
    }
    __pyx_L12:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":370
 *             c_ns_list = c_nsref_ptr
 * 
 *         c_ns_list[c_ns_list_len].ns   = c_nsdef             # <<<<<<<<<<<<<<
 *         c_ns_list[c_ns_list_len].node = c_element
 *         c_ns_list_len += 1
 */
    (__pyx_v_c_ns_list[__pyx_v_c_ns_list_len]).ns = __pyx_v_c_nsdef;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":371
 * 
 *         c_ns_list[c_ns_list_len].ns   = c_nsdef
 *         c_ns_list[c_ns_list_len].node = c_element             # <<<<<<<<<<<<<<
 *         c_ns_list_len += 1
 *         c_nsdef = c_nsdef.next
 */
    (__pyx_v_c_ns_list[__pyx_v_c_ns_list_len]).node = __pyx_v_c_element;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":372
 *         c_ns_list[c_ns_list_len].ns   = c_nsdef
 *         c_ns_list[c_ns_list_len].node = c_element
 *         c_ns_list_len += 1             # <<<<<<<<<<<<<<
 *         c_nsdef = c_nsdef.next
 * 
 */
    __pyx_v_c_ns_list_len = (__pyx_v_c_ns_list_len + 1);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":373
 *         c_ns_list[c_ns_list_len].node = c_element
 *         c_ns_list_len += 1
 *         c_nsdef = c_nsdef.next             # <<<<<<<<<<<<<<
 * 
 *     # remove all namespace declarations from the list that are referenced
 */
    __pyx_v_c_nsdef = __pyx_v_c_nsdef->next;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":376
 * 
 *     # remove all namespace declarations from the list that are referenced
 *     if c_element.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         c_node = c_element
 *         while c_node is not NULL:
 */
  __pyx_t_3 = (__pyx_v_c_element->type == XML_ELEMENT_NODE);
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":377
 *     # remove all namespace declarations from the list that are referenced
 *     if c_element.type == tree.XML_ELEMENT_NODE:
 *         c_node = c_element             # <<<<<<<<<<<<<<
 *         while c_node is not NULL:
 *             if c_node.ns is not NULL:
 */
    __pyx_v_c_node = __pyx_v_c_element;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":378
 *     if c_element.type == tree.XML_ELEMENT_NODE:
 *         c_node = c_element
 *         while c_node is not NULL:             # <<<<<<<<<<<<<<
 *             if c_node.ns is not NULL:
 *                 for i from 0 <= i < c_ns_list_len:
 */
    while (1) {
      __pyx_t_3 = (__pyx_v_c_node != NULL);
      if (!__pyx_t_3) break;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":379
 *         c_node = c_element
 *         while c_node is not NULL:
 *             if c_node.ns is not NULL:             # <<<<<<<<<<<<<<
 *                 for i from 0 <= i < c_ns_list_len:
 *                     if c_node.ns is c_ns_list[i].ns:
 */
      __pyx_t_3 = (__pyx_v_c_node->ns != NULL);
      if (__pyx_t_3) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":380
 *         while c_node is not NULL:
 *             if c_node.ns is not NULL:
 *                 for i from 0 <= i < c_ns_list_len:             # <<<<<<<<<<<<<<
 *                     if c_node.ns is c_ns_list[i].ns:
 *                         c_ns_list_len -= 1
 */
        __pyx_t_5 = __pyx_v_c_ns_list_len;
        for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_5; __pyx_v_i++) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":381
 *             if c_node.ns is not NULL:
 *                 for i from 0 <= i < c_ns_list_len:
 *                     if c_node.ns is c_ns_list[i].ns:             # <<<<<<<<<<<<<<
 *                         c_ns_list_len -= 1
 *                         c_ns_list[i].ns   = c_ns_list[c_ns_list_len].ns
 */
          __pyx_t_3 = (__pyx_v_c_node->ns == (__pyx_v_c_ns_list[__pyx_v_i]).ns);
          if (__pyx_t_3) {

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":382
 *                 for i from 0 <= i < c_ns_list_len:
 *                     if c_node.ns is c_ns_list[i].ns:
 *                         c_ns_list_len -= 1             # <<<<<<<<<<<<<<
 *                         c_ns_list[i].ns   = c_ns_list[c_ns_list_len].ns
 *                         c_ns_list[i].node = c_ns_list[c_ns_list_len].node
 */
            __pyx_v_c_ns_list_len = (__pyx_v_c_ns_list_len - 1);

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":383
 *                     if c_node.ns is c_ns_list[i].ns:
 *                         c_ns_list_len -= 1
 *                         c_ns_list[i].ns   = c_ns_list[c_ns_list_len].ns             # <<<<<<<<<<<<<<
 *                         c_ns_list[i].node = c_ns_list[c_ns_list_len].node
 *                         c_ns_list[c_ns_list_len].ns   = NULL
 */
            (__pyx_v_c_ns_list[__pyx_v_i]).ns = (__pyx_v_c_ns_list[__pyx_v_c_ns_list_len]).ns;

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":384
 *                         c_ns_list_len -= 1
 *                         c_ns_list[i].ns   = c_ns_list[c_ns_list_len].ns
 *                         c_ns_list[i].node = c_ns_list[c_ns_list_len].node             # <<<<<<<<<<<<<<
 *                         c_ns_list[c_ns_list_len].ns   = NULL
 *                         c_ns_list[c_ns_list_len].node = NULL
 */
            (__pyx_v_c_ns_list[__pyx_v_i]).node = (__pyx_v_c_ns_list[__pyx_v_c_ns_list_len]).node;

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":385
 *                         c_ns_list[i].ns   = c_ns_list[c_ns_list_len].ns
 *                         c_ns_list[i].node = c_ns_list[c_ns_list_len].node
 *                         c_ns_list[c_ns_list_len].ns   = NULL             # <<<<<<<<<<<<<<
 *                         c_ns_list[c_ns_list_len].node = NULL
 *                         break
 */
            (__pyx_v_c_ns_list[__pyx_v_c_ns_list_len]).ns = NULL;

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":386
 *                         c_ns_list[i].node = c_ns_list[c_ns_list_len].node
 *                         c_ns_list[c_ns_list_len].ns   = NULL
 *                         c_ns_list[c_ns_list_len].node = NULL             # <<<<<<<<<<<<<<
 *                         break
 *             if c_node is c_element:
 */
            (__pyx_v_c_ns_list[__pyx_v_c_ns_list_len]).node = NULL;

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":387
 *                         c_ns_list[c_ns_list_len].ns   = NULL
 *                         c_ns_list[c_ns_list_len].node = NULL
 *                         break             # <<<<<<<<<<<<<<
 *             if c_node is c_element:
 *                 # continue with attributes
 */
            goto __pyx_L21_break;
            goto __pyx_L22;
          }
          __pyx_L22:;
        }
        __pyx_L21_break:;
        goto __pyx_L19;
      }
      __pyx_L19:;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":388
 *                         c_ns_list[c_ns_list_len].node = NULL
 *                         break
 *             if c_node is c_element:             # <<<<<<<<<<<<<<
 *                 # continue with attributes
 *                 c_node = <xmlNode*>c_element.properties
 */
      __pyx_t_3 = (__pyx_v_c_node == __pyx_v_c_element);
      if (__pyx_t_3) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":390
 *             if c_node is c_element:
 *                 # continue with attributes
 *                 c_node = <xmlNode*>c_element.properties             # <<<<<<<<<<<<<<
 *             else:
 *                 c_node = c_node.next
 */
        __pyx_v_c_node = ((xmlNode *)__pyx_v_c_element->properties);
        goto __pyx_L23;
      }
      /*else*/ {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":392
 *                 c_node = <xmlNode*>c_element.properties
 *             else:
 *                 c_node = c_node.next             # <<<<<<<<<<<<<<
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_element)
 * 
 */
        __pyx_v_c_node = __pyx_v_c_node->next;
      }
      __pyx_L23:;
    }
    goto __pyx_L16;
  }
  __pyx_L16:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":393
 *             else:
 *                 c_node = c_node.next
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_element)             # <<<<<<<<<<<<<<
 * 
 *     if c_ns_list is NULL:
 */
  END_FOR_EACH_ELEMENT_FROM(__pyx_v_c_element);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":395
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_element)
 * 
 *     if c_ns_list is NULL:             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  __pyx_t_3 = (__pyx_v_c_ns_list == NULL);
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":396
 * 
 *     if c_ns_list is NULL:
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     # free all namespace declarations that remained in the list
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L24;
  }
  __pyx_L24:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":399
 * 
 *     # free all namespace declarations that remained in the list
 *     for i from 0 <= i < c_ns_list_len:             # <<<<<<<<<<<<<<
 *         c_node = c_ns_list[i].node
 *         c_nsdef = c_node.nsDef
 */
  __pyx_t_5 = __pyx_v_c_ns_list_len;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_5; __pyx_v_i++) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":400
 *     # free all namespace declarations that remained in the list
 *     for i from 0 <= i < c_ns_list_len:
 *         c_node = c_ns_list[i].node             # <<<<<<<<<<<<<<
 *         c_nsdef = c_node.nsDef
 *         if c_nsdef is c_ns_list[i].ns:
 */
    __pyx_v_c_node = (__pyx_v_c_ns_list[__pyx_v_i]).node;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":401
 *     for i from 0 <= i < c_ns_list_len:
 *         c_node = c_ns_list[i].node
 *         c_nsdef = c_node.nsDef             # <<<<<<<<<<<<<<
 *         if c_nsdef is c_ns_list[i].ns:
 *             c_node.nsDef = c_node.nsDef.next
 */
    __pyx_v_c_nsdef = __pyx_v_c_node->nsDef;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":402
 *         c_node = c_ns_list[i].node
 *         c_nsdef = c_node.nsDef
 *         if c_nsdef is c_ns_list[i].ns:             # <<<<<<<<<<<<<<
 *             c_node.nsDef = c_node.nsDef.next
 *         else:
 */
    __pyx_t_3 = (__pyx_v_c_nsdef == (__pyx_v_c_ns_list[__pyx_v_i]).ns);
    if (__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":403
 *         c_nsdef = c_node.nsDef
 *         if c_nsdef is c_ns_list[i].ns:
 *             c_node.nsDef = c_node.nsDef.next             # <<<<<<<<<<<<<<
 *         else:
 *             while c_nsdef.next is not c_ns_list[i].ns:
 */
      __pyx_v_c_node->nsDef = __pyx_v_c_node->nsDef->next;
      goto __pyx_L27;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":405
 *             c_node.nsDef = c_node.nsDef.next
 *         else:
 *             while c_nsdef.next is not c_ns_list[i].ns:             # <<<<<<<<<<<<<<
 *                 c_nsdef = c_nsdef.next
 *             c_nsdef.next = c_nsdef.next.next
 */
      while (1) {
        __pyx_t_3 = (__pyx_v_c_nsdef->next != (__pyx_v_c_ns_list[__pyx_v_i]).ns);
        if (!__pyx_t_3) break;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":406
 *         else:
 *             while c_nsdef.next is not c_ns_list[i].ns:
 *                 c_nsdef = c_nsdef.next             # <<<<<<<<<<<<<<
 *             c_nsdef.next = c_nsdef.next.next
 *         tree.xmlFreeNs(c_ns_list[i].ns)
 */
        __pyx_v_c_nsdef = __pyx_v_c_nsdef->next;
      }

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":407
 *             while c_nsdef.next is not c_ns_list[i].ns:
 *                 c_nsdef = c_nsdef.next
 *             c_nsdef.next = c_nsdef.next.next             # <<<<<<<<<<<<<<
 *         tree.xmlFreeNs(c_ns_list[i].ns)
 * 
 */
      __pyx_v_c_nsdef->next = __pyx_v_c_nsdef->next->next;
    }
    __pyx_L27:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":408
 *                 c_nsdef = c_nsdef.next
 *             c_nsdef.next = c_nsdef.next.next
 *         tree.xmlFreeNs(c_ns_list[i].ns)             # <<<<<<<<<<<<<<
 * 
 *     if c_ns_list is not NULL:
 */
    xmlFreeNs((__pyx_v_c_ns_list[__pyx_v_i]).ns);
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":410
 *         tree.xmlFreeNs(c_ns_list[i].ns)
 * 
 *     if c_ns_list is not NULL:             # <<<<<<<<<<<<<<
 *         cstd.free(c_ns_list)
 *     return 0
 */
  __pyx_t_3 = (__pyx_v_c_ns_list != NULL);
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":411
 * 
 *     if c_ns_list is not NULL:
 *         cstd.free(c_ns_list)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    free(__pyx_v_c_ns_list);
    goto __pyx_L30;
  }
  __pyx_L30:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":412
 *     if c_ns_list is not NULL:
 *         cstd.free(c_ns_list)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef xmlNs* _searchNsByHref(xmlNode* c_node, char* c_href, bint is_attribute):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._removeUnusedNamespaceDeclarations");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":414
 *     return 0
 * 
 * cdef xmlNs* _searchNsByHref(xmlNode* c_node, char* c_href, bint is_attribute):             # <<<<<<<<<<<<<<
 *     u"""Search a namespace declaration that covers a node (element or
 *     attribute).
 */

static  xmlNs *__pyx_f_4lxml_5etree__searchNsByHref(xmlNode *__pyx_v_c_node, char *__pyx_v_c_href, int __pyx_v_is_attribute) {
  xmlNs *__pyx_v_c_ns;
  xmlNs *__pyx_v_c_default_ns;
  xmlNode *__pyx_v_c_element;
  xmlNs *__pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("_searchNsByHref");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":423
 *     """
 *     cdef xmlNs* c_ns
 *     cdef xmlNs* c_default_ns = NULL             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_element
 *     if c_href is NULL or c_node is NULL or c_node.type == tree.XML_ENTITY_REF_NODE:
 */
  __pyx_v_c_default_ns = NULL;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":425
 *     cdef xmlNs* c_default_ns = NULL
 *     cdef xmlNode* c_element
 *     if c_href is NULL or c_node is NULL or c_node.type == tree.XML_ENTITY_REF_NODE:             # <<<<<<<<<<<<<<
 *         return NULL
 *     if cstd.strcmp(c_href, tree.XML_XML_NAMESPACE) == 0:
 */
  __pyx_t_1 = (__pyx_v_c_href == NULL);
  if (!__pyx_t_1) {
    __pyx_t_2 = (__pyx_v_c_node == NULL);
    if (!__pyx_t_2) {
      __pyx_t_3 = (__pyx_v_c_node->type == XML_ENTITY_REF_NODE);
      __pyx_t_4 = __pyx_t_3;
    } else {
      __pyx_t_4 = __pyx_t_2;
    }
    __pyx_t_2 = __pyx_t_4;
  } else {
    __pyx_t_2 = __pyx_t_1;
  }
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":426
 *     cdef xmlNode* c_element
 *     if c_href is NULL or c_node is NULL or c_node.type == tree.XML_ENTITY_REF_NODE:
 *         return NULL             # <<<<<<<<<<<<<<
 *     if cstd.strcmp(c_href, tree.XML_XML_NAMESPACE) == 0:
 *         # no special cases here, let libxml2 handle this
 */
    __pyx_r = NULL;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":427
 *     if c_href is NULL or c_node is NULL or c_node.type == tree.XML_ENTITY_REF_NODE:
 *         return NULL
 *     if cstd.strcmp(c_href, tree.XML_XML_NAMESPACE) == 0:             # <<<<<<<<<<<<<<
 *         # no special cases here, let libxml2 handle this
 *         return tree.xmlSearchNsByHref(c_node.doc, c_node, c_href)
 */
  __pyx_t_2 = (strcmp(__pyx_v_c_href, XML_XML_NAMESPACE) == 0);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":429
 *     if cstd.strcmp(c_href, tree.XML_XML_NAMESPACE) == 0:
 *         # no special cases here, let libxml2 handle this
 *         return tree.xmlSearchNsByHref(c_node.doc, c_node, c_href)             # <<<<<<<<<<<<<<
 *     if c_node.type == tree.XML_ATTRIBUTE_NODE:
 *         is_attribute = 1
 */
    __pyx_r = xmlSearchNsByHref(__pyx_v_c_node->doc, __pyx_v_c_node, __pyx_v_c_href);
    goto __pyx_L0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":430
 *         # no special cases here, let libxml2 handle this
 *         return tree.xmlSearchNsByHref(c_node.doc, c_node, c_href)
 *     if c_node.type == tree.XML_ATTRIBUTE_NODE:             # <<<<<<<<<<<<<<
 *         is_attribute = 1
 *     while c_node is not NULL and c_node.type != tree.XML_ELEMENT_NODE:
 */
  __pyx_t_2 = (__pyx_v_c_node->type == XML_ATTRIBUTE_NODE);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":431
 *         return tree.xmlSearchNsByHref(c_node.doc, c_node, c_href)
 *     if c_node.type == tree.XML_ATTRIBUTE_NODE:
 *         is_attribute = 1             # <<<<<<<<<<<<<<
 *     while c_node is not NULL and c_node.type != tree.XML_ELEMENT_NODE:
 *         c_node = c_node.parent
 */
    __pyx_v_is_attribute = 1;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":432
 *     if c_node.type == tree.XML_ATTRIBUTE_NODE:
 *         is_attribute = 1
 *     while c_node is not NULL and c_node.type != tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         c_node = c_node.parent
 *     c_element = c_node
 */
  while (1) {
    __pyx_t_2 = (__pyx_v_c_node != NULL);
    if (__pyx_t_2) {
      __pyx_t_1 = (__pyx_v_c_node->type != XML_ELEMENT_NODE);
      __pyx_t_4 = __pyx_t_1;
    } else {
      __pyx_t_4 = __pyx_t_2;
    }
    if (!__pyx_t_4) break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":433
 *         is_attribute = 1
 *     while c_node is not NULL and c_node.type != tree.XML_ELEMENT_NODE:
 *         c_node = c_node.parent             # <<<<<<<<<<<<<<
 *     c_element = c_node
 *     while c_node is not NULL:
 */
    __pyx_v_c_node = __pyx_v_c_node->parent;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":434
 *     while c_node is not NULL and c_node.type != tree.XML_ELEMENT_NODE:
 *         c_node = c_node.parent
 *     c_element = c_node             # <<<<<<<<<<<<<<
 *     while c_node is not NULL:
 *         if c_node.type == tree.XML_ELEMENT_NODE:
 */
  __pyx_v_c_element = __pyx_v_c_node;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":435
 *         c_node = c_node.parent
 *     c_element = c_node
 *     while c_node is not NULL:             # <<<<<<<<<<<<<<
 *         if c_node.type == tree.XML_ELEMENT_NODE:
 *             c_ns = c_node.nsDef
 */
  while (1) {
    __pyx_t_4 = (__pyx_v_c_node != NULL);
    if (!__pyx_t_4) break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":436
 *     c_element = c_node
 *     while c_node is not NULL:
 *         if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *             c_ns = c_node.nsDef
 *             while c_ns is not NULL:
 */
    __pyx_t_4 = (__pyx_v_c_node->type == XML_ELEMENT_NODE);
    if (__pyx_t_4) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":437
 *     while c_node is not NULL:
 *         if c_node.type == tree.XML_ELEMENT_NODE:
 *             c_ns = c_node.nsDef             # <<<<<<<<<<<<<<
 *             while c_ns is not NULL:
 *                 if c_ns.href is not NULL and cstd.strcmp(c_href, c_ns.href) == 0:
 */
      __pyx_v_c_ns = __pyx_v_c_node->nsDef;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":438
 *         if c_node.type == tree.XML_ELEMENT_NODE:
 *             c_ns = c_node.nsDef
 *             while c_ns is not NULL:             # <<<<<<<<<<<<<<
 *                 if c_ns.href is not NULL and cstd.strcmp(c_href, c_ns.href) == 0:
 *                     if c_ns.prefix is NULL and is_attribute:
 */
      while (1) {
        __pyx_t_4 = (__pyx_v_c_ns != NULL);
        if (!__pyx_t_4) break;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":439
 *             c_ns = c_node.nsDef
 *             while c_ns is not NULL:
 *                 if c_ns.href is not NULL and cstd.strcmp(c_href, c_ns.href) == 0:             # <<<<<<<<<<<<<<
 *                     if c_ns.prefix is NULL and is_attribute:
 *                         # for attributes, continue searching a named
 */
        __pyx_t_4 = (__pyx_v_c_ns->href != NULL);
        if (__pyx_t_4) {
          __pyx_t_2 = (strcmp(__pyx_v_c_href, __pyx_v_c_ns->href) == 0);
          __pyx_t_1 = __pyx_t_2;
        } else {
          __pyx_t_1 = __pyx_t_4;
        }
        if (__pyx_t_1) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":440
 *             while c_ns is not NULL:
 *                 if c_ns.href is not NULL and cstd.strcmp(c_href, c_ns.href) == 0:
 *                     if c_ns.prefix is NULL and is_attribute:             # <<<<<<<<<<<<<<
 *                         # for attributes, continue searching a named
 *                         # prefix, but keep the first default namespace
 */
          __pyx_t_1 = (__pyx_v_c_ns->prefix == NULL);
          if (__pyx_t_1) {
            __pyx_t_4 = __pyx_v_is_attribute;
          } else {
            __pyx_t_4 = __pyx_t_1;
          }
          if (__pyx_t_4) {

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":444
 *                         # prefix, but keep the first default namespace
 *                         # declaration that we found
 *                         if c_default_ns is NULL:             # <<<<<<<<<<<<<<
 *                             c_default_ns = c_ns
 *                     elif tree.xmlSearchNs(
 */
            __pyx_t_4 = (__pyx_v_c_default_ns == NULL);
            if (__pyx_t_4) {

              /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":445
 *                         # declaration that we found
 *                         if c_default_ns is NULL:
 *                             c_default_ns = c_ns             # <<<<<<<<<<<<<<
 *                     elif tree.xmlSearchNs(
 *                         c_element.doc, c_element, c_ns.prefix) is c_ns:
 */
              __pyx_v_c_default_ns = __pyx_v_c_ns;
              goto __pyx_L15;
            }
            __pyx_L15:;
            goto __pyx_L14;
          }

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":447
 *                             c_default_ns = c_ns
 *                     elif tree.xmlSearchNs(
 *                         c_element.doc, c_element, c_ns.prefix) is c_ns:             # <<<<<<<<<<<<<<
 *                         # start node is in namespace scope => found!
 *                         return c_ns
 */
          __pyx_t_4 = (xmlSearchNs(__pyx_v_c_element->doc, __pyx_v_c_element, __pyx_v_c_ns->prefix) == __pyx_v_c_ns);
          if (__pyx_t_4) {

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":449
 *                         c_element.doc, c_element, c_ns.prefix) is c_ns:
 *                         # start node is in namespace scope => found!
 *                         return c_ns             # <<<<<<<<<<<<<<
 *                 c_ns = c_ns.next
 *             if c_node is not c_element and c_node.ns is not NULL:
 */
            __pyx_r = __pyx_v_c_ns;
            goto __pyx_L0;
            goto __pyx_L14;
          }
          __pyx_L14:;
          goto __pyx_L13;
        }
        __pyx_L13:;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":450
 *                         # start node is in namespace scope => found!
 *                         return c_ns
 *                 c_ns = c_ns.next             # <<<<<<<<<<<<<<
 *             if c_node is not c_element and c_node.ns is not NULL:
 *                 # optimise: the node may have the namespace itself
 */
        __pyx_v_c_ns = __pyx_v_c_ns->next;
      }

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":451
 *                         return c_ns
 *                 c_ns = c_ns.next
 *             if c_node is not c_element and c_node.ns is not NULL:             # <<<<<<<<<<<<<<
 *                 # optimise: the node may have the namespace itself
 *                 c_ns = c_node.ns
 */
      __pyx_t_4 = (__pyx_v_c_node != __pyx_v_c_element);
      if (__pyx_t_4) {
        __pyx_t_1 = (__pyx_v_c_node->ns != NULL);
        __pyx_t_2 = __pyx_t_1;
      } else {
        __pyx_t_2 = __pyx_t_4;
      }
      if (__pyx_t_2) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":453
 *             if c_node is not c_element and c_node.ns is not NULL:
 *                 # optimise: the node may have the namespace itself
 *                 c_ns = c_node.ns             # <<<<<<<<<<<<<<
 *                 if c_ns.href is not NULL and cstd.strcmp(c_href, c_ns.href) == 0:
 *                     if c_ns.prefix is NULL and is_attribute:
 */
        __pyx_v_c_ns = __pyx_v_c_node->ns;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":454
 *                 # optimise: the node may have the namespace itself
 *                 c_ns = c_node.ns
 *                 if c_ns.href is not NULL and cstd.strcmp(c_href, c_ns.href) == 0:             # <<<<<<<<<<<<<<
 *                     if c_ns.prefix is NULL and is_attribute:
 *                         # for attributes, continue searching a named
 */
        __pyx_t_2 = (__pyx_v_c_ns->href != NULL);
        if (__pyx_t_2) {
          __pyx_t_4 = (strcmp(__pyx_v_c_href, __pyx_v_c_ns->href) == 0);
          __pyx_t_1 = __pyx_t_4;
        } else {
          __pyx_t_1 = __pyx_t_2;
        }
        if (__pyx_t_1) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":455
 *                 c_ns = c_node.ns
 *                 if c_ns.href is not NULL and cstd.strcmp(c_href, c_ns.href) == 0:
 *                     if c_ns.prefix is NULL and is_attribute:             # <<<<<<<<<<<<<<
 *                         # for attributes, continue searching a named
 *                         # prefix, but keep the first default namespace
 */
          __pyx_t_1 = (__pyx_v_c_ns->prefix == NULL);
          if (__pyx_t_1) {
            __pyx_t_2 = __pyx_v_is_attribute;
          } else {
            __pyx_t_2 = __pyx_t_1;
          }
          if (__pyx_t_2) {

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":459
 *                         # prefix, but keep the first default namespace
 *                         # declaration that we found
 *                         if c_default_ns is NULL:             # <<<<<<<<<<<<<<
 *                             c_default_ns = c_ns
 *                     elif tree.xmlSearchNs(
 */
            __pyx_t_2 = (__pyx_v_c_default_ns == NULL);
            if (__pyx_t_2) {

              /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":460
 *                         # declaration that we found
 *                         if c_default_ns is NULL:
 *                             c_default_ns = c_ns             # <<<<<<<<<<<<<<
 *                     elif tree.xmlSearchNs(
 *                         c_element.doc, c_element, c_ns.prefix) is c_ns:
 */
              __pyx_v_c_default_ns = __pyx_v_c_ns;
              goto __pyx_L19;
            }
            __pyx_L19:;
            goto __pyx_L18;
          }

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":462
 *                             c_default_ns = c_ns
 *                     elif tree.xmlSearchNs(
 *                         c_element.doc, c_element, c_ns.prefix) is c_ns:             # <<<<<<<<<<<<<<
 *                         # start node is in namespace scope => found!
 *                         return c_ns
 */
          __pyx_t_2 = (xmlSearchNs(__pyx_v_c_element->doc, __pyx_v_c_element, __pyx_v_c_ns->prefix) == __pyx_v_c_ns);
          if (__pyx_t_2) {

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":464
 *                         c_element.doc, c_element, c_ns.prefix) is c_ns:
 *                         # start node is in namespace scope => found!
 *                         return c_ns             # <<<<<<<<<<<<<<
 *         c_node = c_node.parent
 *     # nothing found => use a matching default namespace or fail
 */
            __pyx_r = __pyx_v_c_ns;
            goto __pyx_L0;
            goto __pyx_L18;
          }
          __pyx_L18:;
          goto __pyx_L17;
        }
        __pyx_L17:;
        goto __pyx_L16;
      }
      __pyx_L16:;
      goto __pyx_L10;
    }
    __pyx_L10:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":465
 *                         # start node is in namespace scope => found!
 *                         return c_ns
 *         c_node = c_node.parent             # <<<<<<<<<<<<<<
 *     # nothing found => use a matching default namespace or fail
 *     if c_default_ns is not NULL:
 */
    __pyx_v_c_node = __pyx_v_c_node->parent;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":467
 *         c_node = c_node.parent
 *     # nothing found => use a matching default namespace or fail
 *     if c_default_ns is not NULL:             # <<<<<<<<<<<<<<
 *         if tree.xmlSearchNs(c_element.doc, c_element, NULL) is c_default_ns:
 *             return c_default_ns
 */
  __pyx_t_2 = (__pyx_v_c_default_ns != NULL);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":468
 *     # nothing found => use a matching default namespace or fail
 *     if c_default_ns is not NULL:
 *         if tree.xmlSearchNs(c_element.doc, c_element, NULL) is c_default_ns:             # <<<<<<<<<<<<<<
 *             return c_default_ns
 *     return NULL
 */
    __pyx_t_2 = (xmlSearchNs(__pyx_v_c_element->doc, __pyx_v_c_element, NULL) == __pyx_v_c_default_ns);
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":469
 *     if c_default_ns is not NULL:
 *         if tree.xmlSearchNs(c_element.doc, c_element, NULL) is c_default_ns:
 *             return c_default_ns             # <<<<<<<<<<<<<<
 *     return NULL
 * 
 */
      __pyx_r = __pyx_v_c_default_ns;
      goto __pyx_L0;
      goto __pyx_L21;
    }
    __pyx_L21:;
    goto __pyx_L20;
  }
  __pyx_L20:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":470
 *         if tree.xmlSearchNs(c_element.doc, c_element, NULL) is c_default_ns:
 *             return c_default_ns
 *     return NULL             # <<<<<<<<<<<<<<
 * 
 * cdef int _replaceNodeByChildren(_Document doc, xmlNode* c_node) except -1:
 */
  __pyx_r = NULL;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":472
 *     return NULL
 * 
 * cdef int _replaceNodeByChildren(_Document doc, xmlNode* c_node) except -1:             # <<<<<<<<<<<<<<
 *     # NOTE: this does not deallocate the node, just unlink it!
 *     cdef xmlNode* c_parent
 */

static  int __pyx_f_4lxml_5etree__replaceNodeByChildren(struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node) {
  xmlNode *__pyx_v_c_parent;
  xmlNode *__pyx_v_c_child;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("_replaceNodeByChildren");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":476
 *     cdef xmlNode* c_parent
 *     cdef xmlNode* c_child
 *     if c_node.children is NULL:             # <<<<<<<<<<<<<<
 *         tree.xmlUnlinkNode(c_node)
 *         return 0
 */
  __pyx_t_1 = (__pyx_v_c_node->children == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":477
 *     cdef xmlNode* c_child
 *     if c_node.children is NULL:
 *         tree.xmlUnlinkNode(c_node)             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
    xmlUnlinkNode(__pyx_v_c_node);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":478
 *     if c_node.children is NULL:
 *         tree.xmlUnlinkNode(c_node)
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     c_parent = c_node.parent
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":480
 *         return 0
 * 
 *     c_parent = c_node.parent             # <<<<<<<<<<<<<<
 *     # fix parent links of children
 *     c_child = c_node.children
 */
  __pyx_v_c_parent = __pyx_v_c_node->parent;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":482
 *     c_parent = c_node.parent
 *     # fix parent links of children
 *     c_child = c_node.children             # <<<<<<<<<<<<<<
 *     while c_child is not NULL:
 *         c_child.parent = c_parent
 */
  __pyx_v_c_child = __pyx_v_c_node->children;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":483
 *     # fix parent links of children
 *     c_child = c_node.children
 *     while c_child is not NULL:             # <<<<<<<<<<<<<<
 *         c_child.parent = c_parent
 *         c_child = c_child.next
 */
  while (1) {
    __pyx_t_1 = (__pyx_v_c_child != NULL);
    if (!__pyx_t_1) break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":484
 *     c_child = c_node.children
 *     while c_child is not NULL:
 *         c_child.parent = c_parent             # <<<<<<<<<<<<<<
 *         c_child = c_child.next
 * 
 */
    __pyx_v_c_child->parent = __pyx_v_c_parent;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":485
 *     while c_child is not NULL:
 *         c_child.parent = c_parent
 *         c_child = c_child.next             # <<<<<<<<<<<<<<
 * 
 *     # fix namespace references of children if their parent's namespace
 */
    __pyx_v_c_child = __pyx_v_c_child->next;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":489
 *     # fix namespace references of children if their parent's namespace
 *     # declarations get lost
 *     if c_node.nsDef is not NULL:             # <<<<<<<<<<<<<<
 *         c_child = c_node.children
 *         while c_child is not NULL:
 */
  __pyx_t_1 = (__pyx_v_c_node->nsDef != NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":490
 *     # declarations get lost
 *     if c_node.nsDef is not NULL:
 *         c_child = c_node.children             # <<<<<<<<<<<<<<
 *         while c_child is not NULL:
 *             moveNodeToDocument(doc, doc._c_doc, c_child)
 */
    __pyx_v_c_child = __pyx_v_c_node->children;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":491
 *     if c_node.nsDef is not NULL:
 *         c_child = c_node.children
 *         while c_child is not NULL:             # <<<<<<<<<<<<<<
 *             moveNodeToDocument(doc, doc._c_doc, c_child)
 *             c_child = c_child.next
 */
    while (1) {
      __pyx_t_1 = (__pyx_v_c_child != NULL);
      if (!__pyx_t_1) break;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":492
 *         c_child = c_node.children
 *         while c_child is not NULL:
 *             moveNodeToDocument(doc, doc._c_doc, c_child)             # <<<<<<<<<<<<<<
 *             c_child = c_child.next
 * 
 */
      __pyx_t_2 = __pyx_f_4lxml_5etree_moveNodeToDocument(__pyx_v_doc, __pyx_v_doc->_c_doc, __pyx_v_c_child); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":493
 *         while c_child is not NULL:
 *             moveNodeToDocument(doc, doc._c_doc, c_child)
 *             c_child = c_child.next             # <<<<<<<<<<<<<<
 * 
 *     # fix sibling links to/from child slice
 */
      __pyx_v_c_child = __pyx_v_c_child->next;
    }
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":496
 * 
 *     # fix sibling links to/from child slice
 *     if c_node.prev is NULL:             # <<<<<<<<<<<<<<
 *         c_parent.children = c_node.children
 *     else:
 */
  __pyx_t_1 = (__pyx_v_c_node->prev == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":497
 *     # fix sibling links to/from child slice
 *     if c_node.prev is NULL:
 *         c_parent.children = c_node.children             # <<<<<<<<<<<<<<
 *     else:
 *         c_node.prev.next = c_node.children
 */
    __pyx_v_c_parent->children = __pyx_v_c_node->children;
    goto __pyx_L9;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":499
 *         c_parent.children = c_node.children
 *     else:
 *         c_node.prev.next = c_node.children             # <<<<<<<<<<<<<<
 *         c_node.children.prev = c_node.prev
 *     if c_node.next is NULL:
 */
    __pyx_v_c_node->prev->next = __pyx_v_c_node->children;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":500
 *     else:
 *         c_node.prev.next = c_node.children
 *         c_node.children.prev = c_node.prev             # <<<<<<<<<<<<<<
 *     if c_node.next is NULL:
 *         c_parent.last = c_node.last
 */
    __pyx_v_c_node->children->prev = __pyx_v_c_node->prev;
  }
  __pyx_L9:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":501
 *         c_node.prev.next = c_node.children
 *         c_node.children.prev = c_node.prev
 *     if c_node.next is NULL:             # <<<<<<<<<<<<<<
 *         c_parent.last = c_node.last
 *     else:
 */
  __pyx_t_1 = (__pyx_v_c_node->next == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":502
 *         c_node.children.prev = c_node.prev
 *     if c_node.next is NULL:
 *         c_parent.last = c_node.last             # <<<<<<<<<<<<<<
 *     else:
 *         c_node.next.prev = c_node.last
 */
    __pyx_v_c_parent->last = __pyx_v_c_node->last;
    goto __pyx_L10;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":504
 *         c_parent.last = c_node.last
 *     else:
 *         c_node.next.prev = c_node.last             # <<<<<<<<<<<<<<
 *         c_node.last.next = c_node.next
 * 
 */
    __pyx_v_c_node->next->prev = __pyx_v_c_node->last;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":505
 *     else:
 *         c_node.next.prev = c_node.last
 *         c_node.last.next = c_node.next             # <<<<<<<<<<<<<<
 * 
 *     # unlink c_node
 */
    __pyx_v_c_node->last->next = __pyx_v_c_node->next;
  }
  __pyx_L10:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":508
 * 
 *     # unlink c_node
 *     c_node.children = c_node.last = NULL             # <<<<<<<<<<<<<<
 *     c_node.parent = c_node.next = c_node.prev = NULL
 *     return 0
 */
  __pyx_v_c_node->children = NULL;
  __pyx_v_c_node->last = NULL;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":509
 *     # unlink c_node
 *     c_node.children = c_node.last = NULL
 *     c_node.parent = c_node.next = c_node.prev = NULL             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_v_c_node->parent = NULL;
  __pyx_v_c_node->next = NULL;
  __pyx_v_c_node->prev = NULL;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":510
 *     c_node.children = c_node.last = NULL
 *     c_node.parent = c_node.next = c_node.prev = NULL
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef object _attributeValue(xmlNode* c_element, xmlAttr* c_attrib_node):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._replaceNodeByChildren");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":512
 *     return 0
 * 
 * cdef object _attributeValue(xmlNode* c_element, xmlAttr* c_attrib_node):             # <<<<<<<<<<<<<<
 *     cdef char* value
 *     cdef char* c_href
 */

static  PyObject *__pyx_f_4lxml_5etree__attributeValue(xmlNode *__pyx_v_c_element, xmlAttr *__pyx_v_c_attrib_node) {
  char *__pyx_v_value;
  char *__pyx_v_c_href;
  PyObject *__pyx_v_result;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("_attributeValue");
  __pyx_v_result = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":515
 *     cdef char* value
 *     cdef char* c_href
 *     c_href = _getNs(<xmlNode*>c_attrib_node)             # <<<<<<<<<<<<<<
 *     value = tree.xmlGetNsProp(c_element, c_attrib_node.name, c_href)
 *     try:
 */
  __pyx_v_c_href = _getNs(((xmlNode *)__pyx_v_c_attrib_node));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":516
 *     cdef char* c_href
 *     c_href = _getNs(<xmlNode*>c_attrib_node)
 *     value = tree.xmlGetNsProp(c_element, c_attrib_node.name, c_href)             # <<<<<<<<<<<<<<
 *     try:
 *         result = funicode(value)
 */
  __pyx_v_value = xmlGetNsProp(__pyx_v_c_element, __pyx_v_c_attrib_node->name, __pyx_v_c_href);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":517
 *     c_href = _getNs(<xmlNode*>c_attrib_node)
 *     value = tree.xmlGetNsProp(c_element, c_attrib_node.name, c_href)
 *     try:             # <<<<<<<<<<<<<<
 *         result = funicode(value)
 *     finally:
 */
  /*try:*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":518
 *     value = tree.xmlGetNsProp(c_element, c_attrib_node.name, c_href)
 *     try:
 *         result = funicode(value)             # <<<<<<<<<<<<<<
 *     finally:
 *         tree.xmlFree(value)
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree_funicode(__pyx_v_value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L4;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_v_result);
    __pyx_v_result = __pyx_t_1;
    __pyx_t_1 = 0;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":520
 *         result = funicode(value)
 *     finally:
 *         tree.xmlFree(value)             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
  /*finally:*/ {
    int __pyx_why;
    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
    int __pyx_exc_lineno;
    __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 0; goto __pyx_L5;
    __pyx_L4: {
      __pyx_why = 4;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
      __pyx_exc_lineno = __pyx_lineno;
      goto __pyx_L5;
    }
    __pyx_L5:;
    xmlFree(__pyx_v_value);
    switch (__pyx_why) {
      case 4: {
        __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
        __pyx_lineno = __pyx_exc_lineno;
        __pyx_exc_type = 0;
        __pyx_exc_value = 0;
        __pyx_exc_tb = 0;
        goto __pyx_L1_error;
      }
    }
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":521
 *     finally:
 *         tree.xmlFree(value)
 *     return result             # <<<<<<<<<<<<<<
 * 
 * cdef object _attributeValueFromNsName(xmlNode* c_element,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._attributeValue");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":523
 *     return result
 * 
 * cdef object _attributeValueFromNsName(xmlNode* c_element,             # <<<<<<<<<<<<<<
 *                                       char* c_href, char* c_name):
 *     cdef char* c_result = tree.xmlGetNsProp(c_element, c_name, c_href)
 */

static  PyObject *__pyx_f_4lxml_5etree__attributeValueFromNsName(xmlNode *__pyx_v_c_element, char *__pyx_v_c_href, char *__pyx_v_c_name) {
  char *__pyx_v_c_result;
  PyObject *__pyx_v_result;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_attributeValueFromNsName");
  __pyx_v_result = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":525
 * cdef object _attributeValueFromNsName(xmlNode* c_element,
 *                                       char* c_href, char* c_name):
 *     cdef char* c_result = tree.xmlGetNsProp(c_element, c_name, c_href)             # <<<<<<<<<<<<<<
 *     if c_result is NULL:
 *         return None
 */
  __pyx_v_c_result = xmlGetNsProp(__pyx_v_c_element, __pyx_v_c_name, __pyx_v_c_href);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":526
 *                                       char* c_href, char* c_name):
 *     cdef char* c_result = tree.xmlGetNsProp(c_element, c_name, c_href)
 *     if c_result is NULL:             # <<<<<<<<<<<<<<
 *         return None
 *     try:
 */
  __pyx_t_1 = (__pyx_v_c_result == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":527
 *     cdef char* c_result = tree.xmlGetNsProp(c_element, c_name, c_href)
 *     if c_result is NULL:
 *         return None             # <<<<<<<<<<<<<<
 *     try:
 *         result = funicode(c_result)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":528
 *     if c_result is NULL:
 *         return None
 *     try:             # <<<<<<<<<<<<<<
 *         result = funicode(c_result)
 *     finally:
 */
  /*try:*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":529
 *         return None
 *     try:
 *         result = funicode(c_result)             # <<<<<<<<<<<<<<
 *     finally:
 *         tree.xmlFree(c_result)
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_result); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L5;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_v_result);
    __pyx_v_result = __pyx_t_2;
    __pyx_t_2 = 0;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":531
 *         result = funicode(c_result)
 *     finally:
 *         tree.xmlFree(c_result)             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
  /*finally:*/ {
    int __pyx_why;
    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
    int __pyx_exc_lineno;
    __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 0; goto __pyx_L6;
    __pyx_L5: {
      __pyx_why = 4;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
      __pyx_exc_lineno = __pyx_lineno;
      goto __pyx_L6;
    }
    __pyx_L6:;
    xmlFree(__pyx_v_c_result);
    switch (__pyx_why) {
      case 4: {
        __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
        __pyx_lineno = __pyx_exc_lineno;
        __pyx_exc_type = 0;
        __pyx_exc_value = 0;
        __pyx_exc_tb = 0;
        goto __pyx_L1_error;
      }
    }
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":532
 *     finally:
 *         tree.xmlFree(c_result)
 *     return result             # <<<<<<<<<<<<<<
 * 
 * cdef object _getNodeAttributeValue(xmlNode* c_node, key, default):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._attributeValueFromNsName");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":534
 *     return result
 * 
 * cdef object _getNodeAttributeValue(xmlNode* c_node, key, default):             # <<<<<<<<<<<<<<
 *     cdef char* c_result
 *     cdef char* c_href
 */

static  PyObject *__pyx_f_4lxml_5etree__getNodeAttributeValue(xmlNode *__pyx_v_c_node, PyObject *__pyx_v_key, PyObject *__pyx_v_default) {
  char *__pyx_v_c_result;
  char *__pyx_v_c_href;
  PyObject *__pyx_v_ns;
  PyObject *__pyx_v_tag;
  PyObject *__pyx_v_result;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  void *__pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("_getNodeAttributeValue");
  __pyx_v_ns = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_tag = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_result = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":537
 *     cdef char* c_result
 *     cdef char* c_href
 *     ns, tag = _getNsTag(key)             # <<<<<<<<<<<<<<
 *     c_href = NULL if ns is None else _cstr(ns)
 *     c_result = tree.xmlGetNsProp(c_node, _cstr(tag), c_href)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__getNsTag(__pyx_v_key)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(__pyx_t_1 != Py_None) && likely(PyTuple_GET_SIZE(__pyx_t_1) == 2)) {
    PyObject* tuple = __pyx_t_1;
    __pyx_t_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_v_ns);
    __pyx_v_ns = __pyx_t_2;
    __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_v_tag);
    __pyx_v_tag = __pyx_t_3;
    __pyx_t_3 = 0;
  } else {
    __Pyx_UnpackTupleError(__pyx_t_1, 2);
    {__pyx_filename = __pyx_f[2]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":538
 *     cdef char* c_href
 *     ns, tag = _getNsTag(key)
 *     c_href = NULL if ns is None else _cstr(ns)             # <<<<<<<<<<<<<<
 *     c_result = tree.xmlGetNsProp(c_node, _cstr(tag), c_href)
 *     if c_result is NULL:
 */
  __pyx_t_5 = (__pyx_v_ns == Py_None);
  if (__pyx_t_5) {
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_4 = PyBytes_AS_STRING(__pyx_v_ns);
  }
  __pyx_v_c_href = __pyx_t_4;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":539
 *     ns, tag = _getNsTag(key)
 *     c_href = NULL if ns is None else _cstr(ns)
 *     c_result = tree.xmlGetNsProp(c_node, _cstr(tag), c_href)             # <<<<<<<<<<<<<<
 *     if c_result is NULL:
 *         # XXX free namespace that is not in use..?
 */
  __pyx_v_c_result = xmlGetNsProp(__pyx_v_c_node, PyBytes_AS_STRING(__pyx_v_tag), __pyx_v_c_href);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":540
 *     c_href = NULL if ns is None else _cstr(ns)
 *     c_result = tree.xmlGetNsProp(c_node, _cstr(tag), c_href)
 *     if c_result is NULL:             # <<<<<<<<<<<<<<
 *         # XXX free namespace that is not in use..?
 *         return default
 */
  __pyx_t_5 = (__pyx_v_c_result == NULL);
  if (__pyx_t_5) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":542
 *     if c_result is NULL:
 *         # XXX free namespace that is not in use..?
 *         return default             # <<<<<<<<<<<<<<
 *     try:
 *         result = funicode(c_result)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_default);
    __pyx_r = __pyx_v_default;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":543
 *         # XXX free namespace that is not in use..?
 *         return default
 *     try:             # <<<<<<<<<<<<<<
 *         result = funicode(c_result)
 *     finally:
 */
  /*try:*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":544
 *         return default
 *     try:
 *         result = funicode(c_result)             # <<<<<<<<<<<<<<
 *     finally:
 *         tree.xmlFree(c_result)
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_result); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L5;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_v_result);
    __pyx_v_result = __pyx_t_1;
    __pyx_t_1 = 0;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":546
 *         result = funicode(c_result)
 *     finally:
 *         tree.xmlFree(c_result)             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
  /*finally:*/ {
    int __pyx_why;
    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
    int __pyx_exc_lineno;
    __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 0; goto __pyx_L6;
    __pyx_L5: {
      __pyx_why = 4;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
      __pyx_exc_lineno = __pyx_lineno;
      goto __pyx_L6;
    }
    __pyx_L6:;
    xmlFree(__pyx_v_c_result);
    switch (__pyx_why) {
      case 4: {
        __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
        __pyx_lineno = __pyx_exc_lineno;
        __pyx_exc_type = 0;
        __pyx_exc_value = 0;
        __pyx_exc_tb = 0;
        goto __pyx_L1_error;
      }
    }
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":547
 *     finally:
 *         tree.xmlFree(c_result)
 *     return result             # <<<<<<<<<<<<<<
 * 
 * cdef inline object _getAttributeValue(_Element element, key, default):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._getNodeAttributeValue");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_ns);
  __Pyx_DECREF(__pyx_v_tag);
  __Pyx_DECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":549
 *     return result
 * 
 * cdef inline object _getAttributeValue(_Element element, key, default):             # <<<<<<<<<<<<<<
 *     return _getNodeAttributeValue(element._c_node, key, default)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_4lxml_5etree__getAttributeValue(struct LxmlElement *__pyx_v_element, PyObject *__pyx_v_key, PyObject *__pyx_v_default) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("_getAttributeValue");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":550
 * 
 * cdef inline object _getAttributeValue(_Element element, key, default):
 *     return _getNodeAttributeValue(element._c_node, key, default)             # <<<<<<<<<<<<<<
 * 
 * cdef int _setAttributeValue(_Element element, key, value) except -1:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__getNodeAttributeValue(__pyx_v_element->_c_node, __pyx_v_key, __pyx_v_default); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._getAttributeValue");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":552
 *     return _getNodeAttributeValue(element._c_node, key, default)
 * 
 * cdef int _setAttributeValue(_Element element, key, value) except -1:             # <<<<<<<<<<<<<<
 *     cdef xmlNs* c_ns
 *     cdef char* c_value
 */

static  int __pyx_f_4lxml_5etree__setAttributeValue(struct LxmlElement *__pyx_v_element, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
  xmlNs *__pyx_v_c_ns;
  char *__pyx_v_c_value;
  char *__pyx_v_c_tag;
  PyObject *__pyx_v_ns;
  PyObject *__pyx_v_tag;
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  xmlNs *__pyx_t_6;
  __Pyx_RefNannySetupContext("_setAttributeValue");
  __Pyx_INCREF(__pyx_v_value);
  __pyx_v_ns = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_tag = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":556
 *     cdef char* c_value
 *     cdef char* c_tag
 *     ns, tag = _getNsTag(key)             # <<<<<<<<<<<<<<
 *     if not element._doc._parser._for_html:
 *         _attributeValidOrRaise(tag)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__getNsTag(__pyx_v_key)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(__pyx_t_1 != Py_None) && likely(PyTuple_GET_SIZE(__pyx_t_1) == 2)) {
    PyObject* tuple = __pyx_t_1;
    __pyx_t_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_v_ns);
    __pyx_v_ns = __pyx_t_2;
    __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_v_tag);
    __pyx_v_tag = __pyx_t_3;
    __pyx_t_3 = 0;
  } else {
    __Pyx_UnpackTupleError(__pyx_t_1, 2);
    {__pyx_filename = __pyx_f[2]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":557
 *     cdef char* c_tag
 *     ns, tag = _getNsTag(key)
 *     if not element._doc._parser._for_html:             # <<<<<<<<<<<<<<
 *         _attributeValidOrRaise(tag)
 *     c_tag = _cstr(tag)
 */
  __pyx_t_4 = (!__pyx_v_element->_doc->_parser->_for_html);
  if (__pyx_t_4) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":558
 *     ns, tag = _getNsTag(key)
 *     if not element._doc._parser._for_html:
 *         _attributeValidOrRaise(tag)             # <<<<<<<<<<<<<<
 *     c_tag = _cstr(tag)
 *     if isinstance(value, QName):
 */
    __pyx_t_5 = __pyx_f_4lxml_5etree__attributeValidOrRaise(__pyx_v_tag); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":559
 *     if not element._doc._parser._for_html:
 *         _attributeValidOrRaise(tag)
 *     c_tag = _cstr(tag)             # <<<<<<<<<<<<<<
 *     if isinstance(value, QName):
 *         value = _resolveQNameText(element, value)
 */
  __pyx_v_c_tag = PyBytes_AS_STRING(__pyx_v_tag);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":560
 *         _attributeValidOrRaise(tag)
 *     c_tag = _cstr(tag)
 *     if isinstance(value, QName):             # <<<<<<<<<<<<<<
 *         value = _resolveQNameText(element, value)
 *     else:
 */
  __pyx_t_4 = __Pyx_TypeCheck(__pyx_v_value, ((PyObject*)__pyx_ptype_4lxml_5etree_QName)); 
  if (__pyx_t_4) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":561
 *     c_tag = _cstr(tag)
 *     if isinstance(value, QName):
 *         value = _resolveQNameText(element, value)             # <<<<<<<<<<<<<<
 *     else:
 *         value = _utf8(value)
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__resolveQNameText(__pyx_v_element, __pyx_v_value)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_v_value);
    __pyx_v_value = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":563
 *         value = _resolveQNameText(element, value)
 *     else:
 *         value = _utf8(value)             # <<<<<<<<<<<<<<
 *     c_value = _cstr(value)
 *     if ns is None:
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_v_value)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_v_value);
    __pyx_v_value = __pyx_t_1;
    __pyx_t_1 = 0;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":564
 *     else:
 *         value = _utf8(value)
 *     c_value = _cstr(value)             # <<<<<<<<<<<<<<
 *     if ns is None:
 *         c_ns = NULL
 */
  __pyx_v_c_value = PyBytes_AS_STRING(__pyx_v_value);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":565
 *         value = _utf8(value)
 *     c_value = _cstr(value)
 *     if ns is None:             # <<<<<<<<<<<<<<
 *         c_ns = NULL
 *     else:
 */
  __pyx_t_4 = (__pyx_v_ns == Py_None);
  if (__pyx_t_4) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":566
 *     c_value = _cstr(value)
 *     if ns is None:
 *         c_ns = NULL             # <<<<<<<<<<<<<<
 *     else:
 *         c_ns = element._doc._findOrBuildNodeNs(element._c_node,
 */
    __pyx_v_c_ns = NULL;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":569
 *     else:
 *         c_ns = element._doc._findOrBuildNodeNs(element._c_node,
 *                                                _cstr(ns), NULL, 1)             # <<<<<<<<<<<<<<
 *     tree.xmlSetNsProp(element._c_node, c_ns, c_tag, c_value)
 *     return 0
 */
    __pyx_t_6 = ((struct __pyx_vtabstruct_4lxml_5etree__Document *)__pyx_v_element->_doc->__pyx_vtab)->_findOrBuildNodeNs(__pyx_v_element->_doc, __pyx_v_element->_c_node, PyBytes_AS_STRING(__pyx_v_ns), NULL, 1); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_c_ns = __pyx_t_6;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":570
 *         c_ns = element._doc._findOrBuildNodeNs(element._c_node,
 *                                                _cstr(ns), NULL, 1)
 *     tree.xmlSetNsProp(element._c_node, c_ns, c_tag, c_value)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  xmlSetNsProp(__pyx_v_element->_c_node, __pyx_v_c_ns, __pyx_v_c_tag, __pyx_v_c_value);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":571
 *                                                _cstr(ns), NULL, 1)
 *     tree.xmlSetNsProp(element._c_node, c_ns, c_tag, c_value)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int _delAttribute(_Element element, key) except -1:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._setAttributeValue");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_ns);
  __Pyx_DECREF(__pyx_v_tag);
  __Pyx_DECREF(__pyx_v_value);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":573
 *     return 0
 * 
 * cdef int _delAttribute(_Element element, key) except -1:             # <<<<<<<<<<<<<<
 *     cdef char* c_href
 *     ns, tag = _getNsTag(key)
 */

static  int __pyx_f_4lxml_5etree__delAttribute(struct LxmlElement *__pyx_v_element, PyObject *__pyx_v_key) {
  char *__pyx_v_c_href;
  PyObject *__pyx_v_ns;
  PyObject *__pyx_v_tag;
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  void *__pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("_delAttribute");
  __pyx_v_ns = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_tag = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":575
 * cdef int _delAttribute(_Element element, key) except -1:
 *     cdef char* c_href
 *     ns, tag = _getNsTag(key)             # <<<<<<<<<<<<<<
 *     c_href = NULL if ns is None else _cstr(ns)
 *     if _delAttributeFromNsName(element._c_node, c_href, _cstr(tag)):
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__getNsTag(__pyx_v_key)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(__pyx_t_1 != Py_None) && likely(PyTuple_GET_SIZE(__pyx_t_1) == 2)) {
    PyObject* tuple = __pyx_t_1;
    __pyx_t_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_v_ns);
    __pyx_v_ns = __pyx_t_2;
    __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_v_tag);
    __pyx_v_tag = __pyx_t_3;
    __pyx_t_3 = 0;
  } else {
    __Pyx_UnpackTupleError(__pyx_t_1, 2);
    {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":576
 *     cdef char* c_href
 *     ns, tag = _getNsTag(key)
 *     c_href = NULL if ns is None else _cstr(ns)             # <<<<<<<<<<<<<<
 *     if _delAttributeFromNsName(element._c_node, c_href, _cstr(tag)):
 *         raise KeyError, key
 */
  __pyx_t_5 = (__pyx_v_ns == Py_None);
  if (__pyx_t_5) {
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_4 = PyBytes_AS_STRING(__pyx_v_ns);
  }
  __pyx_v_c_href = __pyx_t_4;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":577
 *     ns, tag = _getNsTag(key)
 *     c_href = NULL if ns is None else _cstr(ns)
 *     if _delAttributeFromNsName(element._c_node, c_href, _cstr(tag)):             # <<<<<<<<<<<<<<
 *         raise KeyError, key
 *     return 0
 */
  __pyx_t_6 = __pyx_f_4lxml_5etree__delAttributeFromNsName(__pyx_v_element->_c_node, __pyx_v_c_href, PyBytes_AS_STRING(__pyx_v_tag));
  if (__pyx_t_6) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":578
 *     c_href = NULL if ns is None else _cstr(ns)
 *     if _delAttributeFromNsName(element._c_node, c_href, _cstr(tag)):
 *         raise KeyError, key             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    __Pyx_Raise(__pyx_builtin_KeyError, __pyx_v_key, 0);
    {__pyx_filename = __pyx_f[2]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":579
 *     if _delAttributeFromNsName(element._c_node, c_href, _cstr(tag)):
 *         raise KeyError, key
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int _delAttributeFromNsName(xmlNode* c_node, char* c_href, char* c_name):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._delAttribute");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_ns);
  __Pyx_DECREF(__pyx_v_tag);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":581
 *     return 0
 * 
 * cdef int _delAttributeFromNsName(xmlNode* c_node, char* c_href, char* c_name):             # <<<<<<<<<<<<<<
 *     cdef xmlAttr* c_attr
 *     c_attr = tree.xmlHasNsProp(c_node, c_name, c_href)
 */

static  int __pyx_f_4lxml_5etree__delAttributeFromNsName(xmlNode *__pyx_v_c_node, char *__pyx_v_c_href, char *__pyx_v_c_name) {
  xmlAttr *__pyx_v_c_attr;
  int __pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_delAttributeFromNsName");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":583
 * cdef int _delAttributeFromNsName(xmlNode* c_node, char* c_href, char* c_name):
 *     cdef xmlAttr* c_attr
 *     c_attr = tree.xmlHasNsProp(c_node, c_name, c_href)             # <<<<<<<<<<<<<<
 *     if c_attr is NULL:
 *         # XXX free namespace that is not in use..?
 */
  __pyx_v_c_attr = xmlHasNsProp(__pyx_v_c_node, __pyx_v_c_name, __pyx_v_c_href);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":584
 *     cdef xmlAttr* c_attr
 *     c_attr = tree.xmlHasNsProp(c_node, c_name, c_href)
 *     if c_attr is NULL:             # <<<<<<<<<<<<<<
 *         # XXX free namespace that is not in use..?
 *         return -1
 */
  __pyx_t_1 = (__pyx_v_c_attr == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":586
 *     if c_attr is NULL:
 *         # XXX free namespace that is not in use..?
 *         return -1             # <<<<<<<<<<<<<<
 *     tree.xmlRemoveProp(c_attr)
 *     return 0
 */
    __pyx_r = -1;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":587
 *         # XXX free namespace that is not in use..?
 *         return -1
 *     tree.xmlRemoveProp(c_attr)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  xmlRemoveProp(__pyx_v_c_attr);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":588
 *         return -1
 *     tree.xmlRemoveProp(c_attr)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef list _collectAttributes(xmlNode* c_node, int collecttype):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":590
 *     return 0
 * 
 * cdef list _collectAttributes(xmlNode* c_node, int collecttype):             # <<<<<<<<<<<<<<
 *     u"""Collect all attributes of a node in a list.  Depending on collecttype,
 *     it collects either the name (1), the value (2) or the name-value tuples.
 */

static  PyObject *__pyx_f_4lxml_5etree__collectAttributes(xmlNode *__pyx_v_c_node, int __pyx_v_collecttype) {
  Py_ssize_t __pyx_v_count;
  xmlAttr *__pyx_v_c_attr;
  PyObject *__pyx_v_attributes;
  PyObject *__pyx_v_item;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("_collectAttributes");
  __pyx_v_attributes = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_item = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":596
 *     cdef Py_ssize_t count
 *     cdef xmlAttr* c_attr
 *     c_attr = c_node.properties             # <<<<<<<<<<<<<<
 *     count = 0
 *     while c_attr is not NULL:
 */
  __pyx_v_c_attr = __pyx_v_c_node->properties;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":597
 *     cdef xmlAttr* c_attr
 *     c_attr = c_node.properties
 *     count = 0             # <<<<<<<<<<<<<<
 *     while c_attr is not NULL:
 *         if c_attr.type == tree.XML_ATTRIBUTE_NODE:
 */
  __pyx_v_count = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":598
 *     c_attr = c_node.properties
 *     count = 0
 *     while c_attr is not NULL:             # <<<<<<<<<<<<<<
 *         if c_attr.type == tree.XML_ATTRIBUTE_NODE:
 *             count = count + 1
 */
  while (1) {
    __pyx_t_1 = (__pyx_v_c_attr != NULL);
    if (!__pyx_t_1) break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":599
 *     count = 0
 *     while c_attr is not NULL:
 *         if c_attr.type == tree.XML_ATTRIBUTE_NODE:             # <<<<<<<<<<<<<<
 *             count = count + 1
 *         c_attr = c_attr.next
 */
    __pyx_t_1 = (__pyx_v_c_attr->type == XML_ATTRIBUTE_NODE);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":600
 *     while c_attr is not NULL:
 *         if c_attr.type == tree.XML_ATTRIBUTE_NODE:
 *             count = count + 1             # <<<<<<<<<<<<<<
 *         c_attr = c_attr.next
 * 
 */
      __pyx_v_count = (__pyx_v_count + 1);
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":601
 *         if c_attr.type == tree.XML_ATTRIBUTE_NODE:
 *             count = count + 1
 *         c_attr = c_attr.next             # <<<<<<<<<<<<<<
 * 
 *     if count == 0:
 */
    __pyx_v_c_attr = __pyx_v_c_attr->next;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":603
 *         c_attr = c_attr.next
 * 
 *     if count == 0:             # <<<<<<<<<<<<<<
 *         return []
 * 
 */
  __pyx_t_1 = (__pyx_v_count == 0);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":604
 * 
 *     if count == 0:
 *         return []             # <<<<<<<<<<<<<<
 * 
 *     attributes = python.PyList_New(count)
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":606
 *         return []
 * 
 *     attributes = python.PyList_New(count)             # <<<<<<<<<<<<<<
 *     c_attr = c_node.properties
 *     count = 0
 */
  __pyx_t_2 = PyList_New(__pyx_v_count); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_v_attributes);
  __pyx_v_attributes = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":607
 * 
 *     attributes = python.PyList_New(count)
 *     c_attr = c_node.properties             # <<<<<<<<<<<<<<
 *     count = 0
 *     while c_attr is not NULL:
 */
  __pyx_v_c_attr = __pyx_v_c_node->properties;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":608
 *     attributes = python.PyList_New(count)
 *     c_attr = c_node.properties
 *     count = 0             # <<<<<<<<<<<<<<
 *     while c_attr is not NULL:
 *         if c_attr.type == tree.XML_ATTRIBUTE_NODE:
 */
  __pyx_v_count = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":609
 *     c_attr = c_node.properties
 *     count = 0
 *     while c_attr is not NULL:             # <<<<<<<<<<<<<<
 *         if c_attr.type == tree.XML_ATTRIBUTE_NODE:
 *             if collecttype == 1:
 */
  while (1) {
    __pyx_t_1 = (__pyx_v_c_attr != NULL);
    if (!__pyx_t_1) break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":610
 *     count = 0
 *     while c_attr is not NULL:
 *         if c_attr.type == tree.XML_ATTRIBUTE_NODE:             # <<<<<<<<<<<<<<
 *             if collecttype == 1:
 *                 item = _namespacedName(<xmlNode*>c_attr)
 */
    __pyx_t_1 = (__pyx_v_c_attr->type == XML_ATTRIBUTE_NODE);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":613
 *             if collecttype == 1:
 *                 item = _namespacedName(<xmlNode*>c_attr)
 *             elif collecttype == 2:             # <<<<<<<<<<<<<<
 *                 item = _attributeValue(c_node, c_attr)
 *             else:
 */
      switch (__pyx_v_collecttype) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":611
 *     while c_attr is not NULL:
 *         if c_attr.type == tree.XML_ATTRIBUTE_NODE:
 *             if collecttype == 1:             # <<<<<<<<<<<<<<
 *                 item = _namespacedName(<xmlNode*>c_attr)
 *             elif collecttype == 2:
 */
        case 1:

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":612
 *         if c_attr.type == tree.XML_ATTRIBUTE_NODE:
 *             if collecttype == 1:
 *                 item = _namespacedName(<xmlNode*>c_attr)             # <<<<<<<<<<<<<<
 *             elif collecttype == 2:
 *                 item = _attributeValue(c_node, c_attr)
 */
        __pyx_t_2 = __pyx_f_4lxml_5etree__namespacedName(((xmlNode *)__pyx_v_c_attr)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_v_item);
        __pyx_v_item = __pyx_t_2;
        __pyx_t_2 = 0;
        break;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":613
 *             if collecttype == 1:
 *                 item = _namespacedName(<xmlNode*>c_attr)
 *             elif collecttype == 2:             # <<<<<<<<<<<<<<
 *                 item = _attributeValue(c_node, c_attr)
 *             else:
 */
        case 2:

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":614
 *                 item = _namespacedName(<xmlNode*>c_attr)
 *             elif collecttype == 2:
 *                 item = _attributeValue(c_node, c_attr)             # <<<<<<<<<<<<<<
 *             else:
 *                 item = (_namespacedName(<xmlNode*>c_attr),
 */
        __pyx_t_2 = __pyx_f_4lxml_5etree__attributeValue(__pyx_v_c_node, __pyx_v_c_attr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_v_item);
        __pyx_v_item = __pyx_t_2;
        __pyx_t_2 = 0;
        break;
        default:

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":616
 *                 item = _attributeValue(c_node, c_attr)
 *             else:
 *                 item = (_namespacedName(<xmlNode*>c_attr),             # <<<<<<<<<<<<<<
 *                         _attributeValue(c_node, c_attr))
 * 
 */
        __pyx_t_2 = __pyx_f_4lxml_5etree__namespacedName(((xmlNode *)__pyx_v_c_attr)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":617
 *             else:
 *                 item = (_namespacedName(<xmlNode*>c_attr),
 *                         _attributeValue(c_node, c_attr))             # <<<<<<<<<<<<<<
 * 
 *             python.Py_INCREF(item)
 */
        __pyx_t_3 = __pyx_f_4lxml_5etree__attributeValue(__pyx_v_c_node, __pyx_v_c_attr); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_4));
        PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __pyx_t_2 = 0;
        __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_v_item);
        __pyx_v_item = ((PyObject *)__pyx_t_4);
        __pyx_t_4 = 0;
        break;
      }

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":619
 *                         _attributeValue(c_node, c_attr))
 * 
 *             python.Py_INCREF(item)             # <<<<<<<<<<<<<<
 *             python.PyList_SET_ITEM(attributes, count, item)
 *             count = count + 1
 */
      Py_INCREF(__pyx_v_item);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":620
 * 
 *             python.Py_INCREF(item)
 *             python.PyList_SET_ITEM(attributes, count, item)             # <<<<<<<<<<<<<<
 *             count = count + 1
 *         c_attr = c_attr.next
 */
      PyList_SET_ITEM(__pyx_v_attributes, __pyx_v_count, __pyx_v_item);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":621
 *             python.Py_INCREF(item)
 *             python.PyList_SET_ITEM(attributes, count, item)
 *             count = count + 1             # <<<<<<<<<<<<<<
 *         c_attr = c_attr.next
 *     return attributes
 */
      __pyx_v_count = (__pyx_v_count + 1);
      goto __pyx_L9;
    }
    __pyx_L9:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":622
 *             python.PyList_SET_ITEM(attributes, count, item)
 *             count = count + 1
 *         c_attr = c_attr.next             # <<<<<<<<<<<<<<
 *     return attributes
 * 
 */
    __pyx_v_c_attr = __pyx_v_c_attr->next;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":623
 *             count = count + 1
 *         c_attr = c_attr.next
 *     return attributes             # <<<<<<<<<<<<<<
 * 
 * cdef object __RE_XML_ENCODING
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  if (!(likely(PyList_CheckExact(__pyx_v_attributes))||((__pyx_v_attributes) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_v_attributes)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_attributes);
  __pyx_r = ((PyObject*)__pyx_v_attributes);
  goto __pyx_L0;

  __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._collectAttributes");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_attributes);
  __Pyx_DECREF(__pyx_v_item);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":635
 * __HAS_XML_ENCODING = __RE_XML_ENCODING.match
 * 
 * cdef object _stripEncodingDeclaration(object xml_string):             # <<<<<<<<<<<<<<
 *     # this is a hack to remove the XML encoding declaration from unicode
 *     return __REPLACE_XML_ENCODING(ur'\g<1>', xml_string)
 */

static  PyObject *__pyx_f_4lxml_5etree__stripEncodingDeclaration(PyObject *__pyx_v_xml_string) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_stripEncodingDeclaration");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":637
 * cdef object _stripEncodingDeclaration(object xml_string):
 *     # this is a hack to remove the XML encoding declaration from unicode
 *     return __REPLACE_XML_ENCODING(ur'\g<1>', xml_string)             # <<<<<<<<<<<<<<
 * 
 * cdef bint _hasEncodingDeclaration(object xml_string):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_20));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_u_20));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_20));
  __Pyx_INCREF(__pyx_v_xml_string);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_xml_string);
  __Pyx_GIVEREF(__pyx_v_xml_string);
  __pyx_t_2 = PyObject_Call(__pyx_v_4lxml_5etree___REPLACE_XML_ENCODING, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._stripEncodingDeclaration");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":639
 *     return __REPLACE_XML_ENCODING(ur'\g<1>', xml_string)
 * 
 * cdef bint _hasEncodingDeclaration(object xml_string):             # <<<<<<<<<<<<<<
 *     # check if a (unicode) string has an XML encoding declaration
 *     return __HAS_XML_ENCODING(xml_string) is not None
 */

static  int __pyx_f_4lxml_5etree__hasEncodingDeclaration(PyObject *__pyx_v_xml_string) {
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("_hasEncodingDeclaration");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":641
 * cdef bint _hasEncodingDeclaration(object xml_string):
 *     # check if a (unicode) string has an XML encoding declaration
 *     return __HAS_XML_ENCODING(xml_string) is not None             # <<<<<<<<<<<<<<
 * 
 * cdef object _stripDeclaration(object xml_string):
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_xml_string);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_xml_string);
  __Pyx_GIVEREF(__pyx_v_xml_string);
  __pyx_t_2 = PyObject_Call(__pyx_v_4lxml_5etree___HAS_XML_ENCODING, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_t_2 != Py_None);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_WriteUnraisable("lxml.etree._hasEncodingDeclaration");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":643
 *     return __HAS_XML_ENCODING(xml_string) is not None
 * 
 * cdef object _stripDeclaration(object xml_string):             # <<<<<<<<<<<<<<
 *     # this is a hack to remove the XML declaration when we encode to UTF-8
 *     xml_string = xml_string.strip()
 */

static  PyObject *__pyx_f_4lxml_5etree__stripDeclaration(PyObject *__pyx_v_xml_string) {
  PyObject *__pyx_v_i;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  __Pyx_RefNannySetupContext("_stripDeclaration");
  __Pyx_INCREF(__pyx_v_xml_string);
  __pyx_v_i = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":645
 * cdef object _stripDeclaration(object xml_string):
 *     # this is a hack to remove the XML declaration when we encode to UTF-8
 *     xml_string = xml_string.strip()             # <<<<<<<<<<<<<<
 *     if xml_string[:5] == '<?xml':
 *         i = xml_string.find('?>')
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_xml_string, __pyx_n_s__strip); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_v_xml_string);
  __pyx_v_xml_string = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":646
 *     # this is a hack to remove the XML declaration when we encode to UTF-8
 *     xml_string = xml_string.strip()
 *     if xml_string[:5] == '<?xml':             # <<<<<<<<<<<<<<
 *         i = xml_string.find('?>')
 *         if i != -1:
 */
  __pyx_t_2 = __Pyx_PySequence_GetSlice(__pyx_v_xml_string, 0, 5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_kp_s_21), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":647
 *     xml_string = xml_string.strip()
 *     if xml_string[:5] == '<?xml':
 *         i = xml_string.find('?>')             # <<<<<<<<<<<<<<
 *         if i != -1:
 *             i = i + 2
 */
    __pyx_t_1 = PyObject_GetAttr(__pyx_v_xml_string, __pyx_n_s__find); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_23), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_v_i);
    __pyx_v_i = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":648
 *     if xml_string[:5] == '<?xml':
 *         i = xml_string.find('?>')
 *         if i != -1:             # <<<<<<<<<<<<<<
 *             i = i + 2
 *             while xml_string[i:i+1] in '\n\r ':
 */
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_i, __pyx_int_neg_1, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":649
 *         i = xml_string.find('?>')
 *         if i != -1:
 *             i = i + 2             # <<<<<<<<<<<<<<
 *             while xml_string[i:i+1] in '\n\r ':
 *                 i = i+1
 */
      __pyx_t_2 = PyNumber_Add(__pyx_v_i, __pyx_int_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_v_i);
      __pyx_v_i = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":650
 *         if i != -1:
 *             i = i + 2
 *             while xml_string[i:i+1] in '\n\r ':             # <<<<<<<<<<<<<<
 *                 i = i+1
 *             xml_string = xml_string[i:]
 */
      while (1) {
        __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_2 = PyNumber_Add(__pyx_v_i, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_PySequence_GetSlice(__pyx_v_xml_string, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = ((PySequence_Contains(((PyObject *)__pyx_kp_s_24), __pyx_t_2))); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (!__pyx_t_3) break;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":651
 *             i = i + 2
 *             while xml_string[i:i+1] in '\n\r ':
 *                 i = i+1             # <<<<<<<<<<<<<<
 *             xml_string = xml_string[i:]
 *     return xml_string
 */
        __pyx_t_2 = PyNumber_Add(__pyx_v_i, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_v_i);
        __pyx_v_i = __pyx_t_2;
        __pyx_t_2 = 0;
      }

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":652
 *             while xml_string[i:i+1] in '\n\r ':
 *                 i = i+1
 *             xml_string = xml_string[i:]             # <<<<<<<<<<<<<<
 *     return xml_string
 * 
 */
      __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_2 = __Pyx_PySequence_GetSlice(__pyx_v_xml_string, __pyx_t_5, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_v_xml_string);
      __pyx_v_xml_string = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":653
 *                 i = i+1
 *             xml_string = xml_string[i:]
 *     return xml_string             # <<<<<<<<<<<<<<
 * 
 * cdef inline bint _hasText(xmlNode* c_node):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_xml_string);
  __pyx_r = __pyx_v_xml_string;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._stripDeclaration");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_i);
  __Pyx_DECREF(__pyx_v_xml_string);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":655
 *     return xml_string
 * 
 * cdef inline bint _hasText(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     return c_node is not NULL and _textNodeOrSkip(c_node.children) is not NULL
 * 
 */

static CYTHON_INLINE int __pyx_f_4lxml_5etree__hasText(xmlNode *__pyx_v_c_node) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("_hasText");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":656
 * 
 * cdef inline bint _hasText(xmlNode* c_node):
 *     return c_node is not NULL and _textNodeOrSkip(c_node.children) is not NULL             # <<<<<<<<<<<<<<
 * 
 * cdef inline bint _hasTail(xmlNode* c_node):
 */
  __pyx_t_1 = (__pyx_v_c_node != NULL);
  if (__pyx_t_1) {
    __pyx_t_2 = (__pyx_f_4lxml_5etree__textNodeOrSkip(__pyx_v_c_node->children) != NULL);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  __pyx_r = __pyx_t_3;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":658
 *     return c_node is not NULL and _textNodeOrSkip(c_node.children) is not NULL
 * 
 * cdef inline bint _hasTail(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     return c_node is not NULL and _textNodeOrSkip(c_node.next) is not NULL
 * 
 */

static CYTHON_INLINE int __pyx_f_4lxml_5etree__hasTail(xmlNode *__pyx_v_c_node) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("_hasTail");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":659
 * 
 * cdef inline bint _hasTail(xmlNode* c_node):
 *     return c_node is not NULL and _textNodeOrSkip(c_node.next) is not NULL             # <<<<<<<<<<<<<<
 * 
 * cdef _collectText(xmlNode* c_node):
 */
  __pyx_t_1 = (__pyx_v_c_node != NULL);
  if (__pyx_t_1) {
    __pyx_t_2 = (__pyx_f_4lxml_5etree__textNodeOrSkip(__pyx_v_c_node->next) != NULL);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  __pyx_r = __pyx_t_3;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":661
 *     return c_node is not NULL and _textNodeOrSkip(c_node.next) is not NULL
 * 
 * cdef _collectText(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     u"""Collect all text nodes and return them as a unicode string.
 * 
 */

static  PyObject *__pyx_f_4lxml_5etree__collectText(xmlNode *__pyx_v_c_node) {
  Py_ssize_t __pyx_v_scount;
  char *__pyx_v_c_text;
  xmlNode *__pyx_v_c_node_cur;
  PyObject *__pyx_v_result;
  PyObject *__pyx_r = NULL;
  xmlNode *__pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  char *__pyx_t_5;
  __Pyx_RefNannySetupContext("_collectText");
  __pyx_v_result = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":672
 *     cdef xmlNode* c_node_cur
 *     # check for multiple text nodes
 *     scount = 0             # <<<<<<<<<<<<<<
 *     c_text = NULL
 *     c_node_cur = c_node = _textNodeOrSkip(c_node)
 */
  __pyx_v_scount = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":673
 *     # check for multiple text nodes
 *     scount = 0
 *     c_text = NULL             # <<<<<<<<<<<<<<
 *     c_node_cur = c_node = _textNodeOrSkip(c_node)
 *     while c_node_cur is not NULL:
 */
  __pyx_v_c_text = NULL;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":674
 *     scount = 0
 *     c_text = NULL
 *     c_node_cur = c_node = _textNodeOrSkip(c_node)             # <<<<<<<<<<<<<<
 *     while c_node_cur is not NULL:
 *         if c_node_cur.content[0] != c'\0':
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__textNodeOrSkip(__pyx_v_c_node);
  __pyx_v_c_node_cur = __pyx_t_1;
  __pyx_v_c_node = __pyx_t_1;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":675
 *     c_text = NULL
 *     c_node_cur = c_node = _textNodeOrSkip(c_node)
 *     while c_node_cur is not NULL:             # <<<<<<<<<<<<<<
 *         if c_node_cur.content[0] != c'\0':
 *             c_text = c_node_cur.content
 */
  while (1) {
    __pyx_t_2 = (__pyx_v_c_node_cur != NULL);
    if (!__pyx_t_2) break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":676
 *     c_node_cur = c_node = _textNodeOrSkip(c_node)
 *     while c_node_cur is not NULL:
 *         if c_node_cur.content[0] != c'\0':             # <<<<<<<<<<<<<<
 *             c_text = c_node_cur.content
 *         scount = scount + 1
 */
    __pyx_t_2 = ((__pyx_v_c_node_cur->content[0]) != '\x00');
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":677
 *     while c_node_cur is not NULL:
 *         if c_node_cur.content[0] != c'\0':
 *             c_text = c_node_cur.content             # <<<<<<<<<<<<<<
 *         scount = scount + 1
 *         c_node_cur = _textNodeOrSkip(c_node_cur.next)
 */
      __pyx_v_c_text = __pyx_v_c_node_cur->content;
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":678
 *         if c_node_cur.content[0] != c'\0':
 *             c_text = c_node_cur.content
 *         scount = scount + 1             # <<<<<<<<<<<<<<
 *         c_node_cur = _textNodeOrSkip(c_node_cur.next)
 * 
 */
    __pyx_v_scount = (__pyx_v_scount + 1);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":679
 *             c_text = c_node_cur.content
 *         scount = scount + 1
 *         c_node_cur = _textNodeOrSkip(c_node_cur.next)             # <<<<<<<<<<<<<<
 * 
 *     # handle two most common cases first
 */
    __pyx_v_c_node_cur = __pyx_f_4lxml_5etree__textNodeOrSkip(__pyx_v_c_node_cur->next);
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":682
 * 
 *     # handle two most common cases first
 *     if c_text is NULL:             # <<<<<<<<<<<<<<
 *         if scount > 0:
 *             if python.IS_PYTHON3:
 */
  __pyx_t_2 = (__pyx_v_c_text == NULL);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":683
 *     # handle two most common cases first
 *     if c_text is NULL:
 *         if scount > 0:             # <<<<<<<<<<<<<<
 *             if python.IS_PYTHON3:
 *                 return u''
 */
    __pyx_t_2 = (__pyx_v_scount > 0);
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":684
 *     if c_text is NULL:
 *         if scount > 0:
 *             if python.IS_PYTHON3:             # <<<<<<<<<<<<<<
 *                 return u''
 *             else:
 */
      if (IS_PYTHON3) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":685
 *         if scount > 0:
 *             if python.IS_PYTHON3:
 *                 return u''             # <<<<<<<<<<<<<<
 *             else:
 *                 return b''
 */
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(((PyObject *)__pyx_kp_u_25));
        __pyx_r = ((PyObject *)__pyx_kp_u_25);
        goto __pyx_L0;
        goto __pyx_L8;
      }
      /*else*/ {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":687
 *                 return u''
 *             else:
 *                 return b''             # <<<<<<<<<<<<<<
 *         else:
 *             return None
 */
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(((PyObject *)__pyx_kp_b_25));
        __pyx_r = ((PyObject *)__pyx_kp_b_25);
        goto __pyx_L0;
      }
      __pyx_L8:;
      goto __pyx_L7;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":689
 *                 return b''
 *         else:
 *             return None             # <<<<<<<<<<<<<<
 *     if scount == 1:
 *         return funicode(c_text)
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_None);
      __pyx_r = Py_None;
      goto __pyx_L0;
    }
    __pyx_L7:;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":690
 *         else:
 *             return None
 *     if scount == 1:             # <<<<<<<<<<<<<<
 *         return funicode(c_text)
 * 
 */
  __pyx_t_2 = (__pyx_v_scount == 1);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":691
 *             return None
 *     if scount == 1:
 *         return funicode(c_text)             # <<<<<<<<<<<<<<
 * 
 *     # the rest is not performance critical anymore
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_text); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
    goto __pyx_L9;
  }
  __pyx_L9:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":694
 * 
 *     # the rest is not performance critical anymore
 *     result = b''             # <<<<<<<<<<<<<<
 *     while c_node is not NULL:
 *         result = result + c_node.content
 */
  __Pyx_INCREF(((PyObject *)__pyx_kp_b_25));
  __Pyx_DECREF(((PyObject *)__pyx_v_result));
  __pyx_v_result = __pyx_kp_b_25;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":695
 *     # the rest is not performance critical anymore
 *     result = b''
 *     while c_node is not NULL:             # <<<<<<<<<<<<<<
 *         result = result + c_node.content
 *         c_node = _textNodeOrSkip(c_node.next)
 */
  while (1) {
    __pyx_t_2 = (__pyx_v_c_node != NULL);
    if (!__pyx_t_2) break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":696
 *     result = b''
 *     while c_node is not NULL:
 *         result = result + c_node.content             # <<<<<<<<<<<<<<
 *         c_node = _textNodeOrSkip(c_node.next)
 *     return funicode(result)
 */
    __pyx_t_3 = PyBytes_FromString(__pyx_v_c_node->content); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_v_result), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_v_result));
    __pyx_v_result = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":697
 *     while c_node is not NULL:
 *         result = result + c_node.content
 *         c_node = _textNodeOrSkip(c_node.next)             # <<<<<<<<<<<<<<
 *     return funicode(result)
 * 
 */
    __pyx_v_c_node = __pyx_f_4lxml_5etree__textNodeOrSkip(__pyx_v_c_node->next);
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":698
 *         result = result + c_node.content
 *         c_node = _textNodeOrSkip(c_node.next)
 *     return funicode(result)             # <<<<<<<<<<<<<<
 * 
 * cdef void _removeText(xmlNode* c_node):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = PyBytes_AsString(((PyObject *)__pyx_v_result)); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __pyx_f_4lxml_5etree_funicode(__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._collectText");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":700
 *     return funicode(result)
 * 
 * cdef void _removeText(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     u"""Remove all text nodes.
 * 
 */

static  void __pyx_f_4lxml_5etree__removeText(xmlNode *__pyx_v_c_node) {
  xmlNode *__pyx_v_c_next;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_removeText");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":706
 *     """
 *     cdef xmlNode* c_next
 *     c_node = _textNodeOrSkip(c_node)             # <<<<<<<<<<<<<<
 *     while c_node is not NULL:
 *         c_next = _textNodeOrSkip(c_node.next)
 */
  __pyx_v_c_node = __pyx_f_4lxml_5etree__textNodeOrSkip(__pyx_v_c_node);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":707
 *     cdef xmlNode* c_next
 *     c_node = _textNodeOrSkip(c_node)
 *     while c_node is not NULL:             # <<<<<<<<<<<<<<
 *         c_next = _textNodeOrSkip(c_node.next)
 *         tree.xmlUnlinkNode(c_node)
 */
  while (1) {
    __pyx_t_1 = (__pyx_v_c_node != NULL);
    if (!__pyx_t_1) break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":708
 *     c_node = _textNodeOrSkip(c_node)
 *     while c_node is not NULL:
 *         c_next = _textNodeOrSkip(c_node.next)             # <<<<<<<<<<<<<<
 *         tree.xmlUnlinkNode(c_node)
 *         tree.xmlFreeNode(c_node)
 */
    __pyx_v_c_next = __pyx_f_4lxml_5etree__textNodeOrSkip(__pyx_v_c_node->next);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":709
 *     while c_node is not NULL:
 *         c_next = _textNodeOrSkip(c_node.next)
 *         tree.xmlUnlinkNode(c_node)             # <<<<<<<<<<<<<<
 *         tree.xmlFreeNode(c_node)
 *         c_node = c_next
 */
    xmlUnlinkNode(__pyx_v_c_node);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":710
 *         c_next = _textNodeOrSkip(c_node.next)
 *         tree.xmlUnlinkNode(c_node)
 *         tree.xmlFreeNode(c_node)             # <<<<<<<<<<<<<<
 *         c_node = c_next
 * 
 */
    xmlFreeNode(__pyx_v_c_node);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":711
 *         tree.xmlUnlinkNode(c_node)
 *         tree.xmlFreeNode(c_node)
 *         c_node = c_next             # <<<<<<<<<<<<<<
 * 
 * cdef int _setNodeText(xmlNode* c_node, value) except -1:
 */
    __pyx_v_c_node = __pyx_v_c_next;
  }

  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":713
 *         c_node = c_next
 * 
 * cdef int _setNodeText(xmlNode* c_node, value) except -1:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_text_node
 *     # remove all text nodes at the start first
 */

static  int __pyx_f_4lxml_5etree__setNodeText(xmlNode *__pyx_v_c_node, PyObject *__pyx_v_value) {
  xmlNode *__pyx_v_c_text_node;
  PyObject *__pyx_v_text;
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("_setNodeText");
  __pyx_v_text = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":716
 *     cdef xmlNode* c_text_node
 *     # remove all text nodes at the start first
 *     _removeText(c_node.children)             # <<<<<<<<<<<<<<
 *     if value is None:
 *         return 0
 */
  __pyx_f_4lxml_5etree__removeText(__pyx_v_c_node->children);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":717
 *     # remove all text nodes at the start first
 *     _removeText(c_node.children)
 *     if value is None:             # <<<<<<<<<<<<<<
 *         return 0
 *     # now add new text node with value at start
 */
  __pyx_t_1 = (__pyx_v_value == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":718
 *     _removeText(c_node.children)
 *     if value is None:
 *         return 0             # <<<<<<<<<<<<<<
 *     # now add new text node with value at start
 *     if python._isString(value):
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":720
 *         return 0
 *     # now add new text node with value at start
 *     if python._isString(value):             # <<<<<<<<<<<<<<
 *         text = _utf8(value)
 *         c_text_node = tree.xmlNewDocText(c_node.doc, _cstr(text))
 */
  __pyx_t_1 = _isString(__pyx_v_value);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":721
 *     # now add new text node with value at start
 *     if python._isString(value):
 *         text = _utf8(value)             # <<<<<<<<<<<<<<
 *         c_text_node = tree.xmlNewDocText(c_node.doc, _cstr(text))
 *     elif isinstance(value, CDATA):
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_v_value)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_v_text));
    __pyx_v_text = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":722
 *     if python._isString(value):
 *         text = _utf8(value)
 *         c_text_node = tree.xmlNewDocText(c_node.doc, _cstr(text))             # <<<<<<<<<<<<<<
 *     elif isinstance(value, CDATA):
 *         c_text_node = tree.xmlNewCDataBlock(
 */
    __pyx_v_c_text_node = xmlNewDocText(__pyx_v_c_node->doc, PyBytes_AS_STRING(((PyObject *)__pyx_v_text)));
    goto __pyx_L4;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":723
 *         text = _utf8(value)
 *         c_text_node = tree.xmlNewDocText(c_node.doc, _cstr(text))
 *     elif isinstance(value, CDATA):             # <<<<<<<<<<<<<<
 *         c_text_node = tree.xmlNewCDataBlock(
 *             c_node.doc, _cstr((<CDATA>value)._utf8_data),
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_value, ((PyObject*)__pyx_ptype_4lxml_5etree_CDATA)); 
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":725
 *     elif isinstance(value, CDATA):
 *         c_text_node = tree.xmlNewCDataBlock(
 *             c_node.doc, _cstr((<CDATA>value)._utf8_data),             # <<<<<<<<<<<<<<
 *             python.PyBytes_GET_SIZE((<CDATA>value)._utf8_data))
 *     else:
 */
    __pyx_t_2 = ((struct __pyx_obj_4lxml_5etree_CDATA *)__pyx_v_value)->_utf8_data;
    __Pyx_INCREF(__pyx_t_2);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":726
 *         c_text_node = tree.xmlNewCDataBlock(
 *             c_node.doc, _cstr((<CDATA>value)._utf8_data),
 *             python.PyBytes_GET_SIZE((<CDATA>value)._utf8_data))             # <<<<<<<<<<<<<<
 *     else:
 *         # this will raise the right error
 */
    __pyx_t_3 = ((struct __pyx_obj_4lxml_5etree_CDATA *)__pyx_v_value)->_utf8_data;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_v_c_text_node = xmlNewCDataBlock(__pyx_v_c_node->doc, PyBytes_AS_STRING(__pyx_t_2), PyBytes_GET_SIZE(__pyx_t_3));
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":729
 *     else:
 *         # this will raise the right error
 *        _utf8(value)             # <<<<<<<<<<<<<<
 *        return -1
 *     if c_node.children is NULL:
 */
    __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_v_value)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":730
 *         # this will raise the right error
 *        _utf8(value)
 *        return -1             # <<<<<<<<<<<<<<
 *     if c_node.children is NULL:
 *         tree.xmlAddChild(c_node, c_text_node)
 */
    __pyx_r = -1;
    goto __pyx_L0;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":731
 *        _utf8(value)
 *        return -1
 *     if c_node.children is NULL:             # <<<<<<<<<<<<<<
 *         tree.xmlAddChild(c_node, c_text_node)
 *     else:
 */
  __pyx_t_1 = (__pyx_v_c_node->children == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":732
 *        return -1
 *     if c_node.children is NULL:
 *         tree.xmlAddChild(c_node, c_text_node)             # <<<<<<<<<<<<<<
 *     else:
 *         tree.xmlAddPrevSibling(c_node.children, c_text_node)
 */
    xmlAddChild(__pyx_v_c_node, __pyx_v_c_text_node);
    goto __pyx_L5;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":734
 *         tree.xmlAddChild(c_node, c_text_node)
 *     else:
 *         tree.xmlAddPrevSibling(c_node.children, c_text_node)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    xmlAddPrevSibling(__pyx_v_c_node->children, __pyx_v_c_text_node);
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":735
 *     else:
 *         tree.xmlAddPrevSibling(c_node.children, c_text_node)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int _setTailText(xmlNode* c_node, value) except -1:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._setNodeText");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_text);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":737
 *     return 0
 * 
 * cdef int _setTailText(xmlNode* c_node, value) except -1:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_text_node
 *     # remove all text nodes at the start first
 */

static  int __pyx_f_4lxml_5etree__setTailText(xmlNode *__pyx_v_c_node, PyObject *__pyx_v_value) {
  xmlNode *__pyx_v_c_text_node;
  PyObject *__pyx_v_text;
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_setTailText");
  __pyx_v_text = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":740
 *     cdef xmlNode* c_text_node
 *     # remove all text nodes at the start first
 *     _removeText(c_node.next)             # <<<<<<<<<<<<<<
 *     if value is None:
 *         return 0
 */
  __pyx_f_4lxml_5etree__removeText(__pyx_v_c_node->next);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":741
 *     # remove all text nodes at the start first
 *     _removeText(c_node.next)
 *     if value is None:             # <<<<<<<<<<<<<<
 *         return 0
 *     text = _utf8(value)
 */
  __pyx_t_1 = (__pyx_v_value == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":742
 *     _removeText(c_node.next)
 *     if value is None:
 *         return 0             # <<<<<<<<<<<<<<
 *     text = _utf8(value)
 *     c_text_node = tree.xmlNewDocText(c_node.doc, _cstr(text))
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":743
 *     if value is None:
 *         return 0
 *     text = _utf8(value)             # <<<<<<<<<<<<<<
 *     c_text_node = tree.xmlNewDocText(c_node.doc, _cstr(text))
 *     # XXX what if we're the top element?
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_v_value)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_v_text));
  __pyx_v_text = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":744
 *         return 0
 *     text = _utf8(value)
 *     c_text_node = tree.xmlNewDocText(c_node.doc, _cstr(text))             # <<<<<<<<<<<<<<
 *     # XXX what if we're the top element?
 *     tree.xmlAddNextSibling(c_node, c_text_node)
 */
  __pyx_v_c_text_node = xmlNewDocText(__pyx_v_c_node->doc, PyBytes_AS_STRING(((PyObject *)__pyx_v_text)));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":746
 *     c_text_node = tree.xmlNewDocText(c_node.doc, _cstr(text))
 *     # XXX what if we're the top element?
 *     tree.xmlAddNextSibling(c_node, c_text_node)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  xmlAddNextSibling(__pyx_v_c_node, __pyx_v_c_text_node);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":747
 *     # XXX what if we're the top element?
 *     tree.xmlAddNextSibling(c_node, c_text_node)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef bytes _resolveQNameText(_Element element, value):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._setTailText");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_text);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":749
 *     return 0
 * 
 * cdef bytes _resolveQNameText(_Element element, value):             # <<<<<<<<<<<<<<
 *     cdef xmlNs* c_ns
 *     ns, tag = _getNsTag(value)
 */

static  PyObject *__pyx_f_4lxml_5etree__resolveQNameText(struct LxmlElement *__pyx_v_element, PyObject *__pyx_v_value) {
  xmlNs *__pyx_v_c_ns;
  PyObject *__pyx_v_ns;
  PyObject *__pyx_v_tag;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  xmlNs *__pyx_t_5;
  __Pyx_RefNannySetupContext("_resolveQNameText");
  __pyx_v_ns = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_tag = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":751
 * cdef bytes _resolveQNameText(_Element element, value):
 *     cdef xmlNs* c_ns
 *     ns, tag = _getNsTag(value)             # <<<<<<<<<<<<<<
 *     if ns is None:
 *         return tag
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__getNsTag(__pyx_v_value)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(__pyx_t_1 != Py_None) && likely(PyTuple_GET_SIZE(__pyx_t_1) == 2)) {
    PyObject* tuple = __pyx_t_1;
    __pyx_t_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_v_ns);
    __pyx_v_ns = __pyx_t_2;
    __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_v_tag);
    __pyx_v_tag = __pyx_t_3;
    __pyx_t_3 = 0;
  } else {
    __Pyx_UnpackTupleError(__pyx_t_1, 2);
    {__pyx_filename = __pyx_f[2]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":752
 *     cdef xmlNs* c_ns
 *     ns, tag = _getNsTag(value)
 *     if ns is None:             # <<<<<<<<<<<<<<
 *         return tag
 *     else:
 */
  __pyx_t_4 = (__pyx_v_ns == Py_None);
  if (__pyx_t_4) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":753
 *     ns, tag = _getNsTag(value)
 *     if ns is None:
 *         return tag             # <<<<<<<<<<<<<<
 *     else:
 *         c_ns = element._doc._findOrBuildNodeNs(
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    if (!(likely(PyBytes_CheckExact(__pyx_v_tag))||((__pyx_v_tag) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_v_tag)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_INCREF(__pyx_v_tag);
    __pyx_r = ((PyObject*)__pyx_v_tag);
    goto __pyx_L0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":756
 *     else:
 *         c_ns = element._doc._findOrBuildNodeNs(
 *             element._c_node, _cstr(ns), NULL, 0)             # <<<<<<<<<<<<<<
 *         return python.PyBytes_FromFormat('%s:%s', c_ns.prefix, _cstr(tag))
 * 
 */
    __pyx_t_5 = ((struct __pyx_vtabstruct_4lxml_5etree__Document *)__pyx_v_element->_doc->__pyx_vtab)->_findOrBuildNodeNs(__pyx_v_element->_doc, __pyx_v_element->_c_node, PyBytes_AS_STRING(__pyx_v_ns), NULL, 0); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_c_ns = __pyx_t_5;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":757
 *         c_ns = element._doc._findOrBuildNodeNs(
 *             element._c_node, _cstr(ns), NULL, 0)
 *         return python.PyBytes_FromFormat('%s:%s', c_ns.prefix, _cstr(tag))             # <<<<<<<<<<<<<<
 * 
 * cdef inline bint _hasChild(xmlNode* c_node):
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __pyx_t_1 = ((PyObject *)PyBytes_FromFormat(__pyx_k_26, __pyx_v_c_ns->prefix, PyBytes_AS_STRING(__pyx_v_tag))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L0;
  }
  __pyx_L3:;

  __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._resolveQNameText");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_ns);
  __Pyx_DECREF(__pyx_v_tag);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":759
 *         return python.PyBytes_FromFormat('%s:%s', c_ns.prefix, _cstr(tag))
 * 
 * cdef inline bint _hasChild(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     return c_node is not NULL and _findChildForwards(c_node, 0) is not NULL
 * 
 */

static CYTHON_INLINE int __pyx_f_4lxml_5etree__hasChild(xmlNode *__pyx_v_c_node) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("_hasChild");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":760
 * 
 * cdef inline bint _hasChild(xmlNode* c_node):
 *     return c_node is not NULL and _findChildForwards(c_node, 0) is not NULL             # <<<<<<<<<<<<<<
 * 
 * cdef inline Py_ssize_t _countElements(xmlNode* c_node):
 */
  __pyx_t_1 = (__pyx_v_c_node != NULL);
  if (__pyx_t_1) {
    __pyx_t_2 = (__pyx_f_4lxml_5etree__findChildForwards(__pyx_v_c_node, 0) != NULL);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  __pyx_r = __pyx_t_3;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":762
 *     return c_node is not NULL and _findChildForwards(c_node, 0) is not NULL
 * 
 * cdef inline Py_ssize_t _countElements(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     u"Counts the elements within the following siblings and the node itself."
 *     cdef Py_ssize_t count
 */

static CYTHON_INLINE Py_ssize_t __pyx_f_4lxml_5etree__countElements(xmlNode *__pyx_v_c_node) {
  Py_ssize_t __pyx_v_count;
  Py_ssize_t __pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_countElements");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":765
 *     u"Counts the elements within the following siblings and the node itself."
 *     cdef Py_ssize_t count
 *     count = 0             # <<<<<<<<<<<<<<
 *     while c_node is not NULL:
 *         if _isElement(c_node):
 */
  __pyx_v_count = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":766
 *     cdef Py_ssize_t count
 *     count = 0
 *     while c_node is not NULL:             # <<<<<<<<<<<<<<
 *         if _isElement(c_node):
 *             count = count + 1
 */
  while (1) {
    __pyx_t_1 = (__pyx_v_c_node != NULL);
    if (!__pyx_t_1) break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":767
 *     count = 0
 *     while c_node is not NULL:
 *         if _isElement(c_node):             # <<<<<<<<<<<<<<
 *             count = count + 1
 *         c_node = c_node.next
 */
    __pyx_t_1 = _isElement(__pyx_v_c_node);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":768
 *     while c_node is not NULL:
 *         if _isElement(c_node):
 *             count = count + 1             # <<<<<<<<<<<<<<
 *         c_node = c_node.next
 *     return count
 */
      __pyx_v_count = (__pyx_v_count + 1);
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":769
 *         if _isElement(c_node):
 *             count = count + 1
 *         c_node = c_node.next             # <<<<<<<<<<<<<<
 *     return count
 * 
 */
    __pyx_v_c_node = __pyx_v_c_node->next;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":770
 *             count = count + 1
 *         c_node = c_node.next
 *     return count             # <<<<<<<<<<<<<<
 * 
 * cdef int _findChildSlice(
 */
  __pyx_r = __pyx_v_count;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":772
 *     return count
 * 
 * cdef int _findChildSlice(             # <<<<<<<<<<<<<<
 *     slice sliceobject, xmlNode* c_parent,
 *     xmlNode** c_start_node, Py_ssize_t* c_step, Py_ssize_t* c_length) except -1:
 */

static  int __pyx_f_4lxml_5etree__findChildSlice(PyObject *__pyx_v_sliceobject, xmlNode *__pyx_v_c_parent, xmlNode **__pyx_v_c_start_node, Py_ssize_t *__pyx_v_c_step, Py_ssize_t *__pyx_v_c_length) {
  Py_ssize_t __pyx_v_start;
  Py_ssize_t __pyx_v_stop;
  Py_ssize_t __pyx_v_childcount;
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("_findChildSlice");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":781
 *     """
 *     cdef Py_ssize_t start, stop, childcount
 *     childcount = _countElements(c_parent.children)             # <<<<<<<<<<<<<<
 *     if childcount == 0:
 *         c_start_node[0] = NULL
 */
  __pyx_v_childcount = __pyx_f_4lxml_5etree__countElements(__pyx_v_c_parent->children);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":782
 *     cdef Py_ssize_t start, stop, childcount
 *     childcount = _countElements(c_parent.children)
 *     if childcount == 0:             # <<<<<<<<<<<<<<
 *         c_start_node[0] = NULL
 *         c_length[0] = 0
 */
  __pyx_t_1 = (__pyx_v_childcount == 0);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":783
 *     childcount = _countElements(c_parent.children)
 *     if childcount == 0:
 *         c_start_node[0] = NULL             # <<<<<<<<<<<<<<
 *         c_length[0] = 0
 *         if sliceobject.step is None:
 */
    (__pyx_v_c_start_node[0]) = NULL;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":784
 *     if childcount == 0:
 *         c_start_node[0] = NULL
 *         c_length[0] = 0             # <<<<<<<<<<<<<<
 *         if sliceobject.step is None:
 *             c_step[0] = 1
 */
    (__pyx_v_c_length[0]) = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":785
 *         c_start_node[0] = NULL
 *         c_length[0] = 0
 *         if sliceobject.step is None:             # <<<<<<<<<<<<<<
 *             c_step[0] = 1
 *         else:
 */
    __pyx_t_1 = (((PySliceObject*)__pyx_v_sliceobject)->step == Py_None);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":786
 *         c_length[0] = 0
 *         if sliceobject.step is None:
 *             c_step[0] = 1             # <<<<<<<<<<<<<<
 *         else:
 *             python._PyEval_SliceIndex(sliceobject.step, c_step)
 */
      (__pyx_v_c_step[0]) = 1;
      goto __pyx_L4;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":788
 *             c_step[0] = 1
 *         else:
 *             python._PyEval_SliceIndex(sliceobject.step, c_step)             # <<<<<<<<<<<<<<
 *         return 0
 *     python.PySlice_GetIndicesEx(
 */
      __pyx_t_2 = ((PySliceObject*)__pyx_v_sliceobject)->step;
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_3 = _PyEval_SliceIndex(__pyx_t_2, __pyx_v_c_step); if (unlikely(__pyx_t_3 == 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 788; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __pyx_L4:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":789
 *         else:
 *             python._PyEval_SliceIndex(sliceobject.step, c_step)
 *         return 0             # <<<<<<<<<<<<<<
 *     python.PySlice_GetIndicesEx(
 *         sliceobject, childcount, &start, &stop, c_step, c_length)
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":791
 *         return 0
 *     python.PySlice_GetIndicesEx(
 *         sliceobject, childcount, &start, &stop, c_step, c_length)             # <<<<<<<<<<<<<<
 *     if start > childcount / 2:
 *         c_start_node[0] = _findChildBackwards(c_parent, childcount - start - 1)
 */
  __pyx_t_3 = PySlice_GetIndicesEx(__pyx_v_sliceobject, __pyx_v_childcount, (&__pyx_v_start), (&__pyx_v_stop), __pyx_v_c_step, __pyx_v_c_length); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":792
 *     python.PySlice_GetIndicesEx(
 *         sliceobject, childcount, &start, &stop, c_step, c_length)
 *     if start > childcount / 2:             # <<<<<<<<<<<<<<
 *         c_start_node[0] = _findChildBackwards(c_parent, childcount - start - 1)
 *     else:
 */
  __pyx_t_1 = (__pyx_v_start > __Pyx_div_Py_ssize_t(__pyx_v_childcount, 2));
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":793
 *         sliceobject, childcount, &start, &stop, c_step, c_length)
 *     if start > childcount / 2:
 *         c_start_node[0] = _findChildBackwards(c_parent, childcount - start - 1)             # <<<<<<<<<<<<<<
 *     else:
 *         c_start_node[0] = _findChild(c_parent, start)
 */
    (__pyx_v_c_start_node[0]) = __pyx_f_4lxml_5etree__findChildBackwards(__pyx_v_c_parent, ((__pyx_v_childcount - __pyx_v_start) - 1));
    goto __pyx_L5;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":795
 *         c_start_node[0] = _findChildBackwards(c_parent, childcount - start - 1)
 *     else:
 *         c_start_node[0] = _findChild(c_parent, start)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    (__pyx_v_c_start_node[0]) = __pyx_f_4lxml_5etree__findChild(__pyx_v_c_parent, __pyx_v_start);
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":796
 *     else:
 *         c_start_node[0] = _findChild(c_parent, start)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef bint _isFullSlice(slice sliceobject):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._findChildSlice");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":798
 *     return 0
 * 
 * cdef bint _isFullSlice(slice sliceobject):             # <<<<<<<<<<<<<<
 *     u"""Conservative guess if this slice is a full slice as in ``s[:]``.
 *     """
 */

static  int __pyx_f_4lxml_5etree__isFullSlice(PyObject *__pyx_v_sliceobject) {
  Py_ssize_t __pyx_v_step;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("_isFullSlice");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":802
 *     """
 *     cdef Py_ssize_t step
 *     if sliceobject is None:             # <<<<<<<<<<<<<<
 *         return 0
 *     if sliceobject.start is None and \
 */
  __pyx_t_1 = (__pyx_v_sliceobject == ((PyObject*)Py_None));
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":803
 *     cdef Py_ssize_t step
 *     if sliceobject is None:
 *         return 0             # <<<<<<<<<<<<<<
 *     if sliceobject.start is None and \
 *             sliceobject.stop is None:
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":804
 *     if sliceobject is None:
 *         return 0
 *     if sliceobject.start is None and \             # <<<<<<<<<<<<<<
 *             sliceobject.stop is None:
 *         if sliceobject.step is None:
 */
  __pyx_t_1 = (((PySliceObject*)__pyx_v_sliceobject)->start == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":805
 *         return 0
 *     if sliceobject.start is None and \
 *             sliceobject.stop is None:             # <<<<<<<<<<<<<<
 *         if sliceobject.step is None:
 *             return 1
 */
    __pyx_t_2 = (((PySliceObject*)__pyx_v_sliceobject)->stop == Py_None);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":806
 *     if sliceobject.start is None and \
 *             sliceobject.stop is None:
 *         if sliceobject.step is None:             # <<<<<<<<<<<<<<
 *             return 1
 *         python._PyEval_SliceIndex(sliceobject.step, &step)
 */
    __pyx_t_3 = (((PySliceObject*)__pyx_v_sliceobject)->step == Py_None);
    if (__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":807
 *             sliceobject.stop is None:
 *         if sliceobject.step is None:
 *             return 1             # <<<<<<<<<<<<<<
 *         python._PyEval_SliceIndex(sliceobject.step, &step)
 *         if step == 1:
 */
      __pyx_r = 1;
      goto __pyx_L0;
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":808
 *         if sliceobject.step is None:
 *             return 1
 *         python._PyEval_SliceIndex(sliceobject.step, &step)             # <<<<<<<<<<<<<<
 *         if step == 1:
 *             return 1
 */
    __pyx_t_4 = ((PySliceObject*)__pyx_v_sliceobject)->step;
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_5 = _PyEval_SliceIndex(__pyx_t_4, (&__pyx_v_step)); if (unlikely(__pyx_t_5 == 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":809
 *             return 1
 *         python._PyEval_SliceIndex(sliceobject.step, &step)
 *         if step == 1:             # <<<<<<<<<<<<<<
 *             return 1
 *         return 0
 */
    __pyx_t_3 = (__pyx_v_step == 1);
    if (__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":810
 *         python._PyEval_SliceIndex(sliceobject.step, &step)
 *         if step == 1:
 *             return 1             # <<<<<<<<<<<<<<
 *         return 0
 *     return 0
 */
      __pyx_r = 1;
      goto __pyx_L0;
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":811
 *         if step == 1:
 *             return 1
 *         return 0             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":812
 *             return 1
 *         return 0
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef _collectChildren(_Element element):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_WriteUnraisable("lxml.etree._isFullSlice");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":814
 *     return 0
 * 
 * cdef _collectChildren(_Element element):             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     cdef list result = []
 */

static  PyObject *__pyx_f_4lxml_5etree__collectChildren(struct LxmlElement *__pyx_v_element) {
  xmlNode *__pyx_v_c_node;
  PyObject *__pyx_v_result = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("_collectChildren");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":816
 * cdef _collectChildren(_Element element):
 *     cdef xmlNode* c_node
 *     cdef list result = []             # <<<<<<<<<<<<<<
 *     c_node = element._c_node.children
 *     if c_node is not NULL:
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_result = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":817
 *     cdef xmlNode* c_node
 *     cdef list result = []
 *     c_node = element._c_node.children             # <<<<<<<<<<<<<<
 *     if c_node is not NULL:
 *         if not _isElement(c_node):
 */
  __pyx_v_c_node = __pyx_v_element->_c_node->children;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":818
 *     cdef list result = []
 *     c_node = element._c_node.children
 *     if c_node is not NULL:             # <<<<<<<<<<<<<<
 *         if not _isElement(c_node):
 *             c_node = _nextElement(c_node)
 */
  __pyx_t_2 = (__pyx_v_c_node != NULL);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":819
 *     c_node = element._c_node.children
 *     if c_node is not NULL:
 *         if not _isElement(c_node):             # <<<<<<<<<<<<<<
 *             c_node = _nextElement(c_node)
 *         while c_node is not NULL:
 */
    __pyx_t_2 = (!_isElement(__pyx_v_c_node));
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":820
 *     if c_node is not NULL:
 *         if not _isElement(c_node):
 *             c_node = _nextElement(c_node)             # <<<<<<<<<<<<<<
 *         while c_node is not NULL:
 *             result.append(_elementFactory(element._doc, c_node))
 */
      __pyx_v_c_node = __pyx_f_4lxml_5etree__nextElement(__pyx_v_c_node);
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":821
 *         if not _isElement(c_node):
 *             c_node = _nextElement(c_node)
 *         while c_node is not NULL:             # <<<<<<<<<<<<<<
 *             result.append(_elementFactory(element._doc, c_node))
 *             c_node = _nextElement(c_node)
 */
    while (1) {
      __pyx_t_2 = (__pyx_v_c_node != NULL);
      if (!__pyx_t_2) break;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":822
 *             c_node = _nextElement(c_node)
 *         while c_node is not NULL:
 *             result.append(_elementFactory(element._doc, c_node))             # <<<<<<<<<<<<<<
 *             c_node = _nextElement(c_node)
 *     return result
 */
      if (unlikely(__pyx_v_result == Py_None)) {
        PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
      }
      __pyx_t_1 = ((PyObject *)__pyx_v_element->_doc);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_1), __pyx_v_c_node)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_4 = PyList_Append(__pyx_v_result, __pyx_t_3); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":823
 *         while c_node is not NULL:
 *             result.append(_elementFactory(element._doc, c_node))
 *             c_node = _nextElement(c_node)             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
      __pyx_v_c_node = __pyx_f_4lxml_5etree__nextElement(__pyx_v_c_node);
    }
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":824
 *             result.append(_elementFactory(element._doc, c_node))
 *             c_node = _nextElement(c_node)
 *     return result             # <<<<<<<<<<<<<<
 * 
 * cdef inline xmlNode* _findChild(xmlNode* c_node, Py_ssize_t index):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._collectChildren");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":826
 *     return result
 * 
 * cdef inline xmlNode* _findChild(xmlNode* c_node, Py_ssize_t index):             # <<<<<<<<<<<<<<
 *     if index < 0:
 *         return _findChildBackwards(c_node, -index - 1)
 */

static CYTHON_INLINE xmlNode *__pyx_f_4lxml_5etree__findChild(xmlNode *__pyx_v_c_node, Py_ssize_t __pyx_v_index) {
  xmlNode *__pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_findChild");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":827
 * 
 * cdef inline xmlNode* _findChild(xmlNode* c_node, Py_ssize_t index):
 *     if index < 0:             # <<<<<<<<<<<<<<
 *         return _findChildBackwards(c_node, -index - 1)
 *     else:
 */
  __pyx_t_1 = (__pyx_v_index < 0);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":828
 * cdef inline xmlNode* _findChild(xmlNode* c_node, Py_ssize_t index):
 *     if index < 0:
 *         return _findChildBackwards(c_node, -index - 1)             # <<<<<<<<<<<<<<
 *     else:
 *         return _findChildForwards(c_node, index)
 */
    __pyx_r = __pyx_f_4lxml_5etree__findChildBackwards(__pyx_v_c_node, ((-__pyx_v_index) - 1));
    goto __pyx_L0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":830
 *         return _findChildBackwards(c_node, -index - 1)
 *     else:
 *         return _findChildForwards(c_node, index)             # <<<<<<<<<<<<<<
 * 
 * cdef inline xmlNode* _findChildForwards(xmlNode* c_node, Py_ssize_t index):
 */
    __pyx_r = __pyx_f_4lxml_5etree__findChildForwards(__pyx_v_c_node, __pyx_v_index);
    goto __pyx_L0;
  }
  __pyx_L3:;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":832
 *         return _findChildForwards(c_node, index)
 * 
 * cdef inline xmlNode* _findChildForwards(xmlNode* c_node, Py_ssize_t index):             # <<<<<<<<<<<<<<
 *     u"""Return child element of c_node with index, or return NULL if not found.
 *     """
 */

static CYTHON_INLINE xmlNode *__pyx_f_4lxml_5etree__findChildForwards(xmlNode *__pyx_v_c_node, Py_ssize_t __pyx_v_index) {
  xmlNode *__pyx_v_c_child;
  Py_ssize_t __pyx_v_c;
  xmlNode *__pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_findChildForwards");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":837
 *     cdef xmlNode* c_child
 *     cdef Py_ssize_t c
 *     c_child = c_node.children             # <<<<<<<<<<<<<<
 *     c = 0
 *     while c_child is not NULL:
 */
  __pyx_v_c_child = __pyx_v_c_node->children;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":838
 *     cdef Py_ssize_t c
 *     c_child = c_node.children
 *     c = 0             # <<<<<<<<<<<<<<
 *     while c_child is not NULL:
 *         if _isElement(c_child):
 */
  __pyx_v_c = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":839
 *     c_child = c_node.children
 *     c = 0
 *     while c_child is not NULL:             # <<<<<<<<<<<<<<
 *         if _isElement(c_child):
 *             if c == index:
 */
  while (1) {
    __pyx_t_1 = (__pyx_v_c_child != NULL);
    if (!__pyx_t_1) break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":840
 *     c = 0
 *     while c_child is not NULL:
 *         if _isElement(c_child):             # <<<<<<<<<<<<<<
 *             if c == index:
 *                 return c_child
 */
    __pyx_t_1 = _isElement(__pyx_v_c_child);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":841
 *     while c_child is not NULL:
 *         if _isElement(c_child):
 *             if c == index:             # <<<<<<<<<<<<<<
 *                 return c_child
 *             c = c + 1
 */
      __pyx_t_1 = (__pyx_v_c == __pyx_v_index);
      if (__pyx_t_1) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":842
 *         if _isElement(c_child):
 *             if c == index:
 *                 return c_child             # <<<<<<<<<<<<<<
 *             c = c + 1
 *         c_child = c_child.next
 */
        __pyx_r = __pyx_v_c_child;
        goto __pyx_L0;
        goto __pyx_L6;
      }
      __pyx_L6:;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":843
 *             if c == index:
 *                 return c_child
 *             c = c + 1             # <<<<<<<<<<<<<<
 *         c_child = c_child.next
 *     return NULL
 */
      __pyx_v_c = (__pyx_v_c + 1);
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":844
 *                 return c_child
 *             c = c + 1
 *         c_child = c_child.next             # <<<<<<<<<<<<<<
 *     return NULL
 * 
 */
    __pyx_v_c_child = __pyx_v_c_child->next;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":845
 *             c = c + 1
 *         c_child = c_child.next
 *     return NULL             # <<<<<<<<<<<<<<
 * 
 * cdef inline xmlNode* _findChildBackwards(xmlNode* c_node, Py_ssize_t index):
 */
  __pyx_r = NULL;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":847
 *     return NULL
 * 
 * cdef inline xmlNode* _findChildBackwards(xmlNode* c_node, Py_ssize_t index):             # <<<<<<<<<<<<<<
 *     u"""Return child element of c_node with index, or return NULL if not found.
 *     Search from the end.
 */

static CYTHON_INLINE xmlNode *__pyx_f_4lxml_5etree__findChildBackwards(xmlNode *__pyx_v_c_node, Py_ssize_t __pyx_v_index) {
  xmlNode *__pyx_v_c_child;
  Py_ssize_t __pyx_v_c;
  xmlNode *__pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_findChildBackwards");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":853
 *     cdef xmlNode* c_child
 *     cdef Py_ssize_t c
 *     c_child = c_node.last             # <<<<<<<<<<<<<<
 *     c = 0
 *     while c_child is not NULL:
 */
  __pyx_v_c_child = __pyx_v_c_node->last;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":854
 *     cdef Py_ssize_t c
 *     c_child = c_node.last
 *     c = 0             # <<<<<<<<<<<<<<
 *     while c_child is not NULL:
 *         if _isElement(c_child):
 */
  __pyx_v_c = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":855
 *     c_child = c_node.last
 *     c = 0
 *     while c_child is not NULL:             # <<<<<<<<<<<<<<
 *         if _isElement(c_child):
 *             if c == index:
 */
  while (1) {
    __pyx_t_1 = (__pyx_v_c_child != NULL);
    if (!__pyx_t_1) break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":856
 *     c = 0
 *     while c_child is not NULL:
 *         if _isElement(c_child):             # <<<<<<<<<<<<<<
 *             if c == index:
 *                 return c_child
 */
    __pyx_t_1 = _isElement(__pyx_v_c_child);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":857
 *     while c_child is not NULL:
 *         if _isElement(c_child):
 *             if c == index:             # <<<<<<<<<<<<<<
 *                 return c_child
 *             c = c + 1
 */
      __pyx_t_1 = (__pyx_v_c == __pyx_v_index);
      if (__pyx_t_1) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":858
 *         if _isElement(c_child):
 *             if c == index:
 *                 return c_child             # <<<<<<<<<<<<<<
 *             c = c + 1
 *         c_child = c_child.prev
 */
        __pyx_r = __pyx_v_c_child;
        goto __pyx_L0;
        goto __pyx_L6;
      }
      __pyx_L6:;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":859
 *             if c == index:
 *                 return c_child
 *             c = c + 1             # <<<<<<<<<<<<<<
 *         c_child = c_child.prev
 *     return NULL
 */
      __pyx_v_c = (__pyx_v_c + 1);
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":860
 *                 return c_child
 *             c = c + 1
 *         c_child = c_child.prev             # <<<<<<<<<<<<<<
 *     return NULL
 * 
 */
    __pyx_v_c_child = __pyx_v_c_child->prev;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":861
 *             c = c + 1
 *         c_child = c_child.prev
 *     return NULL             # <<<<<<<<<<<<<<
 * 
 * cdef inline xmlNode* _textNodeOrSkip(xmlNode* c_node) nogil:
 */
  __pyx_r = NULL;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":863
 *     return NULL
 * 
 * cdef inline xmlNode* _textNodeOrSkip(xmlNode* c_node) nogil:             # <<<<<<<<<<<<<<
 *     u"""Return the node if it's a text node.  Skip over ignorable nodes in a
 *     series of text nodes.  Return NULL if a non-ignorable node is found.
 */

static CYTHON_INLINE xmlNode *__pyx_f_4lxml_5etree__textNodeOrSkip(xmlNode *__pyx_v_c_node) {
  xmlNode *__pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":870
 *     nodes.
 *     """
 *     while c_node is not NULL:             # <<<<<<<<<<<<<<
 *         if c_node.type == tree.XML_TEXT_NODE or \
 *                c_node.type == tree.XML_CDATA_SECTION_NODE:
 */
  while (1) {
    __pyx_t_1 = (__pyx_v_c_node != NULL);
    if (!__pyx_t_1) break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":871
 *     """
 *     while c_node is not NULL:
 *         if c_node.type == tree.XML_TEXT_NODE or \             # <<<<<<<<<<<<<<
 *                c_node.type == tree.XML_CDATA_SECTION_NODE:
 *             return c_node
 */
    __pyx_t_1 = (__pyx_v_c_node->type == XML_TEXT_NODE);
    if (!__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":872
 *     while c_node is not NULL:
 *         if c_node.type == tree.XML_TEXT_NODE or \
 *                c_node.type == tree.XML_CDATA_SECTION_NODE:             # <<<<<<<<<<<<<<
 *             return c_node
 *         elif c_node.type == tree.XML_XINCLUDE_START or \
 */
      __pyx_t_2 = (__pyx_v_c_node->type == XML_CDATA_SECTION_NODE);
      __pyx_t_3 = __pyx_t_2;
    } else {
      __pyx_t_3 = __pyx_t_1;
    }
    if (__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":873
 *         if c_node.type == tree.XML_TEXT_NODE or \
 *                c_node.type == tree.XML_CDATA_SECTION_NODE:
 *             return c_node             # <<<<<<<<<<<<<<
 *         elif c_node.type == tree.XML_XINCLUDE_START or \
 *                  c_node.type == tree.XML_XINCLUDE_END:
 */
      __pyx_r = __pyx_v_c_node;
      goto __pyx_L0;
      goto __pyx_L5;
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":874
 *                c_node.type == tree.XML_CDATA_SECTION_NODE:
 *             return c_node
 *         elif c_node.type == tree.XML_XINCLUDE_START or \             # <<<<<<<<<<<<<<
 *                  c_node.type == tree.XML_XINCLUDE_END:
 *             c_node = c_node.next
 */
    __pyx_t_3 = (__pyx_v_c_node->type == XML_XINCLUDE_START);
    if (!__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":875
 *             return c_node
 *         elif c_node.type == tree.XML_XINCLUDE_START or \
 *                  c_node.type == tree.XML_XINCLUDE_END:             # <<<<<<<<<<<<<<
 *             c_node = c_node.next
 *         else:
 */
      __pyx_t_1 = (__pyx_v_c_node->type == XML_XINCLUDE_END);
      __pyx_t_2 = __pyx_t_1;
    } else {
      __pyx_t_2 = __pyx_t_3;
    }
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":876
 *         elif c_node.type == tree.XML_XINCLUDE_START or \
 *                  c_node.type == tree.XML_XINCLUDE_END:
 *             c_node = c_node.next             # <<<<<<<<<<<<<<
 *         else:
 *             return NULL
 */
      __pyx_v_c_node = __pyx_v_c_node->next;
      goto __pyx_L5;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":878
 *             c_node = c_node.next
 *         else:
 *             return NULL             # <<<<<<<<<<<<<<
 *     return NULL
 * 
 */
      __pyx_r = NULL;
      goto __pyx_L0;
    }
    __pyx_L5:;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":879
 *         else:
 *             return NULL
 *     return NULL             # <<<<<<<<<<<<<<
 * 
 * cdef inline xmlNode* _nextElement(xmlNode* c_node):
 */
  __pyx_r = NULL;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":881
 *     return NULL
 * 
 * cdef inline xmlNode* _nextElement(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     u"""Given a node, find the next sibling that is an element.
 *     """
 */

static CYTHON_INLINE xmlNode *__pyx_f_4lxml_5etree__nextElement(xmlNode *__pyx_v_c_node) {
  xmlNode *__pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_nextElement");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":884
 *     u"""Given a node, find the next sibling that is an element.
 *     """
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         return NULL
 *     c_node = c_node.next
 */
  __pyx_t_1 = (__pyx_v_c_node == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":885
 *     """
 *     if c_node is NULL:
 *         return NULL             # <<<<<<<<<<<<<<
 *     c_node = c_node.next
 *     while c_node is not NULL:
 */
    __pyx_r = NULL;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":886
 *     if c_node is NULL:
 *         return NULL
 *     c_node = c_node.next             # <<<<<<<<<<<<<<
 *     while c_node is not NULL:
 *         if _isElement(c_node):
 */
  __pyx_v_c_node = __pyx_v_c_node->next;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":887
 *         return NULL
 *     c_node = c_node.next
 *     while c_node is not NULL:             # <<<<<<<<<<<<<<
 *         if _isElement(c_node):
 *             return c_node
 */
  while (1) {
    __pyx_t_1 = (__pyx_v_c_node != NULL);
    if (!__pyx_t_1) break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":888
 *     c_node = c_node.next
 *     while c_node is not NULL:
 *         if _isElement(c_node):             # <<<<<<<<<<<<<<
 *             return c_node
 *         c_node = c_node.next
 */
    __pyx_t_1 = _isElement(__pyx_v_c_node);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":889
 *     while c_node is not NULL:
 *         if _isElement(c_node):
 *             return c_node             # <<<<<<<<<<<<<<
 *         c_node = c_node.next
 *     return NULL
 */
      __pyx_r = __pyx_v_c_node;
      goto __pyx_L0;
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":890
 *         if _isElement(c_node):
 *             return c_node
 *         c_node = c_node.next             # <<<<<<<<<<<<<<
 *     return NULL
 * 
 */
    __pyx_v_c_node = __pyx_v_c_node->next;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":891
 *             return c_node
 *         c_node = c_node.next
 *     return NULL             # <<<<<<<<<<<<<<
 * 
 * cdef inline xmlNode* _previousElement(xmlNode* c_node):
 */
  __pyx_r = NULL;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":893
 *     return NULL
 * 
 * cdef inline xmlNode* _previousElement(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     u"""Given a node, find the next sibling that is an element.
 *     """
 */

static CYTHON_INLINE xmlNode *__pyx_f_4lxml_5etree__previousElement(xmlNode *__pyx_v_c_node) {
  xmlNode *__pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_previousElement");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":896
 *     u"""Given a node, find the next sibling that is an element.
 *     """
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         return NULL
 *     c_node = c_node.prev
 */
  __pyx_t_1 = (__pyx_v_c_node == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":897
 *     """
 *     if c_node is NULL:
 *         return NULL             # <<<<<<<<<<<<<<
 *     c_node = c_node.prev
 *     while c_node is not NULL:
 */
    __pyx_r = NULL;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":898
 *     if c_node is NULL:
 *         return NULL
 *     c_node = c_node.prev             # <<<<<<<<<<<<<<
 *     while c_node is not NULL:
 *         if _isElement(c_node):
 */
  __pyx_v_c_node = __pyx_v_c_node->prev;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":899
 *         return NULL
 *     c_node = c_node.prev
 *     while c_node is not NULL:             # <<<<<<<<<<<<<<
 *         if _isElement(c_node):
 *             return c_node
 */
  while (1) {
    __pyx_t_1 = (__pyx_v_c_node != NULL);
    if (!__pyx_t_1) break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":900
 *     c_node = c_node.prev
 *     while c_node is not NULL:
 *         if _isElement(c_node):             # <<<<<<<<<<<<<<
 *             return c_node
 *         c_node = c_node.prev
 */
    __pyx_t_1 = _isElement(__pyx_v_c_node);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":901
 *     while c_node is not NULL:
 *         if _isElement(c_node):
 *             return c_node             # <<<<<<<<<<<<<<
 *         c_node = c_node.prev
 *     return NULL
 */
      __pyx_r = __pyx_v_c_node;
      goto __pyx_L0;
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":902
 *         if _isElement(c_node):
 *             return c_node
 *         c_node = c_node.prev             # <<<<<<<<<<<<<<
 *     return NULL
 * 
 */
    __pyx_v_c_node = __pyx_v_c_node->prev;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":903
 *             return c_node
 *         c_node = c_node.prev
 *     return NULL             # <<<<<<<<<<<<<<
 * 
 * cdef inline xmlNode* _parentElement(xmlNode* c_node):
 */
  __pyx_r = NULL;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":905
 *     return NULL
 * 
 * cdef inline xmlNode* _parentElement(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     u"Given a node, find the parent element."
 *     if c_node is NULL or not _isElement(c_node):
 */

static CYTHON_INLINE xmlNode *__pyx_f_4lxml_5etree__parentElement(xmlNode *__pyx_v_c_node) {
  xmlNode *__pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("_parentElement");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":907
 * cdef inline xmlNode* _parentElement(xmlNode* c_node):
 *     u"Given a node, find the parent element."
 *     if c_node is NULL or not _isElement(c_node):             # <<<<<<<<<<<<<<
 *         return NULL
 *     c_node = c_node.parent
 */
  __pyx_t_1 = (__pyx_v_c_node == NULL);
  if (!__pyx_t_1) {
    __pyx_t_2 = (!_isElement(__pyx_v_c_node));
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":908
 *     u"Given a node, find the parent element."
 *     if c_node is NULL or not _isElement(c_node):
 *         return NULL             # <<<<<<<<<<<<<<
 *     c_node = c_node.parent
 *     if c_node is NULL or not _isElement(c_node):
 */
    __pyx_r = NULL;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":909
 *     if c_node is NULL or not _isElement(c_node):
 *         return NULL
 *     c_node = c_node.parent             # <<<<<<<<<<<<<<
 *     if c_node is NULL or not _isElement(c_node):
 *         return NULL
 */
  __pyx_v_c_node = __pyx_v_c_node->parent;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":910
 *         return NULL
 *     c_node = c_node.parent
 *     if c_node is NULL or not _isElement(c_node):             # <<<<<<<<<<<<<<
 *         return NULL
 *     return c_node
 */
  __pyx_t_3 = (__pyx_v_c_node == NULL);
  if (!__pyx_t_3) {
    __pyx_t_1 = (!_isElement(__pyx_v_c_node));
    __pyx_t_2 = __pyx_t_1;
  } else {
    __pyx_t_2 = __pyx_t_3;
  }
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":911
 *     c_node = c_node.parent
 *     if c_node is NULL or not _isElement(c_node):
 *         return NULL             # <<<<<<<<<<<<<<
 *     return c_node
 * 
 */
    __pyx_r = NULL;
    goto __pyx_L0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":912
 *     if c_node is NULL or not _isElement(c_node):
 *         return NULL
 *     return c_node             # <<<<<<<<<<<<<<
 * 
 * cdef inline bint _tagMatches(xmlNode* c_node, char* c_href, char* c_name):
 */
  __pyx_r = __pyx_v_c_node;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":914
 *     return c_node
 * 
 * cdef inline bint _tagMatches(xmlNode* c_node, char* c_href, char* c_name):             # <<<<<<<<<<<<<<
 *     u"""Tests if the node matches namespace URI and tag name.
 * 
 */

static CYTHON_INLINE int __pyx_f_4lxml_5etree__tagMatches(xmlNode *__pyx_v_c_node, char *__pyx_v_c_href, char *__pyx_v_c_name) {
  char *__pyx_v_c_node_href;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("_tagMatches");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":929
 *     """
 *     cdef char* c_node_href
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         return 0
 *     if c_node.type != tree.XML_ELEMENT_NODE:
 */
  __pyx_t_1 = (__pyx_v_c_node == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":930
 *     cdef char* c_node_href
 *     if c_node is NULL:
 *         return 0             # <<<<<<<<<<<<<<
 *     if c_node.type != tree.XML_ELEMENT_NODE:
 *         # not an element, only succeed if we match everything
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":931
 *     if c_node is NULL:
 *         return 0
 *     if c_node.type != tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         # not an element, only succeed if we match everything
 *         return c_name is NULL and c_href is NULL
 */
  __pyx_t_1 = (__pyx_v_c_node->type != XML_ELEMENT_NODE);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":933
 *     if c_node.type != tree.XML_ELEMENT_NODE:
 *         # not an element, only succeed if we match everything
 *         return c_name is NULL and c_href is NULL             # <<<<<<<<<<<<<<
 *     if c_name is NULL:
 *         if c_href is NULL:
 */
    __pyx_t_1 = (__pyx_v_c_name == NULL);
    if (__pyx_t_1) {
      __pyx_t_2 = (__pyx_v_c_href == NULL);
      __pyx_t_3 = __pyx_t_2;
    } else {
      __pyx_t_3 = __pyx_t_1;
    }
    __pyx_r = __pyx_t_3;
    goto __pyx_L0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":934
 *         # not an element, only succeed if we match everything
 *         return c_name is NULL and c_href is NULL
 *     if c_name is NULL:             # <<<<<<<<<<<<<<
 *         if c_href is NULL:
 *             # always match
 */
  __pyx_t_3 = (__pyx_v_c_name == NULL);
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":935
 *         return c_name is NULL and c_href is NULL
 *     if c_name is NULL:
 *         if c_href is NULL:             # <<<<<<<<<<<<<<
 *             # always match
 *             return 1
 */
    __pyx_t_3 = (__pyx_v_c_href == NULL);
    if (__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":937
 *         if c_href is NULL:
 *             # always match
 *             return 1             # <<<<<<<<<<<<<<
 *         else:
 *             c_node_href = _getNs(c_node)
 */
      __pyx_r = 1;
      goto __pyx_L0;
      goto __pyx_L6;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":939
 *             return 1
 *         else:
 *             c_node_href = _getNs(c_node)             # <<<<<<<<<<<<<<
 *             if c_node_href is NULL:
 *                 return c_href[0] == c'\0'
 */
      __pyx_v_c_node_href = _getNs(__pyx_v_c_node);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":940
 *         else:
 *             c_node_href = _getNs(c_node)
 *             if c_node_href is NULL:             # <<<<<<<<<<<<<<
 *                 return c_href[0] == c'\0'
 *             else:
 */
      __pyx_t_3 = (__pyx_v_c_node_href == NULL);
      if (__pyx_t_3) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":941
 *             c_node_href = _getNs(c_node)
 *             if c_node_href is NULL:
 *                 return c_href[0] == c'\0'             # <<<<<<<<<<<<<<
 *             else:
 *                 return cstd.strcmp(c_node_href, c_href) == 0
 */
        __pyx_r = ((__pyx_v_c_href[0]) == '\x00');
        goto __pyx_L0;
        goto __pyx_L7;
      }
      /*else*/ {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":943
 *                 return c_href[0] == c'\0'
 *             else:
 *                 return cstd.strcmp(c_node_href, c_href) == 0             # <<<<<<<<<<<<<<
 *     elif c_href is NULL:
 *         if _getNs(c_node) is not NULL:
 */
        __pyx_r = (strcmp(__pyx_v_c_node_href, __pyx_v_c_href) == 0);
        goto __pyx_L0;
      }
      __pyx_L7:;
    }
    __pyx_L6:;
    goto __pyx_L5;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":944
 *             else:
 *                 return cstd.strcmp(c_node_href, c_href) == 0
 *     elif c_href is NULL:             # <<<<<<<<<<<<<<
 *         if _getNs(c_node) is not NULL:
 *             return 0
 */
  __pyx_t_3 = (__pyx_v_c_href == NULL);
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":945
 *                 return cstd.strcmp(c_node_href, c_href) == 0
 *     elif c_href is NULL:
 *         if _getNs(c_node) is not NULL:             # <<<<<<<<<<<<<<
 *             return 0
 *         return c_node.name == c_name or cstd.strcmp(c_node.name, c_name) == 0
 */
    __pyx_t_3 = (_getNs(__pyx_v_c_node) != NULL);
    if (__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":946
 *     elif c_href is NULL:
 *         if _getNs(c_node) is not NULL:
 *             return 0             # <<<<<<<<<<<<<<
 *         return c_node.name == c_name or cstd.strcmp(c_node.name, c_name) == 0
 *     elif c_node.name == c_name or cstd.strcmp(c_node.name, c_name) == 0:
 */
      __pyx_r = 0;
      goto __pyx_L0;
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":947
 *         if _getNs(c_node) is not NULL:
 *             return 0
 *         return c_node.name == c_name or cstd.strcmp(c_node.name, c_name) == 0             # <<<<<<<<<<<<<<
 *     elif c_node.name == c_name or cstd.strcmp(c_node.name, c_name) == 0:
 *         c_node_href = _getNs(c_node)
 */
    __pyx_t_3 = (__pyx_v_c_node->name == __pyx_v_c_name);
    if (!__pyx_t_3) {
      __pyx_t_1 = (strcmp(__pyx_v_c_node->name, __pyx_v_c_name) == 0);
      __pyx_t_2 = __pyx_t_1;
    } else {
      __pyx_t_2 = __pyx_t_3;
    }
    __pyx_r = __pyx_t_2;
    goto __pyx_L0;
    goto __pyx_L5;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":948
 *             return 0
 *         return c_node.name == c_name or cstd.strcmp(c_node.name, c_name) == 0
 *     elif c_node.name == c_name or cstd.strcmp(c_node.name, c_name) == 0:             # <<<<<<<<<<<<<<
 *         c_node_href = _getNs(c_node)
 *         if c_node_href is NULL:
 */
  __pyx_t_2 = (__pyx_v_c_node->name == __pyx_v_c_name);
  if (!__pyx_t_2) {
    __pyx_t_3 = (strcmp(__pyx_v_c_node->name, __pyx_v_c_name) == 0);
    __pyx_t_1 = __pyx_t_3;
  } else {
    __pyx_t_1 = __pyx_t_2;
  }
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":949
 *         return c_node.name == c_name or cstd.strcmp(c_node.name, c_name) == 0
 *     elif c_node.name == c_name or cstd.strcmp(c_node.name, c_name) == 0:
 *         c_node_href = _getNs(c_node)             # <<<<<<<<<<<<<<
 *         if c_node_href is NULL:
 *             return c_href[0] == c'\0'
 */
    __pyx_v_c_node_href = _getNs(__pyx_v_c_node);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":950
 *     elif c_node.name == c_name or cstd.strcmp(c_node.name, c_name) == 0:
 *         c_node_href = _getNs(c_node)
 *         if c_node_href is NULL:             # <<<<<<<<<<<<<<
 *             return c_href[0] == c'\0'
 *         else:
 */
    __pyx_t_1 = (__pyx_v_c_node_href == NULL);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":951
 *         c_node_href = _getNs(c_node)
 *         if c_node_href is NULL:
 *             return c_href[0] == c'\0'             # <<<<<<<<<<<<<<
 *         else:
 *             return cstd.strcmp(c_node_href, c_href) == 0
 */
      __pyx_r = ((__pyx_v_c_href[0]) == '\x00');
      goto __pyx_L0;
      goto __pyx_L9;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":953
 *             return c_href[0] == c'\0'
 *         else:
 *             return cstd.strcmp(c_node_href, c_href) == 0             # <<<<<<<<<<<<<<
 *     else:
 *         return 0
 */
      __pyx_r = (strcmp(__pyx_v_c_node_href, __pyx_v_c_href) == 0);
      goto __pyx_L0;
    }
    __pyx_L9:;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":955
 *             return cstd.strcmp(c_node_href, c_href) == 0
 *     else:
 *         return 0             # <<<<<<<<<<<<<<
 * 
 * cdef inline bint _tagMatchesExactly(xmlNode* c_node, char* c_href, char* c_name):
 */
    __pyx_r = 0;
    goto __pyx_L0;
  }
  __pyx_L5:;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":957
 *         return 0
 * 
 * cdef inline bint _tagMatchesExactly(xmlNode* c_node, char* c_href, char* c_name):             # <<<<<<<<<<<<<<
 *     u"""Tests if the node matches namespace URI and tag name.
 * 
 */

static CYTHON_INLINE int __pyx_f_4lxml_5etree__tagMatchesExactly(xmlNode *__pyx_v_c_node, char *__pyx_v_c_href, char *__pyx_v_c_name) {
  char *__pyx_v_c_node_href;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("_tagMatchesExactly");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":976
 *     """
 *     cdef char* c_node_href
 *     if c_name is not NULL and c_name is not c_node.name:             # <<<<<<<<<<<<<<
 *         return 0
 *     c_node_href = _getNs(c_node)
 */
  __pyx_t_1 = (__pyx_v_c_name != NULL);
  if (__pyx_t_1) {
    __pyx_t_2 = (__pyx_v_c_name != __pyx_v_c_node->name);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":977
 *     cdef char* c_node_href
 *     if c_name is not NULL and c_name is not c_node.name:
 *         return 0             # <<<<<<<<<<<<<<
 *     c_node_href = _getNs(c_node)
 *     if c_href is NULL:
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":978
 *     if c_name is not NULL and c_name is not c_node.name:
 *         return 0
 *     c_node_href = _getNs(c_node)             # <<<<<<<<<<<<<<
 *     if c_href is NULL:
 *         return c_node_href is NULL or c_node_href[0] == '\0'
 */
  __pyx_v_c_node_href = _getNs(__pyx_v_c_node);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":979
 *         return 0
 *     c_node_href = _getNs(c_node)
 *     if c_href is NULL:             # <<<<<<<<<<<<<<
 *         return c_node_href is NULL or c_node_href[0] == '\0'
 *     elif c_node_href is NULL:
 */
  __pyx_t_3 = (__pyx_v_c_href == NULL);
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":980
 *     c_node_href = _getNs(c_node)
 *     if c_href is NULL:
 *         return c_node_href is NULL or c_node_href[0] == '\0'             # <<<<<<<<<<<<<<
 *     elif c_node_href is NULL:
 *         return 0
 */
    __pyx_t_3 = (__pyx_v_c_node_href == NULL);
    if (!__pyx_t_3) {
      __pyx_t_1 = ((__pyx_v_c_node_href[0]) == '\x00');
      __pyx_t_2 = __pyx_t_1;
    } else {
      __pyx_t_2 = __pyx_t_3;
    }
    __pyx_r = __pyx_t_2;
    goto __pyx_L0;
    goto __pyx_L4;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":981
 *     if c_href is NULL:
 *         return c_node_href is NULL or c_node_href[0] == '\0'
 *     elif c_node_href is NULL:             # <<<<<<<<<<<<<<
 *         return 0
 *     else:
 */
  __pyx_t_2 = (__pyx_v_c_node_href == NULL);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":982
 *         return c_node_href is NULL or c_node_href[0] == '\0'
 *     elif c_node_href is NULL:
 *         return 0             # <<<<<<<<<<<<<<
 *     else:
 *         return cstd.strcmp(c_href, c_node_href) == 0
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":984
 *         return 0
 *     else:
 *         return cstd.strcmp(c_href, c_node_href) == 0             # <<<<<<<<<<<<<<
 * 
 * cdef int _removeNode(_Document doc, xmlNode* c_node) except -1:
 */
    __pyx_r = (strcmp(__pyx_v_c_href, __pyx_v_c_node_href) == 0);
    goto __pyx_L0;
  }
  __pyx_L4:;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":986
 *         return cstd.strcmp(c_href, c_node_href) == 0
 * 
 * cdef int _removeNode(_Document doc, xmlNode* c_node) except -1:             # <<<<<<<<<<<<<<
 *     u"""Unlink and free a node and subnodes if possible.  Otherwise, make sure
 *     it's self-contained.
 */

static  int __pyx_f_4lxml_5etree__removeNode(struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node) {
  xmlNode *__pyx_v_c_next;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("_removeNode");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":991
 *     """
 *     cdef xmlNode* c_next
 *     c_next = c_node.next             # <<<<<<<<<<<<<<
 *     tree.xmlUnlinkNode(c_node)
 *     _moveTail(c_next, c_node)
 */
  __pyx_v_c_next = __pyx_v_c_node->next;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":992
 *     cdef xmlNode* c_next
 *     c_next = c_node.next
 *     tree.xmlUnlinkNode(c_node)             # <<<<<<<<<<<<<<
 *     _moveTail(c_next, c_node)
 *     if not attemptDeallocation(c_node):
 */
  xmlUnlinkNode(__pyx_v_c_node);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":993
 *     c_next = c_node.next
 *     tree.xmlUnlinkNode(c_node)
 *     _moveTail(c_next, c_node)             # <<<<<<<<<<<<<<
 *     if not attemptDeallocation(c_node):
 *         # make namespaces absolute
 */
  __pyx_f_4lxml_5etree__moveTail(__pyx_v_c_next, __pyx_v_c_node);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":994
 *     tree.xmlUnlinkNode(c_node)
 *     _moveTail(c_next, c_node)
 *     if not attemptDeallocation(c_node):             # <<<<<<<<<<<<<<
 *         # make namespaces absolute
 *         moveNodeToDocument(doc, c_node.doc, c_node)
 */
  __pyx_t_1 = (!__pyx_f_4lxml_5etree_attemptDeallocation(__pyx_v_c_node));
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":996
 *     if not attemptDeallocation(c_node):
 *         # make namespaces absolute
 *         moveNodeToDocument(doc, c_node.doc, c_node)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree_moveNodeToDocument(__pyx_v_doc, __pyx_v_c_node->doc, __pyx_v_c_node); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 996; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":997
 *         # make namespaces absolute
 *         moveNodeToDocument(doc, c_node.doc, c_node)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int _removeSiblings(xmlNode* c_element, int node_type, bint with_tail) except -1:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._removeNode");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":999
 *     return 0
 * 
 * cdef int _removeSiblings(xmlNode* c_element, int node_type, bint with_tail) except -1:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     cdef xmlNode* c_next
 */

static  int __pyx_f_4lxml_5etree__removeSiblings(xmlNode *__pyx_v_c_element, int __pyx_v_node_type, int __pyx_v_with_tail) {
  xmlNode *__pyx_v_c_node;
  xmlNode *__pyx_v_c_next;
  int __pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_removeSiblings");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1002
 *     cdef xmlNode* c_node
 *     cdef xmlNode* c_next
 *     c_node = c_element.next             # <<<<<<<<<<<<<<
 *     while c_node is not NULL:
 *         c_next = _nextElement(c_node)
 */
  __pyx_v_c_node = __pyx_v_c_element->next;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1003
 *     cdef xmlNode* c_next
 *     c_node = c_element.next
 *     while c_node is not NULL:             # <<<<<<<<<<<<<<
 *         c_next = _nextElement(c_node)
 *         if c_node.type == node_type:
 */
  while (1) {
    __pyx_t_1 = (__pyx_v_c_node != NULL);
    if (!__pyx_t_1) break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1004
 *     c_node = c_element.next
 *     while c_node is not NULL:
 *         c_next = _nextElement(c_node)             # <<<<<<<<<<<<<<
 *         if c_node.type == node_type:
 *             if with_tail:
 */
    __pyx_v_c_next = __pyx_f_4lxml_5etree__nextElement(__pyx_v_c_node);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1005
 *     while c_node is not NULL:
 *         c_next = _nextElement(c_node)
 *         if c_node.type == node_type:             # <<<<<<<<<<<<<<
 *             if with_tail:
 *                 _removeText(c_node.next)
 */
    __pyx_t_1 = (__pyx_v_c_node->type == __pyx_v_node_type);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1006
 *         c_next = _nextElement(c_node)
 *         if c_node.type == node_type:
 *             if with_tail:             # <<<<<<<<<<<<<<
 *                 _removeText(c_node.next)
 *             tree.xmlUnlinkNode(c_node)
 */
      if (__pyx_v_with_tail) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1007
 *         if c_node.type == node_type:
 *             if with_tail:
 *                 _removeText(c_node.next)             # <<<<<<<<<<<<<<
 *             tree.xmlUnlinkNode(c_node)
 *             attemptDeallocation(c_node)
 */
        __pyx_f_4lxml_5etree__removeText(__pyx_v_c_node->next);
        goto __pyx_L6;
      }
      __pyx_L6:;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1008
 *             if with_tail:
 *                 _removeText(c_node.next)
 *             tree.xmlUnlinkNode(c_node)             # <<<<<<<<<<<<<<
 *             attemptDeallocation(c_node)
 *         c_node = c_next
 */
      xmlUnlinkNode(__pyx_v_c_node);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1009
 *                 _removeText(c_node.next)
 *             tree.xmlUnlinkNode(c_node)
 *             attemptDeallocation(c_node)             # <<<<<<<<<<<<<<
 *         c_node = c_next
 *     c_node = c_element.prev
 */
      __pyx_f_4lxml_5etree_attemptDeallocation(__pyx_v_c_node);
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1010
 *             tree.xmlUnlinkNode(c_node)
 *             attemptDeallocation(c_node)
 *         c_node = c_next             # <<<<<<<<<<<<<<
 *     c_node = c_element.prev
 *     while c_node is not NULL:
 */
    __pyx_v_c_node = __pyx_v_c_next;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1011
 *             attemptDeallocation(c_node)
 *         c_node = c_next
 *     c_node = c_element.prev             # <<<<<<<<<<<<<<
 *     while c_node is not NULL:
 *         c_next = _previousElement(c_node)
 */
  __pyx_v_c_node = __pyx_v_c_element->prev;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1012
 *         c_node = c_next
 *     c_node = c_element.prev
 *     while c_node is not NULL:             # <<<<<<<<<<<<<<
 *         c_next = _previousElement(c_node)
 *         if c_node.type == node_type:
 */
  while (1) {
    __pyx_t_1 = (__pyx_v_c_node != NULL);
    if (!__pyx_t_1) break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1013
 *     c_node = c_element.prev
 *     while c_node is not NULL:
 *         c_next = _previousElement(c_node)             # <<<<<<<<<<<<<<
 *         if c_node.type == node_type:
 *             if with_tail:
 */
    __pyx_v_c_next = __pyx_f_4lxml_5etree__previousElement(__pyx_v_c_node);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1014
 *     while c_node is not NULL:
 *         c_next = _previousElement(c_node)
 *         if c_node.type == node_type:             # <<<<<<<<<<<<<<
 *             if with_tail:
 *                 _removeText(c_node.next)
 */
    __pyx_t_1 = (__pyx_v_c_node->type == __pyx_v_node_type);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1015
 *         c_next = _previousElement(c_node)
 *         if c_node.type == node_type:
 *             if with_tail:             # <<<<<<<<<<<<<<
 *                 _removeText(c_node.next)
 *             tree.xmlUnlinkNode(c_node)
 */
      if (__pyx_v_with_tail) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1016
 *         if c_node.type == node_type:
 *             if with_tail:
 *                 _removeText(c_node.next)             # <<<<<<<<<<<<<<
 *             tree.xmlUnlinkNode(c_node)
 *             attemptDeallocation(c_node)
 */
        __pyx_f_4lxml_5etree__removeText(__pyx_v_c_node->next);
        goto __pyx_L10;
      }
      __pyx_L10:;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1017
 *             if with_tail:
 *                 _removeText(c_node.next)
 *             tree.xmlUnlinkNode(c_node)             # <<<<<<<<<<<<<<
 *             attemptDeallocation(c_node)
 *         c_node = c_next
 */
      xmlUnlinkNode(__pyx_v_c_node);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1018
 *                 _removeText(c_node.next)
 *             tree.xmlUnlinkNode(c_node)
 *             attemptDeallocation(c_node)             # <<<<<<<<<<<<<<
 *         c_node = c_next
 *     return 0
 */
      __pyx_f_4lxml_5etree_attemptDeallocation(__pyx_v_c_node);
      goto __pyx_L9;
    }
    __pyx_L9:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1019
 *             tree.xmlUnlinkNode(c_node)
 *             attemptDeallocation(c_node)
 *         c_node = c_next             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    __pyx_v_c_node = __pyx_v_c_next;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1020
 *             attemptDeallocation(c_node)
 *         c_node = c_next
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef void _moveTail(xmlNode* c_tail, xmlNode* c_target):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1022
 *     return 0
 * 
 * cdef void _moveTail(xmlNode* c_tail, xmlNode* c_target):             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_next
 *     # tail support: look for any text nodes trailing this node and
 */

static  void __pyx_f_4lxml_5etree__moveTail(xmlNode *__pyx_v_c_tail, xmlNode *__pyx_v_c_target) {
  xmlNode *__pyx_v_c_next;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_moveTail");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1026
 *     # tail support: look for any text nodes trailing this node and
 *     # move them too
 *     c_tail = _textNodeOrSkip(c_tail)             # <<<<<<<<<<<<<<
 *     while c_tail is not NULL:
 *         c_next = _textNodeOrSkip(c_tail.next)
 */
  __pyx_v_c_tail = __pyx_f_4lxml_5etree__textNodeOrSkip(__pyx_v_c_tail);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1027
 *     # move them too
 *     c_tail = _textNodeOrSkip(c_tail)
 *     while c_tail is not NULL:             # <<<<<<<<<<<<<<
 *         c_next = _textNodeOrSkip(c_tail.next)
 *         tree.xmlUnlinkNode(c_tail)
 */
  while (1) {
    __pyx_t_1 = (__pyx_v_c_tail != NULL);
    if (!__pyx_t_1) break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1028
 *     c_tail = _textNodeOrSkip(c_tail)
 *     while c_tail is not NULL:
 *         c_next = _textNodeOrSkip(c_tail.next)             # <<<<<<<<<<<<<<
 *         tree.xmlUnlinkNode(c_tail)
 *         tree.xmlAddNextSibling(c_target, c_tail)
 */
    __pyx_v_c_next = __pyx_f_4lxml_5etree__textNodeOrSkip(__pyx_v_c_tail->next);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1029
 *     while c_tail is not NULL:
 *         c_next = _textNodeOrSkip(c_tail.next)
 *         tree.xmlUnlinkNode(c_tail)             # <<<<<<<<<<<<<<
 *         tree.xmlAddNextSibling(c_target, c_tail)
 *         c_target = c_tail
 */
    xmlUnlinkNode(__pyx_v_c_tail);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1030
 *         c_next = _textNodeOrSkip(c_tail.next)
 *         tree.xmlUnlinkNode(c_tail)
 *         tree.xmlAddNextSibling(c_target, c_tail)             # <<<<<<<<<<<<<<
 *         c_target = c_tail
 *         c_tail = c_next
 */
    xmlAddNextSibling(__pyx_v_c_target, __pyx_v_c_tail);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1031
 *         tree.xmlUnlinkNode(c_tail)
 *         tree.xmlAddNextSibling(c_target, c_tail)
 *         c_target = c_tail             # <<<<<<<<<<<<<<
 *         c_tail = c_next
 * 
 */
    __pyx_v_c_target = __pyx_v_c_tail;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1032
 *         tree.xmlAddNextSibling(c_target, c_tail)
 *         c_target = c_tail
 *         c_tail = c_next             # <<<<<<<<<<<<<<
 * 
 * cdef int _copyTail(xmlNode* c_tail, xmlNode* c_target) except -1:
 */
    __pyx_v_c_tail = __pyx_v_c_next;
  }

  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1034
 *         c_tail = c_next
 * 
 * cdef int _copyTail(xmlNode* c_tail, xmlNode* c_target) except -1:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_new_tail
 *     # tail copying support: look for any text nodes trailing this node and
 */

static  int __pyx_f_4lxml_5etree__copyTail(xmlNode *__pyx_v_c_tail, xmlNode *__pyx_v_c_target) {
  xmlNode *__pyx_v_c_new_tail;
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_copyTail");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1038
 *     # tail copying support: look for any text nodes trailing this node and
 *     # copy it to the target node
 *     c_tail = _textNodeOrSkip(c_tail)             # <<<<<<<<<<<<<<
 *     while c_tail is not NULL:
 *         if c_target.doc is not c_tail.doc:
 */
  __pyx_v_c_tail = __pyx_f_4lxml_5etree__textNodeOrSkip(__pyx_v_c_tail);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1039
 *     # copy it to the target node
 *     c_tail = _textNodeOrSkip(c_tail)
 *     while c_tail is not NULL:             # <<<<<<<<<<<<<<
 *         if c_target.doc is not c_tail.doc:
 *             c_new_tail = tree.xmlDocCopyNode(c_tail, c_target.doc, 0)
 */
  while (1) {
    __pyx_t_1 = (__pyx_v_c_tail != NULL);
    if (!__pyx_t_1) break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1040
 *     c_tail = _textNodeOrSkip(c_tail)
 *     while c_tail is not NULL:
 *         if c_target.doc is not c_tail.doc:             # <<<<<<<<<<<<<<
 *             c_new_tail = tree.xmlDocCopyNode(c_tail, c_target.doc, 0)
 *         else:
 */
    __pyx_t_1 = (__pyx_v_c_target->doc != __pyx_v_c_tail->doc);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1041
 *     while c_tail is not NULL:
 *         if c_target.doc is not c_tail.doc:
 *             c_new_tail = tree.xmlDocCopyNode(c_tail, c_target.doc, 0)             # <<<<<<<<<<<<<<
 *         else:
 *             c_new_tail = tree.xmlCopyNode(c_tail, 0)
 */
      __pyx_v_c_new_tail = xmlDocCopyNode(__pyx_v_c_tail, __pyx_v_c_target->doc, 0);
      goto __pyx_L5;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1043
 *             c_new_tail = tree.xmlDocCopyNode(c_tail, c_target.doc, 0)
 *         else:
 *             c_new_tail = tree.xmlCopyNode(c_tail, 0)             # <<<<<<<<<<<<<<
 *         if c_new_tail is NULL:
 *             python.PyErr_NoMemory()
 */
      __pyx_v_c_new_tail = xmlCopyNode(__pyx_v_c_tail, 0);
    }
    __pyx_L5:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1044
 *         else:
 *             c_new_tail = tree.xmlCopyNode(c_tail, 0)
 *         if c_new_tail is NULL:             # <<<<<<<<<<<<<<
 *             python.PyErr_NoMemory()
 *         tree.xmlAddNextSibling(c_target, c_new_tail)
 */
    __pyx_t_1 = (__pyx_v_c_new_tail == NULL);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1045
 *             c_new_tail = tree.xmlCopyNode(c_tail, 0)
 *         if c_new_tail is NULL:
 *             python.PyErr_NoMemory()             # <<<<<<<<<<<<<<
 *         tree.xmlAddNextSibling(c_target, c_new_tail)
 *         c_target = c_new_tail
 */
      __pyx_t_2 = PyErr_NoMemory(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1045; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1046
 *         if c_new_tail is NULL:
 *             python.PyErr_NoMemory()
 *         tree.xmlAddNextSibling(c_target, c_new_tail)             # <<<<<<<<<<<<<<
 *         c_target = c_new_tail
 *         c_tail = _textNodeOrSkip(c_tail.next)
 */
    xmlAddNextSibling(__pyx_v_c_target, __pyx_v_c_new_tail);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1047
 *             python.PyErr_NoMemory()
 *         tree.xmlAddNextSibling(c_target, c_new_tail)
 *         c_target = c_new_tail             # <<<<<<<<<<<<<<
 *         c_tail = _textNodeOrSkip(c_tail.next)
 *     return 0
 */
    __pyx_v_c_target = __pyx_v_c_new_tail;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1048
 *         tree.xmlAddNextSibling(c_target, c_new_tail)
 *         c_target = c_new_tail
 *         c_tail = _textNodeOrSkip(c_tail.next)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    __pyx_v_c_tail = __pyx_f_4lxml_5etree__textNodeOrSkip(__pyx_v_c_tail->next);
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1049
 *         c_target = c_new_tail
 *         c_tail = _textNodeOrSkip(c_tail.next)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int _copyNonElementSiblings(xmlNode* c_node, xmlNode* c_target) except -1:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._copyTail");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1051
 *     return 0
 * 
 * cdef int _copyNonElementSiblings(xmlNode* c_node, xmlNode* c_target) except -1:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_copy
 *     cdef xmlNode* c_sibling = c_node
 */

static  int __pyx_f_4lxml_5etree__copyNonElementSiblings(xmlNode *__pyx_v_c_node, xmlNode *__pyx_v_c_target) {
  xmlNode *__pyx_v_c_copy;
  xmlNode *__pyx_v_c_sibling;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("_copyNonElementSiblings");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1053
 * cdef int _copyNonElementSiblings(xmlNode* c_node, xmlNode* c_target) except -1:
 *     cdef xmlNode* c_copy
 *     cdef xmlNode* c_sibling = c_node             # <<<<<<<<<<<<<<
 *     while c_sibling.prev != NULL and \
 *             (c_sibling.prev.type == tree.XML_PI_NODE or \
 */
  __pyx_v_c_sibling = __pyx_v_c_node;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1054
 *     cdef xmlNode* c_copy
 *     cdef xmlNode* c_sibling = c_node
 *     while c_sibling.prev != NULL and \             # <<<<<<<<<<<<<<
 *             (c_sibling.prev.type == tree.XML_PI_NODE or \
 *                  c_sibling.prev.type == tree.XML_COMMENT_NODE):
 */
  while (1) {
    __pyx_t_1 = (__pyx_v_c_sibling->prev != NULL);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1055
 *     cdef xmlNode* c_sibling = c_node
 *     while c_sibling.prev != NULL and \
 *             (c_sibling.prev.type == tree.XML_PI_NODE or \             # <<<<<<<<<<<<<<
 *                  c_sibling.prev.type == tree.XML_COMMENT_NODE):
 *         c_sibling = c_sibling.prev
 */
      __pyx_t_2 = (__pyx_v_c_sibling->prev->type == XML_PI_NODE);
      if (!__pyx_t_2) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1056
 *     while c_sibling.prev != NULL and \
 *             (c_sibling.prev.type == tree.XML_PI_NODE or \
 *                  c_sibling.prev.type == tree.XML_COMMENT_NODE):             # <<<<<<<<<<<<<<
 *         c_sibling = c_sibling.prev
 *     while c_sibling != c_node:
 */
        __pyx_t_3 = (__pyx_v_c_sibling->prev->type == XML_COMMENT_NODE);
        __pyx_t_4 = __pyx_t_3;
      } else {
        __pyx_t_4 = __pyx_t_2;
      }
      __pyx_t_2 = __pyx_t_4;
    } else {
      __pyx_t_2 = __pyx_t_1;
    }
    if (!__pyx_t_2) break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1057
 *             (c_sibling.prev.type == tree.XML_PI_NODE or \
 *                  c_sibling.prev.type == tree.XML_COMMENT_NODE):
 *         c_sibling = c_sibling.prev             # <<<<<<<<<<<<<<
 *     while c_sibling != c_node:
 *         c_copy = tree.xmlDocCopyNode(c_sibling, c_target.doc, 1)
 */
    __pyx_v_c_sibling = __pyx_v_c_sibling->prev;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1058
 *                  c_sibling.prev.type == tree.XML_COMMENT_NODE):
 *         c_sibling = c_sibling.prev
 *     while c_sibling != c_node:             # <<<<<<<<<<<<<<
 *         c_copy = tree.xmlDocCopyNode(c_sibling, c_target.doc, 1)
 *         if c_copy is NULL:
 */
  while (1) {
    __pyx_t_2 = (__pyx_v_c_sibling != __pyx_v_c_node);
    if (!__pyx_t_2) break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1059
 *         c_sibling = c_sibling.prev
 *     while c_sibling != c_node:
 *         c_copy = tree.xmlDocCopyNode(c_sibling, c_target.doc, 1)             # <<<<<<<<<<<<<<
 *         if c_copy is NULL:
 *             python.PyErr_NoMemory()
 */
    __pyx_v_c_copy = xmlDocCopyNode(__pyx_v_c_sibling, __pyx_v_c_target->doc, 1);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1060
 *     while c_sibling != c_node:
 *         c_copy = tree.xmlDocCopyNode(c_sibling, c_target.doc, 1)
 *         if c_copy is NULL:             # <<<<<<<<<<<<<<
 *             python.PyErr_NoMemory()
 *         tree.xmlAddPrevSibling(c_target, c_copy)
 */
    __pyx_t_2 = (__pyx_v_c_copy == NULL);
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1061
 *         c_copy = tree.xmlDocCopyNode(c_sibling, c_target.doc, 1)
 *         if c_copy is NULL:
 *             python.PyErr_NoMemory()             # <<<<<<<<<<<<<<
 *         tree.xmlAddPrevSibling(c_target, c_copy)
 *         c_sibling = c_sibling.next
 */
      __pyx_t_5 = PyErr_NoMemory(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1062
 *         if c_copy is NULL:
 *             python.PyErr_NoMemory()
 *         tree.xmlAddPrevSibling(c_target, c_copy)             # <<<<<<<<<<<<<<
 *         c_sibling = c_sibling.next
 *     while c_sibling.next != NULL and \
 */
    xmlAddPrevSibling(__pyx_v_c_target, __pyx_v_c_copy);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1063
 *             python.PyErr_NoMemory()
 *         tree.xmlAddPrevSibling(c_target, c_copy)
 *         c_sibling = c_sibling.next             # <<<<<<<<<<<<<<
 *     while c_sibling.next != NULL and \
 *             (c_sibling.next.type == tree.XML_PI_NODE or \
 */
    __pyx_v_c_sibling = __pyx_v_c_sibling->next;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1064
 *         tree.xmlAddPrevSibling(c_target, c_copy)
 *         c_sibling = c_sibling.next
 *     while c_sibling.next != NULL and \             # <<<<<<<<<<<<<<
 *             (c_sibling.next.type == tree.XML_PI_NODE or \
 *                  c_sibling.next.type == tree.XML_COMMENT_NODE):
 */
  while (1) {
    __pyx_t_2 = (__pyx_v_c_sibling->next != NULL);
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1065
 *         c_sibling = c_sibling.next
 *     while c_sibling.next != NULL and \
 *             (c_sibling.next.type == tree.XML_PI_NODE or \             # <<<<<<<<<<<<<<
 *                  c_sibling.next.type == tree.XML_COMMENT_NODE):
 *         c_sibling = c_sibling.next
 */
      __pyx_t_1 = (__pyx_v_c_sibling->next->type == XML_PI_NODE);
      if (!__pyx_t_1) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1066
 *     while c_sibling.next != NULL and \
 *             (c_sibling.next.type == tree.XML_PI_NODE or \
 *                  c_sibling.next.type == tree.XML_COMMENT_NODE):             # <<<<<<<<<<<<<<
 *         c_sibling = c_sibling.next
 *         c_copy = tree.xmlDocCopyNode(c_sibling, c_target.doc, 1)
 */
        __pyx_t_4 = (__pyx_v_c_sibling->next->type == XML_COMMENT_NODE);
        __pyx_t_3 = __pyx_t_4;
      } else {
        __pyx_t_3 = __pyx_t_1;
      }
      __pyx_t_1 = __pyx_t_3;
    } else {
      __pyx_t_1 = __pyx_t_2;
    }
    if (!__pyx_t_1) break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1067
 *             (c_sibling.next.type == tree.XML_PI_NODE or \
 *                  c_sibling.next.type == tree.XML_COMMENT_NODE):
 *         c_sibling = c_sibling.next             # <<<<<<<<<<<<<<
 *         c_copy = tree.xmlDocCopyNode(c_sibling, c_target.doc, 1)
 *         if c_copy is NULL:
 */
    __pyx_v_c_sibling = __pyx_v_c_sibling->next;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1068
 *                  c_sibling.next.type == tree.XML_COMMENT_NODE):
 *         c_sibling = c_sibling.next
 *         c_copy = tree.xmlDocCopyNode(c_sibling, c_target.doc, 1)             # <<<<<<<<<<<<<<
 *         if c_copy is NULL:
 *             python.PyErr_NoMemory()
 */
    __pyx_v_c_copy = xmlDocCopyNode(__pyx_v_c_sibling, __pyx_v_c_target->doc, 1);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1069
 *         c_sibling = c_sibling.next
 *         c_copy = tree.xmlDocCopyNode(c_sibling, c_target.doc, 1)
 *         if c_copy is NULL:             # <<<<<<<<<<<<<<
 *             python.PyErr_NoMemory()
 *         tree.xmlAddNextSibling(c_target, c_copy)
 */
    __pyx_t_1 = (__pyx_v_c_copy == NULL);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1070
 *         c_copy = tree.xmlDocCopyNode(c_sibling, c_target.doc, 1)
 *         if c_copy is NULL:
 *             python.PyErr_NoMemory()             # <<<<<<<<<<<<<<
 *         tree.xmlAddNextSibling(c_target, c_copy)
 * 
 */
      __pyx_t_5 = PyErr_NoMemory(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L10;
    }
    __pyx_L10:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1071
 *         if c_copy is NULL:
 *             python.PyErr_NoMemory()
 *         tree.xmlAddNextSibling(c_target, c_copy)             # <<<<<<<<<<<<<<
 * 
 * cdef int _deleteSlice(_Document doc, xmlNode* c_node,
 */
    xmlAddNextSibling(__pyx_v_c_target, __pyx_v_c_copy);
  }

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._copyNonElementSiblings");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1073
 *         tree.xmlAddNextSibling(c_target, c_copy)
 * 
 * cdef int _deleteSlice(_Document doc, xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                       Py_ssize_t count, Py_ssize_t step) except -1:
 *     u"""Delete slice, ``count`` items starting with ``c_node`` with a step
 */

static  int __pyx_f_4lxml_5etree__deleteSlice(struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node, Py_ssize_t __pyx_v_count, Py_ssize_t __pyx_v_step) {
  xmlNode *__pyx_v_c_next;
  Py_ssize_t __pyx_v_c;
  Py_ssize_t __pyx_v_i;
  _node_to_node_function __pyx_v_next_element;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("_deleteSlice");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1081
 *     cdef Py_ssize_t c, i
 *     cdef _node_to_node_function next_element
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         return 0
 *     if step > 0:
 */
  __pyx_t_1 = (__pyx_v_c_node == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1082
 *     cdef _node_to_node_function next_element
 *     if c_node is NULL:
 *         return 0             # <<<<<<<<<<<<<<
 *     if step > 0:
 *         next_element = _nextElement
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1083
 *     if c_node is NULL:
 *         return 0
 *     if step > 0:             # <<<<<<<<<<<<<<
 *         next_element = _nextElement
 *     else:
 */
  __pyx_t_1 = (__pyx_v_step > 0);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1084
 *         return 0
 *     if step > 0:
 *         next_element = _nextElement             # <<<<<<<<<<<<<<
 *     else:
 *         step = -step
 */
    __pyx_v_next_element = __pyx_f_4lxml_5etree__nextElement;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1086
 *         next_element = _nextElement
 *     else:
 *         step = -step             # <<<<<<<<<<<<<<
 *         next_element = _previousElement
 *     # now start deleting nodes
 */
    __pyx_v_step = (-__pyx_v_step);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1087
 *     else:
 *         step = -step
 *         next_element = _previousElement             # <<<<<<<<<<<<<<
 *     # now start deleting nodes
 *     c = 0
 */
    __pyx_v_next_element = __pyx_f_4lxml_5etree__previousElement;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1089
 *         next_element = _previousElement
 *     # now start deleting nodes
 *     c = 0             # <<<<<<<<<<<<<<
 *     c_next = c_node
 *     while c_node is not NULL and c < count:
 */
  __pyx_v_c = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1090
 *     # now start deleting nodes
 *     c = 0
 *     c_next = c_node             # <<<<<<<<<<<<<<
 *     while c_node is not NULL and c < count:
 *         for i from 0 <= i < step:
 */
  __pyx_v_c_next = __pyx_v_c_node;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1091
 *     c = 0
 *     c_next = c_node
 *     while c_node is not NULL and c < count:             # <<<<<<<<<<<<<<
 *         for i from 0 <= i < step:
 *             c_next = next_element(c_next)
 */
  while (1) {
    __pyx_t_1 = (__pyx_v_c_node != NULL);
    if (__pyx_t_1) {
      __pyx_t_2 = (__pyx_v_c < __pyx_v_count);
      __pyx_t_3 = __pyx_t_2;
    } else {
      __pyx_t_3 = __pyx_t_1;
    }
    if (!__pyx_t_3) break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1092
 *     c_next = c_node
 *     while c_node is not NULL and c < count:
 *         for i from 0 <= i < step:             # <<<<<<<<<<<<<<
 *             c_next = next_element(c_next)
 *         _removeNode(doc, c_node)
 */
    __pyx_t_4 = __pyx_v_step;
    for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_4; __pyx_v_i++) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1093
 *     while c_node is not NULL and c < count:
 *         for i from 0 <= i < step:
 *             c_next = next_element(c_next)             # <<<<<<<<<<<<<<
 *         _removeNode(doc, c_node)
 *         c = c + 1
 */
      __pyx_v_c_next = __pyx_v_next_element(__pyx_v_c_next);
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1094
 *         for i from 0 <= i < step:
 *             c_next = next_element(c_next)
 *         _removeNode(doc, c_node)             # <<<<<<<<<<<<<<
 *         c = c + 1
 *         c_node = c_next
 */
    __pyx_t_5 = __pyx_f_4lxml_5etree__removeNode(__pyx_v_doc, __pyx_v_c_node); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1095
 *             c_next = next_element(c_next)
 *         _removeNode(doc, c_node)
 *         c = c + 1             # <<<<<<<<<<<<<<
 *         c_node = c_next
 *     return 0
 */
    __pyx_v_c = (__pyx_v_c + 1);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1096
 *         _removeNode(doc, c_node)
 *         c = c + 1
 *         c_node = c_next             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    __pyx_v_c_node = __pyx_v_c_next;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1097
 *         c = c + 1
 *         c_node = c_next
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int _replaceSlice(_Element parent, xmlNode* c_node,
 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._deleteSlice");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1099
 *     return 0
 * 
 * cdef int _replaceSlice(_Element parent, xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                        Py_ssize_t slicelength, Py_ssize_t step,
 *                        bint left_to_right, elements) except -1:
 */

static  int __pyx_f_4lxml_5etree__replaceSlice(struct LxmlElement *__pyx_v_parent, xmlNode *__pyx_v_c_node, Py_ssize_t __pyx_v_slicelength, Py_ssize_t __pyx_v_step, int __pyx_v_left_to_right, PyObject *__pyx_v_elements) {
  xmlNode *__pyx_v_c_orig_neighbour;
  xmlNode *__pyx_v_c_next;
  xmlDoc *__pyx_v_c_source_doc;
  struct LxmlElement *__pyx_v_element;
  Py_ssize_t __pyx_v_seqlength;
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_c;
  _node_to_node_function __pyx_v_next_element;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  __Pyx_RefNannySetupContext("_replaceSlice");
  __Pyx_INCREF(__pyx_v_elements);
  __pyx_v_element = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1114
 *     cdef Py_ssize_t seqlength, i, c
 *     cdef _node_to_node_function next_element
 *     assert step > 0             # <<<<<<<<<<<<<<
 *     if left_to_right:
 *         next_element = _nextElement
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!(__pyx_v_step > 0))) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1115
 *     cdef _node_to_node_function next_element
 *     assert step > 0
 *     if left_to_right:             # <<<<<<<<<<<<<<
 *         next_element = _nextElement
 *     else:
 */
  if (__pyx_v_left_to_right) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1116
 *     assert step > 0
 *     if left_to_right:
 *         next_element = _nextElement             # <<<<<<<<<<<<<<
 *     else:
 *         next_element = _previousElement
 */
    __pyx_v_next_element = __pyx_f_4lxml_5etree__nextElement;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1118
 *         next_element = _nextElement
 *     else:
 *         next_element = _previousElement             # <<<<<<<<<<<<<<
 * 
 *     if not python.PyList_Check(elements) and \
 */
    __pyx_v_next_element = __pyx_f_4lxml_5etree__previousElement;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1120
 *         next_element = _previousElement
 * 
 *     if not python.PyList_Check(elements) and \             # <<<<<<<<<<<<<<
 *             not python.PyTuple_Check(elements):
 *         elements = list(elements)
 */
  __pyx_t_1 = (!PyList_Check(__pyx_v_elements));
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1121
 * 
 *     if not python.PyList_Check(elements) and \
 *             not python.PyTuple_Check(elements):             # <<<<<<<<<<<<<<
 *         elements = list(elements)
 * 
 */
    __pyx_t_2 = (!PyTuple_Check(__pyx_v_elements));
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1122
 *     if not python.PyList_Check(elements) and \
 *             not python.PyTuple_Check(elements):
 *         elements = list(elements)             # <<<<<<<<<<<<<<
 * 
 *     if step > 1:
 */
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_INCREF(__pyx_v_elements);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_elements);
    __Pyx_GIVEREF(__pyx_v_elements);
    __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_v_elements);
    __pyx_v_elements = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1124
 *         elements = list(elements)
 * 
 *     if step > 1:             # <<<<<<<<<<<<<<
 *         # *replacing* children stepwise with list => check size!
 *         seqlength = len(elements)
 */
  __pyx_t_3 = (__pyx_v_step > 1);
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1126
 *     if step > 1:
 *         # *replacing* children stepwise with list => check size!
 *         seqlength = len(elements)             # <<<<<<<<<<<<<<
 *         if seqlength != slicelength:
 *             raise ValueError, u"attempt to assign sequence of size %d " \
 */
    __pyx_t_6 = PyObject_Length(__pyx_v_elements); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_seqlength = __pyx_t_6;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1127
 *         # *replacing* children stepwise with list => check size!
 *         seqlength = len(elements)
 *         if seqlength != slicelength:             # <<<<<<<<<<<<<<
 *             raise ValueError, u"attempt to assign sequence of size %d " \
 *                 u"to extended slice of size %d" % (seqlength, slicelength)
 */
    __pyx_t_3 = (__pyx_v_seqlength != __pyx_v_slicelength);
    if (__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1129
 *         if seqlength != slicelength:
 *             raise ValueError, u"attempt to assign sequence of size %d " \
 *                 u"to extended slice of size %d" % (seqlength, slicelength)             # <<<<<<<<<<<<<<
 * 
 *     if c_node is NULL:
 */
      __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_seqlength); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_slicelength); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_7));
      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_5 = 0;
      __pyx_t_4 = 0;
      __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_27), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
      __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), 0);
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L6;
    }
    __pyx_L6:;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1131
 *                 u"to extended slice of size %d" % (seqlength, slicelength)
 * 
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         # no children yet => add all elements straight away
 *         if left_to_right:
 */
  __pyx_t_3 = (__pyx_v_c_node == NULL);
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1133
 *     if c_node is NULL:
 *         # no children yet => add all elements straight away
 *         if left_to_right:             # <<<<<<<<<<<<<<
 *             for element in elements:
 *                 assert element is not None, u"Node must not be None"
 */
    if (__pyx_v_left_to_right) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1134
 *         # no children yet => add all elements straight away
 *         if left_to_right:
 *             for element in elements:             # <<<<<<<<<<<<<<
 *                 assert element is not None, u"Node must not be None"
 *                 _appendChild(parent, element)
 */
      if (PyList_CheckExact(__pyx_v_elements) || PyTuple_CheckExact(__pyx_v_elements)) {
        __pyx_t_6 = 0; __pyx_t_4 = __pyx_v_elements; __Pyx_INCREF(__pyx_t_4);
      } else {
        __pyx_t_6 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_elements); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
      }
      for (;;) {
        if (likely(PyList_CheckExact(__pyx_t_4))) {
          if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_4)) break;
          __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_7); __pyx_t_6++;
        } else if (likely(PyTuple_CheckExact(__pyx_t_4))) {
          if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
          __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_7); __pyx_t_6++;
        } else {
          __pyx_t_7 = PyIter_Next(__pyx_t_4);
          if (!__pyx_t_7) {
            if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            break;
          }
          __Pyx_GOTREF(__pyx_t_7);
        }
        if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(((PyObject *)__pyx_v_element));
        __pyx_v_element = ((struct LxmlElement *)__pyx_t_7);
        __pyx_t_7 = 0;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1135
 *         if left_to_right:
 *             for element in elements:
 *                 assert element is not None, u"Node must not be None"             # <<<<<<<<<<<<<<
 *                 _appendChild(parent, element)
 *         else:
 */
        #ifndef CYTHON_WITHOUT_ASSERTIONS
        __pyx_t_3 = (((PyObject *)__pyx_v_element) != Py_None);
        if (unlikely(!__pyx_t_3)) {
          PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_u_28));
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        #endif

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1136
 *             for element in elements:
 *                 assert element is not None, u"Node must not be None"
 *                 _appendChild(parent, element)             # <<<<<<<<<<<<<<
 *         else:
 *             for element in elements:
 */
        __pyx_t_8 = __pyx_f_4lxml_5etree__appendChild(__pyx_v_parent, __pyx_v_element); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L8;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1138
 *                 _appendChild(parent, element)
 *         else:
 *             for element in elements:             # <<<<<<<<<<<<<<
 *                 assert element is not None, u"Node must not be None"
 *                 _prependChild(parent, element)
 */
      if (PyList_CheckExact(__pyx_v_elements) || PyTuple_CheckExact(__pyx_v_elements)) {
        __pyx_t_6 = 0; __pyx_t_4 = __pyx_v_elements; __Pyx_INCREF(__pyx_t_4);
      } else {
        __pyx_t_6 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_elements); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
      }
      for (;;) {
        if (likely(PyList_CheckExact(__pyx_t_4))) {
          if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_4)) break;
          __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_7); __pyx_t_6++;
        } else if (likely(PyTuple_CheckExact(__pyx_t_4))) {
          if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
          __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_7); __pyx_t_6++;
        } else {
          __pyx_t_7 = PyIter_Next(__pyx_t_4);
          if (!__pyx_t_7) {
            if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            break;
          }
          __Pyx_GOTREF(__pyx_t_7);
        }
        if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(((PyObject *)__pyx_v_element));
        __pyx_v_element = ((struct LxmlElement *)__pyx_t_7);
        __pyx_t_7 = 0;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1139
 *         else:
 *             for element in elements:
 *                 assert element is not None, u"Node must not be None"             # <<<<<<<<<<<<<<
 *                 _prependChild(parent, element)
 *         return 0
 */
        #ifndef CYTHON_WITHOUT_ASSERTIONS
        __pyx_t_3 = (((PyObject *)__pyx_v_element) != Py_None);
        if (unlikely(!__pyx_t_3)) {
          PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_u_28));
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        #endif

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1140
 *             for element in elements:
 *                 assert element is not None, u"Node must not be None"
 *                 _prependChild(parent, element)             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
        __pyx_t_8 = __pyx_f_4lxml_5etree__prependChild(__pyx_v_parent, __pyx_v_element); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __pyx_L8:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1141
 *                 assert element is not None, u"Node must not be None"
 *                 _prependChild(parent, element)
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     # remove the elements first as some might be re-added
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1144
 * 
 *     # remove the elements first as some might be re-added
 *     if left_to_right:             # <<<<<<<<<<<<<<
 *         # L->R, remember left neighbour
 *         c_orig_neighbour = _previousElement(c_node)
 */
  if (__pyx_v_left_to_right) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1146
 *     if left_to_right:
 *         # L->R, remember left neighbour
 *         c_orig_neighbour = _previousElement(c_node)             # <<<<<<<<<<<<<<
 *     else:
 *         # R->L, remember right neighbour
 */
    __pyx_v_c_orig_neighbour = __pyx_f_4lxml_5etree__previousElement(__pyx_v_c_node);
    goto __pyx_L13;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1149
 *     else:
 *         # R->L, remember right neighbour
 *         c_orig_neighbour = _nextElement(c_node)             # <<<<<<<<<<<<<<
 * 
 *     # We remove the original slice elements one by one. Since we hold
 */
    __pyx_v_c_orig_neighbour = __pyx_f_4lxml_5etree__nextElement(__pyx_v_c_node);
  }
  __pyx_L13:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1155
 *     # safe to let _removeNode() try (and fail) to free them even if
 *     # the element itself or one of its descendents will be reinserted.
 *     c = 0             # <<<<<<<<<<<<<<
 *     c_next = c_node
 *     while c_node is not NULL and c < slicelength:
 */
  __pyx_v_c = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1156
 *     # the element itself or one of its descendents will be reinserted.
 *     c = 0
 *     c_next = c_node             # <<<<<<<<<<<<<<
 *     while c_node is not NULL and c < slicelength:
 *         for i from 0 <= i < step:
 */
  __pyx_v_c_next = __pyx_v_c_node;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1157
 *     c = 0
 *     c_next = c_node
 *     while c_node is not NULL and c < slicelength:             # <<<<<<<<<<<<<<
 *         for i from 0 <= i < step:
 *             c_next = next_element(c_next)
 */
  while (1) {
    __pyx_t_3 = (__pyx_v_c_node != NULL);
    if (__pyx_t_3) {
      __pyx_t_1 = (__pyx_v_c < __pyx_v_slicelength);
      __pyx_t_2 = __pyx_t_1;
    } else {
      __pyx_t_2 = __pyx_t_3;
    }
    if (!__pyx_t_2) break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1158
 *     c_next = c_node
 *     while c_node is not NULL and c < slicelength:
 *         for i from 0 <= i < step:             # <<<<<<<<<<<<<<
 *             c_next = next_element(c_next)
 *         _removeNode(parent._doc, c_node)
 */
    __pyx_t_6 = __pyx_v_step;
    for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_6; __pyx_v_i++) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1159
 *     while c_node is not NULL and c < slicelength:
 *         for i from 0 <= i < step:
 *             c_next = next_element(c_next)             # <<<<<<<<<<<<<<
 *         _removeNode(parent._doc, c_node)
 *         c = c + 1
 */
      __pyx_v_c_next = __pyx_v_next_element(__pyx_v_c_next);
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1160
 *         for i from 0 <= i < step:
 *             c_next = next_element(c_next)
 *         _removeNode(parent._doc, c_node)             # <<<<<<<<<<<<<<
 *         c = c + 1
 *         c_node = c_next
 */
    __pyx_t_4 = ((PyObject *)__pyx_v_parent->_doc);
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_8 = __pyx_f_4lxml_5etree__removeNode(((struct LxmlDocument *)__pyx_t_4), __pyx_v_c_node); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1161
 *             c_next = next_element(c_next)
 *         _removeNode(parent._doc, c_node)
 *         c = c + 1             # <<<<<<<<<<<<<<
 *         c_node = c_next
 * 
 */
    __pyx_v_c = (__pyx_v_c + 1);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1162
 *         _removeNode(parent._doc, c_node)
 *         c = c + 1
 *         c_node = c_next             # <<<<<<<<<<<<<<
 * 
 *     # make sure each element is inserted only once
 */
    __pyx_v_c_node = __pyx_v_c_next;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1165
 * 
 *     # make sure each element is inserted only once
 *     elements = iter(elements)             # <<<<<<<<<<<<<<
 * 
 *     # find the first node right of the new insertion point
 */
  __pyx_t_4 = PyObject_GetIter(__pyx_v_elements); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_v_elements);
  __pyx_v_elements = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1168
 * 
 *     # find the first node right of the new insertion point
 *     if left_to_right:             # <<<<<<<<<<<<<<
 *         if c_orig_neighbour is not NULL:
 *             c_node = next_element(c_orig_neighbour)
 */
  if (__pyx_v_left_to_right) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1169
 *     # find the first node right of the new insertion point
 *     if left_to_right:
 *         if c_orig_neighbour is not NULL:             # <<<<<<<<<<<<<<
 *             c_node = next_element(c_orig_neighbour)
 *         else:
 */
    __pyx_t_2 = (__pyx_v_c_orig_neighbour != NULL);
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1170
 *     if left_to_right:
 *         if c_orig_neighbour is not NULL:
 *             c_node = next_element(c_orig_neighbour)             # <<<<<<<<<<<<<<
 *         else:
 *             # before the first element
 */
      __pyx_v_c_node = __pyx_v_next_element(__pyx_v_c_orig_neighbour);
      goto __pyx_L19;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1173
 *         else:
 *             # before the first element
 *             c_node = _findChildForwards(parent._c_node, 0)             # <<<<<<<<<<<<<<
 *     elif c_orig_neighbour is NULL:
 *         # at the end, but reversed stepping
 */
      __pyx_v_c_node = __pyx_f_4lxml_5etree__findChildForwards(__pyx_v_parent->_c_node, 0);
    }
    __pyx_L19:;
    goto __pyx_L18;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1174
 *             # before the first element
 *             c_node = _findChildForwards(parent._c_node, 0)
 *     elif c_orig_neighbour is NULL:             # <<<<<<<<<<<<<<
 *         # at the end, but reversed stepping
 *         # append one element and go to the next insertion point
 */
  __pyx_t_2 = (__pyx_v_c_orig_neighbour == NULL);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1177
 *         # at the end, but reversed stepping
 *         # append one element and go to the next insertion point
 *         for element in elements:             # <<<<<<<<<<<<<<
 *             assert element is not None, u"Node must not be None"
 *             _appendChild(parent, element)
 */
    if (PyList_CheckExact(__pyx_v_elements) || PyTuple_CheckExact(__pyx_v_elements)) {
      __pyx_t_6 = 0; __pyx_t_4 = __pyx_v_elements; __Pyx_INCREF(__pyx_t_4);
    } else {
      __pyx_t_6 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_elements); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
    }
    for (;;) {
      if (likely(PyList_CheckExact(__pyx_t_4))) {
        if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_4)) break;
        __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_7); __pyx_t_6++;
      } else if (likely(PyTuple_CheckExact(__pyx_t_4))) {
        if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
        __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_7); __pyx_t_6++;
      } else {
        __pyx_t_7 = PyIter_Next(__pyx_t_4);
        if (!__pyx_t_7) {
          if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          break;
        }
        __Pyx_GOTREF(__pyx_t_7);
      }
      if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_v_element));
      __pyx_v_element = ((struct LxmlElement *)__pyx_t_7);
      __pyx_t_7 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1178
 *         # append one element and go to the next insertion point
 *         for element in elements:
 *             assert element is not None, u"Node must not be None"             # <<<<<<<<<<<<<<
 *             _appendChild(parent, element)
 *             c_node = element._c_node
 */
      #ifndef CYTHON_WITHOUT_ASSERTIONS
      __pyx_t_2 = (((PyObject *)__pyx_v_element) != Py_None);
      if (unlikely(!__pyx_t_2)) {
        PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_u_28));
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #endif

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1179
 *         for element in elements:
 *             assert element is not None, u"Node must not be None"
 *             _appendChild(parent, element)             # <<<<<<<<<<<<<<
 *             c_node = element._c_node
 *             if slicelength > 0:
 */
      __pyx_t_8 = __pyx_f_4lxml_5etree__appendChild(__pyx_v_parent, __pyx_v_element); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1180
 *             assert element is not None, u"Node must not be None"
 *             _appendChild(parent, element)
 *             c_node = element._c_node             # <<<<<<<<<<<<<<
 *             if slicelength > 0:
 *                 slicelength = slicelength - 1
 */
      __pyx_v_c_node = __pyx_v_element->_c_node;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1181
 *             _appendChild(parent, element)
 *             c_node = element._c_node
 *             if slicelength > 0:             # <<<<<<<<<<<<<<
 *                 slicelength = slicelength - 1
 *                 for i from 1 <= i < step:
 */
      __pyx_t_2 = (__pyx_v_slicelength > 0);
      if (__pyx_t_2) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1182
 *             c_node = element._c_node
 *             if slicelength > 0:
 *                 slicelength = slicelength - 1             # <<<<<<<<<<<<<<
 *                 for i from 1 <= i < step:
 *                     c_node = next_element(c_node)
 */
        __pyx_v_slicelength = (__pyx_v_slicelength - 1);

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1183
 *             if slicelength > 0:
 *                 slicelength = slicelength - 1
 *                 for i from 1 <= i < step:             # <<<<<<<<<<<<<<
 *                     c_node = next_element(c_node)
 *             break
 */
        __pyx_t_9 = __pyx_v_step;
        for (__pyx_v_i = 1; __pyx_v_i < __pyx_t_9; __pyx_v_i++) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1184
 *                 slicelength = slicelength - 1
 *                 for i from 1 <= i < step:
 *                     c_node = next_element(c_node)             # <<<<<<<<<<<<<<
 *             break
 * 
 */
          __pyx_v_c_node = __pyx_v_next_element(__pyx_v_c_node);
        }
        goto __pyx_L22;
      }
      __pyx_L22:;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1185
 *                 for i from 1 <= i < step:
 *                     c_node = next_element(c_node)
 *             break             # <<<<<<<<<<<<<<
 * 
 *     if left_to_right:
 */
      goto __pyx_L21_break;
    }
    __pyx_L21_break:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L18;
  }
  __pyx_L18:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1187
 *             break
 * 
 *     if left_to_right:             # <<<<<<<<<<<<<<
 *         # adjust step size after removing slice as we are not stepping
 *         # over the newly inserted elements
 */
  if (__pyx_v_left_to_right) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1190
 *         # adjust step size after removing slice as we are not stepping
 *         # over the newly inserted elements
 *         step = step - 1             # <<<<<<<<<<<<<<
 * 
 *     # now insert elements where we removed them
 */
    __pyx_v_step = (__pyx_v_step - 1);
    goto __pyx_L25;
  }
  __pyx_L25:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1193
 * 
 *     # now insert elements where we removed them
 *     if c_node is not NULL:             # <<<<<<<<<<<<<<
 *         for element in elements:
 *             assert element is not None, u"Node must not be None"
 */
  __pyx_t_2 = (__pyx_v_c_node != NULL);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1194
 *     # now insert elements where we removed them
 *     if c_node is not NULL:
 *         for element in elements:             # <<<<<<<<<<<<<<
 *             assert element is not None, u"Node must not be None"
 *             _assertValidNode(element)
 */
    if (PyList_CheckExact(__pyx_v_elements) || PyTuple_CheckExact(__pyx_v_elements)) {
      __pyx_t_6 = 0; __pyx_t_4 = __pyx_v_elements; __Pyx_INCREF(__pyx_t_4);
    } else {
      __pyx_t_6 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_elements); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
    }
    for (;;) {
      if (likely(PyList_CheckExact(__pyx_t_4))) {
        if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_4)) break;
        __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_7); __pyx_t_6++;
      } else if (likely(PyTuple_CheckExact(__pyx_t_4))) {
        if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
        __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_7); __pyx_t_6++;
      } else {
        __pyx_t_7 = PyIter_Next(__pyx_t_4);
        if (!__pyx_t_7) {
          if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          break;
        }
        __Pyx_GOTREF(__pyx_t_7);
      }
      if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_v_element));
      __pyx_v_element = ((struct LxmlElement *)__pyx_t_7);
      __pyx_t_7 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1195
 *     if c_node is not NULL:
 *         for element in elements:
 *             assert element is not None, u"Node must not be None"             # <<<<<<<<<<<<<<
 *             _assertValidNode(element)
 *             # move element and tail over
 */
      #ifndef CYTHON_WITHOUT_ASSERTIONS
      __pyx_t_2 = (((PyObject *)__pyx_v_element) != Py_None);
      if (unlikely(!__pyx_t_2)) {
        PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_u_28));
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #endif

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1196
 *         for element in elements:
 *             assert element is not None, u"Node must not be None"
 *             _assertValidNode(element)             # <<<<<<<<<<<<<<
 *             # move element and tail over
 *             c_source_doc = element._c_node.doc
 */
      __pyx_t_8 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1198
 *             _assertValidNode(element)
 *             # move element and tail over
 *             c_source_doc = element._c_node.doc             # <<<<<<<<<<<<<<
 *             c_next = element._c_node.next
 *             tree.xmlAddPrevSibling(c_node, element._c_node)
 */
      __pyx_v_c_source_doc = __pyx_v_element->_c_node->doc;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1199
 *             # move element and tail over
 *             c_source_doc = element._c_node.doc
 *             c_next = element._c_node.next             # <<<<<<<<<<<<<<
 *             tree.xmlAddPrevSibling(c_node, element._c_node)
 *             _moveTail(c_next, element._c_node)
 */
      __pyx_v_c_next = __pyx_v_element->_c_node->next;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1200
 *             c_source_doc = element._c_node.doc
 *             c_next = element._c_node.next
 *             tree.xmlAddPrevSibling(c_node, element._c_node)             # <<<<<<<<<<<<<<
 *             _moveTail(c_next, element._c_node)
 * 
 */
      xmlAddPrevSibling(__pyx_v_c_node, __pyx_v_element->_c_node);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1201
 *             c_next = element._c_node.next
 *             tree.xmlAddPrevSibling(c_node, element._c_node)
 *             _moveTail(c_next, element._c_node)             # <<<<<<<<<<<<<<
 * 
 *             # integrate element into new document
 */
      __pyx_f_4lxml_5etree__moveTail(__pyx_v_c_next, __pyx_v_element->_c_node);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1204
 * 
 *             # integrate element into new document
 *             moveNodeToDocument(parent._doc, c_source_doc, element._c_node)             # <<<<<<<<<<<<<<
 * 
 *             # stop at the end of the slice
 */
      __pyx_t_7 = ((PyObject *)__pyx_v_parent->_doc);
      __Pyx_INCREF(__pyx_t_7);
      __pyx_t_8 = __pyx_f_4lxml_5etree_moveNodeToDocument(((struct LxmlDocument *)__pyx_t_7), __pyx_v_c_source_doc, __pyx_v_element->_c_node); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1207
 * 
 *             # stop at the end of the slice
 *             if slicelength > 0:             # <<<<<<<<<<<<<<
 *                 slicelength = slicelength - 1
 *                 for i from 0 <= i < step:
 */
      __pyx_t_2 = (__pyx_v_slicelength > 0);
      if (__pyx_t_2) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1208
 *             # stop at the end of the slice
 *             if slicelength > 0:
 *                 slicelength = slicelength - 1             # <<<<<<<<<<<<<<
 *                 for i from 0 <= i < step:
 *                     c_node = next_element(c_node)
 */
        __pyx_v_slicelength = (__pyx_v_slicelength - 1);

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1209
 *             if slicelength > 0:
 *                 slicelength = slicelength - 1
 *                 for i from 0 <= i < step:             # <<<<<<<<<<<<<<
 *                     c_node = next_element(c_node)
 *                 if c_node is NULL:
 */
        __pyx_t_9 = __pyx_v_step;
        for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_9; __pyx_v_i++) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1210
 *                 slicelength = slicelength - 1
 *                 for i from 0 <= i < step:
 *                     c_node = next_element(c_node)             # <<<<<<<<<<<<<<
 *                 if c_node is NULL:
 *                     break
 */
          __pyx_v_c_node = __pyx_v_next_element(__pyx_v_c_node);
        }

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1211
 *                 for i from 0 <= i < step:
 *                     c_node = next_element(c_node)
 *                 if c_node is NULL:             # <<<<<<<<<<<<<<
 *                     break
 *         else:
 */
        __pyx_t_2 = (__pyx_v_c_node == NULL);
        if (__pyx_t_2) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1212
 *                     c_node = next_element(c_node)
 *                 if c_node is NULL:
 *                     break             # <<<<<<<<<<<<<<
 *         else:
 *             # everything inserted
 */
          goto __pyx_L28_break;
          goto __pyx_L32;
        }
        __pyx_L32:;
        goto __pyx_L29;
      }
      __pyx_L29:;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1215
 *         else:
 *             # everything inserted
 *             return 0             # <<<<<<<<<<<<<<
 * 
 *     # append the remaining elements at the respective end
 */
      __pyx_r = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L0;
    }
    __pyx_L28_break:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L26;
  }
  __pyx_L26:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1218
 * 
 *     # append the remaining elements at the respective end
 *     if left_to_right:             # <<<<<<<<<<<<<<
 *         for element in elements:
 *             assert element is not None, u"Node must not be None"
 */
  if (__pyx_v_left_to_right) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1219
 *     # append the remaining elements at the respective end
 *     if left_to_right:
 *         for element in elements:             # <<<<<<<<<<<<<<
 *             assert element is not None, u"Node must not be None"
 *             _assertValidNode(element)
 */
    if (PyList_CheckExact(__pyx_v_elements) || PyTuple_CheckExact(__pyx_v_elements)) {
      __pyx_t_6 = 0; __pyx_t_4 = __pyx_v_elements; __Pyx_INCREF(__pyx_t_4);
    } else {
      __pyx_t_6 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_elements); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
    }
    for (;;) {
      if (likely(PyList_CheckExact(__pyx_t_4))) {
        if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_4)) break;
        __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_7); __pyx_t_6++;
      } else if (likely(PyTuple_CheckExact(__pyx_t_4))) {
        if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
        __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_7); __pyx_t_6++;
      } else {
        __pyx_t_7 = PyIter_Next(__pyx_t_4);
        if (!__pyx_t_7) {
          if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          break;
        }
        __Pyx_GOTREF(__pyx_t_7);
      }
      if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_v_element));
      __pyx_v_element = ((struct LxmlElement *)__pyx_t_7);
      __pyx_t_7 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1220
 *     if left_to_right:
 *         for element in elements:
 *             assert element is not None, u"Node must not be None"             # <<<<<<<<<<<<<<
 *             _assertValidNode(element)
 *             _appendChild(parent, element)
 */
      #ifndef CYTHON_WITHOUT_ASSERTIONS
      __pyx_t_2 = (((PyObject *)__pyx_v_element) != Py_None);
      if (unlikely(!__pyx_t_2)) {
        PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_u_28));
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #endif

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1221
 *         for element in elements:
 *             assert element is not None, u"Node must not be None"
 *             _assertValidNode(element)             # <<<<<<<<<<<<<<
 *             _appendChild(parent, element)
 *     else:
 */
      __pyx_t_8 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1222
 *             assert element is not None, u"Node must not be None"
 *             _assertValidNode(element)
 *             _appendChild(parent, element)             # <<<<<<<<<<<<<<
 *     else:
 *         for element in elements:
 */
      __pyx_t_8 = __pyx_f_4lxml_5etree__appendChild(__pyx_v_parent, __pyx_v_element); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L34;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1224
 *             _appendChild(parent, element)
 *     else:
 *         for element in elements:             # <<<<<<<<<<<<<<
 *             assert element is not None, u"Node must not be None"
 *             _assertValidNode(element)
 */
    if (PyList_CheckExact(__pyx_v_elements) || PyTuple_CheckExact(__pyx_v_elements)) {
      __pyx_t_6 = 0; __pyx_t_4 = __pyx_v_elements; __Pyx_INCREF(__pyx_t_4);
    } else {
      __pyx_t_6 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_elements); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
    }
    for (;;) {
      if (likely(PyList_CheckExact(__pyx_t_4))) {
        if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_4)) break;
        __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_7); __pyx_t_6++;
      } else if (likely(PyTuple_CheckExact(__pyx_t_4))) {
        if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
        __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_7); __pyx_t_6++;
      } else {
        __pyx_t_7 = PyIter_Next(__pyx_t_4);
        if (!__pyx_t_7) {
          if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          break;
        }
        __Pyx_GOTREF(__pyx_t_7);
      }
      if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_v_element));
      __pyx_v_element = ((struct LxmlElement *)__pyx_t_7);
      __pyx_t_7 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1225
 *     else:
 *         for element in elements:
 *             assert element is not None, u"Node must not be None"             # <<<<<<<<<<<<<<
 *             _assertValidNode(element)
 *             _prependChild(parent, element)
 */
      #ifndef CYTHON_WITHOUT_ASSERTIONS
      __pyx_t_2 = (((PyObject *)__pyx_v_element) != Py_None);
      if (unlikely(!__pyx_t_2)) {
        PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_u_28));
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #endif

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1226
 *         for element in elements:
 *             assert element is not None, u"Node must not be None"
 *             _assertValidNode(element)             # <<<<<<<<<<<<<<
 *             _prependChild(parent, element)
 * 
 */
      __pyx_t_8 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1227
 *             assert element is not None, u"Node must not be None"
 *             _assertValidNode(element)
 *             _prependChild(parent, element)             # <<<<<<<<<<<<<<
 * 
 *     return 0
 */
      __pyx_t_8 = __pyx_f_4lxml_5etree__prependChild(__pyx_v_parent, __pyx_v_element); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_L34:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1229
 *             _prependChild(parent, element)
 * 
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int _appendChild(_Element parent, _Element child) except -1:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree._replaceSlice");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_element);
  __Pyx_DECREF(__pyx_v_elements);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1231
 *     return 0
 * 
 * cdef int _appendChild(_Element parent, _Element child) except -1:             # <<<<<<<<<<<<<<
 *     u"""Append a new child to a parent element.
 *     """
 */

static  int __pyx_f_4lxml_5etree__appendChild(struct LxmlElement *__pyx_v_parent, struct LxmlElement *__pyx_v_child) {
  xmlNode *__pyx_v_c_next;
  xmlNode *__pyx_v_c_node;
  xmlDoc *__pyx_v_c_source_doc;
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("_appendChild");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1235
 *     """
 *     cdef xmlNode* c_next
 *     cdef xmlNode* c_node = child._c_node             # <<<<<<<<<<<<<<
 *     cdef xmlDoc* c_source_doc = c_node.doc
 *     # store possible text node
 */
  __pyx_v_c_node = __pyx_v_child->_c_node;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1236
 *     cdef xmlNode* c_next
 *     cdef xmlNode* c_node = child._c_node
 *     cdef xmlDoc* c_source_doc = c_node.doc             # <<<<<<<<<<<<<<
 *     # store possible text node
 *     c_next = c_node.next
 */
  __pyx_v_c_source_doc = __pyx_v_c_node->doc;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1238
 *     cdef xmlDoc* c_source_doc = c_node.doc
 *     # store possible text node
 *     c_next = c_node.next             # <<<<<<<<<<<<<<
 *     # move node itself
 *     tree.xmlUnlinkNode(c_node)
 */
  __pyx_v_c_next = __pyx_v_c_node->next;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1240
 *     c_next = c_node.next
 *     # move node itself
 *     tree.xmlUnlinkNode(c_node)             # <<<<<<<<<<<<<<
 *     tree.xmlAddChild(parent._c_node, c_node)
 *     _moveTail(c_next, c_node)
 */
  xmlUnlinkNode(__pyx_v_c_node);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1241
 *     # move node itself
 *     tree.xmlUnlinkNode(c_node)
 *     tree.xmlAddChild(parent._c_node, c_node)             # <<<<<<<<<<<<<<
 *     _moveTail(c_next, c_node)
 *     # uh oh, elements may be pointing to different doc when
 */
  xmlAddChild(__pyx_v_parent->_c_node, __pyx_v_c_node);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1242
 *     tree.xmlUnlinkNode(c_node)
 *     tree.xmlAddChild(parent._c_node, c_node)
 *     _moveTail(c_next, c_node)             # <<<<<<<<<<<<<<
 *     # uh oh, elements may be pointing to different doc when
 *     # parent element has moved; change them too..
 */
  __pyx_f_4lxml_5etree__moveTail(__pyx_v_c_next, __pyx_v_c_node);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1245
 *     # uh oh, elements may be pointing to different doc when
 *     # parent element has moved; change them too..
 *     moveNodeToDocument(parent._doc, c_source_doc, c_node)             # <<<<<<<<<<<<<<
 * 
 * cdef int _prependChild(_Element parent, _Element child) except -1:
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_parent->_doc);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree_moveNodeToDocument(((struct LxmlDocument *)__pyx_t_1), __pyx_v_c_source_doc, __pyx_v_c_node); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._appendChild");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1247
 *     moveNodeToDocument(parent._doc, c_source_doc, c_node)
 * 
 * cdef int _prependChild(_Element parent, _Element child) except -1:             # <<<<<<<<<<<<<<
 *     u"""Prepend a new child to a parent element.
 *     """
 */

static  int __pyx_f_4lxml_5etree__prependChild(struct LxmlElement *__pyx_v_parent, struct LxmlElement *__pyx_v_child) {
  xmlNode *__pyx_v_c_next;
  xmlNode *__pyx_v_c_child;
  xmlNode *__pyx_v_c_node;
  xmlDoc *__pyx_v_c_source_doc;
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("_prependChild");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1252
 *     cdef xmlNode* c_next
 *     cdef xmlNode* c_child
 *     cdef xmlNode* c_node = child._c_node             # <<<<<<<<<<<<<<
 *     cdef xmlDoc* c_source_doc = c_node.doc
 *     # store possible text node
 */
  __pyx_v_c_node = __pyx_v_child->_c_node;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1253
 *     cdef xmlNode* c_child
 *     cdef xmlNode* c_node = child._c_node
 *     cdef xmlDoc* c_source_doc = c_node.doc             # <<<<<<<<<<<<<<
 *     # store possible text node
 *     c_next = c_node.next
 */
  __pyx_v_c_source_doc = __pyx_v_c_node->doc;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1255
 *     cdef xmlDoc* c_source_doc = c_node.doc
 *     # store possible text node
 *     c_next = c_node.next             # <<<<<<<<<<<<<<
 *     # move node itself
 *     c_child = _findChildForwards(parent._c_node, 0)
 */
  __pyx_v_c_next = __pyx_v_c_node->next;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1257
 *     c_next = c_node.next
 *     # move node itself
 *     c_child = _findChildForwards(parent._c_node, 0)             # <<<<<<<<<<<<<<
 *     if c_child is NULL:
 *         tree.xmlUnlinkNode(c_node)
 */
  __pyx_v_c_child = __pyx_f_4lxml_5etree__findChildForwards(__pyx_v_parent->_c_node, 0);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1258
 *     # move node itself
 *     c_child = _findChildForwards(parent._c_node, 0)
 *     if c_child is NULL:             # <<<<<<<<<<<<<<
 *         tree.xmlUnlinkNode(c_node)
 *         tree.xmlAddChild(parent._c_node, c_node)
 */
  __pyx_t_1 = (__pyx_v_c_child == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1259
 *     c_child = _findChildForwards(parent._c_node, 0)
 *     if c_child is NULL:
 *         tree.xmlUnlinkNode(c_node)             # <<<<<<<<<<<<<<
 *         tree.xmlAddChild(parent._c_node, c_node)
 *     else:
 */
    xmlUnlinkNode(__pyx_v_c_node);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1260
 *     if c_child is NULL:
 *         tree.xmlUnlinkNode(c_node)
 *         tree.xmlAddChild(parent._c_node, c_node)             # <<<<<<<<<<<<<<
 *     else:
 *         tree.xmlAddPrevSibling(c_child, c_node)
 */
    xmlAddChild(__pyx_v_parent->_c_node, __pyx_v_c_node);
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1262
 *         tree.xmlAddChild(parent._c_node, c_node)
 *     else:
 *         tree.xmlAddPrevSibling(c_child, c_node)             # <<<<<<<<<<<<<<
 *     _moveTail(c_next, c_node)
 *     # uh oh, elements may be pointing to different doc when
 */
    xmlAddPrevSibling(__pyx_v_c_child, __pyx_v_c_node);
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1263
 *     else:
 *         tree.xmlAddPrevSibling(c_child, c_node)
 *     _moveTail(c_next, c_node)             # <<<<<<<<<<<<<<
 *     # uh oh, elements may be pointing to different doc when
 *     # parent element has moved; change them too..
 */
  __pyx_f_4lxml_5etree__moveTail(__pyx_v_c_next, __pyx_v_c_node);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1266
 *     # uh oh, elements may be pointing to different doc when
 *     # parent element has moved; change them too..
 *     moveNodeToDocument(parent._doc, c_source_doc, c_node)             # <<<<<<<<<<<<<<
 * 
 * cdef int _appendSibling(_Element element, _Element sibling) except -1:
 */
  __pyx_t_2 = ((PyObject *)__pyx_v_parent->_doc);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_4lxml_5etree_moveNodeToDocument(((struct LxmlDocument *)__pyx_t_2), __pyx_v_c_source_doc, __pyx_v_c_node); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._prependChild");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1268
 *     moveNodeToDocument(parent._doc, c_source_doc, c_node)
 * 
 * cdef int _appendSibling(_Element element, _Element sibling) except -1:             # <<<<<<<<<<<<<<
 *     u"""Append a new child to a parent element.
 *     """
 */

static  int __pyx_f_4lxml_5etree__appendSibling(struct LxmlElement *__pyx_v_element, struct LxmlElement *__pyx_v_sibling) {
  xmlNode *__pyx_v_c_node;
  xmlDoc *__pyx_v_c_source_doc;
  xmlNode *__pyx_v_c_next;
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("_appendSibling");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1271
 *     u"""Append a new child to a parent element.
 *     """
 *     cdef xmlNode* c_node = sibling._c_node             # <<<<<<<<<<<<<<
 *     cdef xmlDoc* c_source_doc = c_node.doc
 *     cdef xmlNode* c_next
 */
  __pyx_v_c_node = __pyx_v_sibling->_c_node;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1272
 *     """
 *     cdef xmlNode* c_node = sibling._c_node
 *     cdef xmlDoc* c_source_doc = c_node.doc             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_next
 *     # store possible text node
 */
  __pyx_v_c_source_doc = __pyx_v_c_node->doc;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1275
 *     cdef xmlNode* c_next
 *     # store possible text node
 *     c_next = c_node.next             # <<<<<<<<<<<<<<
 *     # move node itself
 *     tree.xmlAddNextSibling(element._c_node, c_node)
 */
  __pyx_v_c_next = __pyx_v_c_node->next;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1277
 *     c_next = c_node.next
 *     # move node itself
 *     tree.xmlAddNextSibling(element._c_node, c_node)             # <<<<<<<<<<<<<<
 *     _moveTail(c_next, c_node)
 *     # uh oh, elements may be pointing to different doc when
 */
  xmlAddNextSibling(__pyx_v_element->_c_node, __pyx_v_c_node);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1278
 *     # move node itself
 *     tree.xmlAddNextSibling(element._c_node, c_node)
 *     _moveTail(c_next, c_node)             # <<<<<<<<<<<<<<
 *     # uh oh, elements may be pointing to different doc when
 *     # parent element has moved; change them too..
 */
  __pyx_f_4lxml_5etree__moveTail(__pyx_v_c_next, __pyx_v_c_node);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1281
 *     # uh oh, elements may be pointing to different doc when
 *     # parent element has moved; change them too..
 *     moveNodeToDocument(element._doc, c_source_doc, c_node)             # <<<<<<<<<<<<<<
 * 
 * cdef int _prependSibling(_Element element, _Element sibling) except -1:
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_element->_doc);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree_moveNodeToDocument(((struct LxmlDocument *)__pyx_t_1), __pyx_v_c_source_doc, __pyx_v_c_node); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._appendSibling");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1283
 *     moveNodeToDocument(element._doc, c_source_doc, c_node)
 * 
 * cdef int _prependSibling(_Element element, _Element sibling) except -1:             # <<<<<<<<<<<<<<
 *     u"""Append a new child to a parent element.
 *     """
 */

static  int __pyx_f_4lxml_5etree__prependSibling(struct LxmlElement *__pyx_v_element, struct LxmlElement *__pyx_v_sibling) {
  xmlNode *__pyx_v_c_node;
  xmlDoc *__pyx_v_c_source_doc;
  xmlNode *__pyx_v_c_next;
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("_prependSibling");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1286
 *     u"""Append a new child to a parent element.
 *     """
 *     cdef xmlNode* c_node = sibling._c_node             # <<<<<<<<<<<<<<
 *     cdef xmlDoc* c_source_doc = c_node.doc
 *     cdef xmlNode* c_next
 */
  __pyx_v_c_node = __pyx_v_sibling->_c_node;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1287
 *     """
 *     cdef xmlNode* c_node = sibling._c_node
 *     cdef xmlDoc* c_source_doc = c_node.doc             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_next
 *     # store possible text node
 */
  __pyx_v_c_source_doc = __pyx_v_c_node->doc;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1290
 *     cdef xmlNode* c_next
 *     # store possible text node
 *     c_next = c_node.next             # <<<<<<<<<<<<<<
 *     # move node itself
 *     tree.xmlAddPrevSibling(element._c_node, c_node)
 */
  __pyx_v_c_next = __pyx_v_c_node->next;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1292
 *     c_next = c_node.next
 *     # move node itself
 *     tree.xmlAddPrevSibling(element._c_node, c_node)             # <<<<<<<<<<<<<<
 *     _moveTail(c_next, c_node)
 *     # uh oh, elements may be pointing to different doc when
 */
  xmlAddPrevSibling(__pyx_v_element->_c_node, __pyx_v_c_node);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1293
 *     # move node itself
 *     tree.xmlAddPrevSibling(element._c_node, c_node)
 *     _moveTail(c_next, c_node)             # <<<<<<<<<<<<<<
 *     # uh oh, elements may be pointing to different doc when
 *     # parent element has moved; change them too..
 */
  __pyx_f_4lxml_5etree__moveTail(__pyx_v_c_next, __pyx_v_c_node);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1296
 *     # uh oh, elements may be pointing to different doc when
 *     # parent element has moved; change them too..
 *     moveNodeToDocument(element._doc, c_source_doc, c_node)             # <<<<<<<<<<<<<<
 * 
 * cdef inline int isutf8(char* s):
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_element->_doc);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree_moveNodeToDocument(((struct LxmlDocument *)__pyx_t_1), __pyx_v_c_source_doc, __pyx_v_c_node); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._prependSibling");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1298
 *     moveNodeToDocument(element._doc, c_source_doc, c_node)
 * 
 * cdef inline int isutf8(char* s):             # <<<<<<<<<<<<<<
 *     cdef char c = s[0]
 *     while c != c'\0':
 */

static CYTHON_INLINE int __pyx_f_4lxml_5etree_isutf8(char *__pyx_v_s) {
  char __pyx_v_c;
  int __pyx_r;
  int __pyx_t_1;
  long __pyx_t_2;
  __Pyx_RefNannySetupContext("isutf8");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1299
 * 
 * cdef inline int isutf8(char* s):
 *     cdef char c = s[0]             # <<<<<<<<<<<<<<
 *     while c != c'\0':
 *         if c & 0x80:
 */
  __pyx_v_c = (__pyx_v_s[0]);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1300
 * cdef inline int isutf8(char* s):
 *     cdef char c = s[0]
 *     while c != c'\0':             # <<<<<<<<<<<<<<
 *         if c & 0x80:
 *             return 1
 */
  while (1) {
    __pyx_t_1 = (__pyx_v_c != '\x00');
    if (!__pyx_t_1) break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1301
 *     cdef char c = s[0]
 *     while c != c'\0':
 *         if c & 0x80:             # <<<<<<<<<<<<<<
 *             return 1
 *         s = s + 1
 */
    __pyx_t_2 = (__pyx_v_c & 0x80);
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1302
 *     while c != c'\0':
 *         if c & 0x80:
 *             return 1             # <<<<<<<<<<<<<<
 *         s = s + 1
 *         c = s[0]
 */
      __pyx_r = 1;
      goto __pyx_L0;
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1303
 *         if c & 0x80:
 *             return 1
 *         s = s + 1             # <<<<<<<<<<<<<<
 *         c = s[0]
 *     return 0
 */
    __pyx_v_s = (__pyx_v_s + 1);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1304
 *             return 1
 *         s = s + 1
 *         c = s[0]             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    __pyx_v_c = (__pyx_v_s[0]);
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1305
 *         s = s + 1
 *         c = s[0]
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int check_string_utf8(bytes pystring):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1307
 *     return 0
 * 
 * cdef int check_string_utf8(bytes pystring):             # <<<<<<<<<<<<<<
 *     u"""Check if a string looks like valid UTF-8 XML content.  Returns 0
 *     for ASCII, 1 for UTF-8 and -1 in the case of errors, such as NULL
 */

static  int __pyx_f_4lxml_5etree_check_string_utf8(PyObject *__pyx_v_pystring) {
  char *__pyx_v_s;
  char *__pyx_v_c_end;
  int __pyx_v_is_non_ascii;
  int __pyx_r;
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  long __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("check_string_utf8");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1312
 *     bytes or ASCII control characters.
 *     """
 *     cdef char* s = _cstr(pystring)             # <<<<<<<<<<<<<<
 *     cdef char* c_end = s + len(pystring)
 *     cdef bint is_non_ascii = 0
 */
  __pyx_v_s = PyBytes_AS_STRING(((PyObject *)__pyx_v_pystring));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1313
 *     """
 *     cdef char* s = _cstr(pystring)
 *     cdef char* c_end = s + len(pystring)             # <<<<<<<<<<<<<<
 *     cdef bint is_non_ascii = 0
 *     while s < c_end:
 */
  if (unlikely(__pyx_v_pystring == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_1 = PyBytes_GET_SIZE(((PyObject *)__pyx_v_pystring)); 
  __pyx_v_c_end = (__pyx_v_s + __pyx_t_1);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1314
 *     cdef char* s = _cstr(pystring)
 *     cdef char* c_end = s + len(pystring)
 *     cdef bint is_non_ascii = 0             # <<<<<<<<<<<<<<
 *     while s < c_end:
 *         if s[0] & 0x80:
 */
  __pyx_v_is_non_ascii = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1315
 *     cdef char* c_end = s + len(pystring)
 *     cdef bint is_non_ascii = 0
 *     while s < c_end:             # <<<<<<<<<<<<<<
 *         if s[0] & 0x80:
 *             # skip over multi byte sequences
 */
  while (1) {
    __pyx_t_2 = (__pyx_v_s < __pyx_v_c_end);
    if (!__pyx_t_2) break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1316
 *     cdef bint is_non_ascii = 0
 *     while s < c_end:
 *         if s[0] & 0x80:             # <<<<<<<<<<<<<<
 *             # skip over multi byte sequences
 *             while s < c_end and s[0] & 0x80:
 */
    __pyx_t_3 = ((__pyx_v_s[0]) & 0x80);
    if (__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1318
 *         if s[0] & 0x80:
 *             # skip over multi byte sequences
 *             while s < c_end and s[0] & 0x80:             # <<<<<<<<<<<<<<
 *                 s += 1
 *             is_non_ascii = 1
 */
      while (1) {
        __pyx_t_2 = (__pyx_v_s < __pyx_v_c_end);
        if (__pyx_t_2) {
          __pyx_t_4 = ((__pyx_v_s[0]) & 0x80);
        } else {
          __pyx_t_4 = __pyx_t_2;
        }
        if (!__pyx_t_4) break;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1319
 *             # skip over multi byte sequences
 *             while s < c_end and s[0] & 0x80:
 *                 s += 1             # <<<<<<<<<<<<<<
 *             is_non_ascii = 1
 *         if  s < c_end and not tree.xmlIsChar_ch(s[0]):
 */
        __pyx_v_s = (__pyx_v_s + 1);
      }

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1320
 *             while s < c_end and s[0] & 0x80:
 *                 s += 1
 *             is_non_ascii = 1             # <<<<<<<<<<<<<<
 *         if  s < c_end and not tree.xmlIsChar_ch(s[0]):
 *             return -1 # invalid!
 */
      __pyx_v_is_non_ascii = 1;
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1321
 *                 s += 1
 *             is_non_ascii = 1
 *         if  s < c_end and not tree.xmlIsChar_ch(s[0]):             # <<<<<<<<<<<<<<
 *             return -1 # invalid!
 *         s += 1
 */
    __pyx_t_4 = (__pyx_v_s < __pyx_v_c_end);
    if (__pyx_t_4) {
      __pyx_t_2 = (!xmlIsChar_ch((__pyx_v_s[0])));
      __pyx_t_5 = __pyx_t_2;
    } else {
      __pyx_t_5 = __pyx_t_4;
    }
    if (__pyx_t_5) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1322
 *             is_non_ascii = 1
 *         if  s < c_end and not tree.xmlIsChar_ch(s[0]):
 *             return -1 # invalid!             # <<<<<<<<<<<<<<
 *         s += 1
 *     return is_non_ascii
 */
      __pyx_r = -1;
      goto __pyx_L0;
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1323
 *         if  s < c_end and not tree.xmlIsChar_ch(s[0]):
 *             return -1 # invalid!
 *         s += 1             # <<<<<<<<<<<<<<
 *     return is_non_ascii
 * 
 */
    __pyx_v_s = (__pyx_v_s + 1);
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1324
 *             return -1 # invalid!
 *         s += 1
 *     return is_non_ascii             # <<<<<<<<<<<<<<
 * 
 * cdef object funicode(char* s):
 */
  __pyx_r = __pyx_v_is_non_ascii;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("lxml.etree.check_string_utf8");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1326
 *     return is_non_ascii
 * 
 * cdef object funicode(char* s):             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t slen
 *     cdef char* spos
 */

static  PyObject *__pyx_f_4lxml_5etree_funicode(char *__pyx_v_s) {
  Py_ssize_t __pyx_v_slen;
  char *__pyx_v_spos;
  int __pyx_v_is_non_ascii;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  long __pyx_t_3;
  __Pyx_RefNannySetupContext("funicode");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1330
 *     cdef char* spos
 *     cdef bint is_non_ascii
 *     if python.IS_PYTHON3:             # <<<<<<<<<<<<<<
 *         slen = cstd.strlen(s)
 *         return s[:slen].decode('UTF-8')
 */
  if (IS_PYTHON3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1331
 *     cdef bint is_non_ascii
 *     if python.IS_PYTHON3:
 *         slen = cstd.strlen(s)             # <<<<<<<<<<<<<<
 *         return s[:slen].decode('UTF-8')
 *     spos = s
 */
    __pyx_v_slen = strlen(__pyx_v_s);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1332
 *     if python.IS_PYTHON3:
 *         slen = cstd.strlen(s)
 *         return s[:slen].decode('UTF-8')             # <<<<<<<<<<<<<<
 *     spos = s
 *     is_non_ascii = 0
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = ((PyObject *)PyUnicode_DecodeUTF8(__pyx_v_s, __pyx_v_slen, NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __pyx_r = ((PyObject *)__pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1333
 *         slen = cstd.strlen(s)
 *         return s[:slen].decode('UTF-8')
 *     spos = s             # <<<<<<<<<<<<<<
 *     is_non_ascii = 0
 *     while spos[0] != c'\0':
 */
  __pyx_v_spos = __pyx_v_s;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1334
 *         return s[:slen].decode('UTF-8')
 *     spos = s
 *     is_non_ascii = 0             # <<<<<<<<<<<<<<
 *     while spos[0] != c'\0':
 *         if spos[0] & 0x80:
 */
  __pyx_v_is_non_ascii = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1335
 *     spos = s
 *     is_non_ascii = 0
 *     while spos[0] != c'\0':             # <<<<<<<<<<<<<<
 *         if spos[0] & 0x80:
 *             is_non_ascii = 1
 */
  while (1) {
    __pyx_t_2 = ((__pyx_v_spos[0]) != '\x00');
    if (!__pyx_t_2) break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1336
 *     is_non_ascii = 0
 *     while spos[0] != c'\0':
 *         if spos[0] & 0x80:             # <<<<<<<<<<<<<<
 *             is_non_ascii = 1
 *             break
 */
    __pyx_t_3 = ((__pyx_v_spos[0]) & 0x80);
    if (__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1337
 *     while spos[0] != c'\0':
 *         if spos[0] & 0x80:
 *             is_non_ascii = 1             # <<<<<<<<<<<<<<
 *             break
 *         spos += 1
 */
      __pyx_v_is_non_ascii = 1;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1338
 *         if spos[0] & 0x80:
 *             is_non_ascii = 1
 *             break             # <<<<<<<<<<<<<<
 *         spos += 1
 *     while spos[0] != c'\0':
 */
      goto __pyx_L5_break;
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1339
 *             is_non_ascii = 1
 *             break
 *         spos += 1             # <<<<<<<<<<<<<<
 *     while spos[0] != c'\0':
 *         spos += 1
 */
    __pyx_v_spos = (__pyx_v_spos + 1);
  }
  __pyx_L5_break:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1340
 *             break
 *         spos += 1
 *     while spos[0] != c'\0':             # <<<<<<<<<<<<<<
 *         spos += 1
 *     slen = spos - s
 */
  while (1) {
    __pyx_t_2 = ((__pyx_v_spos[0]) != '\x00');
    if (!__pyx_t_2) break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1341
 *         spos += 1
 *     while spos[0] != c'\0':
 *         spos += 1             # <<<<<<<<<<<<<<
 *     slen = spos - s
 *     if is_non_ascii:
 */
    __pyx_v_spos = (__pyx_v_spos + 1);
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1342
 *     while spos[0] != c'\0':
 *         spos += 1
 *     slen = spos - s             # <<<<<<<<<<<<<<
 *     if is_non_ascii:
 *         return s[:slen].decode('UTF-8')
 */
  __pyx_v_slen = (__pyx_v_spos - __pyx_v_s);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1343
 *         spos += 1
 *     slen = spos - s
 *     if is_non_ascii:             # <<<<<<<<<<<<<<
 *         return s[:slen].decode('UTF-8')
 *     return <bytes>s[:slen]
 */
  if (__pyx_v_is_non_ascii) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1344
 *     slen = spos - s
 *     if is_non_ascii:
 *         return s[:slen].decode('UTF-8')             # <<<<<<<<<<<<<<
 *     return <bytes>s[:slen]
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = ((PyObject *)PyUnicode_DecodeUTF8(__pyx_v_s, __pyx_v_slen, NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __pyx_r = ((PyObject *)__pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L0;
    goto __pyx_L9;
  }
  __pyx_L9:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1345
 *     if is_non_ascii:
 *         return s[:slen].decode('UTF-8')
 *     return <bytes>s[:slen]             # <<<<<<<<<<<<<<
 * 
 * cdef bytes _utf8(object s):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyBytes_FromStringAndSize(__pyx_v_s + 0, __pyx_v_slen - 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_r = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.funicode");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1347
 *     return <bytes>s[:slen]
 * 
 * cdef bytes _utf8(object s):             # <<<<<<<<<<<<<<
 *     """Test if a string is valid user input and encode it to UTF-8.
 *     Reject all bytes/unicode input that contains non-XML characters.
 */

static  PyObject *__pyx_f_4lxml_5etree__utf8(PyObject *__pyx_v_s) {
  int __pyx_v_invalid;
  PyObject *__pyx_v_utf8_string;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("_utf8");
  __pyx_v_utf8_string = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1354
 *     cdef int invalid
 *     cdef bytes utf8_string
 *     if python.PyBytes_CheckExact(s):             # <<<<<<<<<<<<<<
 *         utf8_string = <bytes>s
 *         invalid = check_string_utf8(utf8_string)
 */
  __pyx_t_1 = PyBytes_CheckExact(__pyx_v_s);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1355
 *     cdef bytes utf8_string
 *     if python.PyBytes_CheckExact(s):
 *         utf8_string = <bytes>s             # <<<<<<<<<<<<<<
 *         invalid = check_string_utf8(utf8_string)
 *     elif python.PyUnicode_Check(s):
 */
    __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_v_s)));
    __Pyx_DECREF(((PyObject *)__pyx_v_utf8_string));
    __pyx_v_utf8_string = ((PyObject*)__pyx_v_s);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1356
 *     if python.PyBytes_CheckExact(s):
 *         utf8_string = <bytes>s
 *         invalid = check_string_utf8(utf8_string)             # <<<<<<<<<<<<<<
 *     elif python.PyUnicode_Check(s):
 *         utf8_string = python.PyUnicode_AsUTF8String(s)
 */
    __pyx_v_invalid = __pyx_f_4lxml_5etree_check_string_utf8(__pyx_v_utf8_string);
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1357
 *         utf8_string = <bytes>s
 *         invalid = check_string_utf8(utf8_string)
 *     elif python.PyUnicode_Check(s):             # <<<<<<<<<<<<<<
 *         utf8_string = python.PyUnicode_AsUTF8String(s)
 *         invalid = check_string_utf8(utf8_string) == -1 # non-XML?
 */
  __pyx_t_1 = PyUnicode_Check(__pyx_v_s);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1358
 *         invalid = check_string_utf8(utf8_string)
 *     elif python.PyUnicode_Check(s):
 *         utf8_string = python.PyUnicode_AsUTF8String(s)             # <<<<<<<<<<<<<<
 *         invalid = check_string_utf8(utf8_string) == -1 # non-XML?
 *     elif python.PyBytes_Check(s):
 */
    __pyx_t_2 = ((PyObject *)PyUnicode_AsUTF8String(__pyx_v_s)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_v_utf8_string));
    __pyx_v_utf8_string = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1359
 *     elif python.PyUnicode_Check(s):
 *         utf8_string = python.PyUnicode_AsUTF8String(s)
 *         invalid = check_string_utf8(utf8_string) == -1 # non-XML?             # <<<<<<<<<<<<<<
 *     elif python.PyBytes_Check(s):
 *         utf8_string = bytes(s)
 */
    __pyx_v_invalid = (__pyx_f_4lxml_5etree_check_string_utf8(__pyx_v_utf8_string) == -1);
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1360
 *         utf8_string = python.PyUnicode_AsUTF8String(s)
 *         invalid = check_string_utf8(utf8_string) == -1 # non-XML?
 *     elif python.PyBytes_Check(s):             # <<<<<<<<<<<<<<
 *         utf8_string = bytes(s)
 *         invalid = check_string_utf8(utf8_string)
 */
  __pyx_t_1 = PyBytes_Check(__pyx_v_s);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1361
 *         invalid = check_string_utf8(utf8_string) == -1 # non-XML?
 *     elif python.PyBytes_Check(s):
 *         utf8_string = bytes(s)             # <<<<<<<<<<<<<<
 *         invalid = check_string_utf8(utf8_string)
 *     else:
 */
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __Pyx_INCREF(__pyx_v_s);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_s);
    __Pyx_GIVEREF(__pyx_v_s);
    __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyBytes_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_v_utf8_string));
    __pyx_v_utf8_string = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1362
 *     elif python.PyBytes_Check(s):
 *         utf8_string = bytes(s)
 *         invalid = check_string_utf8(utf8_string)             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError, (u"Argument must be bytes or unicode, got '%.200s'" % type(s).__name__)
 */
    __pyx_v_invalid = __pyx_f_4lxml_5etree_check_string_utf8(__pyx_v_utf8_string);
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1364
 *         invalid = check_string_utf8(utf8_string)
 *     else:
 *         raise TypeError, (u"Argument must be bytes or unicode, got '%.200s'" % type(s).__name__)             # <<<<<<<<<<<<<<
 *     if invalid:
 *         raise ValueError, \
 */
    __pyx_t_3 = PyObject_GetAttr(((PyObject *)Py_TYPE(__pyx_v_s)), __pyx_n_s____name__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_29), __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_2), 0);
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1365
 *     else:
 *         raise TypeError, (u"Argument must be bytes or unicode, got '%.200s'" % type(s).__name__)
 *     if invalid:             # <<<<<<<<<<<<<<
 *         raise ValueError, \
 *             u"All strings must be XML compatible: Unicode or ASCII, no NULL bytes or control characters"
 */
  if (__pyx_v_invalid) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1366
 *         raise TypeError, (u"Argument must be bytes or unicode, got '%.200s'" % type(s).__name__)
 *     if invalid:
 *         raise ValueError, \             # <<<<<<<<<<<<<<
 *             u"All strings must be XML compatible: Unicode or ASCII, no NULL bytes or control characters"
 *     return utf8_string
 */
    __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_u_30), 0);
    {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1368
 *         raise ValueError, \
 *             u"All strings must be XML compatible: Unicode or ASCII, no NULL bytes or control characters"
 *     return utf8_string             # <<<<<<<<<<<<<<
 * 
 * cdef bint _isFilePath(char* c_path):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_utf8_string));
  __pyx_r = __pyx_v_utf8_string;
  goto __pyx_L0;

  __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._utf8");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_utf8_string);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1370
 *     return utf8_string
 * 
 * cdef bint _isFilePath(char* c_path):             # <<<<<<<<<<<<<<
 *     u"simple heuristic to see if a path is a filename"
 *     cdef char c
 */

static  int __pyx_f_4lxml_5etree__isFilePath(char *__pyx_v_c_path) {
  char __pyx_v_c;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("_isFilePath");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1374
 *     cdef char c
 *     # test if it looks like an absolute Unix path or a Windows network path
 *     if c_path[0] == c'/':             # <<<<<<<<<<<<<<
 *         return 1
 *     # test if it looks like an absolute Windows path
 */
  __pyx_t_1 = ((__pyx_v_c_path[0]) == '/');
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1375
 *     # test if it looks like an absolute Unix path or a Windows network path
 *     if c_path[0] == c'/':
 *         return 1             # <<<<<<<<<<<<<<
 *     # test if it looks like an absolute Windows path
 *     if (c_path[0] >= c'a' and c_path[0] <= c'z') or \
 */
    __pyx_r = 1;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1377
 *         return 1
 *     # test if it looks like an absolute Windows path
 *     if (c_path[0] >= c'a' and c_path[0] <= c'z') or \             # <<<<<<<<<<<<<<
 *             (c_path[0] >= c'A' and c_path[0] <= c'Z'):
 *         if c_path[1] == c':':
 */
  __pyx_t_1 = ((__pyx_v_c_path[0]) >= 'a');
  if (__pyx_t_1) {
    __pyx_t_2 = ((__pyx_v_c_path[0]) <= 'z');
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (!__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1378
 *     # test if it looks like an absolute Windows path
 *     if (c_path[0] >= c'a' and c_path[0] <= c'z') or \
 *             (c_path[0] >= c'A' and c_path[0] <= c'Z'):             # <<<<<<<<<<<<<<
 *         if c_path[1] == c':':
 *             return 1
 */
    __pyx_t_1 = ((__pyx_v_c_path[0]) >= 'A');
    if (__pyx_t_1) {
      __pyx_t_2 = ((__pyx_v_c_path[0]) <= 'Z');
      __pyx_t_4 = __pyx_t_2;
    } else {
      __pyx_t_4 = __pyx_t_1;
    }
    __pyx_t_1 = __pyx_t_4;
  } else {
    __pyx_t_1 = __pyx_t_3;
  }
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1379
 *     if (c_path[0] >= c'a' and c_path[0] <= c'z') or \
 *             (c_path[0] >= c'A' and c_path[0] <= c'Z'):
 *         if c_path[1] == c':':             # <<<<<<<<<<<<<<
 *             return 1
 *     # test if it looks like a relative path
 */
    __pyx_t_1 = ((__pyx_v_c_path[1]) == ':');
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1380
 *             (c_path[0] >= c'A' and c_path[0] <= c'Z'):
 *         if c_path[1] == c':':
 *             return 1             # <<<<<<<<<<<<<<
 *     # test if it looks like a relative path
 *     while c_path[0] != c'\0':
 */
      __pyx_r = 1;
      goto __pyx_L0;
      goto __pyx_L5;
    }
    __pyx_L5:;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1382
 *             return 1
 *     # test if it looks like a relative path
 *     while c_path[0] != c'\0':             # <<<<<<<<<<<<<<
 *         c = c_path[0]
 *         if c == c':':
 */
  while (1) {
    __pyx_t_1 = ((__pyx_v_c_path[0]) != '\x00');
    if (!__pyx_t_1) break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1383
 *     # test if it looks like a relative path
 *     while c_path[0] != c'\0':
 *         c = c_path[0]             # <<<<<<<<<<<<<<
 *         if c == c':':
 *             return 0
 */
    __pyx_v_c = (__pyx_v_c_path[0]);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1388
 *         elif c == c'/':
 *             return 1
 *         elif c == c'\\':             # <<<<<<<<<<<<<<
 *             return 1
 *         c_path += 1
 */
    switch (__pyx_v_c) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1384
 *     while c_path[0] != c'\0':
 *         c = c_path[0]
 *         if c == c':':             # <<<<<<<<<<<<<<
 *             return 0
 *         elif c == c'/':
 */
      case ':':

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1385
 *         c = c_path[0]
 *         if c == c':':
 *             return 0             # <<<<<<<<<<<<<<
 *         elif c == c'/':
 *             return 1
 */
      __pyx_r = 0;
      goto __pyx_L0;
      break;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1386
 *         if c == c':':
 *             return 0
 *         elif c == c'/':             # <<<<<<<<<<<<<<
 *             return 1
 *         elif c == c'\\':
 */
      case '/':

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1387
 *             return 0
 *         elif c == c'/':
 *             return 1             # <<<<<<<<<<<<<<
 *         elif c == c'\\':
 *             return 1
 */
      __pyx_r = 1;
      goto __pyx_L0;
      break;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1388
 *         elif c == c'/':
 *             return 1
 *         elif c == c'\\':             # <<<<<<<<<<<<<<
 *             return 1
 *         c_path += 1
 */
      case '\\':

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1389
 *             return 1
 *         elif c == c'\\':
 *             return 1             # <<<<<<<<<<<<<<
 *         c_path += 1
 *     return 1
 */
      __pyx_r = 1;
      goto __pyx_L0;
      break;
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1390
 *         elif c == c'\\':
 *             return 1
 *         c_path += 1             # <<<<<<<<<<<<<<
 *     return 1
 * 
 */
    __pyx_v_c_path = (__pyx_v_c_path + 1);
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1391
 *             return 1
 *         c_path += 1
 *     return 1             # <<<<<<<<<<<<<<
 * 
 * cdef object _encodeFilename(object filename):
 */
  __pyx_r = 1;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1393
 *     return 1
 * 
 * cdef object _encodeFilename(object filename):             # <<<<<<<<<<<<<<
 *     u"""Make sure a filename is 8-bit encoded (or None).
 *     """
 */

static  PyObject *__pyx_f_4lxml_5etree__encodeFilename(PyObject *__pyx_v_filename) {
  PyObject *__pyx_v_filename8;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  char *__pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("_encodeFilename");
  __pyx_v_filename8 = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1396
 *     u"""Make sure a filename is 8-bit encoded (or None).
 *     """
 *     if filename is None:             # <<<<<<<<<<<<<<
 *         return None
 *     elif python.PyBytes_Check(filename):
 */
  __pyx_t_1 = (__pyx_v_filename == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1397
 *     """
 *     if filename is None:
 *         return None             # <<<<<<<<<<<<<<
 *     elif python.PyBytes_Check(filename):
 *         return filename
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1398
 *     if filename is None:
 *         return None
 *     elif python.PyBytes_Check(filename):             # <<<<<<<<<<<<<<
 *         return filename
 *     elif python.PyUnicode_Check(filename):
 */
  __pyx_t_1 = PyBytes_Check(__pyx_v_filename);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1399
 *         return None
 *     elif python.PyBytes_Check(filename):
 *         return filename             # <<<<<<<<<<<<<<
 *     elif python.PyUnicode_Check(filename):
 *         filename8 = python.PyUnicode_AsEncodedString(
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_filename);
    __pyx_r = __pyx_v_filename;
    goto __pyx_L0;
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1400
 *     elif python.PyBytes_Check(filename):
 *         return filename
 *     elif python.PyUnicode_Check(filename):             # <<<<<<<<<<<<<<
 *         filename8 = python.PyUnicode_AsEncodedString(
 *             filename, 'UTF-8', NULL)
 */
  __pyx_t_1 = PyUnicode_Check(__pyx_v_filename);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1402
 *     elif python.PyUnicode_Check(filename):
 *         filename8 = python.PyUnicode_AsEncodedString(
 *             filename, 'UTF-8', NULL)             # <<<<<<<<<<<<<<
 *         if _isFilePath(filename8):
 *             try:
 */
    __pyx_t_2 = ((PyObject *)PyUnicode_AsEncodedString(__pyx_v_filename, __pyx_k_31, NULL)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_v_filename8));
    __pyx_v_filename8 = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1403
 *         filename8 = python.PyUnicode_AsEncodedString(
 *             filename, 'UTF-8', NULL)
 *         if _isFilePath(filename8):             # <<<<<<<<<<<<<<
 *             try:
 *                 return python.PyUnicode_AsEncodedString(
 */
    __pyx_t_3 = PyBytes_AsString(((PyObject *)__pyx_v_filename8)); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = __pyx_f_4lxml_5etree__isFilePath(__pyx_t_3);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1404
 *             filename, 'UTF-8', NULL)
 *         if _isFilePath(filename8):
 *             try:             # <<<<<<<<<<<<<<
 *                 return python.PyUnicode_AsEncodedString(
 *                     filename, _C_FILENAME_ENCODING, NULL)
 */
      {
        PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
        __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
        __Pyx_XGOTREF(__pyx_save_exc_type);
        __Pyx_XGOTREF(__pyx_save_exc_value);
        __Pyx_XGOTREF(__pyx_save_exc_tb);
        /*try:*/ {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1405
 *         if _isFilePath(filename8):
 *             try:
 *                 return python.PyUnicode_AsEncodedString(             # <<<<<<<<<<<<<<
 *                     filename, _C_FILENAME_ENCODING, NULL)
 *             except UnicodeEncodeError:
 */
          __Pyx_XDECREF(__pyx_r);

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1406
 *             try:
 *                 return python.PyUnicode_AsEncodedString(
 *                     filename, _C_FILENAME_ENCODING, NULL)             # <<<<<<<<<<<<<<
 *             except UnicodeEncodeError:
 *                 pass
 */
          __pyx_t_2 = ((PyObject *)PyUnicode_AsEncodedString(__pyx_v_filename, __pyx_v_4lxml_5etree__C_FILENAME_ENCODING, NULL)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1405; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_r = __pyx_t_2;
          __pyx_t_2 = 0;
          goto __pyx_L9_try_return;
        }
        __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
        __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
        __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
        goto __pyx_L12_try_end;
        __pyx_L9_try_return:;
        __Pyx_XGIVEREF(__pyx_save_exc_type);
        __Pyx_XGIVEREF(__pyx_save_exc_value);
        __Pyx_XGIVEREF(__pyx_save_exc_tb);
        __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
        goto __pyx_L0;
        __pyx_L5_error:;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1407
 *                 return python.PyUnicode_AsEncodedString(
 *                     filename, _C_FILENAME_ENCODING, NULL)
 *             except UnicodeEncodeError:             # <<<<<<<<<<<<<<
 *                 pass
 *         return filename8
 */
        __pyx_t_4 = PyErr_ExceptionMatches(__pyx_builtin_UnicodeEncodeError);
        if (__pyx_t_4) {
          PyErr_Restore(0,0,0);
          goto __pyx_L6_exception_handled;
        }
        __Pyx_XGIVEREF(__pyx_save_exc_type);
        __Pyx_XGIVEREF(__pyx_save_exc_value);
        __Pyx_XGIVEREF(__pyx_save_exc_tb);
        __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
        goto __pyx_L1_error;
        __pyx_L6_exception_handled:;
        __Pyx_XGIVEREF(__pyx_save_exc_type);
        __Pyx_XGIVEREF(__pyx_save_exc_value);
        __Pyx_XGIVEREF(__pyx_save_exc_tb);
        __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
        __pyx_L12_try_end:;
      }
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1409
 *             except UnicodeEncodeError:
 *                 pass
 *         return filename8             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError, u"Argument must be string or unicode."
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_filename8));
    __pyx_r = ((PyObject *)__pyx_v_filename8);
    goto __pyx_L0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1411
 *         return filename8
 *     else:
 *         raise TypeError, u"Argument must be string or unicode."             # <<<<<<<<<<<<<<
 * 
 * cdef object _decodeFilename(char* c_path):
 */
    __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_u_32), 0);
    {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1411; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._encodeFilename");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_filename8);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1413
 *         raise TypeError, u"Argument must be string or unicode."
 * 
 * cdef object _decodeFilename(char* c_path):             # <<<<<<<<<<<<<<
 *     u"""Make the filename a unicode string if we are in Py3.
 *     """
 */

static  PyObject *__pyx_f_4lxml_5etree__decodeFilename(char *__pyx_v_c_path) {
  Py_ssize_t __pyx_v_c_len;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("_decodeFilename");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1416
 *     u"""Make the filename a unicode string if we are in Py3.
 *     """
 *     cdef Py_ssize_t c_len = cstd.strlen(c_path)             # <<<<<<<<<<<<<<
 *     if _isFilePath(c_path):
 *         try:
 */
  __pyx_v_c_len = strlen(__pyx_v_c_path);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1417
 *     """
 *     cdef Py_ssize_t c_len = cstd.strlen(c_path)
 *     if _isFilePath(c_path):             # <<<<<<<<<<<<<<
 *         try:
 *             return python.PyUnicode_Decode(
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__isFilePath(__pyx_v_c_path);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1418
 *     cdef Py_ssize_t c_len = cstd.strlen(c_path)
 *     if _isFilePath(c_path):
 *         try:             # <<<<<<<<<<<<<<
 *             return python.PyUnicode_Decode(
 *                 c_path, c_len, _C_FILENAME_ENCODING, NULL)
 */
    {
      PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
      __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
      __Pyx_XGOTREF(__pyx_save_exc_type);
      __Pyx_XGOTREF(__pyx_save_exc_value);
      __Pyx_XGOTREF(__pyx_save_exc_tb);
      /*try:*/ {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1419
 *     if _isFilePath(c_path):
 *         try:
 *             return python.PyUnicode_Decode(             # <<<<<<<<<<<<<<
 *                 c_path, c_len, _C_FILENAME_ENCODING, NULL)
 *         except UnicodeDecodeError:
 */
        __Pyx_XDECREF(__pyx_r);

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1420
 *         try:
 *             return python.PyUnicode_Decode(
 *                 c_path, c_len, _C_FILENAME_ENCODING, NULL)             # <<<<<<<<<<<<<<
 *         except UnicodeDecodeError:
 *             pass
 */
        __pyx_t_2 = ((PyObject *)PyUnicode_Decode(__pyx_v_c_path, __pyx_v_c_len, __pyx_v_4lxml_5etree__C_FILENAME_ENCODING, NULL)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1419; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        goto __pyx_L8_try_return;
      }
      __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
      __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
      __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
      goto __pyx_L11_try_end;
      __pyx_L8_try_return:;
      __Pyx_XGIVEREF(__pyx_save_exc_type);
      __Pyx_XGIVEREF(__pyx_save_exc_value);
      __Pyx_XGIVEREF(__pyx_save_exc_tb);
      __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
      goto __pyx_L0;
      __pyx_L4_error:;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1421
 *             return python.PyUnicode_Decode(
 *                 c_path, c_len, _C_FILENAME_ENCODING, NULL)
 *         except UnicodeDecodeError:             # <<<<<<<<<<<<<<
 *             pass
 *     try:
 */
      __pyx_t_3 = PyErr_ExceptionMatches(__pyx_builtin_UnicodeDecodeError);
      if (__pyx_t_3) {
        PyErr_Restore(0,0,0);
        goto __pyx_L5_exception_handled;
      }
      __Pyx_XGIVEREF(__pyx_save_exc_type);
      __Pyx_XGIVEREF(__pyx_save_exc_value);
      __Pyx_XGIVEREF(__pyx_save_exc_tb);
      __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
      goto __pyx_L1_error;
      __pyx_L5_exception_handled:;
      __Pyx_XGIVEREF(__pyx_save_exc_type);
      __Pyx_XGIVEREF(__pyx_save_exc_value);
      __Pyx_XGIVEREF(__pyx_save_exc_tb);
      __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
      __pyx_L11_try_end:;
    }
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1423
 *         except UnicodeDecodeError:
 *             pass
 *     try:             # <<<<<<<<<<<<<<
 *         return c_path[:c_len].decode('UTF-8')
 *     except UnicodeDecodeError:
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1424
 *             pass
 *     try:
 *         return c_path[:c_len].decode('UTF-8')             # <<<<<<<<<<<<<<
 *     except UnicodeDecodeError:
 *         # this is a stupid fallback, but it might still work...
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = ((PyObject *)PyUnicode_DecodeUTF8(__pyx_v_c_path, __pyx_v_c_len, NULL)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1424; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __pyx_r = ((PyObject *)__pyx_t_2);
      __pyx_t_2 = 0;
      goto __pyx_L16_try_return;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L19_try_end;
    __pyx_L16_try_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;
    __pyx_L12_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1425
 *     try:
 *         return c_path[:c_len].decode('UTF-8')
 *     except UnicodeDecodeError:             # <<<<<<<<<<<<<<
 *         # this is a stupid fallback, but it might still work...
 *         return c_path[:c_len].decode('latin-1', 'replace')
 */
    __pyx_t_3 = PyErr_ExceptionMatches(__pyx_builtin_UnicodeDecodeError);
    if (__pyx_t_3) {
      __Pyx_AddTraceback("lxml.etree._decodeFilename");
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_4, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1425; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_5);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1427
 *     except UnicodeDecodeError:
 *         # this is a stupid fallback, but it might still work...
 *         return c_path[:c_len].decode('latin-1', 'replace')             # <<<<<<<<<<<<<<
 * 
 * cdef object _encodeFilenameUTF8(object filename):
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_6 = ((PyObject *)PyUnicode_DecodeLatin1(__pyx_v_c_path, __pyx_v_c_len, __pyx_k__replace)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1427; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
      __pyx_r = ((PyObject *)__pyx_t_6);
      __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L15_except_return;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L13_exception_handled;
    }
    __pyx_L14_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L15_except_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;
    __pyx_L13_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L19_try_end:;
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._decodeFilename");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1429
 *         return c_path[:c_len].decode('latin-1', 'replace')
 * 
 * cdef object _encodeFilenameUTF8(object filename):             # <<<<<<<<<<<<<<
 *     u"""Recode filename as UTF-8. Tries ASCII, local filesystem encoding and
 *     UTF-8 as source encoding.
 */

static  PyObject *__pyx_f_4lxml_5etree__encodeFilenameUTF8(PyObject *__pyx_v_filename) {
  char *__pyx_v_c_filename;
  PyObject *__pyx_v_decode_exc;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  __Pyx_RefNannySetupContext("_encodeFilenameUTF8");
  __Pyx_INCREF(__pyx_v_filename);
  __pyx_v_decode_exc = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1434
 *     """
 *     cdef char* c_filename
 *     if filename is None:             # <<<<<<<<<<<<<<
 *         return None
 *     elif python.PyBytes_Check(filename):
 */
  __pyx_t_1 = (__pyx_v_filename == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1435
 *     cdef char* c_filename
 *     if filename is None:
 *         return None             # <<<<<<<<<<<<<<
 *     elif python.PyBytes_Check(filename):
 *         if not check_string_utf8(<bytes>filename):
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1436
 *     if filename is None:
 *         return None
 *     elif python.PyBytes_Check(filename):             # <<<<<<<<<<<<<<
 *         if not check_string_utf8(<bytes>filename):
 *             # plain ASCII!
 */
  __pyx_t_1 = PyBytes_Check(__pyx_v_filename);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1437
 *         return None
 *     elif python.PyBytes_Check(filename):
 *         if not check_string_utf8(<bytes>filename):             # <<<<<<<<<<<<<<
 *             # plain ASCII!
 *             return filename
 */
    __pyx_t_1 = (!__pyx_f_4lxml_5etree_check_string_utf8(((PyObject*)__pyx_v_filename)));
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1439
 *         if not check_string_utf8(<bytes>filename):
 *             # plain ASCII!
 *             return filename             # <<<<<<<<<<<<<<
 *         c_filename = _cstr(<bytes>filename)
 *         try:
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_filename);
      __pyx_r = __pyx_v_filename;
      goto __pyx_L0;
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1440
 *             # plain ASCII!
 *             return filename
 *         c_filename = _cstr(<bytes>filename)             # <<<<<<<<<<<<<<
 *         try:
 *             # try to decode with default encoding
 */
    __pyx_v_c_filename = PyBytes_AS_STRING(__pyx_v_filename);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1441
 *             return filename
 *         c_filename = _cstr(<bytes>filename)
 *         try:             # <<<<<<<<<<<<<<
 *             # try to decode with default encoding
 *             filename = python.PyUnicode_Decode(
 */
    {
      PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
      __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
      __Pyx_XGOTREF(__pyx_save_exc_type);
      __Pyx_XGOTREF(__pyx_save_exc_value);
      __Pyx_XGOTREF(__pyx_save_exc_tb);
      /*try:*/ {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1444
 *             # try to decode with default encoding
 *             filename = python.PyUnicode_Decode(
 *                 c_filename, len(<bytes>filename),             # <<<<<<<<<<<<<<
 *                 _C_FILENAME_ENCODING, NULL)
 *         except UnicodeDecodeError, decode_exc:
 */
        if (unlikely(((PyObject*)__pyx_v_filename) == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1444; __pyx_clineno = __LINE__; goto __pyx_L5_error;} 
        }
        __pyx_t_2 = PyBytes_GET_SIZE(((PyObject *)((PyObject*)__pyx_v_filename))); 

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1445
 *             filename = python.PyUnicode_Decode(
 *                 c_filename, len(<bytes>filename),
 *                 _C_FILENAME_ENCODING, NULL)             # <<<<<<<<<<<<<<
 *         except UnicodeDecodeError, decode_exc:
 *             try:
 */
        __pyx_t_3 = ((PyObject *)PyUnicode_Decode(__pyx_v_c_filename, __pyx_t_2, __pyx_v_4lxml_5etree__C_FILENAME_ENCODING, NULL)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1443; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_v_filename);
        __pyx_v_filename = __pyx_t_3;
        __pyx_t_3 = 0;
      }
      __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
      __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
      __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
      goto __pyx_L12_try_end;
      __pyx_L5_error:;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1446
 *                 c_filename, len(<bytes>filename),
 *                 _C_FILENAME_ENCODING, NULL)
 *         except UnicodeDecodeError, decode_exc:             # <<<<<<<<<<<<<<
 *             try:
 *                 # try if it's UTF-8
 */
      __pyx_t_4 = PyErr_ExceptionMatches(__pyx_builtin_UnicodeDecodeError);
      if (__pyx_t_4) {
        __Pyx_AddTraceback("lxml.etree._encodeFilenameUTF8");
        if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_5, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1446; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_v_decode_exc);
        __pyx_v_decode_exc = __pyx_t_5;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1447
 *                 _C_FILENAME_ENCODING, NULL)
 *         except UnicodeDecodeError, decode_exc:
 *             try:             # <<<<<<<<<<<<<<
 *                 # try if it's UTF-8
 *                 filename = python.PyUnicode_DecodeUTF8(
 */
        {
          PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
          __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
          __Pyx_XGOTREF(__pyx_save_exc_type);
          __Pyx_XGOTREF(__pyx_save_exc_value);
          __Pyx_XGOTREF(__pyx_save_exc_tb);
          /*try:*/ {

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1450
 *                 # try if it's UTF-8
 *                 filename = python.PyUnicode_DecodeUTF8(
 *                     c_filename, len(<bytes>filename), NULL)             # <<<<<<<<<<<<<<
 *             except UnicodeDecodeError:
 *                 raise decode_exc # otherwise re-raise original exception
 */
            if (unlikely(((PyObject*)__pyx_v_filename) == Py_None)) {
              PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1450; __pyx_clineno = __LINE__; goto __pyx_L15_error;} 
            }
            __pyx_t_2 = PyBytes_GET_SIZE(((PyObject *)((PyObject*)__pyx_v_filename))); 
            __pyx_t_7 = ((PyObject *)PyUnicode_DecodeUTF8(__pyx_v_c_filename, __pyx_t_2, NULL)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1449; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
            __Pyx_GOTREF(__pyx_t_7);
            __Pyx_DECREF(__pyx_v_filename);
            __pyx_v_filename = __pyx_t_7;
            __pyx_t_7 = 0;
          }
          __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
          __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
          __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
          goto __pyx_L22_try_end;
          __pyx_L15_error:;
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1451
 *                 filename = python.PyUnicode_DecodeUTF8(
 *                     c_filename, len(<bytes>filename), NULL)
 *             except UnicodeDecodeError:             # <<<<<<<<<<<<<<
 *                 raise decode_exc # otherwise re-raise original exception
 *     if python.PyUnicode_Check(filename):
 */
          __pyx_t_4 = PyErr_ExceptionMatches(__pyx_builtin_UnicodeDecodeError);
          if (__pyx_t_4) {
            __Pyx_AddTraceback("lxml.etree._encodeFilenameUTF8");
            if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1451; __pyx_clineno = __LINE__; goto __pyx_L17_except_error;}
            __Pyx_GOTREF(__pyx_t_7);
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_GOTREF(__pyx_t_9);

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1452
 *                     c_filename, len(<bytes>filename), NULL)
 *             except UnicodeDecodeError:
 *                 raise decode_exc # otherwise re-raise original exception             # <<<<<<<<<<<<<<
 *     if python.PyUnicode_Check(filename):
 *         return python.PyUnicode_AsUTF8String(filename)
 */
            __Pyx_Raise(__pyx_v_decode_exc, 0, 0);
            {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1452; __pyx_clineno = __LINE__; goto __pyx_L17_except_error;}
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
            goto __pyx_L16_exception_handled;
          }
          __pyx_L17_except_error:;
          __Pyx_XGIVEREF(__pyx_save_exc_type);
          __Pyx_XGIVEREF(__pyx_save_exc_value);
          __Pyx_XGIVEREF(__pyx_save_exc_tb);
          __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
          goto __pyx_L7_except_error;
          __pyx_L16_exception_handled:;
          __Pyx_XGIVEREF(__pyx_save_exc_type);
          __Pyx_XGIVEREF(__pyx_save_exc_value);
          __Pyx_XGIVEREF(__pyx_save_exc_tb);
          __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
          __pyx_L22_try_end:;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        goto __pyx_L6_exception_handled;
      }
      __pyx_L7_except_error:;
      __Pyx_XGIVEREF(__pyx_save_exc_type);
      __Pyx_XGIVEREF(__pyx_save_exc_value);
      __Pyx_XGIVEREF(__pyx_save_exc_tb);
      __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
      goto __pyx_L1_error;
      __pyx_L6_exception_handled:;
      __Pyx_XGIVEREF(__pyx_save_exc_type);
      __Pyx_XGIVEREF(__pyx_save_exc_value);
      __Pyx_XGIVEREF(__pyx_save_exc_tb);
      __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
      __pyx_L12_try_end:;
    }
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1453
 *             except UnicodeDecodeError:
 *                 raise decode_exc # otherwise re-raise original exception
 *     if python.PyUnicode_Check(filename):             # <<<<<<<<<<<<<<
 *         return python.PyUnicode_AsUTF8String(filename)
 *     else:
 */
  __pyx_t_1 = PyUnicode_Check(__pyx_v_filename);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1454
 *                 raise decode_exc # otherwise re-raise original exception
 *     if python.PyUnicode_Check(filename):
 *         return python.PyUnicode_AsUTF8String(filename)             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError, u"Argument must be string or unicode."
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_6 = ((PyObject *)PyUnicode_AsUTF8String(__pyx_v_filename)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L0;
    goto __pyx_L25;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1456
 *         return python.PyUnicode_AsUTF8String(filename)
 *     else:
 *         raise TypeError, u"Argument must be string or unicode."             # <<<<<<<<<<<<<<
 * 
 * cdef tuple _getNsTag(tag):
 */
    __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_u_32), 0);
    {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L25:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("lxml.etree._encodeFilenameUTF8");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_decode_exc);
  __Pyx_DECREF(__pyx_v_filename);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1458
 *         raise TypeError, u"Argument must be string or unicode."
 * 
 * cdef tuple _getNsTag(tag):             # <<<<<<<<<<<<<<
 *     u"""Given a tag, find namespace URI and tag name.
 *     Return None for NS uri if no namespace URI provided.
 */

static  PyObject *__pyx_f_4lxml_5etree__getNsTag(PyObject *__pyx_v_tag) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("_getNsTag");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1462
 *     Return None for NS uri if no namespace URI provided.
 *     """
 *     return __getNsTag(tag, 0)             # <<<<<<<<<<<<<<
 * 
 * cdef tuple _getNsTagWithEmptyNs(tag):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree___getNsTag(__pyx_v_tag, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._getNsTag");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1464
 *     return __getNsTag(tag, 0)
 * 
 * cdef tuple _getNsTagWithEmptyNs(tag):             # <<<<<<<<<<<<<<
 *     u"""Given a tag, find namespace URI and tag name.  Return None for NS uri
 *     if no namespace URI provided, or the empty string if namespace
 */

static  PyObject *__pyx_f_4lxml_5etree__getNsTagWithEmptyNs(PyObject *__pyx_v_tag) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("_getNsTagWithEmptyNs");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1469
 *     part is '{}'.
 *     """
 *     return __getNsTag(tag, 1)             # <<<<<<<<<<<<<<
 * 
 * cdef tuple __getNsTag(tag, bint empty_ns):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree___getNsTag(__pyx_v_tag, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._getNsTagWithEmptyNs");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1471
 *     return __getNsTag(tag, 1)
 * 
 * cdef tuple __getNsTag(tag, bint empty_ns):             # <<<<<<<<<<<<<<
 *     cdef char* c_tag
 *     cdef char* c_ns_end
 */

static  PyObject *__pyx_f_4lxml_5etree___getNsTag(PyObject *__pyx_v_tag, int __pyx_v_empty_ns) {
  char *__pyx_v_c_tag;
  char *__pyx_v_c_ns_end;
  Py_ssize_t __pyx_v_taglen;
  Py_ssize_t __pyx_v_nslen;
  PyObject *__pyx_v_ns = 0;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("__getNsTag");
  __Pyx_INCREF(__pyx_v_tag);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1476
 *     cdef Py_ssize_t taglen
 *     cdef Py_ssize_t nslen
 *     cdef bytes ns = None             # <<<<<<<<<<<<<<
 *     # _isString() is much faster than isinstance()
 *     if not _isString(tag) and isinstance(tag, QName):
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_ns = ((PyObject*)Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1478
 *     cdef bytes ns = None
 *     # _isString() is much faster than isinstance()
 *     if not _isString(tag) and isinstance(tag, QName):             # <<<<<<<<<<<<<<
 *         tag = (<QName>tag).text
 *     tag = _utf8(tag)
 */
  __pyx_t_1 = (!_isString(__pyx_v_tag));
  if (__pyx_t_1) {
    __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_tag, ((PyObject*)__pyx_ptype_4lxml_5etree_QName)); 
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1479
 *     # _isString() is much faster than isinstance()
 *     if not _isString(tag) and isinstance(tag, QName):
 *         tag = (<QName>tag).text             # <<<<<<<<<<<<<<
 *     tag = _utf8(tag)
 *     c_tag = _cstr(tag)
 */
    __Pyx_INCREF(((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_tag)->text);
    __Pyx_DECREF(__pyx_v_tag);
    __pyx_v_tag = ((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_tag)->text;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1480
 *     if not _isString(tag) and isinstance(tag, QName):
 *         tag = (<QName>tag).text
 *     tag = _utf8(tag)             # <<<<<<<<<<<<<<
 *     c_tag = _cstr(tag)
 *     if c_tag[0] == c'{':
 */
  __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_v_tag)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_v_tag);
  __pyx_v_tag = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1481
 *         tag = (<QName>tag).text
 *     tag = _utf8(tag)
 *     c_tag = _cstr(tag)             # <<<<<<<<<<<<<<
 *     if c_tag[0] == c'{':
 *         c_tag += 1
 */
  __pyx_v_c_tag = PyBytes_AS_STRING(__pyx_v_tag);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1482
 *     tag = _utf8(tag)
 *     c_tag = _cstr(tag)
 *     if c_tag[0] == c'{':             # <<<<<<<<<<<<<<
 *         c_tag += 1
 *         c_ns_end = cstd.strchr(c_tag, c'}')
 */
  __pyx_t_3 = ((__pyx_v_c_tag[0]) == '{');
    if (__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1483
 *     c_tag = _cstr(tag)
 *     if c_tag[0] == c'{':
 *         c_tag += 1             # <<<<<<<<<<<<<<
 *         c_ns_end = cstd.strchr(c_tag, c'}')
 *         if c_ns_end is NULL:
 */
      __pyx_v_c_tag = (__pyx_v_c_tag + 1);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1484
 *     if c_tag[0] == c'{':
 *         c_tag += 1
 *         c_ns_end = cstd.strchr(c_tag, c'}')             # <<<<<<<<<<<<<<
 *         if c_ns_end is NULL:
 *             raise ValueError, u"Invalid tag name"
 */
    __pyx_v_c_ns_end = strchr(__pyx_v_c_tag, '}');

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1485
 *         c_tag += 1
 *         c_ns_end = cstd.strchr(c_tag, c'}')
 *         if c_ns_end is NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError, u"Invalid tag name"
 *         nslen  = c_ns_end - c_tag
 */
    __pyx_t_3 = (__pyx_v_c_ns_end == NULL);
    if (__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1486
 *         c_ns_end = cstd.strchr(c_tag, c'}')
 *         if c_ns_end is NULL:
 *             raise ValueError, u"Invalid tag name"             # <<<<<<<<<<<<<<
 *         nslen  = c_ns_end - c_tag
 *         taglen = python.PyBytes_GET_SIZE(tag) - nslen - 2
 */
      __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_u_33), 0);
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1487
 *         if c_ns_end is NULL:
 *             raise ValueError, u"Invalid tag name"
 *         nslen  = c_ns_end - c_tag             # <<<<<<<<<<<<<<
 *         taglen = python.PyBytes_GET_SIZE(tag) - nslen - 2
 *         if taglen == 0:
 */
    __pyx_v_nslen = (__pyx_v_c_ns_end - __pyx_v_c_tag);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1488
 *             raise ValueError, u"Invalid tag name"
 *         nslen  = c_ns_end - c_tag
 *         taglen = python.PyBytes_GET_SIZE(tag) - nslen - 2             # <<<<<<<<<<<<<<
 *         if taglen == 0:
 *             raise ValueError, u"Empty tag name"
 */
    __pyx_v_taglen = ((PyBytes_GET_SIZE(__pyx_v_tag) - __pyx_v_nslen) - 2);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1489
 *         nslen  = c_ns_end - c_tag
 *         taglen = python.PyBytes_GET_SIZE(tag) - nslen - 2
 *         if taglen == 0:             # <<<<<<<<<<<<<<
 *             raise ValueError, u"Empty tag name"
 *         if nslen > 0:
 */
    __pyx_t_3 = (__pyx_v_taglen == 0);
    if (__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1490
 *         taglen = python.PyBytes_GET_SIZE(tag) - nslen - 2
 *         if taglen == 0:
 *             raise ValueError, u"Empty tag name"             # <<<<<<<<<<<<<<
 *         if nslen > 0:
 *             ns = <bytes>c_tag[:nslen]
 */
      __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_u_34), 0);
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1491
 *         if taglen == 0:
 *             raise ValueError, u"Empty tag name"
 *         if nslen > 0:             # <<<<<<<<<<<<<<
 *             ns = <bytes>c_tag[:nslen]
 *         elif empty_ns:
 */
    __pyx_t_3 = (__pyx_v_nslen > 0);
    if (__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1492
 *             raise ValueError, u"Empty tag name"
 *         if nslen > 0:
 *             ns = <bytes>c_tag[:nslen]             # <<<<<<<<<<<<<<
 *         elif empty_ns:
 *             ns = b''
 */
      __pyx_t_4 = PyBytes_FromStringAndSize(__pyx_v_c_tag + 0, __pyx_v_nslen - 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      __Pyx_DECREF(((PyObject *)__pyx_v_ns));
      __pyx_v_ns = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L7;
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1493
 *         if nslen > 0:
 *             ns = <bytes>c_tag[:nslen]
 *         elif empty_ns:             # <<<<<<<<<<<<<<
 *             ns = b''
 *         tag = <bytes>c_ns_end[1:taglen+1]
 */
    if (__pyx_v_empty_ns) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1494
 *             ns = <bytes>c_tag[:nslen]
 *         elif empty_ns:
 *             ns = b''             # <<<<<<<<<<<<<<
 *         tag = <bytes>c_ns_end[1:taglen+1]
 *     elif python.PyBytes_GET_SIZE(tag) == 0:
 */
      __Pyx_INCREF(((PyObject *)__pyx_kp_b_25));
      __Pyx_DECREF(((PyObject *)__pyx_v_ns));
      __pyx_v_ns = __pyx_kp_b_25;
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1495
 *         elif empty_ns:
 *             ns = b''
 *         tag = <bytes>c_ns_end[1:taglen+1]             # <<<<<<<<<<<<<<
 *     elif python.PyBytes_GET_SIZE(tag) == 0:
 *         raise ValueError, u"Empty tag name"
 */
    __pyx_t_4 = PyBytes_FromStringAndSize(__pyx_v_c_ns_end + 1, (__pyx_v_taglen + 1) - 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_DECREF(__pyx_v_tag);
    __pyx_v_tag = ((PyObject *)__pyx_t_4);
    __pyx_t_4 = 0;
    goto __pyx_L4;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1496
 *             ns = b''
 *         tag = <bytes>c_ns_end[1:taglen+1]
 *     elif python.PyBytes_GET_SIZE(tag) == 0:             # <<<<<<<<<<<<<<
 *         raise ValueError, u"Empty tag name"
 *     return ns, tag
 */
  __pyx_t_3 = (PyBytes_GET_SIZE(__pyx_v_tag) == 0);
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1497
 *         tag = <bytes>c_ns_end[1:taglen+1]
 *     elif python.PyBytes_GET_SIZE(tag) == 0:
 *         raise ValueError, u"Empty tag name"             # <<<<<<<<<<<<<<
 *     return ns, tag
 * 
 */
    __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_u_34), 0);
    {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1498
 *     elif python.PyBytes_GET_SIZE(tag) == 0:
 *         raise ValueError, u"Empty tag name"
 *     return ns, tag             # <<<<<<<<<<<<<<
 * 
 * cdef inline int _pyXmlNameIsValid(name_utf8):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  __Pyx_INCREF(((PyObject *)__pyx_v_ns));
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_ns));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_ns));
  __Pyx_INCREF(__pyx_v_tag);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_tag);
  __Pyx_GIVEREF(__pyx_v_tag);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.__getNsTag");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ns);
  __Pyx_DECREF(__pyx_v_tag);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1500
 *     return ns, tag
 * 
 * cdef inline int _pyXmlNameIsValid(name_utf8):             # <<<<<<<<<<<<<<
 *     return _xmlNameIsValid(_cstr(name_utf8))
 * 
 */

static CYTHON_INLINE int __pyx_f_4lxml_5etree__pyXmlNameIsValid(PyObject *__pyx_v_name_utf8) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("_pyXmlNameIsValid");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1501
 * 
 * cdef inline int _pyXmlNameIsValid(name_utf8):
 *     return _xmlNameIsValid(_cstr(name_utf8))             # <<<<<<<<<<<<<<
 * 
 * cdef inline int _pyHtmlNameIsValid(name_utf8):
 */
  __pyx_r = __pyx_f_4lxml_5etree__xmlNameIsValid(PyBytes_AS_STRING(__pyx_v_name_utf8));
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1503
 *     return _xmlNameIsValid(_cstr(name_utf8))
 * 
 * cdef inline int _pyHtmlNameIsValid(name_utf8):             # <<<<<<<<<<<<<<
 *     return _htmlNameIsValid(_cstr(name_utf8))
 * 
 */

static CYTHON_INLINE int __pyx_f_4lxml_5etree__pyHtmlNameIsValid(PyObject *__pyx_v_name_utf8) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("_pyHtmlNameIsValid");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1504
 * 
 * cdef inline int _pyHtmlNameIsValid(name_utf8):
 *     return _htmlNameIsValid(_cstr(name_utf8))             # <<<<<<<<<<<<<<
 * 
 * cdef inline int _xmlNameIsValid(char* c_name):
 */
  __pyx_r = __pyx_f_4lxml_5etree__htmlNameIsValid(PyBytes_AS_STRING(__pyx_v_name_utf8));
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1506
 *     return _htmlNameIsValid(_cstr(name_utf8))
 * 
 * cdef inline int _xmlNameIsValid(char* c_name):             # <<<<<<<<<<<<<<
 *     return tree.xmlValidateNCName(c_name, 0) == 0
 * 
 */

static CYTHON_INLINE int __pyx_f_4lxml_5etree__xmlNameIsValid(char *__pyx_v_c_name) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("_xmlNameIsValid");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1507
 * 
 * cdef inline int _xmlNameIsValid(char* c_name):
 *     return tree.xmlValidateNCName(c_name, 0) == 0             # <<<<<<<<<<<<<<
 * 
 * cdef int _htmlNameIsValid(char* c_name):
 */
  __pyx_r = (xmlValidateNCName(__pyx_v_c_name, 0) == 0);
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1509
 *     return tree.xmlValidateNCName(c_name, 0) == 0
 * 
 * cdef int _htmlNameIsValid(char* c_name):             # <<<<<<<<<<<<<<
 *     cdef char c
 *     if c_name is NULL or c_name[0] == c'\0':
 */

static  int __pyx_f_4lxml_5etree__htmlNameIsValid(char *__pyx_v_c_name) {
  char __pyx_v_c;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("_htmlNameIsValid");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1511
 * cdef int _htmlNameIsValid(char* c_name):
 *     cdef char c
 *     if c_name is NULL or c_name[0] == c'\0':             # <<<<<<<<<<<<<<
 *         return 0
 *     while c_name[0] != c'\0':
 */
  __pyx_t_1 = (__pyx_v_c_name == NULL);
  if (!__pyx_t_1) {
    __pyx_t_2 = ((__pyx_v_c_name[0]) == '\x00');
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1512
 *     cdef char c
 *     if c_name is NULL or c_name[0] == c'\0':
 *         return 0             # <<<<<<<<<<<<<<
 *     while c_name[0] != c'\0':
 *         c = c_name[0]
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1513
 *     if c_name is NULL or c_name[0] == c'\0':
 *         return 0
 *     while c_name[0] != c'\0':             # <<<<<<<<<<<<<<
 *         c = c_name[0]
 *         if c in (c'&', c'<', c'>', c'/', c'"', c"'",
 */
  while (1) {
    __pyx_t_3 = ((__pyx_v_c_name[0]) != '\x00');
    if (!__pyx_t_3) break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1514
 *         return 0
 *     while c_name[0] != c'\0':
 *         c = c_name[0]             # <<<<<<<<<<<<<<
 *         if c in (c'&', c'<', c'>', c'/', c'"', c"'",
 *                  c'\t', c'\n', c'\x0B', c'\x0C', c'\r', c' '):
 */
    __pyx_v_c = (__pyx_v_c_name[0]);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1515
 *     while c_name[0] != c'\0':
 *         c = c_name[0]
 *         if c in (c'&', c'<', c'>', c'/', c'"', c"'",             # <<<<<<<<<<<<<<
 *                  c'\t', c'\n', c'\x0B', c'\x0C', c'\r', c' '):
 *             return 0
 */
    switch (__pyx_v_c) {
      case '&':
      case '<':
      case '>':
      case '/':
      case '"':
      case '\'':

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1516
 *         c = c_name[0]
 *         if c in (c'&', c'<', c'>', c'/', c'"', c"'",
 *                  c'\t', c'\n', c'\x0B', c'\x0C', c'\r', c' '):             # <<<<<<<<<<<<<<
 *             return 0
 *         c_name = c_name + 1
 */
      case '\t':
      case '\n':
      case '\x0B':
      case '\x0C':
      case '\r':
      case ' ':

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1517
 *         if c in (c'&', c'<', c'>', c'/', c'"', c"'",
 *                  c'\t', c'\n', c'\x0B', c'\x0C', c'\r', c' '):
 *             return 0             # <<<<<<<<<<<<<<
 *         c_name = c_name + 1
 *     return 1
 */
      __pyx_r = 0;
      goto __pyx_L0;
      break;
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1518
 *                  c'\t', c'\n', c'\x0B', c'\x0C', c'\r', c' '):
 *             return 0
 *         c_name = c_name + 1             # <<<<<<<<<<<<<<
 *     return 1
 * 
 */
    __pyx_v_c_name = (__pyx_v_c_name + 1);
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1519
 *             return 0
 *         c_name = c_name + 1
 *     return 1             # <<<<<<<<<<<<<<
 * 
 * cdef bint _characterReferenceIsValid(char* c_name):
 */
  __pyx_r = 1;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1521
 *     return 1
 * 
 * cdef bint _characterReferenceIsValid(char* c_name):             # <<<<<<<<<<<<<<
 *     cdef bint is_hex
 *     if c_name[0] == c'x':
 */

static  int __pyx_f_4lxml_5etree__characterReferenceIsValid(char *__pyx_v_c_name) {
  int __pyx_v_is_hex;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("_characterReferenceIsValid");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1523
 * cdef bint _characterReferenceIsValid(char* c_name):
 *     cdef bint is_hex
 *     if c_name[0] == c'x':             # <<<<<<<<<<<<<<
 *         c_name += 1
 *         is_hex = 1
 */
  __pyx_t_1 = ((__pyx_v_c_name[0]) == 'x');
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1524
 *     cdef bint is_hex
 *     if c_name[0] == c'x':
 *         c_name += 1             # <<<<<<<<<<<<<<
 *         is_hex = 1
 *     else:
 */
    __pyx_v_c_name = (__pyx_v_c_name + 1);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1525
 *     if c_name[0] == c'x':
 *         c_name += 1
 *         is_hex = 1             # <<<<<<<<<<<<<<
 *     else:
 *         is_hex = 0
 */
    __pyx_v_is_hex = 1;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1527
 *         is_hex = 1
 *     else:
 *         is_hex = 0             # <<<<<<<<<<<<<<
 *     if c_name[0] == c'\0':
 *         return 0
 */
    __pyx_v_is_hex = 0;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1528
 *     else:
 *         is_hex = 0
 *     if c_name[0] == c'\0':             # <<<<<<<<<<<<<<
 *         return 0
 *     while c_name[0] != c'\0':
 */
  __pyx_t_1 = ((__pyx_v_c_name[0]) == '\x00');
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1529
 *         is_hex = 0
 *     if c_name[0] == c'\0':
 *         return 0             # <<<<<<<<<<<<<<
 *     while c_name[0] != c'\0':
 *         if c_name[0] < c'0' or c_name[0] > c'9':
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1530
 *     if c_name[0] == c'\0':
 *         return 0
 *     while c_name[0] != c'\0':             # <<<<<<<<<<<<<<
 *         if c_name[0] < c'0' or c_name[0] > c'9':
 *             if not is_hex:
 */
  while (1) {
    __pyx_t_1 = ((__pyx_v_c_name[0]) != '\x00');
    if (!__pyx_t_1) break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1531
 *         return 0
 *     while c_name[0] != c'\0':
 *         if c_name[0] < c'0' or c_name[0] > c'9':             # <<<<<<<<<<<<<<
 *             if not is_hex:
 *                 return 0
 */
    __pyx_t_1 = ((__pyx_v_c_name[0]) < '0');
    if (!__pyx_t_1) {
      __pyx_t_2 = ((__pyx_v_c_name[0]) > '9');
      __pyx_t_3 = __pyx_t_2;
    } else {
      __pyx_t_3 = __pyx_t_1;
    }
    if (__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1532
 *     while c_name[0] != c'\0':
 *         if c_name[0] < c'0' or c_name[0] > c'9':
 *             if not is_hex:             # <<<<<<<<<<<<<<
 *                 return 0
 *             if not (c_name[0] >= c'a' and c_name[0] <= c'f'):
 */
      __pyx_t_3 = (!__pyx_v_is_hex);
      if (__pyx_t_3) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1533
 *         if c_name[0] < c'0' or c_name[0] > c'9':
 *             if not is_hex:
 *                 return 0             # <<<<<<<<<<<<<<
 *             if not (c_name[0] >= c'a' and c_name[0] <= c'f'):
 *                 if not (c_name[0] >= c'A' and c_name[0] <= c'F'):
 */
        __pyx_r = 0;
        goto __pyx_L0;
        goto __pyx_L8;
      }
      __pyx_L8:;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1534
 *             if not is_hex:
 *                 return 0
 *             if not (c_name[0] >= c'a' and c_name[0] <= c'f'):             # <<<<<<<<<<<<<<
 *                 if not (c_name[0] >= c'A' and c_name[0] <= c'F'):
 *                     return 0
 */
      __pyx_t_3 = ((__pyx_v_c_name[0]) >= 'a');
      if (__pyx_t_3) {
        __pyx_t_1 = ((__pyx_v_c_name[0]) <= 'f');
        __pyx_t_2 = __pyx_t_1;
      } else {
        __pyx_t_2 = __pyx_t_3;
      }
      __pyx_t_3 = (!__pyx_t_2);
      if (__pyx_t_3) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1535
 *                 return 0
 *             if not (c_name[0] >= c'a' and c_name[0] <= c'f'):
 *                 if not (c_name[0] >= c'A' and c_name[0] <= c'F'):             # <<<<<<<<<<<<<<
 *                     return 0
 *         c_name += 1
 */
        __pyx_t_3 = ((__pyx_v_c_name[0]) >= 'A');
        if (__pyx_t_3) {
          __pyx_t_2 = ((__pyx_v_c_name[0]) <= 'F');
          __pyx_t_1 = __pyx_t_2;
        } else {
          __pyx_t_1 = __pyx_t_3;
        }
        __pyx_t_3 = (!__pyx_t_1);
        if (__pyx_t_3) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1536
 *             if not (c_name[0] >= c'a' and c_name[0] <= c'f'):
 *                 if not (c_name[0] >= c'A' and c_name[0] <= c'F'):
 *                     return 0             # <<<<<<<<<<<<<<
 *         c_name += 1
 *     return 1
 */
          __pyx_r = 0;
          goto __pyx_L0;
          goto __pyx_L10;
        }
        __pyx_L10:;
        goto __pyx_L9;
      }
      __pyx_L9:;
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1537
 *                 if not (c_name[0] >= c'A' and c_name[0] <= c'F'):
 *                     return 0
 *         c_name += 1             # <<<<<<<<<<<<<<
 *     return 1
 * 
 */
    __pyx_v_c_name = (__pyx_v_c_name + 1);
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1538
 *                     return 0
 *         c_name += 1
 *     return 1             # <<<<<<<<<<<<<<
 * 
 * cdef int _tagValidOrRaise(tag_utf) except -1:
 */
  __pyx_r = 1;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1540
 *     return 1
 * 
 * cdef int _tagValidOrRaise(tag_utf) except -1:             # <<<<<<<<<<<<<<
 *     if not _pyXmlNameIsValid(tag_utf):
 *         raise ValueError, u"Invalid tag name %r" % \
 */

static  int __pyx_f_4lxml_5etree__tagValidOrRaise(PyObject *__pyx_v_tag_utf) {
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("_tagValidOrRaise");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1541
 * 
 * cdef int _tagValidOrRaise(tag_utf) except -1:
 *     if not _pyXmlNameIsValid(tag_utf):             # <<<<<<<<<<<<<<
 *         raise ValueError, u"Invalid tag name %r" % \
 *             python.PyUnicode_FromEncodedObject(tag_utf, 'UTF-8', NULL)
 */
  __pyx_t_1 = (!__pyx_f_4lxml_5etree__pyXmlNameIsValid(__pyx_v_tag_utf));
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1543
 *     if not _pyXmlNameIsValid(tag_utf):
 *         raise ValueError, u"Invalid tag name %r" % \
 *             python.PyUnicode_FromEncodedObject(tag_utf, 'UTF-8', NULL)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    __pyx_t_2 = ((PyObject *)PyUnicode_FromEncodedObject(__pyx_v_tag_utf, __pyx_k_31, NULL)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_35), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), 0);
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1544
 *         raise ValueError, u"Invalid tag name %r" % \
 *             python.PyUnicode_FromEncodedObject(tag_utf, 'UTF-8', NULL)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int _htmlTagValidOrRaise(tag_utf) except -1:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._tagValidOrRaise");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1546
 *     return 0
 * 
 * cdef int _htmlTagValidOrRaise(tag_utf) except -1:             # <<<<<<<<<<<<<<
 *     if not _pyHtmlNameIsValid(tag_utf):
 *         raise ValueError, u"Invalid HTML tag name %r" % \
 */

static  int __pyx_f_4lxml_5etree__htmlTagValidOrRaise(PyObject *__pyx_v_tag_utf) {
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("_htmlTagValidOrRaise");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1547
 * 
 * cdef int _htmlTagValidOrRaise(tag_utf) except -1:
 *     if not _pyHtmlNameIsValid(tag_utf):             # <<<<<<<<<<<<<<
 *         raise ValueError, u"Invalid HTML tag name %r" % \
 *             python.PyUnicode_FromEncodedObject(tag_utf, 'UTF-8', NULL)
 */
  __pyx_t_1 = (!__pyx_f_4lxml_5etree__pyHtmlNameIsValid(__pyx_v_tag_utf));
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1549
 *     if not _pyHtmlNameIsValid(tag_utf):
 *         raise ValueError, u"Invalid HTML tag name %r" % \
 *             python.PyUnicode_FromEncodedObject(tag_utf, 'UTF-8', NULL)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    __pyx_t_2 = ((PyObject *)PyUnicode_FromEncodedObject(__pyx_v_tag_utf, __pyx_k_31, NULL)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_36), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), 0);
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1550
 *         raise ValueError, u"Invalid HTML tag name %r" % \
 *             python.PyUnicode_FromEncodedObject(tag_utf, 'UTF-8', NULL)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int _attributeValidOrRaise(name_utf) except -1:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._htmlTagValidOrRaise");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1552
 *     return 0
 * 
 * cdef int _attributeValidOrRaise(name_utf) except -1:             # <<<<<<<<<<<<<<
 *     if not _pyXmlNameIsValid(name_utf):
 *         raise ValueError, u"Invalid attribute name %r" % \
 */

static  int __pyx_f_4lxml_5etree__attributeValidOrRaise(PyObject *__pyx_v_name_utf) {
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("_attributeValidOrRaise");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1553
 * 
 * cdef int _attributeValidOrRaise(name_utf) except -1:
 *     if not _pyXmlNameIsValid(name_utf):             # <<<<<<<<<<<<<<
 *         raise ValueError, u"Invalid attribute name %r" % \
 *             python.PyUnicode_FromEncodedObject(name_utf, 'UTF-8', NULL)
 */
  __pyx_t_1 = (!__pyx_f_4lxml_5etree__pyXmlNameIsValid(__pyx_v_name_utf));
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1555
 *     if not _pyXmlNameIsValid(name_utf):
 *         raise ValueError, u"Invalid attribute name %r" % \
 *             python.PyUnicode_FromEncodedObject(name_utf, 'UTF-8', NULL)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    __pyx_t_2 = ((PyObject *)PyUnicode_FromEncodedObject(__pyx_v_name_utf, __pyx_k_31, NULL)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_37), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1554; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), 0);
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1554; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1556
 *         raise ValueError, u"Invalid attribute name %r" % \
 *             python.PyUnicode_FromEncodedObject(name_utf, 'UTF-8', NULL)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int _prefixValidOrRaise(tag_utf) except -1:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._attributeValidOrRaise");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1558
 *     return 0
 * 
 * cdef int _prefixValidOrRaise(tag_utf) except -1:             # <<<<<<<<<<<<<<
 *     if not _pyXmlNameIsValid(tag_utf):
 *         raise ValueError, u"Invalid namespace prefix %r" % \
 */

static  int __pyx_f_4lxml_5etree__prefixValidOrRaise(PyObject *__pyx_v_tag_utf) {
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("_prefixValidOrRaise");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1559
 * 
 * cdef int _prefixValidOrRaise(tag_utf) except -1:
 *     if not _pyXmlNameIsValid(tag_utf):             # <<<<<<<<<<<<<<
 *         raise ValueError, u"Invalid namespace prefix %r" % \
 *             python.PyUnicode_FromEncodedObject(tag_utf, 'UTF-8', NULL)
 */
  __pyx_t_1 = (!__pyx_f_4lxml_5etree__pyXmlNameIsValid(__pyx_v_tag_utf));
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1561
 *     if not _pyXmlNameIsValid(tag_utf):
 *         raise ValueError, u"Invalid namespace prefix %r" % \
 *             python.PyUnicode_FromEncodedObject(tag_utf, 'UTF-8', NULL)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    __pyx_t_2 = ((PyObject *)PyUnicode_FromEncodedObject(__pyx_v_tag_utf, __pyx_k_31, NULL)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_38), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), 0);
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1562
 *         raise ValueError, u"Invalid namespace prefix %r" % \
 *             python.PyUnicode_FromEncodedObject(tag_utf, 'UTF-8', NULL)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int _uriValidOrRaise(uri_utf) except -1:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._prefixValidOrRaise");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1564
 *     return 0
 * 
 * cdef int _uriValidOrRaise(uri_utf) except -1:             # <<<<<<<<<<<<<<
 *     cdef uri.xmlURI* c_uri = uri.xmlParseURI(_cstr(uri_utf))
 *     if c_uri is NULL:
 */

static  int __pyx_f_4lxml_5etree__uriValidOrRaise(PyObject *__pyx_v_uri_utf) {
  xmlURI *__pyx_v_c_uri;
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("_uriValidOrRaise");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1565
 * 
 * cdef int _uriValidOrRaise(uri_utf) except -1:
 *     cdef uri.xmlURI* c_uri = uri.xmlParseURI(_cstr(uri_utf))             # <<<<<<<<<<<<<<
 *     if c_uri is NULL:
 *         raise ValueError, u"Invalid namespace URI %r" % \
 */
  __pyx_v_c_uri = xmlParseURI(PyBytes_AS_STRING(__pyx_v_uri_utf));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1566
 * cdef int _uriValidOrRaise(uri_utf) except -1:
 *     cdef uri.xmlURI* c_uri = uri.xmlParseURI(_cstr(uri_utf))
 *     if c_uri is NULL:             # <<<<<<<<<<<<<<
 *         raise ValueError, u"Invalid namespace URI %r" % \
 *             python.PyUnicode_FromEncodedObject(uri_utf, 'UTF-8', NULL)
 */
  __pyx_t_1 = (__pyx_v_c_uri == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1568
 *     if c_uri is NULL:
 *         raise ValueError, u"Invalid namespace URI %r" % \
 *             python.PyUnicode_FromEncodedObject(uri_utf, 'UTF-8', NULL)             # <<<<<<<<<<<<<<
 *     uri.xmlFreeURI(c_uri)
 *     return 0
 */
    __pyx_t_2 = ((PyObject *)PyUnicode_FromEncodedObject(__pyx_v_uri_utf, __pyx_k_31, NULL)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1568; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_39), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), 0);
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1569
 *         raise ValueError, u"Invalid namespace URI %r" % \
 *             python.PyUnicode_FromEncodedObject(uri_utf, 'UTF-8', NULL)
 *     uri.xmlFreeURI(c_uri)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  xmlFreeURI(__pyx_v_c_uri);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1570
 *             python.PyUnicode_FromEncodedObject(uri_utf, 'UTF-8', NULL)
 *     uri.xmlFreeURI(c_uri)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef inline object _namespacedName(xmlNode* c_node):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._uriValidOrRaise");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1572
 *     return 0
 * 
 * cdef inline object _namespacedName(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     return _namespacedNameFromNsName(_getNs(c_node), c_node.name)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_4lxml_5etree__namespacedName(xmlNode *__pyx_v_c_node) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("_namespacedName");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1573
 * 
 * cdef inline object _namespacedName(xmlNode* c_node):
 *     return _namespacedNameFromNsName(_getNs(c_node), c_node.name)             # <<<<<<<<<<<<<<
 * 
 * cdef object _namespacedNameFromNsName(char* href, char* name):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__namespacedNameFromNsName(_getNs(__pyx_v_c_node), __pyx_v_c_node->name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._namespacedName");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1575
 *     return _namespacedNameFromNsName(_getNs(c_node), c_node.name)
 * 
 * cdef object _namespacedNameFromNsName(char* href, char* name):             # <<<<<<<<<<<<<<
 *     if href is NULL:
 *         return funicode(name)
 */

static  PyObject *__pyx_f_4lxml_5etree__namespacedNameFromNsName(char *__pyx_v_href, char *__pyx_v_name) {
  PyObject *__pyx_v_s;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("_namespacedNameFromNsName");
  __pyx_v_s = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1576
 * 
 * cdef object _namespacedNameFromNsName(char* href, char* name):
 *     if href is NULL:             # <<<<<<<<<<<<<<
 *         return funicode(name)
 *     elif python.IS_PYTHON3:
 */
  __pyx_t_1 = (__pyx_v_href == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1577
 * cdef object _namespacedNameFromNsName(char* href, char* name):
 *     if href is NULL:
 *         return funicode(name)             # <<<<<<<<<<<<<<
 *     elif python.IS_PYTHON3:
 *         return python.PyUnicode_FromFormat("{%s}%s", href, name)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1578
 *     if href is NULL:
 *         return funicode(name)
 *     elif python.IS_PYTHON3:             # <<<<<<<<<<<<<<
 *         return python.PyUnicode_FromFormat("{%s}%s", href, name)
 *     else:
 */
  if (IS_PYTHON3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1579
 *         return funicode(name)
 *     elif python.IS_PYTHON3:
 *         return python.PyUnicode_FromFormat("{%s}%s", href, name)             # <<<<<<<<<<<<<<
 *     else:
 *         s = python.PyBytes_FromFormat("{%s}%s", href, name)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = ((PyObject *)PyUnicode_FromFormat(__pyx_k_40, __pyx_v_href, __pyx_v_name)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1581
 *         return python.PyUnicode_FromFormat("{%s}%s", href, name)
 *     else:
 *         s = python.PyBytes_FromFormat("{%s}%s", href, name)             # <<<<<<<<<<<<<<
 *         if isutf8(href) or isutf8(name):
 *             return python.PyUnicode_FromEncodedObject(s, 'UTF-8', NULL)
 */
    __pyx_t_2 = ((PyObject *)PyBytes_FromFormat(__pyx_k_40, __pyx_v_href, __pyx_v_name)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_v_s));
    __pyx_v_s = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1582
 *     else:
 *         s = python.PyBytes_FromFormat("{%s}%s", href, name)
 *         if isutf8(href) or isutf8(name):             # <<<<<<<<<<<<<<
 *             return python.PyUnicode_FromEncodedObject(s, 'UTF-8', NULL)
 *         else:
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree_isutf8(__pyx_v_href);
    if (!__pyx_t_3) {
      __pyx_t_4 = __pyx_f_4lxml_5etree_isutf8(__pyx_v_name);
      __pyx_t_1 = __pyx_t_4;
    } else {
      __pyx_t_1 = __pyx_t_3;
    }
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1583
 *         s = python.PyBytes_FromFormat("{%s}%s", href, name)
 *         if isutf8(href) or isutf8(name):
 *             return python.PyUnicode_FromEncodedObject(s, 'UTF-8', NULL)             # <<<<<<<<<<<<<<
 *         else:
 *             return s
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = ((PyObject *)PyUnicode_FromEncodedObject(((PyObject *)__pyx_v_s), __pyx_k_31, NULL)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;
      goto __pyx_L4;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1585
 *             return python.PyUnicode_FromEncodedObject(s, 'UTF-8', NULL)
 *         else:
 *             return s             # <<<<<<<<<<<<<<
 * 
 * cdef _getFilenameForFile(source):
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_s));
      __pyx_r = ((PyObject *)__pyx_v_s);
      goto __pyx_L0;
    }
    __pyx_L4:;
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._namespacedNameFromNsName");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_s);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1587
 *             return s
 * 
 * cdef _getFilenameForFile(source):             # <<<<<<<<<<<<<<
 *     u"""Given a Python File or Gzip object, give filename back.
 * 
 */

static  PyObject *__pyx_f_4lxml_5etree__getFilenameForFile(PyObject *__pyx_v_source) {
  PyObject *__pyx_v_filename;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("_getFilenameForFile");
  __pyx_v_filename = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1593
 *     """
 *     # urllib2 provides a geturl() method
 *     try:             # <<<<<<<<<<<<<<
 *         return source.geturl()
 *     except:
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1594
 *     # urllib2 provides a geturl() method
 *     try:
 *         return source.geturl()             # <<<<<<<<<<<<<<
 *     except:
 *         pass
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = PyObject_GetAttr(__pyx_v_source, __pyx_n_s__geturl); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1594; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1594; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L7_try_return;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L10_try_end;
    __pyx_L7_try_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1595
 *     try:
 *         return source.geturl()
 *     except:             # <<<<<<<<<<<<<<
 *         pass
 *     # file instances have a name attribute
 */
    /*except:*/ {
      PyErr_Restore(0,0,0);
      goto __pyx_L4_exception_handled;
    }
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L10_try_end:;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1598
 *         pass
 *     # file instances have a name attribute
 *     try:             # <<<<<<<<<<<<<<
 *         filename = source.name
 *         if _isString(filename):
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1599
 *     # file instances have a name attribute
 *     try:
 *         filename = source.name             # <<<<<<<<<<<<<<
 *         if _isString(filename):
 *             return os_path_abspath(filename)
 */
      __pyx_t_2 = PyObject_GetAttr(__pyx_v_source, __pyx_n_s__name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1599; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_v_filename);
      __pyx_v_filename = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1600
 *     try:
 *         filename = source.name
 *         if _isString(filename):             # <<<<<<<<<<<<<<
 *             return os_path_abspath(filename)
 *     except:
 */
      __pyx_t_3 = _isString(__pyx_v_filename);
      if (__pyx_t_3) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1601
 *         filename = source.name
 *         if _isString(filename):
 *             return os_path_abspath(filename)             # <<<<<<<<<<<<<<
 *     except:
 *         pass
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1601; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_2));
        __Pyx_INCREF(__pyx_v_filename);
        PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_filename);
        __Pyx_GIVEREF(__pyx_v_filename);
        __pyx_t_1 = PyObject_Call(__pyx_v_4lxml_5etree_os_path_abspath, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1601; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
        __pyx_r = __pyx_t_1;
        __pyx_t_1 = 0;
        goto __pyx_L15_try_return;
        goto __pyx_L19;
      }
      __pyx_L19:;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L18_try_end;
    __pyx_L15_try_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;
    __pyx_L11_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1602
 *         if _isString(filename):
 *             return os_path_abspath(filename)
 *     except:             # <<<<<<<<<<<<<<
 *         pass
 *     # gzip file instances have a filename attribute (before Py3k)
 */
    /*except:*/ {
      PyErr_Restore(0,0,0);
      goto __pyx_L12_exception_handled;
    }
    __pyx_L12_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L18_try_end:;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1605
 *         pass
 *     # gzip file instances have a filename attribute (before Py3k)
 *     try:             # <<<<<<<<<<<<<<
 *         filename = source.filename
 *         if _isString(filename):
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1606
 *     # gzip file instances have a filename attribute (before Py3k)
 *     try:
 *         filename = source.filename             # <<<<<<<<<<<<<<
 *         if _isString(filename):
 *             return os_path_abspath(filename)
 */
      __pyx_t_1 = PyObject_GetAttr(__pyx_v_source, __pyx_n_s__filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1606; __pyx_clineno = __LINE__; goto __pyx_L20_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_v_filename);
      __pyx_v_filename = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1607
 *     try:
 *         filename = source.filename
 *         if _isString(filename):             # <<<<<<<<<<<<<<
 *             return os_path_abspath(filename)
 *     except:
 */
      __pyx_t_3 = _isString(__pyx_v_filename);
      if (__pyx_t_3) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1608
 *         filename = source.filename
 *         if _isString(filename):
 *             return os_path_abspath(filename)             # <<<<<<<<<<<<<<
 *     except:
 *         pass
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1608; __pyx_clineno = __LINE__; goto __pyx_L20_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_1));
        __Pyx_INCREF(__pyx_v_filename);
        PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_filename);
        __Pyx_GIVEREF(__pyx_v_filename);
        __pyx_t_2 = PyObject_Call(__pyx_v_4lxml_5etree_os_path_abspath, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1608; __pyx_clineno = __LINE__; goto __pyx_L20_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        goto __pyx_L24_try_return;
        goto __pyx_L28;
      }
      __pyx_L28:;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L27_try_end;
    __pyx_L24_try_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;
    __pyx_L20_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1609
 *         if _isString(filename):
 *             return os_path_abspath(filename)
 *     except:             # <<<<<<<<<<<<<<
 *         pass
 *     # can't determine filename
 */
    /*except:*/ {
      PyErr_Restore(0,0,0);
      goto __pyx_L21_exception_handled;
    }
    __pyx_L21_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L27_try_end:;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":1612
 *         pass
 *     # can't determine filename
 *     return None             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_None);
  __pyx_r = Py_None;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_filename);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":7
 * # module level API functions
 * 
 * def clear_error_log():             # <<<<<<<<<<<<<<
 *     u"""clear_error_log()
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_1clear_error_log(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_1clear_error_log[] = "clear_error_log()\n\n    Clear the global error log.  Note that this log is already bound to a\n    fixed size.\n\n    Note: since lxml 2.2, the global error log is local to a thread\n    and this function will only clear the global error log of the\n    current thread.\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_1clear_error_log = {__Pyx_NAMESTR("clear_error_log"), (PyCFunction)__pyx_pf_4lxml_5etree_1clear_error_log, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_1clear_error_log)};
static PyObject *__pyx_pf_4lxml_5etree_1clear_error_log(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("clear_error_log");
  __pyx_self = __pyx_self;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":17
 *     current thread.
 *     """
 *     _getGlobalErrorLog().clear()             # <<<<<<<<<<<<<<
 * 
 * # dummy function: no debug output at all
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__getGlobalErrorLog()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__clear); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.clear_error_log");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":20
 * 
 * # dummy function: no debug output at all
 * cdef void _nullGenericErrorFunc(void* ctxt, char* msg, ...) nogil:             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

static  void __pyx_f_4lxml_5etree__nullGenericErrorFunc(void *__pyx_v_ctxt, char *__pyx_v_msg, ...) {

}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":25
 * # setup for global log:
 * 
 * cdef void _initThreadLogging():             # <<<<<<<<<<<<<<
 *     # disable generic error lines from libxml2
 *     xmlerror.xmlThrDefSetGenericErrorFunc(NULL, _nullGenericErrorFunc)
 */

static  void __pyx_f_4lxml_5etree__initThreadLogging(void) {
  __Pyx_RefNannySetupContext("_initThreadLogging");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":27
 * cdef void _initThreadLogging():
 *     # disable generic error lines from libxml2
 *     xmlerror.xmlThrDefSetGenericErrorFunc(NULL, _nullGenericErrorFunc)             # <<<<<<<<<<<<<<
 *     xmlerror.xmlSetGenericErrorFunc(NULL, _nullGenericErrorFunc)
 * 
 */
  xmlThrDefSetGenericErrorFunc(NULL, __pyx_f_4lxml_5etree__nullGenericErrorFunc);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":28
 *     # disable generic error lines from libxml2
 *     xmlerror.xmlThrDefSetGenericErrorFunc(NULL, _nullGenericErrorFunc)
 *     xmlerror.xmlSetGenericErrorFunc(NULL, _nullGenericErrorFunc)             # <<<<<<<<<<<<<<
 * 
 *     # divert error messages to the global error log
 */
  xmlSetGenericErrorFunc(NULL, __pyx_f_4lxml_5etree__nullGenericErrorFunc);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":31
 * 
 *     # divert error messages to the global error log
 *     xmlerror.xmlThrDefSetStructuredErrorFunc(NULL, _receiveError)             # <<<<<<<<<<<<<<
 *     connectErrorLog(NULL)
 * 
 */
  xmlThrDefSetStructuredErrorFunc(NULL, __pyx_f_4lxml_5etree__receiveError);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":32
 *     # divert error messages to the global error log
 *     xmlerror.xmlThrDefSetStructuredErrorFunc(NULL, _receiveError)
 *     connectErrorLog(NULL)             # <<<<<<<<<<<<<<
 * 
 * cdef void connectErrorLog(void* log):
 */
  __pyx_f_4lxml_5etree_connectErrorLog(NULL);

  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":34
 *     connectErrorLog(NULL)
 * 
 * cdef void connectErrorLog(void* log):             # <<<<<<<<<<<<<<
 *     xmlerror.xmlSetStructuredErrorFunc(log, _receiveError)
 *     xslt.xsltSetGenericErrorFunc(log, _receiveXSLTError)
 */

static  void __pyx_f_4lxml_5etree_connectErrorLog(void *__pyx_v_log) {
  __Pyx_RefNannySetupContext("connectErrorLog");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":35
 * 
 * cdef void connectErrorLog(void* log):
 *     xmlerror.xmlSetStructuredErrorFunc(log, _receiveError)             # <<<<<<<<<<<<<<
 *     xslt.xsltSetGenericErrorFunc(log, _receiveXSLTError)
 * 
 */
  xmlSetStructuredErrorFunc(__pyx_v_log, __pyx_f_4lxml_5etree__receiveError);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":36
 * cdef void connectErrorLog(void* log):
 *     xmlerror.xmlSetStructuredErrorFunc(log, _receiveError)
 *     xslt.xsltSetGenericErrorFunc(log, _receiveXSLTError)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  xsltSetGenericErrorFunc(__pyx_v_log, __pyx_f_4lxml_5etree__receiveXSLTError);

  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":62
 *     cdef readonly object filename
 * 
 *     cdef _setError(self, xmlerror.xmlError* error):             # <<<<<<<<<<<<<<
 *         cdef int size
 *         self.domain   = error.domain
 */

static  PyObject *__pyx_f_4lxml_5etree_9_LogEntry__setError(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self, xmlError *__pyx_v_error) {
  int __pyx_v_size;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  __Pyx_RefNannySetupContext("_setError");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":64
 *     cdef _setError(self, xmlerror.xmlError* error):
 *         cdef int size
 *         self.domain   = error.domain             # <<<<<<<<<<<<<<
 *         self.type     = error.code
 *         self.level    = <int>error.level
 */
  __pyx_v_self->domain = __pyx_v_error->domain;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":65
 *         cdef int size
 *         self.domain   = error.domain
 *         self.type     = error.code             # <<<<<<<<<<<<<<
 *         self.level    = <int>error.level
 *         self.line     = error.line
 */
  __pyx_v_self->type = __pyx_v_error->code;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":66
 *         self.domain   = error.domain
 *         self.type     = error.code
 *         self.level    = <int>error.level             # <<<<<<<<<<<<<<
 *         self.line     = error.line
 *         self.column   = error.int2
 */
  __pyx_v_self->level = ((int)__pyx_v_error->level);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":67
 *         self.type     = error.code
 *         self.level    = <int>error.level
 *         self.line     = error.line             # <<<<<<<<<<<<<<
 *         self.column   = error.int2
 *         size = cstd.strlen(error.message)
 */
  __pyx_v_self->line = __pyx_v_error->line;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":68
 *         self.level    = <int>error.level
 *         self.line     = error.line
 *         self.column   = error.int2             # <<<<<<<<<<<<<<
 *         size = cstd.strlen(error.message)
 *         if size > 0 and error.message[size-1] == c'\n':
 */
  __pyx_v_self->column = __pyx_v_error->int2;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":69
 *         self.line     = error.line
 *         self.column   = error.int2
 *         size = cstd.strlen(error.message)             # <<<<<<<<<<<<<<
 *         if size > 0 and error.message[size-1] == c'\n':
 *             size = size - 1 # strip EOL
 */
  __pyx_v_size = strlen(__pyx_v_error->message);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":70
 *         self.column   = error.int2
 *         size = cstd.strlen(error.message)
 *         if size > 0 and error.message[size-1] == c'\n':             # <<<<<<<<<<<<<<
 *             size = size - 1 # strip EOL
 *         try:
 */
  __pyx_t_1 = (__pyx_v_size > 0);
  if (__pyx_t_1) {
    __pyx_t_2 = ((__pyx_v_error->message[(__pyx_v_size - 1)]) == '\n');
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":71
 *         size = cstd.strlen(error.message)
 *         if size > 0 and error.message[size-1] == c'\n':
 *             size = size - 1 # strip EOL             # <<<<<<<<<<<<<<
 *         try:
 *             self.message = python.PyUnicode_DecodeUTF8(
 */
    __pyx_v_size = (__pyx_v_size - 1);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":72
 *         if size > 0 and error.message[size-1] == c'\n':
 *             size = size - 1 # strip EOL
 *         try:             # <<<<<<<<<<<<<<
 *             self.message = python.PyUnicode_DecodeUTF8(
 *                 error.message, size, NULL)
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":74
 *         try:
 *             self.message = python.PyUnicode_DecodeUTF8(
 *                 error.message, size, NULL)             # <<<<<<<<<<<<<<
 *         except:
 *             try:
 */
      __pyx_t_4 = ((PyObject *)PyUnicode_DecodeUTF8(__pyx_v_error->message, __pyx_v_size, NULL)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      __Pyx_GOTREF(__pyx_t_4);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":73
 *             size = size - 1 # strip EOL
 *         try:
 *             self.message = python.PyUnicode_DecodeUTF8(             # <<<<<<<<<<<<<<
 *                 error.message, size, NULL)
 *         except:
 */
      __Pyx_GIVEREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_v_self->message);
      __Pyx_DECREF(__pyx_v_self->message);
      __pyx_v_self->message = __pyx_t_4;
      __pyx_t_4 = 0;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L11_try_end;
    __pyx_L4_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":75
 *             self.message = python.PyUnicode_DecodeUTF8(
 *                 error.message, size, NULL)
 *         except:             # <<<<<<<<<<<<<<
 *             try:
 *                 self.message = python.PyUnicode_DecodeASCII(
 */
    /*except:*/ {
      __Pyx_AddTraceback("lxml.etree._LogEntry._setError");
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_6);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":76
 *                 error.message, size, NULL)
 *         except:
 *             try:             # <<<<<<<<<<<<<<
 *                 self.message = python.PyUnicode_DecodeASCII(
 *                     error.message, size, 'backslashreplace')
 */
      {
        PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
        __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
        __Pyx_XGOTREF(__pyx_save_exc_type);
        __Pyx_XGOTREF(__pyx_save_exc_value);
        __Pyx_XGOTREF(__pyx_save_exc_tb);
        /*try:*/ {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":77
 *         except:
 *             try:
 *                 self.message = python.PyUnicode_DecodeASCII(             # <<<<<<<<<<<<<<
 *                     error.message, size, 'backslashreplace')
 *             except:
 */
          __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__python); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_8 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s_41); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":78
 *             try:
 *                 self.message = python.PyUnicode_DecodeASCII(
 *                     error.message, size, 'backslashreplace')             # <<<<<<<<<<<<<<
 *             except:
 *                 self.message = u'<undecodable error message>'
 */
          __pyx_t_7 = PyBytes_FromString(__pyx_v_error->message); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
          __Pyx_GOTREF(((PyObject *)__pyx_t_7));
          __pyx_t_9 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
          __Pyx_GOTREF(((PyObject *)__pyx_t_10));
          PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_t_7));
          __Pyx_GIVEREF(((PyObject *)__pyx_t_7));
          PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_9);
          __Pyx_GIVEREF(__pyx_t_9);
          __Pyx_INCREF(((PyObject *)__pyx_n_s__backslashreplace));
          PyTuple_SET_ITEM(__pyx_t_10, 2, ((PyObject *)__pyx_n_s__backslashreplace));
          __Pyx_GIVEREF(((PyObject *)__pyx_n_s__backslashreplace));
          __pyx_t_7 = 0;
          __pyx_t_9 = 0;
          __pyx_t_9 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":77
 *         except:
 *             try:
 *                 self.message = python.PyUnicode_DecodeASCII(             # <<<<<<<<<<<<<<
 *                     error.message, size, 'backslashreplace')
 *             except:
 */
          __Pyx_GIVEREF(__pyx_t_9);
          __Pyx_GOTREF(__pyx_v_self->message);
          __Pyx_DECREF(__pyx_v_self->message);
          __pyx_v_self->message = __pyx_t_9;
          __pyx_t_9 = 0;
        }
        __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
        __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
        __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
        goto __pyx_L21_try_end;
        __pyx_L14_error:;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":79
 *                 self.message = python.PyUnicode_DecodeASCII(
 *                     error.message, size, 'backslashreplace')
 *             except:             # <<<<<<<<<<<<<<
 *                 self.message = u'<undecodable error message>'
 *         if error.file is NULL:
 */
        /*except:*/ {
          __Pyx_AddTraceback("lxml.etree._LogEntry._setError");
          if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_10, &__pyx_t_8) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;}
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_GOTREF(__pyx_t_8);

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":80
 *                     error.message, size, 'backslashreplace')
 *             except:
 *                 self.message = u'<undecodable error message>'             # <<<<<<<<<<<<<<
 *         if error.file is NULL:
 *             self.filename = u'<string>'
 */
          __Pyx_INCREF(((PyObject *)__pyx_kp_u_42));
          __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_42));
          __Pyx_GOTREF(__pyx_v_self->message);
          __Pyx_DECREF(__pyx_v_self->message);
          __pyx_v_self->message = ((PyObject *)__pyx_kp_u_42);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          goto __pyx_L15_exception_handled;
        }
        __pyx_L16_except_error:;
        __Pyx_XGIVEREF(__pyx_save_exc_type);
        __Pyx_XGIVEREF(__pyx_save_exc_value);
        __Pyx_XGIVEREF(__pyx_save_exc_tb);
        __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
        goto __pyx_L6_except_error;
        __pyx_L15_exception_handled:;
        __Pyx_XGIVEREF(__pyx_save_exc_type);
        __Pyx_XGIVEREF(__pyx_save_exc_value);
        __Pyx_XGIVEREF(__pyx_save_exc_tb);
        __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
        __pyx_L21_try_end:;
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L5_exception_handled;
    }
    __pyx_L6_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L5_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L11_try_end:;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":81
 *             except:
 *                 self.message = u'<undecodable error message>'
 *         if error.file is NULL:             # <<<<<<<<<<<<<<
 *             self.filename = u'<string>'
 *         else:
 */
  __pyx_t_3 = (__pyx_v_error->file == NULL);
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":82
 *                 self.message = u'<undecodable error message>'
 *         if error.file is NULL:
 *             self.filename = u'<string>'             # <<<<<<<<<<<<<<
 *         else:
 *             self.filename = _decodeFilename(error.file)
 */
    __Pyx_INCREF(((PyObject *)__pyx_kp_u_43));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_43));
    __Pyx_GOTREF(__pyx_v_self->filename);
    __Pyx_DECREF(__pyx_v_self->filename);
    __pyx_v_self->filename = ((PyObject *)__pyx_kp_u_43);
    goto __pyx_L24;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":84
 *             self.filename = u'<string>'
 *         else:
 *             self.filename = _decodeFilename(error.file)             # <<<<<<<<<<<<<<
 * 
 *     cdef _setGeneric(self, int domain, int type, int level, int line,
 */
    __pyx_t_6 = __pyx_f_4lxml_5etree__decodeFilename(__pyx_v_error->file); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    __Pyx_GOTREF(__pyx_v_self->filename);
    __Pyx_DECREF(__pyx_v_self->filename);
    __pyx_v_self->filename = __pyx_t_6;
    __pyx_t_6 = 0;
  }
  __pyx_L24:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("lxml.etree._LogEntry._setError");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":86
 *             self.filename = _decodeFilename(error.file)
 * 
 *     cdef _setGeneric(self, int domain, int type, int level, int line,             # <<<<<<<<<<<<<<
 *                      message, filename):
 *         self.domain  = domain
 */

static  PyObject *__pyx_f_4lxml_5etree_9_LogEntry__setGeneric(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self, int __pyx_v_domain, int __pyx_v_type, int __pyx_v_level, int __pyx_v_line, PyObject *__pyx_v_message, PyObject *__pyx_v_filename) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("_setGeneric");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":88
 *     cdef _setGeneric(self, int domain, int type, int level, int line,
 *                      message, filename):
 *         self.domain  = domain             # <<<<<<<<<<<<<<
 *         self.type    = type
 *         self.level   = level
 */
  __pyx_v_self->domain = __pyx_v_domain;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":89
 *                      message, filename):
 *         self.domain  = domain
 *         self.type    = type             # <<<<<<<<<<<<<<
 *         self.level   = level
 *         self.line    = line
 */
  __pyx_v_self->type = __pyx_v_type;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":90
 *         self.domain  = domain
 *         self.type    = type
 *         self.level   = level             # <<<<<<<<<<<<<<
 *         self.line    = line
 *         self.column  = 0
 */
  __pyx_v_self->level = __pyx_v_level;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":91
 *         self.type    = type
 *         self.level   = level
 *         self.line    = line             # <<<<<<<<<<<<<<
 *         self.column  = 0
 *         self.message = message
 */
  __pyx_v_self->line = __pyx_v_line;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":92
 *         self.level   = level
 *         self.line    = line
 *         self.column  = 0             # <<<<<<<<<<<<<<
 *         self.message = message
 *         self.filename = filename
 */
  __pyx_v_self->column = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":93
 *         self.line    = line
 *         self.column  = 0
 *         self.message = message             # <<<<<<<<<<<<<<
 *         self.filename = filename
 * 
 */
  __Pyx_INCREF(__pyx_v_message);
  __Pyx_GIVEREF(__pyx_v_message);
  __Pyx_GOTREF(__pyx_v_self->message);
  __Pyx_DECREF(__pyx_v_self->message);
  __pyx_v_self->message = __pyx_v_message;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":94
 *         self.column  = 0
 *         self.message = message
 *         self.filename = filename             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  __Pyx_INCREF(__pyx_v_filename);
  __Pyx_GIVEREF(__pyx_v_filename);
  __Pyx_GOTREF(__pyx_v_self->filename);
  __Pyx_DECREF(__pyx_v_self->filename);
  __pyx_v_self->filename = __pyx_v_filename;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":96
 *         self.filename = filename
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return u"%s:%d:%d:%s:%s:%s: %s" % (
 *             self.filename, self.line, self.column, self.level_name,
 */

static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry___repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry___repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("__repr__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":97
 * 
 *     def __repr__(self):
 *         return u"%s:%d:%d:%s:%s:%s: %s" % (             # <<<<<<<<<<<<<<
 *             self.filename, self.line, self.column, self.level_name,
 *             self.domain_name, self.type_name, self.message)
 */
  __Pyx_XDECREF(__pyx_r);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":98
 *     def __repr__(self):
 *         return u"%s:%d:%d:%s:%s:%s: %s" % (
 *             self.filename, self.line, self.column, self.level_name,             # <<<<<<<<<<<<<<
 *             self.domain_name, self.type_name, self.message)
 * 
 */
  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self)->line); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self)->column); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__level_name); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":99
 *         return u"%s:%d:%d:%s:%s:%s: %s" % (
 *             self.filename, self.line, self.column, self.level_name,
 *             self.domain_name, self.type_name, self.message)             # <<<<<<<<<<<<<<
 * 
 *     property domain_name:
 */
  __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__domain_name); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__type_name); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyTuple_New(7); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_6));
  __Pyx_INCREF(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self)->filename);
  PyTuple_SET_ITEM(__pyx_t_6, 0, ((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self)->filename);
  __Pyx_GIVEREF(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self)->filename);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_6, 4, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_6, 5, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __Pyx_INCREF(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self)->message);
  PyTuple_SET_ITEM(__pyx_t_6, 6, ((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self)->message);
  __Pyx_GIVEREF(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self)->message);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_44), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
  __pyx_r = ((PyObject *)__pyx_t_5);
  __pyx_t_5 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._LogEntry.__repr__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":104
 *         """The name of the error domain.  See lxml.etree.ErrorDomains
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return ErrorDomains._getName(self.domain, u"unknown")
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_11domain_name___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_11domain_name___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__get__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":105
 *         """
 *         def __get__(self):
 *             return ErrorDomains._getName(self.domain, u"unknown")             # <<<<<<<<<<<<<<
 * 
 *     property type_name:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__ErrorDomains); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s___getName); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self)->domain); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_n_u__unknown));
  PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_n_u__unknown));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_u__unknown));
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._LogEntry.domain_name.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":110
 *         """The name of the error type.  See lxml.etree.ErrorTypes
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if self.domain == ErrorDomains.RELAXNGV:
 *                 getName = RelaxNGErrorTypes._getName
 */

static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_9type_name___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_9type_name___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_v_getName;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("__get__");
  __pyx_v_getName = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":111
 *         """
 *         def __get__(self):
 *             if self.domain == ErrorDomains.RELAXNGV:             # <<<<<<<<<<<<<<
 *                 getName = RelaxNGErrorTypes._getName
 *             else:
 */
  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self)->domain); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__ErrorDomains); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__RELAXNGV); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_4) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":112
 *         def __get__(self):
 *             if self.domain == ErrorDomains.RELAXNGV:
 *                 getName = RelaxNGErrorTypes._getName             # <<<<<<<<<<<<<<
 *             else:
 *                 getName = ErrorTypes._getName
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__RelaxNGErrorTypes); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s___getName); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_v_getName);
    __pyx_v_getName = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":114
 *                 getName = RelaxNGErrorTypes._getName
 *             else:
 *                 getName = ErrorTypes._getName             # <<<<<<<<<<<<<<
 *             return getName(self.type, u"unknown")
 * 
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__ErrorTypes); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s___getName); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_v_getName);
    __pyx_v_getName = __pyx_t_2;
    __pyx_t_2 = 0;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":115
 *             else:
 *                 getName = ErrorTypes._getName
 *             return getName(self.type, u"unknown")             # <<<<<<<<<<<<<<
 * 
 *     property level_name:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self)->type); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_n_u__unknown));
  PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_n_u__unknown));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_u__unknown));
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_v_getName, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._LogEntry.type_name.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_getName);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":120
 *         """The name of the error level.  See lxml.etree.ErrorLevels
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return ErrorLevels._getName(self.level, u"unknown")
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_10level_name___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_10level_name___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__get__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":121
 *         """
 *         def __get__(self):
 *             return ErrorLevels._getName(self.level, u"unknown")             # <<<<<<<<<<<<<<
 * 
 * cdef class _BaseErrorLog:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__ErrorLevels); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s___getName); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self)->level); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_n_u__unknown));
  PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_n_u__unknown));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_u__unknown));
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._LogEntry.level_name.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":54
 *     - filename: the name of the file in which the message originated (if applicable)
 *     """
 *     cdef readonly int domain             # <<<<<<<<<<<<<<
 *     cdef readonly int type
 *     cdef readonly int level
 */

static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_6domain___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_6domain___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self)->domain); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._LogEntry.domain.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":55
 *     """
 *     cdef readonly int domain
 *     cdef readonly int type             # <<<<<<<<<<<<<<
 *     cdef readonly int level
 *     cdef readonly int line
 */

static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_4type___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_4type___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self)->type); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._LogEntry.type.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":56
 *     cdef readonly int domain
 *     cdef readonly int type
 *     cdef readonly int level             # <<<<<<<<<<<<<<
 *     cdef readonly int line
 *     cdef readonly int column
 */

static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_5level___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_5level___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self)->level); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._LogEntry.level.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":57
 *     cdef readonly int type
 *     cdef readonly int level
 *     cdef readonly int line             # <<<<<<<<<<<<<<
 *     cdef readonly int column
 *     cdef readonly object message
 */

static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_4line___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_4line___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self)->line); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._LogEntry.line.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":58
 *     cdef readonly int level
 *     cdef readonly int line
 *     cdef readonly int column             # <<<<<<<<<<<<<<
 *     cdef readonly object message
 *     cdef readonly object filename
 */

static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_6column___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_6column___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self)->column); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._LogEntry.column.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":59
 *     cdef readonly int line
 *     cdef readonly int column
 *     cdef readonly object message             # <<<<<<<<<<<<<<
 *     cdef readonly object filename
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_7message___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_7message___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self)->message);
  __pyx_r = ((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self)->message;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":60
 *     cdef readonly int column
 *     cdef readonly object message
 *     cdef readonly object filename             # <<<<<<<<<<<<<<
 * 
 *     cdef _setError(self, xmlerror.xmlError* error):
 */

static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_8filename___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_8filename___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self)->filename);
  __pyx_r = ((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self)->filename;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":126
 *     cdef _LogEntry _first_error
 *     cdef readonly object last_error
 *     def __init__(self, first_error, last_error):             # <<<<<<<<<<<<<<
 *         self._first_error = first_error
 *         self.last_error = last_error
 */

static int __pyx_pf_4lxml_5etree_13_BaseErrorLog___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_13_BaseErrorLog___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_first_error = 0;
  PyObject *__pyx_v_last_error = 0;
  int __pyx_r;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__first_error,&__pyx_n_s__last_error,0};
  __Pyx_RefNannySetupContext("__init__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__first_error);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__last_error);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_first_error = values[0];
    __pyx_v_last_error = values[1];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_first_error = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_last_error = PyTuple_GET_ITEM(__pyx_args, 1);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._BaseErrorLog.__init__");
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":127
 *     cdef readonly object last_error
 *     def __init__(self, first_error, last_error):
 *         self._first_error = first_error             # <<<<<<<<<<<<<<
 *         self.last_error = last_error
 * 
 */
  if (!(likely(((__pyx_v_first_error) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_first_error, __pyx_ptype_4lxml_5etree__LogEntry))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_first_error);
  __Pyx_GIVEREF(__pyx_v_first_error);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self)->_first_error);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self)->_first_error));
  ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self)->_first_error = ((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_first_error);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":128
 *     def __init__(self, first_error, last_error):
 *         self._first_error = first_error
 *         self.last_error = last_error             # <<<<<<<<<<<<<<
 * 
 *     def copy(self):
 */
  __Pyx_INCREF(__pyx_v_last_error);
  __Pyx_GIVEREF(__pyx_v_last_error);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self)->last_error);
  __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self)->last_error);
  ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self)->last_error = __pyx_v_last_error;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._BaseErrorLog.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":130
 *         self.last_error = last_error
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         return _BaseErrorLog(self._first_error, self.last_error)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_13_BaseErrorLog_1copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_13_BaseErrorLog_1copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("copy");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":131
 * 
 *     def copy(self):
 *         return _BaseErrorLog(self._first_error, self.last_error)             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self)->_first_error));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self)->_first_error));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self)->_first_error));
  __Pyx_INCREF(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self)->last_error);
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self)->last_error);
  __Pyx_GIVEREF(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self)->last_error);
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__BaseErrorLog)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._BaseErrorLog.copy");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":133
 *         return _BaseErrorLog(self._first_error, self.last_error)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return u''
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_13_BaseErrorLog_2__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_13_BaseErrorLog_2__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("__repr__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":134
 * 
 *     def __repr__(self):
 *         return u''             # <<<<<<<<<<<<<<
 * 
 *     cdef void _receive(self, xmlerror.xmlError* error):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_25));
  __pyx_r = ((PyObject *)__pyx_kp_u_25);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":136
 *         return u''
 * 
 *     cdef void _receive(self, xmlerror.xmlError* error):             # <<<<<<<<<<<<<<
 *         cdef bint is_error
 *         cdef _LogEntry entry
 */

static  void __pyx_f_4lxml_5etree_13_BaseErrorLog__receive(struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_self, xmlError *__pyx_v_error) {
  int __pyx_v_is_error;
  struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_entry;
  struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_global_log;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("_receive");
  __pyx_v_entry = ((struct __pyx_obj_4lxml_5etree__LogEntry *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_global_log = ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":140
 *         cdef _LogEntry entry
 *         cdef _BaseErrorLog global_log
 *         entry = _LogEntry()             # <<<<<<<<<<<<<<
 *         entry._setError(error)
 *         is_error = error.level == xmlerror.XML_ERR_ERROR or \
 */
  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__LogEntry)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_entry));
  __pyx_v_entry = ((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":141
 *         cdef _BaseErrorLog global_log
 *         entry = _LogEntry()
 *         entry._setError(error)             # <<<<<<<<<<<<<<
 *         is_error = error.level == xmlerror.XML_ERR_ERROR or \
 *                    error.level == xmlerror.XML_ERR_FATAL
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__LogEntry *)__pyx_v_entry->__pyx_vtab)->_setError(__pyx_v_entry, __pyx_v_error); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":142
 *         entry = _LogEntry()
 *         entry._setError(error)
 *         is_error = error.level == xmlerror.XML_ERR_ERROR or \             # <<<<<<<<<<<<<<
 *                    error.level == xmlerror.XML_ERR_FATAL
 *         global_log = _getGlobalErrorLog()
 */
  __pyx_t_2 = (__pyx_v_error->level == XML_ERR_ERROR);
  if (!__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":143
 *         entry._setError(error)
 *         is_error = error.level == xmlerror.XML_ERR_ERROR or \
 *                    error.level == xmlerror.XML_ERR_FATAL             # <<<<<<<<<<<<<<
 *         global_log = _getGlobalErrorLog()
 *         if global_log is not self:
 */
    __pyx_t_3 = (__pyx_v_error->level == XML_ERR_FATAL);
    __pyx_t_4 = __pyx_t_3;
  } else {
    __pyx_t_4 = __pyx_t_2;
  }
  __pyx_v_is_error = __pyx_t_4;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":144
 *         is_error = error.level == xmlerror.XML_ERR_ERROR or \
 *                    error.level == xmlerror.XML_ERR_FATAL
 *         global_log = _getGlobalErrorLog()             # <<<<<<<<<<<<<<
 *         if global_log is not self:
 *             global_log.receive(entry)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__getGlobalErrorLog()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_global_log));
  __pyx_v_global_log = ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":145
 *                    error.level == xmlerror.XML_ERR_FATAL
 *         global_log = _getGlobalErrorLog()
 *         if global_log is not self:             # <<<<<<<<<<<<<<
 *             global_log.receive(entry)
 *             if is_error:
 */
  __pyx_t_4 = (__pyx_v_global_log != __pyx_v_self);
  if (__pyx_t_4) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":146
 *         global_log = _getGlobalErrorLog()
 *         if global_log is not self:
 *             global_log.receive(entry)             # <<<<<<<<<<<<<<
 *             if is_error:
 *                 global_log.last_error = entry
 */
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_global_log), __pyx_n_s__receive); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
    __Pyx_INCREF(((PyObject *)__pyx_v_entry));
    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_entry));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_entry));
    __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":147
 *         if global_log is not self:
 *             global_log.receive(entry)
 *             if is_error:             # <<<<<<<<<<<<<<
 *                 global_log.last_error = entry
 *         self.receive(entry)
 */
    if (__pyx_v_is_error) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":148
 *             global_log.receive(entry)
 *             if is_error:
 *                 global_log.last_error = entry             # <<<<<<<<<<<<<<
 *         self.receive(entry)
 *         if is_error:
 */
      __Pyx_INCREF(((PyObject *)__pyx_v_entry));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_entry));
      __Pyx_GOTREF(__pyx_v_global_log->last_error);
      __Pyx_DECREF(__pyx_v_global_log->last_error);
      __pyx_v_global_log->last_error = ((PyObject *)__pyx_v_entry);
      goto __pyx_L4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":149
 *             if is_error:
 *                 global_log.last_error = entry
 *         self.receive(entry)             # <<<<<<<<<<<<<<
 *         if is_error:
 *             self.last_error = entry
 */
  __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__receive); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  __Pyx_INCREF(((PyObject *)__pyx_v_entry));
  PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_entry));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_entry));
  __pyx_t_1 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":150
 *                 global_log.last_error = entry
 *         self.receive(entry)
 *         if is_error:             # <<<<<<<<<<<<<<
 *             self.last_error = entry
 * 
 */
  if (__pyx_v_is_error) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":151
 *         self.receive(entry)
 *         if is_error:
 *             self.last_error = entry             # <<<<<<<<<<<<<<
 * 
 *     cdef void _receiveGeneric(self, int domain, int type, int level, int line,
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_entry));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_entry));
    __Pyx_GOTREF(__pyx_v_self->last_error);
    __Pyx_DECREF(__pyx_v_self->last_error);
    __pyx_v_self->last_error = ((PyObject *)__pyx_v_entry);
    goto __pyx_L5;
  }
  __pyx_L5:;

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_WriteUnraisable("lxml.etree._BaseErrorLog._receive");
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_entry);
  __Pyx_DECREF((PyObject *)__pyx_v_global_log);
  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":153
 *             self.last_error = entry
 * 
 *     cdef void _receiveGeneric(self, int domain, int type, int level, int line,             # <<<<<<<<<<<<<<
 *                               message, filename):
 *         cdef bint is_error
 */

static  void __pyx_f_4lxml_5etree_13_BaseErrorLog__receiveGeneric(struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_self, int __pyx_v_domain, int __pyx_v_type, int __pyx_v_level, int __pyx_v_line, PyObject *__pyx_v_message, PyObject *__pyx_v_filename) {
  int __pyx_v_is_error;
  struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_entry;
  struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_global_log;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("_receiveGeneric");
  __pyx_v_entry = ((struct __pyx_obj_4lxml_5etree__LogEntry *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_global_log = ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":158
 *         cdef _LogEntry entry
 *         cdef _BaseErrorLog global_log
 *         entry = _LogEntry()             # <<<<<<<<<<<<<<
 *         entry._setGeneric(domain, type, level, line, message, filename)
 *         is_error = level == xmlerror.XML_ERR_ERROR or \
 */
  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__LogEntry)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_entry));
  __pyx_v_entry = ((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":159
 *         cdef _BaseErrorLog global_log
 *         entry = _LogEntry()
 *         entry._setGeneric(domain, type, level, line, message, filename)             # <<<<<<<<<<<<<<
 *         is_error = level == xmlerror.XML_ERR_ERROR or \
 *                    level == xmlerror.XML_ERR_FATAL
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__LogEntry *)__pyx_v_entry->__pyx_vtab)->_setGeneric(__pyx_v_entry, __pyx_v_domain, __pyx_v_type, __pyx_v_level, __pyx_v_line, __pyx_v_message, __pyx_v_filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":160
 *         entry = _LogEntry()
 *         entry._setGeneric(domain, type, level, line, message, filename)
 *         is_error = level == xmlerror.XML_ERR_ERROR or \             # <<<<<<<<<<<<<<
 *                    level == xmlerror.XML_ERR_FATAL
 *         global_log = _getGlobalErrorLog()
 */
  __pyx_t_2 = (__pyx_v_level == XML_ERR_ERROR);
  if (!__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":161
 *         entry._setGeneric(domain, type, level, line, message, filename)
 *         is_error = level == xmlerror.XML_ERR_ERROR or \
 *                    level == xmlerror.XML_ERR_FATAL             # <<<<<<<<<<<<<<
 *         global_log = _getGlobalErrorLog()
 *         if global_log is not self:
 */
    __pyx_t_3 = (__pyx_v_level == XML_ERR_FATAL);
    __pyx_t_4 = __pyx_t_3;
  } else {
    __pyx_t_4 = __pyx_t_2;
  }
  __pyx_v_is_error = __pyx_t_4;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":162
 *         is_error = level == xmlerror.XML_ERR_ERROR or \
 *                    level == xmlerror.XML_ERR_FATAL
 *         global_log = _getGlobalErrorLog()             # <<<<<<<<<<<<<<
 *         if global_log is not self:
 *             global_log.receive(entry)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__getGlobalErrorLog()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_global_log));
  __pyx_v_global_log = ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":163
 *                    level == xmlerror.XML_ERR_FATAL
 *         global_log = _getGlobalErrorLog()
 *         if global_log is not self:             # <<<<<<<<<<<<<<
 *             global_log.receive(entry)
 *             if is_error:
 */
  __pyx_t_4 = (__pyx_v_global_log != __pyx_v_self);
  if (__pyx_t_4) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":164
 *         global_log = _getGlobalErrorLog()
 *         if global_log is not self:
 *             global_log.receive(entry)             # <<<<<<<<<<<<<<
 *             if is_error:
 *                 global_log.last_error = entry
 */
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_global_log), __pyx_n_s__receive); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
    __Pyx_INCREF(((PyObject *)__pyx_v_entry));
    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_entry));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_entry));
    __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":165
 *         if global_log is not self:
 *             global_log.receive(entry)
 *             if is_error:             # <<<<<<<<<<<<<<
 *                 global_log.last_error = entry
 *         self.receive(entry)
 */
    if (__pyx_v_is_error) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":166
 *             global_log.receive(entry)
 *             if is_error:
 *                 global_log.last_error = entry             # <<<<<<<<<<<<<<
 *         self.receive(entry)
 *         if is_error:
 */
      __Pyx_INCREF(((PyObject *)__pyx_v_entry));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_entry));
      __Pyx_GOTREF(__pyx_v_global_log->last_error);
      __Pyx_DECREF(__pyx_v_global_log->last_error);
      __pyx_v_global_log->last_error = ((PyObject *)__pyx_v_entry);
      goto __pyx_L4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":167
 *             if is_error:
 *                 global_log.last_error = entry
 *         self.receive(entry)             # <<<<<<<<<<<<<<
 *         if is_error:
 *             self.last_error = entry
 */
  __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__receive); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  __Pyx_INCREF(((PyObject *)__pyx_v_entry));
  PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_entry));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_entry));
  __pyx_t_1 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":168
 *                 global_log.last_error = entry
 *         self.receive(entry)
 *         if is_error:             # <<<<<<<<<<<<<<
 *             self.last_error = entry
 * 
 */
  if (__pyx_v_is_error) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":169
 *         self.receive(entry)
 *         if is_error:
 *             self.last_error = entry             # <<<<<<<<<<<<<<
 * 
 *     cdef _buildParseException(self, exctype, default_message):
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_entry));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_entry));
    __Pyx_GOTREF(__pyx_v_self->last_error);
    __Pyx_DECREF(__pyx_v_self->last_error);
    __pyx_v_self->last_error = ((PyObject *)__pyx_v_entry);
    goto __pyx_L5;
  }
  __pyx_L5:;

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_WriteUnraisable("lxml.etree._BaseErrorLog._receiveGeneric");
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_entry);
  __Pyx_DECREF((PyObject *)__pyx_v_global_log);
  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":171
 *             self.last_error = entry
 * 
 *     cdef _buildParseException(self, exctype, default_message):             # <<<<<<<<<<<<<<
 *         code = xmlerror.XML_ERR_INTERNAL_ERROR
 *         if self._first_error is None:
 */

static  PyObject *__pyx_f_4lxml_5etree_13_BaseErrorLog__buildParseException(struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_self, PyObject *__pyx_v_exctype, PyObject *__pyx_v_default_message) {
  int __pyx_v_code;
  PyObject *__pyx_v_message;
  int __pyx_v_line;
  int __pyx_v_column;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("_buildParseException");
  __pyx_v_message = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":172
 * 
 *     cdef _buildParseException(self, exctype, default_message):
 *         code = xmlerror.XML_ERR_INTERNAL_ERROR             # <<<<<<<<<<<<<<
 *         if self._first_error is None:
 *             return exctype(default_message, code, 0, 0)
 */
  __pyx_v_code = XML_ERR_INTERNAL_ERROR;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":173
 *     cdef _buildParseException(self, exctype, default_message):
 *         code = xmlerror.XML_ERR_INTERNAL_ERROR
 *         if self._first_error is None:             # <<<<<<<<<<<<<<
 *             return exctype(default_message, code, 0, 0)
 *         if not self._first_error.message:
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_self->_first_error) == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":174
 *         code = xmlerror.XML_ERR_INTERNAL_ERROR
 *         if self._first_error is None:
 *             return exctype(default_message, code, 0, 0)             # <<<<<<<<<<<<<<
 *         if not self._first_error.message:
 *             message = default_message
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyInt_FromLong(__pyx_v_code); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_INCREF(__pyx_v_default_message);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_default_message);
    __Pyx_GIVEREF(__pyx_v_default_message);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_int_0);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    __Pyx_INCREF(__pyx_int_0);
    PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(__pyx_v_exctype, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":175
 *         if self._first_error is None:
 *             return exctype(default_message, code, 0, 0)
 *         if not self._first_error.message:             # <<<<<<<<<<<<<<
 *             message = default_message
 *         else:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_self->_first_error->message); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = (!__pyx_t_1);
  if (__pyx_t_4) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":176
 *             return exctype(default_message, code, 0, 0)
 *         if not self._first_error.message:
 *             message = default_message             # <<<<<<<<<<<<<<
 *         else:
 *             message = self._first_error.message
 */
    __Pyx_INCREF(__pyx_v_default_message);
    __Pyx_DECREF(__pyx_v_message);
    __pyx_v_message = __pyx_v_default_message;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":178
 *             message = default_message
 *         else:
 *             message = self._first_error.message             # <<<<<<<<<<<<<<
 *             code = self._first_error.type
 *         line = self._first_error.line
 */
    __Pyx_INCREF(__pyx_v_self->_first_error->message);
    __Pyx_DECREF(__pyx_v_message);
    __pyx_v_message = __pyx_v_self->_first_error->message;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":179
 *         else:
 *             message = self._first_error.message
 *             code = self._first_error.type             # <<<<<<<<<<<<<<
 *         line = self._first_error.line
 *         column = self._first_error.column
 */
    __pyx_v_code = __pyx_v_self->_first_error->type;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":180
 *             message = self._first_error.message
 *             code = self._first_error.type
 *         line = self._first_error.line             # <<<<<<<<<<<<<<
 *         column = self._first_error.column
 *         if line > 0:
 */
  __pyx_v_line = __pyx_v_self->_first_error->line;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":181
 *             code = self._first_error.type
 *         line = self._first_error.line
 *         column = self._first_error.column             # <<<<<<<<<<<<<<
 *         if line > 0:
 *             if column > 0:
 */
  __pyx_v_column = __pyx_v_self->_first_error->column;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":182
 *         line = self._first_error.line
 *         column = self._first_error.column
 *         if line > 0:             # <<<<<<<<<<<<<<
 *             if column > 0:
 *                 message = u"%s, line %d, column %d" % (message, line, column)
 */
  __pyx_t_4 = (__pyx_v_line > 0);
  if (__pyx_t_4) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":183
 *         column = self._first_error.column
 *         if line > 0:
 *             if column > 0:             # <<<<<<<<<<<<<<
 *                 message = u"%s, line %d, column %d" % (message, line, column)
 *             else:
 */
    __pyx_t_4 = (__pyx_v_column > 0);
    if (__pyx_t_4) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":184
 *         if line > 0:
 *             if column > 0:
 *                 message = u"%s, line %d, column %d" % (message, line, column)             # <<<<<<<<<<<<<<
 *             else:
 *                 message = u"%s, line %d" % (message, line)
 */
      __pyx_t_2 = PyInt_FromLong(__pyx_v_line); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyInt_FromLong(__pyx_v_column); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
      __Pyx_INCREF(__pyx_v_message);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_message);
      __Pyx_GIVEREF(__pyx_v_message);
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __pyx_t_2 = 0;
      __pyx_t_3 = 0;
      __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_45), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_v_message);
      __pyx_v_message = ((PyObject *)__pyx_t_3);
      __pyx_t_3 = 0;
      goto __pyx_L6;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":186
 *                 message = u"%s, line %d, column %d" % (message, line, column)
 *             else:
 *                 message = u"%s, line %d" % (message, line)             # <<<<<<<<<<<<<<
 *         return exctype(message, code, line, column)
 * 
 */
      __pyx_t_3 = PyInt_FromLong(__pyx_v_line); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
      __Pyx_INCREF(__pyx_v_message);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_message);
      __Pyx_GIVEREF(__pyx_v_message);
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_46), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_v_message);
      __pyx_v_message = ((PyObject *)__pyx_t_3);
      __pyx_t_3 = 0;
    }
    __pyx_L6:;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":187
 *             else:
 *                 message = u"%s, line %d" % (message, line)
 *         return exctype(message, code, line, column)             # <<<<<<<<<<<<<<
 * 
 *     cdef _buildExceptionMessage(self, default_message):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyInt_FromLong(__pyx_v_code); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyInt_FromLong(__pyx_v_line); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = PyInt_FromLong(__pyx_v_column); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_6));
  __Pyx_INCREF(__pyx_v_message);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_message);
  __Pyx_GIVEREF(__pyx_v_message);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_3 = 0;
  __pyx_t_5 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_v_exctype, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._BaseErrorLog._buildParseException");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_message);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":189
 *         return exctype(message, code, line, column)
 * 
 *     cdef _buildExceptionMessage(self, default_message):             # <<<<<<<<<<<<<<
 *         if self._first_error is None:
 *             return default_message
 */

static  PyObject *__pyx_f_4lxml_5etree_13_BaseErrorLog__buildExceptionMessage(struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_self, PyObject *__pyx_v_default_message) {
  PyObject *__pyx_v_message;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("_buildExceptionMessage");
  __pyx_v_message = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":190
 * 
 *     cdef _buildExceptionMessage(self, default_message):
 *         if self._first_error is None:             # <<<<<<<<<<<<<<
 *             return default_message
 *         if self._first_error.message:
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_self->_first_error) == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":191
 *     cdef _buildExceptionMessage(self, default_message):
 *         if self._first_error is None:
 *             return default_message             # <<<<<<<<<<<<<<
 *         if self._first_error.message:
 *             message = self._first_error.message
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_default_message);
    __pyx_r = __pyx_v_default_message;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":192
 *         if self._first_error is None:
 *             return default_message
 *         if self._first_error.message:             # <<<<<<<<<<<<<<
 *             message = self._first_error.message
 *         elif default_message is None:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_self->_first_error->message); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":193
 *             return default_message
 *         if self._first_error.message:
 *             message = self._first_error.message             # <<<<<<<<<<<<<<
 *         elif default_message is None:
 *             return None
 */
    __Pyx_INCREF(__pyx_v_self->_first_error->message);
    __Pyx_DECREF(__pyx_v_message);
    __pyx_v_message = __pyx_v_self->_first_error->message;
    goto __pyx_L4;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":194
 *         if self._first_error.message:
 *             message = self._first_error.message
 *         elif default_message is None:             # <<<<<<<<<<<<<<
 *             return None
 *         else:
 */
  __pyx_t_1 = (__pyx_v_default_message == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":195
 *             message = self._first_error.message
 *         elif default_message is None:
 *             return None             # <<<<<<<<<<<<<<
 *         else:
 *             message = default_message
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":197
 *             return None
 *         else:
 *             message = default_message             # <<<<<<<<<<<<<<
 *         if self._first_error.line > 0:
 *             if self._first_error.column > 0:
 */
    __Pyx_INCREF(__pyx_v_default_message);
    __Pyx_DECREF(__pyx_v_message);
    __pyx_v_message = __pyx_v_default_message;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":198
 *         else:
 *             message = default_message
 *         if self._first_error.line > 0:             # <<<<<<<<<<<<<<
 *             if self._first_error.column > 0:
 *                 message = u"%s, line %d, column %d" % (
 */
  __pyx_t_1 = (__pyx_v_self->_first_error->line > 0);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":199
 *             message = default_message
 *         if self._first_error.line > 0:
 *             if self._first_error.column > 0:             # <<<<<<<<<<<<<<
 *                 message = u"%s, line %d, column %d" % (
 *                     message, self._first_error.line, self._first_error.column)
 */
    __pyx_t_1 = (__pyx_v_self->_first_error->column > 0);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":201
 *             if self._first_error.column > 0:
 *                 message = u"%s, line %d, column %d" % (
 *                     message, self._first_error.line, self._first_error.column)             # <<<<<<<<<<<<<<
 *             else:
 *                 message = u"%s, line %d" % (message, self._first_error.line)
 */
      __pyx_t_2 = PyInt_FromLong(__pyx_v_self->_first_error->line); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyInt_FromLong(__pyx_v_self->_first_error->column); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      __Pyx_INCREF(__pyx_v_message);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_message);
      __Pyx_GIVEREF(__pyx_v_message);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __pyx_t_2 = 0;
      __pyx_t_3 = 0;
      __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_45), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_v_message);
      __pyx_v_message = ((PyObject *)__pyx_t_3);
      __pyx_t_3 = 0;
      goto __pyx_L6;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":203
 *                     message, self._first_error.line, self._first_error.column)
 *             else:
 *                 message = u"%s, line %d" % (message, self._first_error.line)             # <<<<<<<<<<<<<<
 *         return message
 * 
 */
      __pyx_t_3 = PyInt_FromLong(__pyx_v_self->_first_error->line); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      __Pyx_INCREF(__pyx_v_message);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_message);
      __Pyx_GIVEREF(__pyx_v_message);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_46), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_v_message);
      __pyx_v_message = ((PyObject *)__pyx_t_3);
      __pyx_t_3 = 0;
    }
    __pyx_L6:;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":204
 *             else:
 *                 message = u"%s, line %d" % (message, self._first_error.line)
 *         return message             # <<<<<<<<<<<<<<
 * 
 * cdef class _ListErrorLog(_BaseErrorLog):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_message);
  __pyx_r = __pyx_v_message;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._BaseErrorLog._buildExceptionMessage");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_message);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":125
 * cdef class _BaseErrorLog:
 *     cdef _LogEntry _first_error
 *     cdef readonly object last_error             # <<<<<<<<<<<<<<
 *     def __init__(self, first_error, last_error):
 *         self._first_error = first_error
 */

static PyObject *__pyx_pf_4lxml_5etree_13_BaseErrorLog_10last_error___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_13_BaseErrorLog_10last_error___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self)->last_error);
  __pyx_r = ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self)->last_error;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":209
 *     u"Immutable base version of a list based error log."
 *     cdef list _entries
 *     def __init__(self, entries, first_error, last_error):             # <<<<<<<<<<<<<<
 *         if entries:
 *             if first_error is None:
 */

static int __pyx_pf_4lxml_5etree_13_ListErrorLog___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_13_ListErrorLog___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_entries = 0;
  PyObject *__pyx_v_first_error = 0;
  PyObject *__pyx_v_last_error = 0;
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__entries,&__pyx_n_s__first_error,&__pyx_n_s__last_error,0};
  __Pyx_RefNannySetupContext("__init__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__entries);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__first_error);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__last_error);
      if (likely(values[2])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_entries = values[0];
    __pyx_v_first_error = values[1];
    __pyx_v_last_error = values[2];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_entries = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_first_error = PyTuple_GET_ITEM(__pyx_args, 1);
    __pyx_v_last_error = PyTuple_GET_ITEM(__pyx_args, 2);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.__init__");
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF(__pyx_v_first_error);
  __Pyx_INCREF(__pyx_v_last_error);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":210
 *     cdef list _entries
 *     def __init__(self, entries, first_error, last_error):
 *         if entries:             # <<<<<<<<<<<<<<
 *             if first_error is None:
 *                 first_error = entries[0]
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_entries); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":211
 *     def __init__(self, entries, first_error, last_error):
 *         if entries:
 *             if first_error is None:             # <<<<<<<<<<<<<<
 *                 first_error = entries[0]
 *             if last_error is None:
 */
    __pyx_t_1 = (__pyx_v_first_error == Py_None);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":212
 *         if entries:
 *             if first_error is None:
 *                 first_error = entries[0]             # <<<<<<<<<<<<<<
 *             if last_error is None:
 *                 last_error = entries[-1]
 */
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_entries, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_v_first_error);
      __pyx_v_first_error = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":213
 *             if first_error is None:
 *                 first_error = entries[0]
 *             if last_error is None:             # <<<<<<<<<<<<<<
 *                 last_error = entries[-1]
 *         _BaseErrorLog.__init__(self, first_error, last_error)
 */
    __pyx_t_1 = (__pyx_v_last_error == Py_None);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":214
 *                 first_error = entries[0]
 *             if last_error is None:
 *                 last_error = entries[-1]             # <<<<<<<<<<<<<<
 *         _BaseErrorLog.__init__(self, first_error, last_error)
 *         self._entries = entries
 */
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_entries, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_v_last_error);
      __pyx_v_last_error = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L8;
    }
    __pyx_L8:;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":215
 *             if last_error is None:
 *                 last_error = entries[-1]
 *         _BaseErrorLog.__init__(self, first_error, last_error)             # <<<<<<<<<<<<<<
 *         self._entries = entries
 * 
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__BaseErrorLog)), __pyx_n_s____init__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __Pyx_INCREF(__pyx_v_first_error);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_first_error);
  __Pyx_GIVEREF(__pyx_v_first_error);
  __Pyx_INCREF(__pyx_v_last_error);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_last_error);
  __Pyx_GIVEREF(__pyx_v_last_error);
  __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":216
 *                 last_error = entries[-1]
 *         _BaseErrorLog.__init__(self, first_error, last_error)
 *         self._entries = entries             # <<<<<<<<<<<<<<
 * 
 *     def copy(self):
 */
  if (!(likely(PyList_CheckExact(__pyx_v_entries))||((__pyx_v_entries) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_v_entries)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_entries);
  __Pyx_GIVEREF(__pyx_v_entries);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self)->_entries);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self)->_entries));
  ((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self)->_entries = ((PyObject*)__pyx_v_entries);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_first_error);
  __Pyx_DECREF(__pyx_v_last_error);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":218
 *         self._entries = entries
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         u"""Creates a shallow copy of this error log.  Reuses the list of
 *         entries.
 */

static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_1copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_13_ListErrorLog_1copy[] = "Creates a shallow copy of this error log.  Reuses the list of\n        entries.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_1copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("copy");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":222
 *         entries.
 *         """
 *         return _ListErrorLog(self._entries, self._first_error, self.last_error)             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self)->_entries));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self)->_entries));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self)->_entries));
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self)->__pyx_base._first_error));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self)->__pyx_base._first_error));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self)->__pyx_base._first_error));
  __Pyx_INCREF(((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self)->__pyx_base.last_error);
  PyTuple_SET_ITEM(__pyx_t_1, 2, ((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self)->__pyx_base.last_error);
  __Pyx_GIVEREF(((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self)->__pyx_base.last_error);
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ListErrorLog)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.copy");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":224
 *         return _ListErrorLog(self._entries, self._first_error, self.last_error)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return iter(self._entries)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_2__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_2__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__iter__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":225
 * 
 *     def __iter__(self):
 *         return iter(self._entries)             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self)->_entries);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.__iter__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":227
 *         return iter(self._entries)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         cdef list l = []
 *         for entry in self._entries:
 */

static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_3__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_3__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_v_l = 0;
  PyObject *__pyx_v_entry;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("__repr__");
  __pyx_v_entry = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":228
 * 
 *     def __repr__(self):
 *         cdef list l = []             # <<<<<<<<<<<<<<
 *         for entry in self._entries:
 *             l.append(repr(entry))
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_l = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":229
 *     def __repr__(self):
 *         cdef list l = []
 *         for entry in self._entries:             # <<<<<<<<<<<<<<
 *             l.append(repr(entry))
 *         return u'\n'.join(l)
 */
  if (unlikely(((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self)->_entries == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_2 = 0; __pyx_t_1 = ((PyObject *)((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self)->_entries); __Pyx_INCREF(__pyx_t_1);
  for (;;) {
    if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
    __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++;
    __Pyx_DECREF(__pyx_v_entry);
    __pyx_v_entry = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":230
 *         cdef list l = []
 *         for entry in self._entries:
 *             l.append(repr(entry))             # <<<<<<<<<<<<<<
 *         return u'\n'.join(l)
 * 
 */
    if (unlikely(__pyx_v_l == Py_None)) {
      PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_3 = PyObject_Repr(__pyx_v_entry); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyList_Append(__pyx_v_l, __pyx_t_3); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":231
 *         for entry in self._entries:
 *             l.append(repr(entry))
 *         return u'\n'.join(l)             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, index):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)PyUnicode_Join(__pyx_kp_u_47, ((PyObject *)__pyx_v_l))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.__repr__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_l);
  __Pyx_DECREF(__pyx_v_entry);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":233
 *         return u'\n'.join(l)
 * 
 *     def __getitem__(self, index):             # <<<<<<<<<<<<<<
 *         return self._entries[index]
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_4__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_4__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__getitem__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":234
 * 
 *     def __getitem__(self, index):
 *         return self._entries[index]             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetItem(((PyObject *)((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self)->_entries), __pyx_v_index); if (!__pyx_t_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.__getitem__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":236
 *         return self._entries[index]
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return len(self._entries)
 * 
 */

static Py_ssize_t __pyx_pf_4lxml_5etree_13_ListErrorLog_5__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pf_4lxml_5etree_13_ListErrorLog_5__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  __Pyx_RefNannySetupContext("__len__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":237
 * 
 *     def __len__(self):
 *         return len(self._entries)             # <<<<<<<<<<<<<<
 * 
 *     def __contains__(self, error_type):
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self)->_entries);
  __Pyx_INCREF(__pyx_t_1);
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_2 = PyList_GET_SIZE(__pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.__len__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":239
 *         return len(self._entries)
 * 
 *     def __contains__(self, error_type):             # <<<<<<<<<<<<<<
 *         for entry in self._entries:
 *             if entry.type == error_type:
 */

static int __pyx_pf_4lxml_5etree_13_ListErrorLog_6__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_error_type); /*proto*/
static int __pyx_pf_4lxml_5etree_13_ListErrorLog_6__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_error_type) {
  PyObject *__pyx_v_entry;
  int __pyx_r;
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("__contains__");
  __pyx_v_entry = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":240
 * 
 *     def __contains__(self, error_type):
 *         for entry in self._entries:             # <<<<<<<<<<<<<<
 *             if entry.type == error_type:
 *                 return True
 */
  if (unlikely(((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self)->_entries == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_1 = 0; __pyx_t_2 = ((PyObject *)((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self)->_entries); __Pyx_INCREF(__pyx_t_2);
  for (;;) {
    if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_2)) break;
    __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++;
    __Pyx_DECREF(__pyx_v_entry);
    __pyx_v_entry = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":241
 *     def __contains__(self, error_type):
 *         for entry in self._entries:
 *             if entry.type == error_type:             # <<<<<<<<<<<<<<
 *                 return True
 *         return False
 */
    __pyx_t_3 = PyObject_GetAttr(__pyx_v_entry, __pyx_n_s__type); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_v_error_type, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_5) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":242
 *         for entry in self._entries:
 *             if entry.type == error_type:
 *                 return True             # <<<<<<<<<<<<<<
 *         return False
 * 
 */
      __pyx_r = 1;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L0;
      goto __pyx_L7;
    }
    __pyx_L7:;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":243
 *             if entry.type == error_type:
 *                 return True
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     def __nonzero__(self):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.__contains__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_entry);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":245
 *         return False
 * 
 *     def __nonzero__(self):             # <<<<<<<<<<<<<<
 *         cdef bint result
 *         result = self._entries
 */

static int __pyx_pf_4lxml_5etree_13_ListErrorLog_7__nonzero__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pf_4lxml_5etree_13_ListErrorLog_7__nonzero__(PyObject *__pyx_v_self) {
  int __pyx_v_result;
  int __pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__nonzero__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":247
 *     def __nonzero__(self):
 *         cdef bint result
 *         result = self._entries             # <<<<<<<<<<<<<<
 *         return result
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self)->_entries)); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_result = __pyx_t_1;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":248
 *         cdef bint result
 *         result = self._entries
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     def filter_domains(self, domains):
 */
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.__nonzero__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":250
 *         return result
 * 
 *     def filter_domains(self, domains):             # <<<<<<<<<<<<<<
 *         u"""Filter the errors by the given domains and return a new error log
 *         containing the matches.
 */

static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_8filter_domains(PyObject *__pyx_v_self, PyObject *__pyx_v_domains); /*proto*/
static char __pyx_doc_4lxml_5etree_13_ListErrorLog_8filter_domains[] = "Filter the errors by the given domains and return a new error log\n        containing the matches.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_8filter_domains(PyObject *__pyx_v_self, PyObject *__pyx_v_domains) {
  struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_entry;
  PyObject *__pyx_v_filtered = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("filter_domains");
  __Pyx_INCREF(__pyx_v_domains);
  __pyx_v_entry = ((struct __pyx_obj_4lxml_5etree__LogEntry *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":255
 *         """
 *         cdef _LogEntry entry
 *         cdef list filtered = []             # <<<<<<<<<<<<<<
 *         if not python.PySequence_Check(domains):
 *             domains = (domains,)
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_filtered = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":256
 *         cdef _LogEntry entry
 *         cdef list filtered = []
 *         if not python.PySequence_Check(domains):             # <<<<<<<<<<<<<<
 *             domains = (domains,)
 *         for entry in self._entries:
 */
  __pyx_t_2 = (!PySequence_Check(__pyx_v_domains));
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":257
 *         cdef list filtered = []
 *         if not python.PySequence_Check(domains):
 *             domains = (domains,)             # <<<<<<<<<<<<<<
 *         for entry in self._entries:
 *             if entry.domain in domains:
 */
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __Pyx_INCREF(__pyx_v_domains);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_domains);
    __Pyx_GIVEREF(__pyx_v_domains);
    __Pyx_DECREF(__pyx_v_domains);
    __pyx_v_domains = ((PyObject *)__pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":258
 *         if not python.PySequence_Check(domains):
 *             domains = (domains,)
 *         for entry in self._entries:             # <<<<<<<<<<<<<<
 *             if entry.domain in domains:
 *                 filtered.append(entry)
 */
  if (unlikely(((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self)->_entries == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_3 = 0; __pyx_t_1 = ((PyObject *)((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self)->_entries); __Pyx_INCREF(__pyx_t_1);
  for (;;) {
    if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
    __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++;
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4lxml_5etree__LogEntry))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_v_entry));
    __pyx_v_entry = ((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":259
 *             domains = (domains,)
 *         for entry in self._entries:
 *             if entry.domain in domains:             # <<<<<<<<<<<<<<
 *                 filtered.append(entry)
 *         return _ListErrorLog(filtered, None, None)
 */
    __pyx_t_4 = PyInt_FromLong(__pyx_v_entry->domain); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = ((PySequence_Contains(__pyx_v_domains, __pyx_t_4))); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":260
 *         for entry in self._entries:
 *             if entry.domain in domains:
 *                 filtered.append(entry)             # <<<<<<<<<<<<<<
 *         return _ListErrorLog(filtered, None, None)
 * 
 */
      if (unlikely(__pyx_v_filtered == Py_None)) {
        PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
      }
      __pyx_t_5 = PyList_Append(__pyx_v_filtered, ((PyObject *)__pyx_v_entry)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L8;
    }
    __pyx_L8:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":261
 *             if entry.domain in domains:
 *                 filtered.append(entry)
 *         return _ListErrorLog(filtered, None, None)             # <<<<<<<<<<<<<<
 * 
 *     def filter_types(self, types):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(((PyObject *)__pyx_v_filtered));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_filtered));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_filtered));
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_1, 1, Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
  __Pyx_GIVEREF(Py_None);
  __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ListErrorLog)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.filter_domains");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_entry);
  __Pyx_XDECREF(__pyx_v_filtered);
  __Pyx_DECREF(__pyx_v_domains);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":263
 *         return _ListErrorLog(filtered, None, None)
 * 
 *     def filter_types(self, types):             # <<<<<<<<<<<<<<
 *         u"""filter_types(self, types)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_9filter_types(PyObject *__pyx_v_self, PyObject *__pyx_v_types); /*proto*/
static char __pyx_doc_4lxml_5etree_13_ListErrorLog_9filter_types[] = "filter_types(self, types)\n\n        Filter the errors by the given types and return a new error\n        log containing the matches.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_9filter_types(PyObject *__pyx_v_self, PyObject *__pyx_v_types) {
  struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_entry;
  PyObject *__pyx_v_filtered = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("filter_types");
  __Pyx_INCREF(__pyx_v_types);
  __pyx_v_entry = ((struct __pyx_obj_4lxml_5etree__LogEntry *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":270
 *         """
 *         cdef _LogEntry entry
 *         cdef list filtered = []             # <<<<<<<<<<<<<<
 *         if not python.PySequence_Check(types):
 *             types = (types,)
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_filtered = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":271
 *         cdef _LogEntry entry
 *         cdef list filtered = []
 *         if not python.PySequence_Check(types):             # <<<<<<<<<<<<<<
 *             types = (types,)
 *         for entry in self._entries:
 */
  __pyx_t_2 = (!PySequence_Check(__pyx_v_types));
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":272
 *         cdef list filtered = []
 *         if not python.PySequence_Check(types):
 *             types = (types,)             # <<<<<<<<<<<<<<
 *         for entry in self._entries:
 *             if entry.type in types:
 */
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __Pyx_INCREF(__pyx_v_types);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_types);
    __Pyx_GIVEREF(__pyx_v_types);
    __Pyx_DECREF(__pyx_v_types);
    __pyx_v_types = ((PyObject *)__pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":273
 *         if not python.PySequence_Check(types):
 *             types = (types,)
 *         for entry in self._entries:             # <<<<<<<<<<<<<<
 *             if entry.type in types:
 *                 filtered.append(entry)
 */
  if (unlikely(((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self)->_entries == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_3 = 0; __pyx_t_1 = ((PyObject *)((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self)->_entries); __Pyx_INCREF(__pyx_t_1);
  for (;;) {
    if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
    __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++;
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4lxml_5etree__LogEntry))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_v_entry));
    __pyx_v_entry = ((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":274
 *             types = (types,)
 *         for entry in self._entries:
 *             if entry.type in types:             # <<<<<<<<<<<<<<
 *                 filtered.append(entry)
 *         return _ListErrorLog(filtered, None, None)
 */
    __pyx_t_4 = PyInt_FromLong(__pyx_v_entry->type); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = ((PySequence_Contains(__pyx_v_types, __pyx_t_4))); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":275
 *         for entry in self._entries:
 *             if entry.type in types:
 *                 filtered.append(entry)             # <<<<<<<<<<<<<<
 *         return _ListErrorLog(filtered, None, None)
 * 
 */
      if (unlikely(__pyx_v_filtered == Py_None)) {
        PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
      }
      __pyx_t_5 = PyList_Append(__pyx_v_filtered, ((PyObject *)__pyx_v_entry)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L8;
    }
    __pyx_L8:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":276
 *             if entry.type in types:
 *                 filtered.append(entry)
 *         return _ListErrorLog(filtered, None, None)             # <<<<<<<<<<<<<<
 * 
 *     def filter_levels(self, levels):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(((PyObject *)__pyx_v_filtered));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_filtered));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_filtered));
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_1, 1, Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
  __Pyx_GIVEREF(Py_None);
  __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ListErrorLog)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.filter_types");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_entry);
  __Pyx_XDECREF(__pyx_v_filtered);
  __Pyx_DECREF(__pyx_v_types);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":278
 *         return _ListErrorLog(filtered, None, None)
 * 
 *     def filter_levels(self, levels):             # <<<<<<<<<<<<<<
 *         u"""filter_levels(self, levels)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_10filter_levels(PyObject *__pyx_v_self, PyObject *__pyx_v_levels); /*proto*/
static char __pyx_doc_4lxml_5etree_13_ListErrorLog_10filter_levels[] = "filter_levels(self, levels)\n\n        Filter the errors by the given error levels and return a new\n        error log containing the matches.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_10filter_levels(PyObject *__pyx_v_self, PyObject *__pyx_v_levels) {
  struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_entry;
  PyObject *__pyx_v_filtered = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("filter_levels");
  __Pyx_INCREF(__pyx_v_levels);
  __pyx_v_entry = ((struct __pyx_obj_4lxml_5etree__LogEntry *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":285
 *         """
 *         cdef _LogEntry entry
 *         cdef list filtered = []             # <<<<<<<<<<<<<<
 *         if not python.PySequence_Check(levels):
 *             levels = (levels,)
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_filtered = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":286
 *         cdef _LogEntry entry
 *         cdef list filtered = []
 *         if not python.PySequence_Check(levels):             # <<<<<<<<<<<<<<
 *             levels = (levels,)
 *         for entry in self._entries:
 */
  __pyx_t_2 = (!PySequence_Check(__pyx_v_levels));
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":287
 *         cdef list filtered = []
 *         if not python.PySequence_Check(levels):
 *             levels = (levels,)             # <<<<<<<<<<<<<<
 *         for entry in self._entries:
 *             if entry.level in levels:
 */
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __Pyx_INCREF(__pyx_v_levels);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_levels);
    __Pyx_GIVEREF(__pyx_v_levels);
    __Pyx_DECREF(__pyx_v_levels);
    __pyx_v_levels = ((PyObject *)__pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":288
 *         if not python.PySequence_Check(levels):
 *             levels = (levels,)
 *         for entry in self._entries:             # <<<<<<<<<<<<<<
 *             if entry.level in levels:
 *                 filtered.append(entry)
 */
  if (unlikely(((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self)->_entries == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_3 = 0; __pyx_t_1 = ((PyObject *)((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self)->_entries); __Pyx_INCREF(__pyx_t_1);
  for (;;) {
    if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
    __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++;
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4lxml_5etree__LogEntry))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_v_entry));
    __pyx_v_entry = ((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":289
 *             levels = (levels,)
 *         for entry in self._entries:
 *             if entry.level in levels:             # <<<<<<<<<<<<<<
 *                 filtered.append(entry)
 *         return _ListErrorLog(filtered, None, None)
 */
    __pyx_t_4 = PyInt_FromLong(__pyx_v_entry->level); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = ((PySequence_Contains(__pyx_v_levels, __pyx_t_4))); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":290
 *         for entry in self._entries:
 *             if entry.level in levels:
 *                 filtered.append(entry)             # <<<<<<<<<<<<<<
 *         return _ListErrorLog(filtered, None, None)
 * 
 */
      if (unlikely(__pyx_v_filtered == Py_None)) {
        PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
      }
      __pyx_t_5 = PyList_Append(__pyx_v_filtered, ((PyObject *)__pyx_v_entry)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L8;
    }
    __pyx_L8:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":291
 *             if entry.level in levels:
 *                 filtered.append(entry)
 *         return _ListErrorLog(filtered, None, None)             # <<<<<<<<<<<<<<
 * 
 *     def filter_from_level(self, level):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(((PyObject *)__pyx_v_filtered));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_filtered));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_filtered));
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_1, 1, Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
  __Pyx_GIVEREF(Py_None);
  __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ListErrorLog)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.filter_levels");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_entry);
  __Pyx_XDECREF(__pyx_v_filtered);
  __Pyx_DECREF(__pyx_v_levels);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":293
 *         return _ListErrorLog(filtered, None, None)
 * 
 *     def filter_from_level(self, level):             # <<<<<<<<<<<<<<
 *         u"""filter_from_level(self, level)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_11filter_from_level(PyObject *__pyx_v_self, PyObject *__pyx_v_level); /*proto*/
static char __pyx_doc_4lxml_5etree_13_ListErrorLog_11filter_from_level[] = "filter_from_level(self, level)\n\n        Return a log with all messages of the requested level of worse.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_11filter_from_level(PyObject *__pyx_v_self, PyObject *__pyx_v_level) {
  struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_entry;
  PyObject *__pyx_v_filtered = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("filter_from_level");
  __pyx_v_entry = ((struct __pyx_obj_4lxml_5etree__LogEntry *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":299
 *         """
 *         cdef _LogEntry entry
 *         cdef list filtered = []             # <<<<<<<<<<<<<<
 *         for entry in self._entries:
 *             if entry.level >= level:
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_filtered = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":300
 *         cdef _LogEntry entry
 *         cdef list filtered = []
 *         for entry in self._entries:             # <<<<<<<<<<<<<<
 *             if entry.level >= level:
 *                 filtered.append(entry)
 */
  if (unlikely(((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self)->_entries == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_2 = 0; __pyx_t_1 = ((PyObject *)((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self)->_entries); __Pyx_INCREF(__pyx_t_1);
  for (;;) {
    if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
    __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++;
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_4lxml_5etree__LogEntry))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_v_entry));
    __pyx_v_entry = ((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":301
 *         cdef list filtered = []
 *         for entry in self._entries:
 *             if entry.level >= level:             # <<<<<<<<<<<<<<
 *                 filtered.append(entry)
 *         return _ListErrorLog(filtered, None, None)
 */
    __pyx_t_3 = PyInt_FromLong(__pyx_v_entry->level); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_v_level, Py_GE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_5) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":302
 *         for entry in self._entries:
 *             if entry.level >= level:
 *                 filtered.append(entry)             # <<<<<<<<<<<<<<
 *         return _ListErrorLog(filtered, None, None)
 * 
 */
      if (unlikely(__pyx_v_filtered == Py_None)) {
        PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
      }
      __pyx_t_6 = PyList_Append(__pyx_v_filtered, ((PyObject *)__pyx_v_entry)); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L7;
    }
    __pyx_L7:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":303
 *             if entry.level >= level:
 *                 filtered.append(entry)
 *         return _ListErrorLog(filtered, None, None)             # <<<<<<<<<<<<<<
 * 
 *     def filter_from_fatals(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(((PyObject *)__pyx_v_filtered));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_filtered));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_filtered));
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_1, 1, Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
  __Pyx_GIVEREF(Py_None);
  __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ListErrorLog)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.filter_from_level");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_entry);
  __Pyx_XDECREF(__pyx_v_filtered);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":305
 *         return _ListErrorLog(filtered, None, None)
 * 
 *     def filter_from_fatals(self):             # <<<<<<<<<<<<<<
 *         u"""filter_from_fatals(self)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_12filter_from_fatals(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_13_ListErrorLog_12filter_from_fatals[] = "filter_from_fatals(self)\n\n        Convenience method to get all fatal error messages.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_12filter_from_fatals(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("filter_from_fatals");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":310
 *         Convenience method to get all fatal error messages.
 *         """
 *         return self.filter_from_level(ErrorLevels.FATAL)             # <<<<<<<<<<<<<<
 * 
 *     def filter_from_errors(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__filter_from_level); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__ErrorLevels); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__FATAL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.filter_from_fatals");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":312
 *         return self.filter_from_level(ErrorLevels.FATAL)
 * 
 *     def filter_from_errors(self):             # <<<<<<<<<<<<<<
 *         u"""filter_from_errors(self)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_13filter_from_errors(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_13_ListErrorLog_13filter_from_errors[] = "filter_from_errors(self)\n\n        Convenience method to get all error messages or worse.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_13filter_from_errors(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("filter_from_errors");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":317
 *         Convenience method to get all error messages or worse.
 *         """
 *         return self.filter_from_level(ErrorLevels.ERROR)             # <<<<<<<<<<<<<<
 * 
 *     def filter_from_warnings(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__filter_from_level); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__ErrorLevels); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__ERROR); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.filter_from_errors");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":319
 *         return self.filter_from_level(ErrorLevels.ERROR)
 * 
 *     def filter_from_warnings(self):             # <<<<<<<<<<<<<<
 *         u"""filter_from_warnings(self)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_14filter_from_warnings(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_13_ListErrorLog_14filter_from_warnings[] = "filter_from_warnings(self)\n\n        Convenience method to get all warnings or worse.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_14filter_from_warnings(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("filter_from_warnings");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":324
 *         Convenience method to get all warnings or worse.
 *         """
 *         return self.filter_from_level(ErrorLevels.WARNING)             # <<<<<<<<<<<<<<
 * 
 * cdef class _ErrorLog(_ListErrorLog):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__filter_from_level); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__ErrorLevels); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__WARNING); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.filter_from_warnings");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":327
 * 
 * cdef class _ErrorLog(_ListErrorLog):
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         _ListErrorLog.__init__(self, [], None, None)
 * 
 */

static int __pyx_pf_4lxml_5etree_9_ErrorLog___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_9_ErrorLog___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__init__");
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":328
 * cdef class _ErrorLog(_ListErrorLog):
 *     def __init__(self):
 *         _ListErrorLog.__init__(self, [], None, None)             # <<<<<<<<<<<<<<
 * 
 *     cdef void connect(self):
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ListErrorLog)), __pyx_n_s____init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_t_2));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_3, 2, Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_3, 3, Py_None);
  __Pyx_GIVEREF(Py_None);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ErrorLog.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":330
 *         _ListErrorLog.__init__(self, [], None, None)
 * 
 *     cdef void connect(self):             # <<<<<<<<<<<<<<
 *         self._first_error = None
 *         del self._entries[:]
 */

static  void __pyx_f_4lxml_5etree_9_ErrorLog_connect(struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_self) {
  __Pyx_RefNannySetupContext("connect");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":331
 * 
 *     cdef void connect(self):
 *         self._first_error = None             # <<<<<<<<<<<<<<
 *         del self._entries[:]
 *         connectErrorLog(<void*>self)
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.__pyx_base._first_error);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base._first_error));
  __pyx_v_self->__pyx_base.__pyx_base._first_error = ((struct __pyx_obj_4lxml_5etree__LogEntry *)Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":332
 *     cdef void connect(self):
 *         self._first_error = None
 *         del self._entries[:]             # <<<<<<<<<<<<<<
 *         connectErrorLog(<void*>self)
 * 
 */
  if (__Pyx_PySequence_DelSlice(((PyObject *)__pyx_v_self->__pyx_base._entries), 0, PY_SSIZE_T_MAX) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":333
 *         self._first_error = None
 *         del self._entries[:]
 *         connectErrorLog(<void*>self)             # <<<<<<<<<<<<<<
 * 
 *     cdef void disconnect(self):
 */
  __pyx_f_4lxml_5etree_connectErrorLog(((void *)__pyx_v_self));

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("lxml.etree._ErrorLog.connect");
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":335
 *         connectErrorLog(<void*>self)
 * 
 *     cdef void disconnect(self):             # <<<<<<<<<<<<<<
 *         connectErrorLog(NULL)
 * 
 */

static  void __pyx_f_4lxml_5etree_9_ErrorLog_disconnect(struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_self) {
  __Pyx_RefNannySetupContext("disconnect");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":336
 * 
 *     cdef void disconnect(self):
 *         connectErrorLog(NULL)             # <<<<<<<<<<<<<<
 * 
 *     def clear(self):
 */
  __pyx_f_4lxml_5etree_connectErrorLog(NULL);

  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":338
 *         connectErrorLog(NULL)
 * 
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         self._first_error = None
 *         del self._entries[:]
 */

static PyObject *__pyx_pf_4lxml_5etree_9_ErrorLog_1clear(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_9_ErrorLog_1clear(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("clear");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":339
 * 
 *     def clear(self):
 *         self._first_error = None             # <<<<<<<<<<<<<<
 *         del self._entries[:]
 * 
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_v_self)->__pyx_base.__pyx_base._first_error);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_v_self)->__pyx_base.__pyx_base._first_error));
  ((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_v_self)->__pyx_base.__pyx_base._first_error = ((struct __pyx_obj_4lxml_5etree__LogEntry *)Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":340
 *     def clear(self):
 *         self._first_error = None
 *         del self._entries[:]             # <<<<<<<<<<<<<<
 * 
 *     def copy(self):
 */
  if (__Pyx_PySequence_DelSlice(((PyObject *)((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_v_self)->__pyx_base._entries), 0, PY_SSIZE_T_MAX) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._ErrorLog.clear");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":342
 *         del self._entries[:]
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         u"""Creates a shallow copy of this error log and the list of entries.
 *         """
 */

static PyObject *__pyx_pf_4lxml_5etree_9_ErrorLog_2copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_9_ErrorLog_2copy[] = "Creates a shallow copy of this error log and the list of entries.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_9_ErrorLog_2copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("copy");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":345
 *         u"""Creates a shallow copy of this error log and the list of entries.
 *         """
 *         return _ListErrorLog(self._entries[:], self._first_error,             # <<<<<<<<<<<<<<
 *                              self.last_error)
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PySequence_GetSlice(((PyObject *)((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_v_self)->__pyx_base._entries), 0, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":346
 *         """
 *         return _ListErrorLog(self._entries[:], self._first_error,
 *                              self.last_error)             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_v_self)->__pyx_base.__pyx_base._first_error));
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_v_self)->__pyx_base.__pyx_base._first_error));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_v_self)->__pyx_base.__pyx_base._first_error));
  __Pyx_INCREF(((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_v_self)->__pyx_base.__pyx_base.last_error);
  PyTuple_SET_ITEM(__pyx_t_2, 2, ((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_v_self)->__pyx_base.__pyx_base.last_error);
  __Pyx_GIVEREF(((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_v_self)->__pyx_base.__pyx_base.last_error);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ListErrorLog)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ErrorLog.copy");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":348
 *                              self.last_error)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return iter(self._entries[:])
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_9_ErrorLog_3__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_9_ErrorLog_3__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__iter__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":349
 * 
 *     def __iter__(self):
 *         return iter(self._entries[:])             # <<<<<<<<<<<<<<
 * 
 *     def receive(self, entry):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PySequence_GetSlice(((PyObject *)((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_v_self)->__pyx_base._entries), 0, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_t_2 = PyObject_GetIter(((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ErrorLog.__iter__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":351
 *         return iter(self._entries[:])
 * 
 *     def receive(self, entry):             # <<<<<<<<<<<<<<
 *         if self._first_error is None:
 *             self._first_error = entry
 */

static PyObject *__pyx_pf_4lxml_5etree_9_ErrorLog_4receive(PyObject *__pyx_v_self, PyObject *__pyx_v_entry); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_9_ErrorLog_4receive(PyObject *__pyx_v_self, PyObject *__pyx_v_entry) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("receive");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":352
 * 
 *     def receive(self, entry):
 *         if self._first_error is None:             # <<<<<<<<<<<<<<
 *             self._first_error = entry
 *         self._entries.append(entry)
 */
  __pyx_t_1 = (((PyObject *)((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_v_self)->__pyx_base.__pyx_base._first_error) == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":353
 *     def receive(self, entry):
 *         if self._first_error is None:
 *             self._first_error = entry             # <<<<<<<<<<<<<<
 *         self._entries.append(entry)
 * 
 */
    if (!(likely(((__pyx_v_entry) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_entry, __pyx_ptype_4lxml_5etree__LogEntry))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_INCREF(__pyx_v_entry);
    __Pyx_GIVEREF(__pyx_v_entry);
    __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_v_self)->__pyx_base.__pyx_base._first_error);
    __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_v_self)->__pyx_base.__pyx_base._first_error));
    ((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_v_self)->__pyx_base.__pyx_base._first_error = ((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_entry);
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":354
 *         if self._first_error is None:
 *             self._first_error = entry
 *         self._entries.append(entry)             # <<<<<<<<<<<<<<
 * 
 * cdef class _DomainErrorLog(_ErrorLog):
 */
  if (unlikely(((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_v_self)->__pyx_base._entries == Py_None)) {
    PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_2 = PyList_Append(((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_v_self)->__pyx_base._entries, __pyx_v_entry); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._ErrorLog.receive");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":357
 * 
 * cdef class _DomainErrorLog(_ErrorLog):
 *     def __init__(self, domains):             # <<<<<<<<<<<<<<
 *         _ErrorLog.__init__(self)
 *         self._accepted_domains = tuple(domains)
 */

static int __pyx_pf_4lxml_5etree_15_DomainErrorLog___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_15_DomainErrorLog___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_domains = 0;
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__domains,0};
  __Pyx_RefNannySetupContext("__init__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[1] = {0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__domains);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_domains = values[0];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_domains = PyTuple_GET_ITEM(__pyx_args, 0);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._DomainErrorLog.__init__");
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":358
 * cdef class _DomainErrorLog(_ErrorLog):
 *     def __init__(self, domains):
 *         _ErrorLog.__init__(self)             # <<<<<<<<<<<<<<
 *         self._accepted_domains = tuple(domains)
 * 
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ErrorLog)), __pyx_n_s____init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":359
 *     def __init__(self, domains):
 *         _ErrorLog.__init__(self)
 *         self._accepted_domains = tuple(domains)             # <<<<<<<<<<<<<<
 * 
 *     def receive(self, entry):
 */
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(__pyx_v_domains);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_domains);
  __Pyx_GIVEREF(__pyx_v_domains);
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___accepted_domains, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._DomainErrorLog.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":361
 *         self._accepted_domains = tuple(domains)
 * 
 *     def receive(self, entry):             # <<<<<<<<<<<<<<
 *         if entry.domain in self._accepted_domains:
 *             _ErrorLog.receive(self, entry)
 */

static PyObject *__pyx_pf_4lxml_5etree_15_DomainErrorLog_1receive(PyObject *__pyx_v_self, PyObject *__pyx_v_entry); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_15_DomainErrorLog_1receive(PyObject *__pyx_v_self, PyObject *__pyx_v_entry) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("receive");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":362
 * 
 *     def receive(self, entry):
 *         if entry.domain in self._accepted_domains:             # <<<<<<<<<<<<<<
 *             _ErrorLog.receive(self, entry)
 * 
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_entry, __pyx_n_s__domain); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___accepted_domains); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = ((PySequence_Contains(__pyx_t_2, __pyx_t_1))); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":363
 *     def receive(self, entry):
 *         if entry.domain in self._accepted_domains:
 *             _ErrorLog.receive(self, entry)             # <<<<<<<<<<<<<<
 * 
 * cdef class _RotatingErrorLog(_ErrorLog):
 */
    __pyx_t_2 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ErrorLog)), __pyx_n_s__receive); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __Pyx_INCREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    __Pyx_INCREF(__pyx_v_entry);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_entry);
    __Pyx_GIVEREF(__pyx_v_entry);
    __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._DomainErrorLog.receive");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":367
 * cdef class _RotatingErrorLog(_ErrorLog):
 *     cdef int _max_len
 *     def __init__(self, max_len):             # <<<<<<<<<<<<<<
 *         _ErrorLog.__init__(self)
 *         self._max_len = max_len
 */

static int __pyx_pf_4lxml_5etree_17_RotatingErrorLog___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_17_RotatingErrorLog___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_max_len = 0;
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__max_len,0};
  __Pyx_RefNannySetupContext("__init__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[1] = {0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_len);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_max_len = values[0];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_max_len = PyTuple_GET_ITEM(__pyx_args, 0);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._RotatingErrorLog.__init__");
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":368
 *     cdef int _max_len
 *     def __init__(self, max_len):
 *         _ErrorLog.__init__(self)             # <<<<<<<<<<<<<<
 *         self._max_len = max_len
 * 
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ErrorLog)), __pyx_n_s____init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":369
 *     def __init__(self, max_len):
 *         _ErrorLog.__init__(self)
 *         self._max_len = max_len             # <<<<<<<<<<<<<<
 * 
 *     def receive(self, entry):
 */
  __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_v_max_len); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_4lxml_5etree__RotatingErrorLog *)__pyx_v_self)->_max_len = __pyx_t_4;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._RotatingErrorLog.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":371
 *         self._max_len = max_len
 * 
 *     def receive(self, entry):             # <<<<<<<<<<<<<<
 *         if python.PyList_GET_SIZE(self._entries) > self._max_len:
 *             del self._entries[0]
 */

static PyObject *__pyx_pf_4lxml_5etree_17_RotatingErrorLog_1receive(PyObject *__pyx_v_self, PyObject *__pyx_v_entry); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_17_RotatingErrorLog_1receive(PyObject *__pyx_v_self, PyObject *__pyx_v_entry) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("receive");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":372
 * 
 *     def receive(self, entry):
 *         if python.PyList_GET_SIZE(self._entries) > self._max_len:             # <<<<<<<<<<<<<<
 *             del self._entries[0]
 *         self._entries.append(entry)
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_obj_4lxml_5etree__RotatingErrorLog *)__pyx_v_self)->__pyx_base.__pyx_base._entries);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = (PyList_GET_SIZE(__pyx_t_1) > ((struct __pyx_obj_4lxml_5etree__RotatingErrorLog *)__pyx_v_self)->_max_len);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":373
 *     def receive(self, entry):
 *         if python.PyList_GET_SIZE(self._entries) > self._max_len:
 *             del self._entries[0]             # <<<<<<<<<<<<<<
 *         self._entries.append(entry)
 * 
 */
    if (__Pyx_DelItemInt(((PyObject *)((struct __pyx_obj_4lxml_5etree__RotatingErrorLog *)__pyx_v_self)->__pyx_base.__pyx_base._entries), 0, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":374
 *         if python.PyList_GET_SIZE(self._entries) > self._max_len:
 *             del self._entries[0]
 *         self._entries.append(entry)             # <<<<<<<<<<<<<<
 * 
 * cdef class PyErrorLog(_BaseErrorLog):
 */
  if (unlikely(((struct __pyx_obj_4lxml_5etree__RotatingErrorLog *)__pyx_v_self)->__pyx_base.__pyx_base._entries == Py_None)) {
    PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_3 = PyList_Append(((struct __pyx_obj_4lxml_5etree__RotatingErrorLog *)__pyx_v_self)->__pyx_base.__pyx_base._entries, __pyx_v_entry); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._RotatingErrorLog.receive");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":399
 *     cdef object _map_level
 *     cdef object _log
 *     def __init__(self, logger_name=None, logger=None):             # <<<<<<<<<<<<<<
 *         _BaseErrorLog.__init__(self, None, None)
 *         import logging
 */

static int __pyx_pf_4lxml_5etree_10PyErrorLog___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_10PyErrorLog___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_logger_name = 0;
  PyObject *__pyx_v_logger = 0;
  PyObject *__pyx_v_logging;
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__logger_name,&__pyx_n_s__logger,0};
  __Pyx_RefNannySetupContext("__init__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__logger_name);
        if (value) { values[0] = value; kw_args--; }
      }
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__logger);
        if (value) { values[1] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_logger_name = values[0];
    __pyx_v_logger = values[1];
  } else {
    __pyx_v_logger_name = ((PyObject *)Py_None);
    __pyx_v_logger = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_logger = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v_logger_name = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.PyErrorLog.__init__");
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF(__pyx_v_logger);
  __pyx_v_logging = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":400
 *     cdef object _log
 *     def __init__(self, logger_name=None, logger=None):
 *         _BaseErrorLog.__init__(self, None, None)             # <<<<<<<<<<<<<<
 *         import logging
 *         self.level_map = {
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__BaseErrorLog)), __pyx_n_s____init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_2, 2, Py_None);
  __Pyx_GIVEREF(Py_None);
  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":401
 *     def __init__(self, logger_name=None, logger=None):
 *         _BaseErrorLog.__init__(self, None, None)
 *         import logging             # <<<<<<<<<<<<<<
 *         self.level_map = {
 *             ErrorLevels.WARNING : logging.WARNING,
 */
  __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s__logging), 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_v_logging);
  __pyx_v_logging = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":402
 *         _BaseErrorLog.__init__(self, None, None)
 *         import logging
 *         self.level_map = {             # <<<<<<<<<<<<<<
 *             ErrorLevels.WARNING : logging.WARNING,
 *             ErrorLevels.ERROR   : logging.ERROR,
 */
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":403
 *         import logging
 *         self.level_map = {
 *             ErrorLevels.WARNING : logging.WARNING,             # <<<<<<<<<<<<<<
 *             ErrorLevels.ERROR   : logging.ERROR,
 *             ErrorLevels.FATAL   : logging.CRITICAL
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__ErrorLevels); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__WARNING); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_logging, __pyx_n_s__WARNING); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_3, __pyx_t_1, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":404
 *         self.level_map = {
 *             ErrorLevels.WARNING : logging.WARNING,
 *             ErrorLevels.ERROR   : logging.ERROR,             # <<<<<<<<<<<<<<
 *             ErrorLevels.FATAL   : logging.CRITICAL
 *             }
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__ErrorLevels); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__ERROR); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_logging, __pyx_n_s__ERROR); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_3, __pyx_t_1, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":405
 *             ErrorLevels.WARNING : logging.WARNING,
 *             ErrorLevels.ERROR   : logging.ERROR,
 *             ErrorLevels.FATAL   : logging.CRITICAL             # <<<<<<<<<<<<<<
 *             }
 *         self._map_level = self.level_map.get
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__ErrorLevels); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__FATAL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_logging, __pyx_n_s__CRITICAL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_3, __pyx_t_1, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":402
 *         _BaseErrorLog.__init__(self, None, None)
 *         import logging
 *         self.level_map = {             # <<<<<<<<<<<<<<
 *             ErrorLevels.WARNING : logging.WARNING,
 *             ErrorLevels.ERROR   : logging.ERROR,
 */
  __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree_PyErrorLog *)__pyx_v_self)->level_map);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_PyErrorLog *)__pyx_v_self)->level_map));
  ((struct __pyx_obj_4lxml_5etree_PyErrorLog *)__pyx_v_self)->level_map = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":407
 *             ErrorLevels.FATAL   : logging.CRITICAL
 *             }
 *         self._map_level = self.level_map.get             # <<<<<<<<<<<<<<
 *         if logger is None:
 *             if logger_name:
 */
  __pyx_t_3 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_4lxml_5etree_PyErrorLog *)__pyx_v_self)->level_map), __pyx_n_s__get); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree_PyErrorLog *)__pyx_v_self)->_map_level);
  __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree_PyErrorLog *)__pyx_v_self)->_map_level);
  ((struct __pyx_obj_4lxml_5etree_PyErrorLog *)__pyx_v_self)->_map_level = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":408
 *             }
 *         self._map_level = self.level_map.get
 *         if logger is None:             # <<<<<<<<<<<<<<
 *             if logger_name:
 *                 logger = logging.getLogger(logger_name)
 */
  __pyx_t_4 = (__pyx_v_logger == Py_None);
  if (__pyx_t_4) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":409
 *         self._map_level = self.level_map.get
 *         if logger is None:
 *             if logger_name:             # <<<<<<<<<<<<<<
 *                 logger = logging.getLogger(logger_name)
 *             else:
 */
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_logger_name); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_4) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":410
 *         if logger is None:
 *             if logger_name:
 *                 logger = logging.getLogger(logger_name)             # <<<<<<<<<<<<<<
 *             else:
 *                 logger = logging.getLogger()
 */
      __pyx_t_3 = PyObject_GetAttr(__pyx_v_logging, __pyx_n_s__getLogger); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __Pyx_INCREF(__pyx_v_logger_name);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_logger_name);
      __Pyx_GIVEREF(__pyx_v_logger_name);
      __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_v_logger);
      __pyx_v_logger = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L7;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":412
 *                 logger = logging.getLogger(logger_name)
 *             else:
 *                 logger = logging.getLogger()             # <<<<<<<<<<<<<<
 *         self._log = logger.log
 * 
 */
      __pyx_t_1 = PyObject_GetAttr(__pyx_v_logging, __pyx_n_s__getLogger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_v_logger);
      __pyx_v_logger = __pyx_t_2;
      __pyx_t_2 = 0;
    }
    __pyx_L7:;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":413
 *             else:
 *                 logger = logging.getLogger()
 *         self._log = logger.log             # <<<<<<<<<<<<<<
 * 
 *     def copy(self):
 */
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_logger, __pyx_n_s__log); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree_PyErrorLog *)__pyx_v_self)->_log);
  __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree_PyErrorLog *)__pyx_v_self)->_log);
  ((struct __pyx_obj_4lxml_5etree_PyErrorLog *)__pyx_v_self)->_log = __pyx_t_2;
  __pyx_t_2 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.PyErrorLog.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_logging);
  __Pyx_DECREF(__pyx_v_logger);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":415
 *         self._log = logger.log
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         u"""Dummy method that returns an empty error log.
 *         """
 */

static PyObject *__pyx_pf_4lxml_5etree_10PyErrorLog_1copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_10PyErrorLog_1copy[] = "Dummy method that returns an empty error log.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_10PyErrorLog_1copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("copy");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":418
 *         u"""Dummy method that returns an empty error log.
 *         """
 *         return _ListErrorLog([], None, None)             # <<<<<<<<<<<<<<
 * 
 *     def log(self, log_entry, message, *args):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_2, 2, Py_None);
  __Pyx_GIVEREF(Py_None);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ListErrorLog)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.PyErrorLog.copy");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":420
 *         return _ListErrorLog([], None, None)
 * 
 *     def log(self, log_entry, message, *args):             # <<<<<<<<<<<<<<
 *         u"""log(self, log_entry, message, *args)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_10PyErrorLog_2log(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_10PyErrorLog_2log[] = "log(self, log_entry, message, *args)\n\n        Called by the .receive() method to log a _LogEntry instance to\n        the Python logging system.  This handles the error level\n        mapping.\n\n        In the default implementation, the ``message`` argument\n        receives a complete log line, and there are no further\n        ``args``.  To change the message format, it is best to\n        override the .receive() method instead of this one.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_10PyErrorLog_2log(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_log_entry = 0;
  PyObject *__pyx_v_message = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__log_entry,&__pyx_n_s__message,0};
  __Pyx_RefNannySetupContext("log");
  if (PyTuple_GET_SIZE(__pyx_args) > 2) {
    __pyx_v_args = PyTuple_GetSlice(__pyx_args, 2, PyTuple_GET_SIZE(__pyx_args)); __Pyx_GOTREF(__pyx_v_args);
    if (unlikely(!__pyx_v_args)) return NULL;
  } else {
    __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      default:
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__log_entry);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__message);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("log", 0, 2, 2, 1); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      const Py_ssize_t used_pos_args = (PyTuple_GET_SIZE(__pyx_args) < 2) ? PyTuple_GET_SIZE(__pyx_args) : 2;
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "log") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_log_entry = values[0];
    __pyx_v_message = values[1];
  } else if (PyTuple_GET_SIZE(__pyx_args) < 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_log_entry = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_message = PyTuple_GET_ITEM(__pyx_args, 1);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("log", 0, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_args);
  __Pyx_AddTraceback("lxml.etree.PyErrorLog.log");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":433
 *         """
 *         self._log(
 *             self._map_level(log_entry.level, 0),             # <<<<<<<<<<<<<<
 *             message, *args
 *             )
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_log_entry, __pyx_n_s__level); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(((struct __pyx_obj_4lxml_5etree_PyErrorLog *)__pyx_v_self)->_map_level, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":434
 *         self._log(
 *             self._map_level(log_entry.level, 0),
 *             message, *args             # <<<<<<<<<<<<<<
 *             )
 * 
 */
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_message);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_message);
  __Pyx_GIVEREF(__pyx_v_message);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":435
 *             self._map_level(log_entry.level, 0),
 *             message, *args
 *             )             # <<<<<<<<<<<<<<
 * 
 *     def receive(self, _LogEntry log_entry):
 */
  __pyx_t_1 = PySequence_Tuple(((PyObject *)__pyx_v_args)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_t_3 = PyNumber_Add(((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(((struct __pyx_obj_4lxml_5etree_PyErrorLog *)__pyx_v_self)->_log, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.PyErrorLog.log");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_args);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":437
 *             )
 * 
 *     def receive(self, _LogEntry log_entry):             # <<<<<<<<<<<<<<
 *         u"""receive(self, log_entry)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_10PyErrorLog_3receive(PyObject *__pyx_v_self, PyObject *__pyx_v_log_entry); /*proto*/
static char __pyx_doc_4lxml_5etree_10PyErrorLog_3receive[] = "receive(self, log_entry)\n\n        Receive a _LogEntry instance from the logging system.  Calls\n        the .log() method with appropriate parameters::\n\n            self.log(log_entry, repr(log_entry))\n\n        You can override this method to provide your own log output\n        format.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_10PyErrorLog_3receive(PyObject *__pyx_v_self, PyObject *__pyx_v_log_entry) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("receive");
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_log_entry), __pyx_ptype_4lxml_5etree__LogEntry, 1, "log_entry", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":448
 *         format.
 *         """
 *         self.log(log_entry, repr(log_entry))             # <<<<<<<<<<<<<<
 * 
 * # thread-local, global list log to collect error output messages from
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__log); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Repr(__pyx_v_log_entry); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(__pyx_v_log_entry);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_log_entry);
  __Pyx_GIVEREF(__pyx_v_log_entry);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.PyErrorLog.receive");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":396
 *     with appropriate data.
 *     """
 *     cdef readonly dict level_map             # <<<<<<<<<<<<<<
 *     cdef object _map_level
 *     cdef object _log
 */

static PyObject *__pyx_pf_4lxml_5etree_10PyErrorLog_9level_map___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_10PyErrorLog_9level_map___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_PyErrorLog *)__pyx_v_self)->level_map));
  __pyx_r = ((PyObject *)((struct __pyx_obj_4lxml_5etree_PyErrorLog *)__pyx_v_self)->level_map);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":456
 * __GLOBAL_ERROR_LOG = _RotatingErrorLog(__MAX_LOG_SIZE)
 * 
 * cdef _BaseErrorLog _getGlobalErrorLog():             # <<<<<<<<<<<<<<
 *     u"""Retrieve the global error log of this thread."""
 *     cdef python.PyObject* thread_dict
 */

static  struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_f_4lxml_5etree__getGlobalErrorLog(void) {
  PyObject *__pyx_v_thread_dict;
  struct __pyx_obj_4lxml_5etree__RotatingErrorLog *__pyx_v_log;
  struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("_getGlobalErrorLog");
  __pyx_v_log = ((struct __pyx_obj_4lxml_5etree__RotatingErrorLog *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":459
 *     u"""Retrieve the global error log of this thread."""
 *     cdef python.PyObject* thread_dict
 *     thread_dict = python.PyThreadState_GetDict()             # <<<<<<<<<<<<<<
 *     if thread_dict is NULL:
 *         return __GLOBAL_ERROR_LOG
 */
  __pyx_v_thread_dict = PyThreadState_GetDict();

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":460
 *     cdef python.PyObject* thread_dict
 *     thread_dict = python.PyThreadState_GetDict()
 *     if thread_dict is NULL:             # <<<<<<<<<<<<<<
 *         return __GLOBAL_ERROR_LOG
 *     try:
 */
  __pyx_t_1 = (__pyx_v_thread_dict == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":461
 *     thread_dict = python.PyThreadState_GetDict()
 *     if thread_dict is NULL:
 *         return __GLOBAL_ERROR_LOG             # <<<<<<<<<<<<<<
 *     try:
 *         return (<object>thread_dict)[u"_GlobalErrorLog"]
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __Pyx_INCREF(((PyObject *)__pyx_v_4lxml_5etree___GLOBAL_ERROR_LOG));
    __pyx_r = __pyx_v_4lxml_5etree___GLOBAL_ERROR_LOG;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":462
 *     if thread_dict is NULL:
 *         return __GLOBAL_ERROR_LOG
 *     try:             # <<<<<<<<<<<<<<
 *         return (<object>thread_dict)[u"_GlobalErrorLog"]
 *     except KeyError:
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":463
 *         return __GLOBAL_ERROR_LOG
 *     try:
 *         return (<object>thread_dict)[u"_GlobalErrorLog"]             # <<<<<<<<<<<<<<
 *     except KeyError:
 *         log = (<object>thread_dict)[u"_GlobalErrorLog"] = \
 */
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_thread_dict), ((PyObject *)__pyx_n_u___GlobalErrorLog)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4lxml_5etree__BaseErrorLog))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      __pyx_r = ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_t_2);
      __pyx_t_2 = 0;
      goto __pyx_L8_try_return;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L11_try_end;
    __pyx_L8_try_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;
    __pyx_L4_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":464
 *     try:
 *         return (<object>thread_dict)[u"_GlobalErrorLog"]
 *     except KeyError:             # <<<<<<<<<<<<<<
 *         log = (<object>thread_dict)[u"_GlobalErrorLog"] = \
 *               _RotatingErrorLog(__MAX_LOG_SIZE)
 */
    __pyx_t_3 = PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_3) {
      __Pyx_AddTraceback("lxml.etree._getGlobalErrorLog");
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_4, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_5);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":466
 *     except KeyError:
 *         log = (<object>thread_dict)[u"_GlobalErrorLog"] = \
 *               _RotatingErrorLog(__MAX_LOG_SIZE)             # <<<<<<<<<<<<<<
 *         return log
 * 
 */
      __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__RotatingErrorLog)), ((PyObject *)__pyx_k_tuple_48), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_DECREF(((PyObject *)__pyx_v_log));
      __pyx_v_log = ((struct __pyx_obj_4lxml_5etree__RotatingErrorLog *)__pyx_t_6);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":465
 *         return (<object>thread_dict)[u"_GlobalErrorLog"]
 *     except KeyError:
 *         log = (<object>thread_dict)[u"_GlobalErrorLog"] = \             # <<<<<<<<<<<<<<
 *               _RotatingErrorLog(__MAX_LOG_SIZE)
 *         return log
 */
      if (PyObject_SetItem(((PyObject *)__pyx_v_thread_dict), ((PyObject *)__pyx_n_u___GlobalErrorLog), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":467
 *         log = (<object>thread_dict)[u"_GlobalErrorLog"] = \
 *               _RotatingErrorLog(__MAX_LOG_SIZE)
 *         return log             # <<<<<<<<<<<<<<
 * 
 * cdef _setGlobalErrorLog(_BaseErrorLog log):
 */
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __Pyx_INCREF(((PyObject *)__pyx_v_log));
      __pyx_r = ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_log);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L7_except_return;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L5_exception_handled;
    }
    __pyx_L6_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L7_except_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;
    __pyx_L5_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L11_try_end:;
  }

  __pyx_r = ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._getGlobalErrorLog");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_log);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":469
 *         return log
 * 
 * cdef _setGlobalErrorLog(_BaseErrorLog log):             # <<<<<<<<<<<<<<
 *     u"""Set the global error log of this thread."""
 *     cdef python.PyObject* thread_dict
 */

static  PyObject *__pyx_f_4lxml_5etree__setGlobalErrorLog(struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_log) {
  PyObject *__pyx_v_thread_dict;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_setGlobalErrorLog");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":472
 *     u"""Set the global error log of this thread."""
 *     cdef python.PyObject* thread_dict
 *     thread_dict = python.PyThreadState_GetDict()             # <<<<<<<<<<<<<<
 *     if thread_dict is NULL:
 *         global __GLOBAL_ERROR_LOG
 */
  __pyx_v_thread_dict = PyThreadState_GetDict();

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":473
 *     cdef python.PyObject* thread_dict
 *     thread_dict = python.PyThreadState_GetDict()
 *     if thread_dict is NULL:             # <<<<<<<<<<<<<<
 *         global __GLOBAL_ERROR_LOG
 *         __GLOBAL_ERROR_LOG = log
 */
  __pyx_t_1 = (__pyx_v_thread_dict == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":475
 *     if thread_dict is NULL:
 *         global __GLOBAL_ERROR_LOG
 *         __GLOBAL_ERROR_LOG = log             # <<<<<<<<<<<<<<
 *     else:
 *         (<object>thread_dict)[u"_GlobalErrorLog"] = log
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_log));
    __Pyx_GOTREF(((PyObject *)__pyx_v_4lxml_5etree___GLOBAL_ERROR_LOG));
    __Pyx_DECREF(((PyObject *)__pyx_v_4lxml_5etree___GLOBAL_ERROR_LOG));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_log));
    __pyx_v_4lxml_5etree___GLOBAL_ERROR_LOG = __pyx_v_log;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":477
 *         __GLOBAL_ERROR_LOG = log
 *     else:
 *         (<object>thread_dict)[u"_GlobalErrorLog"] = log             # <<<<<<<<<<<<<<
 * 
 * cdef __copyGlobalErrorLog():
 */
    if (PyObject_SetItem(((PyObject *)__pyx_v_thread_dict), ((PyObject *)__pyx_n_u___GlobalErrorLog), ((PyObject *)__pyx_v_log)) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._setGlobalErrorLog");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":479
 *         (<object>thread_dict)[u"_GlobalErrorLog"] = log
 * 
 * cdef __copyGlobalErrorLog():             # <<<<<<<<<<<<<<
 *     u"Helper function for properties in exceptions."
 *     return _getGlobalErrorLog().copy()
 */

static  PyObject *__pyx_f_4lxml_5etree___copyGlobalErrorLog(void) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__copyGlobalErrorLog");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":481
 * cdef __copyGlobalErrorLog():
 *     u"Helper function for properties in exceptions."
 *     return _getGlobalErrorLog().copy()             # <<<<<<<<<<<<<<
 * 
 * def use_global_python_log(PyErrorLog log not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__getGlobalErrorLog()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__copy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.__copyGlobalErrorLog");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":483
 *     return _getGlobalErrorLog().copy()
 * 
 * def use_global_python_log(PyErrorLog log not None):             # <<<<<<<<<<<<<<
 *     u"""use_global_python_log(log)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_2use_global_python_log(PyObject *__pyx_self, PyObject *__pyx_v_log); /*proto*/
static char __pyx_doc_4lxml_5etree_2use_global_python_log[] = "use_global_python_log(log)\n\n    Replace the global error log by an etree.PyErrorLog that uses the\n    standard Python logging package.\n\n    Note that this disables access to the global error log from exceptions.\n    Parsers, XSLT etc. will continue to provide their normal local error log.\n\n    Note: prior to lxml 2.2, this changed the error log globally.\n    Since lxml 2.2, the global error log is local to a thread and this\n    function will only set the global error log of the current thread.\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_2use_global_python_log = {__Pyx_NAMESTR("use_global_python_log"), (PyCFunction)__pyx_pf_4lxml_5etree_2use_global_python_log, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_2use_global_python_log)};
static PyObject *__pyx_pf_4lxml_5etree_2use_global_python_log(PyObject *__pyx_self, PyObject *__pyx_v_log) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("use_global_python_log");
  __pyx_self = __pyx_self;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_log), __pyx_ptype_4lxml_5etree_PyErrorLog, 0, "log", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":496
 *     function will only set the global error log of the current thread.
 *     """
 *     _setGlobalErrorLog(log)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__setGlobalErrorLog(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_log)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.use_global_python_log");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":500
 * 
 * # local log functions: forward error to logger object
 * cdef void _forwardError(void* c_log_handler, xmlerror.xmlError* error) with gil:             # <<<<<<<<<<<<<<
 *     cdef _BaseErrorLog log_handler
 *     if c_log_handler is not NULL:
 */

static  void __pyx_f_4lxml_5etree__forwardError(void *__pyx_v_c_log_handler, xmlError *__pyx_v_error) {
  struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_log_handler;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  #ifdef WITH_THREAD
  PyGILState_STATE _save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_forwardError");
  __pyx_v_log_handler = ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":502
 * cdef void _forwardError(void* c_log_handler, xmlerror.xmlError* error) with gil:
 *     cdef _BaseErrorLog log_handler
 *     if c_log_handler is not NULL:             # <<<<<<<<<<<<<<
 *         log_handler = <_BaseErrorLog>c_log_handler
 *     else:
 */
  __pyx_t_1 = (__pyx_v_c_log_handler != NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":503
 *     cdef _BaseErrorLog log_handler
 *     if c_log_handler is not NULL:
 *         log_handler = <_BaseErrorLog>c_log_handler             # <<<<<<<<<<<<<<
 *     else:
 *         log_handler = _getGlobalErrorLog()
 */
    __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_c_log_handler)));
    __Pyx_DECREF(((PyObject *)__pyx_v_log_handler));
    __pyx_v_log_handler = ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_c_log_handler);
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":505
 *         log_handler = <_BaseErrorLog>c_log_handler
 *     else:
 *         log_handler = _getGlobalErrorLog()             # <<<<<<<<<<<<<<
 *     log_handler._receive(error)
 * 
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__getGlobalErrorLog()); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_v_log_handler));
    __pyx_v_log_handler = ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_t_2);
    __pyx_t_2 = 0;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":506
 *     else:
 *         log_handler = _getGlobalErrorLog()
 *     log_handler._receive(error)             # <<<<<<<<<<<<<<
 * 
 * cdef void _receiveError(void* c_log_handler, xmlerror.xmlError* error) nogil:
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__BaseErrorLog *)__pyx_v_log_handler->__pyx_vtab)->_receive(__pyx_v_log_handler, __pyx_v_error);

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_WriteUnraisable("lxml.etree._forwardError");
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_log_handler);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(_save);
  #endif
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":508
 *     log_handler._receive(error)
 * 
 * cdef void _receiveError(void* c_log_handler, xmlerror.xmlError* error) nogil:             # <<<<<<<<<<<<<<
 *     # no Python objects here, may be called without thread context !
 *     # when we declare a Python object, Pyrex will INCREF(None) !
 */

static  void __pyx_f_4lxml_5etree__receiveError(void *__pyx_v_c_log_handler, xmlError *__pyx_v_error) {

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":512
 *     # when we declare a Python object, Pyrex will INCREF(None) !
 *     if __DEBUG:
 *         _forwardError(c_log_handler, error)             # <<<<<<<<<<<<<<
 * 
 * cdef void _receiveXSLTError(void* c_log_handler, char* msg, ...) nogil:
 */
  __pyx_f_4lxml_5etree__forwardError(__pyx_v_c_log_handler, __pyx_v_error);

}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":514
 *         _forwardError(c_log_handler, error)
 * 
 * cdef void _receiveXSLTError(void* c_log_handler, char* msg, ...) nogil:             # <<<<<<<<<<<<<<
 *     # no Python objects here, may be called without thread context !
 *     # when we declare a Python object, Pyrex will INCREF(None) !
 */

static  void __pyx_f_4lxml_5etree__receiveXSLTError(void *__pyx_v_c_log_handler, char *__pyx_v_msg, ...) {
  xmlError __pyx_v_c_error;
  va_list __pyx_v_args;
  char *__pyx_v_c_text;
  char *__pyx_v_c_message;
  char *__pyx_v_c_element;
  int __pyx_v_text_size;
  int __pyx_v_element_size;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":523
 *     cdef char* c_element
 *     cdef int i, text_size, element_size
 *     if __DEBUG == 0 or msg is NULL:             # <<<<<<<<<<<<<<
 *         return
 *     if msg[0] == c'\n' or msg[0] == c'\0':
 */
  if (!0) {
    __pyx_t_1 = (__pyx_v_msg == NULL);
    __pyx_t_2 = __pyx_t_1;
  } else {
    __pyx_t_2 = 0;
  }
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":524
 *     cdef int i, text_size, element_size
 *     if __DEBUG == 0 or msg is NULL:
 *         return             # <<<<<<<<<<<<<<
 *     if msg[0] == c'\n' or msg[0] == c'\0':
 *         return
 */
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":525
 *     if __DEBUG == 0 or msg is NULL:
 *         return
 *     if msg[0] == c'\n' or msg[0] == c'\0':             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  __pyx_t_2 = ((__pyx_v_msg[0]) == '\n');
  if (!__pyx_t_2) {
    __pyx_t_1 = ((__pyx_v_msg[0]) == '\x00');
    __pyx_t_3 = __pyx_t_1;
  } else {
    __pyx_t_3 = __pyx_t_2;
  }
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":526
 *         return
 *     if msg[0] == c'\n' or msg[0] == c'\0':
 *         return             # <<<<<<<<<<<<<<
 * 
 *     cstd.va_start(args, msg)
 */
    goto __pyx_L0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":528
 *         return
 * 
 *     cstd.va_start(args, msg)             # <<<<<<<<<<<<<<
 *     if msg[0] == c'%' and msg[1] == c's':
 *         c_text = cstd.va_charptr(args)
 */
  va_start(__pyx_v_args, __pyx_v_msg);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":529
 * 
 *     cstd.va_start(args, msg)
 *     if msg[0] == c'%' and msg[1] == c's':             # <<<<<<<<<<<<<<
 *         c_text = cstd.va_charptr(args)
 *     else:
 */
  __pyx_t_3 = ((__pyx_v_msg[0]) == '%');
  if (__pyx_t_3) {
    __pyx_t_2 = ((__pyx_v_msg[1]) == 's');
    __pyx_t_1 = __pyx_t_2;
  } else {
    __pyx_t_1 = __pyx_t_3;
  }
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":530
 *     cstd.va_start(args, msg)
 *     if msg[0] == c'%' and msg[1] == c's':
 *         c_text = cstd.va_charptr(args)             # <<<<<<<<<<<<<<
 *     else:
 *         c_text = NULL
 */
    __pyx_v_c_text = va_charptr(__pyx_v_args);
    goto __pyx_L5;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":532
 *         c_text = cstd.va_charptr(args)
 *     else:
 *         c_text = NULL             # <<<<<<<<<<<<<<
 *     if cstd.strstr(msg, 'file %s'):
 *         c_error.file = cstd.va_charptr(args)
 */
    __pyx_v_c_text = NULL;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":533
 *     else:
 *         c_text = NULL
 *     if cstd.strstr(msg, 'file %s'):             # <<<<<<<<<<<<<<
 *         c_error.file = cstd.va_charptr(args)
 *         if c_error.file and \
 */
  __pyx_t_1 = (strstr(__pyx_v_msg, __pyx_k_49) != 0);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":534
 *         c_text = NULL
 *     if cstd.strstr(msg, 'file %s'):
 *         c_error.file = cstd.va_charptr(args)             # <<<<<<<<<<<<<<
 *         if c_error.file and \
 *                 cstd.strncmp(c_error.file,
 */
    __pyx_v_c_error.file = va_charptr(__pyx_v_args);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":535
 *     if cstd.strstr(msg, 'file %s'):
 *         c_error.file = cstd.va_charptr(args)
 *         if c_error.file and \             # <<<<<<<<<<<<<<
 *                 cstd.strncmp(c_error.file,
 *                             'string://__STRING__XSLT', 23) == 0:
 */
    if ((__pyx_v_c_error.file != 0)) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":536
 *         c_error.file = cstd.va_charptr(args)
 *         if c_error.file and \
 *                 cstd.strncmp(c_error.file,             # <<<<<<<<<<<<<<
 *                             'string://__STRING__XSLT', 23) == 0:
 *             c_error.file = '<xslt>'
 */
      __pyx_t_1 = (strncmp(__pyx_v_c_error.file, __pyx_k_50, 23) == 0);
      __pyx_t_3 = __pyx_t_1;
    } else {
      __pyx_t_3 = (__pyx_v_c_error.file != 0);
    }
    if (__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":538
 *                 cstd.strncmp(c_error.file,
 *                             'string://__STRING__XSLT', 23) == 0:
 *             c_error.file = '<xslt>'             # <<<<<<<<<<<<<<
 *     else:
 *         c_error.file = NULL
 */
      __pyx_v_c_error.file = __pyx_k_51;
      goto __pyx_L7;
    }
    __pyx_L7:;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":540
 *             c_error.file = '<xslt>'
 *     else:
 *         c_error.file = NULL             # <<<<<<<<<<<<<<
 *     if cstd.strstr(msg, 'line %d'):
 *         c_error.line = cstd.va_int(args)
 */
    __pyx_v_c_error.file = NULL;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":541
 *     else:
 *         c_error.file = NULL
 *     if cstd.strstr(msg, 'line %d'):             # <<<<<<<<<<<<<<
 *         c_error.line = cstd.va_int(args)
 *     else:
 */
  __pyx_t_3 = (strstr(__pyx_v_msg, __pyx_k_52) != 0);
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":542
 *         c_error.file = NULL
 *     if cstd.strstr(msg, 'line %d'):
 *         c_error.line = cstd.va_int(args)             # <<<<<<<<<<<<<<
 *     else:
 *         c_error.line = 0
 */
    __pyx_v_c_error.line = va_int(__pyx_v_args);
    goto __pyx_L8;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":544
 *         c_error.line = cstd.va_int(args)
 *     else:
 *         c_error.line = 0             # <<<<<<<<<<<<<<
 *     if cstd.strstr(msg, 'element %s'):
 *         c_element = cstd.va_charptr(args)
 */
    __pyx_v_c_error.line = 0;
  }
  __pyx_L8:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":545
 *     else:
 *         c_error.line = 0
 *     if cstd.strstr(msg, 'element %s'):             # <<<<<<<<<<<<<<
 *         c_element = cstd.va_charptr(args)
 *     else:
 */
  __pyx_t_3 = (strstr(__pyx_v_msg, __pyx_k_53) != 0);
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":546
 *         c_error.line = 0
 *     if cstd.strstr(msg, 'element %s'):
 *         c_element = cstd.va_charptr(args)             # <<<<<<<<<<<<<<
 *     else:
 *         c_element = NULL
 */
    __pyx_v_c_element = va_charptr(__pyx_v_args);
    goto __pyx_L9;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":548
 *         c_element = cstd.va_charptr(args)
 *     else:
 *         c_element = NULL             # <<<<<<<<<<<<<<
 *     cstd.va_end(args)
 * 
 */
    __pyx_v_c_element = NULL;
  }
  __pyx_L9:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":549
 *     else:
 *         c_element = NULL
 *     cstd.va_end(args)             # <<<<<<<<<<<<<<
 * 
 *     c_message = NULL
 */
  va_end(__pyx_v_args);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":551
 *     cstd.va_end(args)
 * 
 *     c_message = NULL             # <<<<<<<<<<<<<<
 *     if c_text is NULL:
 *         if c_element is not NULL and \
 */
  __pyx_v_c_message = NULL;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":552
 * 
 *     c_message = NULL
 *     if c_text is NULL:             # <<<<<<<<<<<<<<
 *         if c_element is not NULL and \
 *                 cstd.strchr(msg, c'%') == cstd.strrchr(msg, c'%'):
 */
  __pyx_t_3 = (__pyx_v_c_text == NULL);
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":553
 *     c_message = NULL
 *     if c_text is NULL:
 *         if c_element is not NULL and \             # <<<<<<<<<<<<<<
 *                 cstd.strchr(msg, c'%') == cstd.strrchr(msg, c'%'):
 *             # special case: a single occurrence of 'element %s'
 */
    __pyx_t_3 = (__pyx_v_c_element != NULL);
    if (__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":554
 *     if c_text is NULL:
 *         if c_element is not NULL and \
 *                 cstd.strchr(msg, c'%') == cstd.strrchr(msg, c'%'):             # <<<<<<<<<<<<<<
 *             # special case: a single occurrence of 'element %s'
 *             text_size    = cstd.strlen(msg)
 */
      __pyx_t_1 = (strchr(__pyx_v_msg, '%') == strrchr(__pyx_v_msg, '%'));
      __pyx_t_2 = __pyx_t_1;
    } else {
      __pyx_t_2 = __pyx_t_3;
    }
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":556
 *                 cstd.strchr(msg, c'%') == cstd.strrchr(msg, c'%'):
 *             # special case: a single occurrence of 'element %s'
 *             text_size    = cstd.strlen(msg)             # <<<<<<<<<<<<<<
 *             element_size = cstd.strlen(c_element)
 *             c_message = <char*>cstd.malloc(
 */
      __pyx_v_text_size = strlen(__pyx_v_msg);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":557
 *             # special case: a single occurrence of 'element %s'
 *             text_size    = cstd.strlen(msg)
 *             element_size = cstd.strlen(c_element)             # <<<<<<<<<<<<<<
 *             c_message = <char*>cstd.malloc(
 *                 (text_size + element_size + 1) * sizeof(char))
 */
      __pyx_v_element_size = strlen(__pyx_v_c_element);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":559
 *             element_size = cstd.strlen(c_element)
 *             c_message = <char*>cstd.malloc(
 *                 (text_size + element_size + 1) * sizeof(char))             # <<<<<<<<<<<<<<
 *             cstd.sprintf(c_message, msg, c_element)
 *             c_error.message = c_message
 */
      __pyx_v_c_message = ((char *)malloc((((__pyx_v_text_size + __pyx_v_element_size) + 1) * (sizeof(char)))));

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":560
 *             c_message = <char*>cstd.malloc(
 *                 (text_size + element_size + 1) * sizeof(char))
 *             cstd.sprintf(c_message, msg, c_element)             # <<<<<<<<<<<<<<
 *             c_error.message = c_message
 *         else:
 */
      sprintf(__pyx_v_c_message, __pyx_v_msg, __pyx_v_c_element);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":561
 *                 (text_size + element_size + 1) * sizeof(char))
 *             cstd.sprintf(c_message, msg, c_element)
 *             c_error.message = c_message             # <<<<<<<<<<<<<<
 *         else:
 *             c_error.message = ''
 */
      __pyx_v_c_error.message = __pyx_v_c_message;
      goto __pyx_L11;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":563
 *             c_error.message = c_message
 *         else:
 *             c_error.message = ''             # <<<<<<<<<<<<<<
 *     elif c_element is NULL:
 *         c_error.message = c_text
 */
      __pyx_v_c_error.message = __pyx_k_25;
    }
    __pyx_L11:;
    goto __pyx_L10;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":564
 *         else:
 *             c_error.message = ''
 *     elif c_element is NULL:             # <<<<<<<<<<<<<<
 *         c_error.message = c_text
 *     else:
 */
  __pyx_t_2 = (__pyx_v_c_element == NULL);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":565
 *             c_error.message = ''
 *     elif c_element is NULL:
 *         c_error.message = c_text             # <<<<<<<<<<<<<<
 *     else:
 *         text_size    = cstd.strlen(c_text)
 */
    __pyx_v_c_error.message = __pyx_v_c_text;
    goto __pyx_L10;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":567
 *         c_error.message = c_text
 *     else:
 *         text_size    = cstd.strlen(c_text)             # <<<<<<<<<<<<<<
 *         element_size = cstd.strlen(c_element)
 *         c_message = <char*>cstd.malloc(
 */
    __pyx_v_text_size = strlen(__pyx_v_c_text);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":568
 *     else:
 *         text_size    = cstd.strlen(c_text)
 *         element_size = cstd.strlen(c_element)             # <<<<<<<<<<<<<<
 *         c_message = <char*>cstd.malloc(
 *             (text_size + 12 + element_size + 1) * sizeof(char))
 */
    __pyx_v_element_size = strlen(__pyx_v_c_element);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":570
 *         element_size = cstd.strlen(c_element)
 *         c_message = <char*>cstd.malloc(
 *             (text_size + 12 + element_size + 1) * sizeof(char))             # <<<<<<<<<<<<<<
 *         cstd.sprintf(c_message, "%s, element '%s'", c_text, c_element)
 *         c_error.message = c_message
 */
    __pyx_v_c_message = ((char *)malloc(((((__pyx_v_text_size + 12) + __pyx_v_element_size) + 1) * (sizeof(char)))));

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":571
 *         c_message = <char*>cstd.malloc(
 *             (text_size + 12 + element_size + 1) * sizeof(char))
 *         cstd.sprintf(c_message, "%s, element '%s'", c_text, c_element)             # <<<<<<<<<<<<<<
 *         c_error.message = c_message
 * 
 */
    sprintf(__pyx_v_c_message, __pyx_k_54, __pyx_v_c_text, __pyx_v_c_element);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":572
 *             (text_size + 12 + element_size + 1) * sizeof(char))
 *         cstd.sprintf(c_message, "%s, element '%s'", c_text, c_element)
 *         c_error.message = c_message             # <<<<<<<<<<<<<<
 * 
 *     c_error.domain = xmlerror.XML_FROM_XSLT
 */
    __pyx_v_c_error.message = __pyx_v_c_message;
  }
  __pyx_L10:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":574
 *         c_error.message = c_message
 * 
 *     c_error.domain = xmlerror.XML_FROM_XSLT             # <<<<<<<<<<<<<<
 *     c_error.code   = xmlerror.XML_ERR_OK    # what else?
 *     c_error.level  = xmlerror.XML_ERR_ERROR # what else?
 */
  __pyx_v_c_error.domain = XML_FROM_XSLT;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":575
 * 
 *     c_error.domain = xmlerror.XML_FROM_XSLT
 *     c_error.code   = xmlerror.XML_ERR_OK    # what else?             # <<<<<<<<<<<<<<
 *     c_error.level  = xmlerror.XML_ERR_ERROR # what else?
 *     c_error.int2   = 0
 */
  __pyx_v_c_error.code = XML_ERR_OK;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":576
 *     c_error.domain = xmlerror.XML_FROM_XSLT
 *     c_error.code   = xmlerror.XML_ERR_OK    # what else?
 *     c_error.level  = xmlerror.XML_ERR_ERROR # what else?             # <<<<<<<<<<<<<<
 *     c_error.int2   = 0
 * 
 */
  __pyx_v_c_error.level = XML_ERR_ERROR;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":577
 *     c_error.code   = xmlerror.XML_ERR_OK    # what else?
 *     c_error.level  = xmlerror.XML_ERR_ERROR # what else?
 *     c_error.int2   = 0             # <<<<<<<<<<<<<<
 * 
 *     _forwardError(c_log_handler, &c_error)
 */
  __pyx_v_c_error.int2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":579
 *     c_error.int2   = 0
 * 
 *     _forwardError(c_log_handler, &c_error)             # <<<<<<<<<<<<<<
 * 
 *     if c_message is not NULL:
 */
  __pyx_f_4lxml_5etree__forwardError(__pyx_v_c_log_handler, (&__pyx_v_c_error));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":581
 *     _forwardError(c_log_handler, &c_error)
 * 
 *     if c_message is not NULL:             # <<<<<<<<<<<<<<
 *         cstd.free(c_message)
 * 
 */
  __pyx_t_2 = (__pyx_v_c_message != NULL);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":582
 * 
 *     if c_message is not NULL:
 *         cstd.free(c_message)             # <<<<<<<<<<<<<<
 * 
 * ################################################################################
 */
    free(__pyx_v_c_message);
    goto __pyx_L12;
  }
  __pyx_L12:;

  __pyx_L0:;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":588
 * ################################################################################
 * 
 * cdef void __initErrorConstants():             # <<<<<<<<<<<<<<
 *     u"Called at setup time to parse the constants and build the classes below."
 *     cdef dict reverse_dict
 */

static  void __pyx_f_4lxml_5etree___initErrorConstants(void) {
  PyObject *__pyx_v_reverse_dict;
  PyObject *__pyx_v_find_constants;
  PyObject *__pyx_v_const_defs;
  PyObject *__pyx_v_cls;
  PyObject *__pyx_v_constant_tuple;
  PyObject *__pyx_v_constants;
  PyObject *__pyx_v_name;
  PyObject *__pyx_v_value;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  __Pyx_RefNannySetupContext("__initErrorConstants");
  __pyx_v_reverse_dict = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_find_constants = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_const_defs = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_cls = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_constant_tuple = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_constants = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_name = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_value = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":591
 *     u"Called at setup time to parse the constants and build the classes below."
 *     cdef dict reverse_dict
 *     find_constants = re.compile(ur"\s*([a-zA-Z0-9_]+)\s*=\s*([0-9]+)").findall             # <<<<<<<<<<<<<<
 *     const_defs = ((ErrorLevels,          __ERROR_LEVELS),
 *                   (ErrorDomains,         __ERROR_DOMAINS),
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_4lxml_5etree_re, __pyx_n_s__compile); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_56), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__findall); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_v_find_constants);
  __pyx_v_find_constants = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":592
 *     cdef dict reverse_dict
 *     find_constants = re.compile(ur"\s*([a-zA-Z0-9_]+)\s*=\s*([0-9]+)").findall
 *     const_defs = ((ErrorLevels,          __ERROR_LEVELS),             # <<<<<<<<<<<<<<
 *                   (ErrorDomains,         __ERROR_DOMAINS),
 *                   (ErrorTypes,           __PARSER_ERROR_TYPES),
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__ErrorLevels); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_4lxml_5etree___ERROR_LEVELS);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_4lxml_5etree___ERROR_LEVELS);
  __Pyx_GIVEREF(__pyx_v_4lxml_5etree___ERROR_LEVELS);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":593
 *     find_constants = re.compile(ur"\s*([a-zA-Z0-9_]+)\s*=\s*([0-9]+)").findall
 *     const_defs = ((ErrorLevels,          __ERROR_LEVELS),
 *                   (ErrorDomains,         __ERROR_DOMAINS),             # <<<<<<<<<<<<<<
 *                   (ErrorTypes,           __PARSER_ERROR_TYPES),
 *                   (RelaxNGErrorTypes,    __RELAXNG_ERROR_TYPES))
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__ErrorDomains); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_4lxml_5etree___ERROR_DOMAINS);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_4lxml_5etree___ERROR_DOMAINS);
  __Pyx_GIVEREF(__pyx_v_4lxml_5etree___ERROR_DOMAINS);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":594
 *     const_defs = ((ErrorLevels,          __ERROR_LEVELS),
 *                   (ErrorDomains,         __ERROR_DOMAINS),
 *                   (ErrorTypes,           __PARSER_ERROR_TYPES),             # <<<<<<<<<<<<<<
 *                   (RelaxNGErrorTypes,    __RELAXNG_ERROR_TYPES))
 *     for cls, constant_tuple in const_defs:
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__ErrorTypes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_4lxml_5etree___PARSER_ERROR_TYPES);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_4lxml_5etree___PARSER_ERROR_TYPES);
  __Pyx_GIVEREF(__pyx_v_4lxml_5etree___PARSER_ERROR_TYPES);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":595
 *                   (ErrorDomains,         __ERROR_DOMAINS),
 *                   (ErrorTypes,           __PARSER_ERROR_TYPES),
 *                   (RelaxNGErrorTypes,    __RELAXNG_ERROR_TYPES))             # <<<<<<<<<<<<<<
 *     for cls, constant_tuple in const_defs:
 *         reverse_dict = {}
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__RelaxNGErrorTypes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_4lxml_5etree___RELAXNG_ERROR_TYPES);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_4lxml_5etree___RELAXNG_ERROR_TYPES);
  __Pyx_GIVEREF(__pyx_v_4lxml_5etree___RELAXNG_ERROR_TYPES);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_2));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_t_3));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_t_4));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
  PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_t_5));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_v_const_defs));
  __pyx_v_const_defs = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":596
 *                   (ErrorTypes,           __PARSER_ERROR_TYPES),
 *                   (RelaxNGErrorTypes,    __RELAXNG_ERROR_TYPES))
 *     for cls, constant_tuple in const_defs:             # <<<<<<<<<<<<<<
 *         reverse_dict = {}
 *         cls._names   = reverse_dict
 */
  if (unlikely(__pyx_v_const_defs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_6 = 0; __pyx_t_1 = ((PyObject *)__pyx_v_const_defs); __Pyx_INCREF(__pyx_t_1);
  for (;;) {
    if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
    __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++;
    if (PyTuple_CheckExact(__pyx_t_5) && likely(PyTuple_GET_SIZE(__pyx_t_5) == 2)) {
      PyObject* tuple = __pyx_t_5;
      __pyx_t_4 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_4);
      __pyx_t_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_v_cls);
      __pyx_v_cls = __pyx_t_4;
      __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_v_constant_tuple);
      __pyx_v_constant_tuple = __pyx_t_3;
      __pyx_t_3 = 0;
    } else {
      __pyx_t_2 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_4 = __Pyx_UnpackItem(__pyx_t_2, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_2, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      if (__Pyx_EndUnpack(__pyx_t_2, 2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_v_cls);
      __pyx_v_cls = __pyx_t_4;
      __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_v_constant_tuple);
      __pyx_v_constant_tuple = __pyx_t_3;
      __pyx_t_3 = 0;
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":597
 *                   (RelaxNGErrorTypes,    __RELAXNG_ERROR_TYPES))
 *     for cls, constant_tuple in const_defs:
 *         reverse_dict = {}             # <<<<<<<<<<<<<<
 *         cls._names   = reverse_dict
 *         cls._getName = reverse_dict.get
 */
    __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
    __Pyx_DECREF(((PyObject *)__pyx_v_reverse_dict));
    __pyx_v_reverse_dict = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":598
 *     for cls, constant_tuple in const_defs:
 *         reverse_dict = {}
 *         cls._names   = reverse_dict             # <<<<<<<<<<<<<<
 *         cls._getName = reverse_dict.get
 *         for constants in constant_tuple:
 */
    if (PyObject_SetAttr(__pyx_v_cls, __pyx_n_s___names, ((PyObject *)__pyx_v_reverse_dict)) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":599
 *         reverse_dict = {}
 *         cls._names   = reverse_dict
 *         cls._getName = reverse_dict.get             # <<<<<<<<<<<<<<
 *         for constants in constant_tuple:
 *             #print len(constants) + 1
 */
    __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_reverse_dict), __pyx_n_s__get); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    if (PyObject_SetAttr(__pyx_v_cls, __pyx_n_s___getName, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":600
 *         cls._names   = reverse_dict
 *         cls._getName = reverse_dict.get
 *         for constants in constant_tuple:             # <<<<<<<<<<<<<<
 *             #print len(constants) + 1
 *             for name, value in find_constants(constants):
 */
    if (PyList_CheckExact(__pyx_v_constant_tuple) || PyTuple_CheckExact(__pyx_v_constant_tuple)) {
      __pyx_t_7 = 0; __pyx_t_5 = __pyx_v_constant_tuple; __Pyx_INCREF(__pyx_t_5);
    } else {
      __pyx_t_7 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_constant_tuple); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
    }
    for (;;) {
      if (likely(PyList_CheckExact(__pyx_t_5))) {
        if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_5)) break;
        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_3); __pyx_t_7++;
      } else if (likely(PyTuple_CheckExact(__pyx_t_5))) {
        if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
        __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_3); __pyx_t_7++;
      } else {
        __pyx_t_3 = PyIter_Next(__pyx_t_5);
        if (!__pyx_t_3) {
          if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          break;
        }
        __Pyx_GOTREF(__pyx_t_3);
      }
      __Pyx_DECREF(__pyx_v_constants);
      __pyx_v_constants = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":602
 *         for constants in constant_tuple:
 *             #print len(constants) + 1
 *             for name, value in find_constants(constants):             # <<<<<<<<<<<<<<
 *                 value = int(value)
 *                 python.PyObject_SetAttr(cls, name, value)
 */
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
      __Pyx_INCREF(__pyx_v_constants);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_constants);
      __Pyx_GIVEREF(__pyx_v_constants);
      __pyx_t_4 = PyObject_Call(__pyx_v_find_constants, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      if (PyList_CheckExact(__pyx_t_4) || PyTuple_CheckExact(__pyx_t_4)) {
        __pyx_t_8 = 0; __pyx_t_3 = __pyx_t_4; __Pyx_INCREF(__pyx_t_3);
      } else {
        __pyx_t_8 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      for (;;) {
        if (likely(PyList_CheckExact(__pyx_t_3))) {
          if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_3)) break;
          __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++;
        } else if (likely(PyTuple_CheckExact(__pyx_t_3))) {
          if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
          __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++;
        } else {
          __pyx_t_4 = PyIter_Next(__pyx_t_3);
          if (!__pyx_t_4) {
            if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            break;
          }
          __Pyx_GOTREF(__pyx_t_4);
        }
        if (PyTuple_CheckExact(__pyx_t_4) && likely(PyTuple_GET_SIZE(__pyx_t_4) == 2)) {
          PyObject* tuple = __pyx_t_4;
          __pyx_t_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_2);
          __pyx_t_9 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_v_name);
          __pyx_v_name = __pyx_t_2;
          __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_v_value);
          __pyx_v_value = __pyx_t_9;
          __pyx_t_9 = 0;
        } else {
          __pyx_t_10 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_10, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_9 = __Pyx_UnpackItem(__pyx_t_10, 1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_9);
          if (__Pyx_EndUnpack(__pyx_t_10, 2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_DECREF(__pyx_v_name);
          __pyx_v_name = __pyx_t_2;
          __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_v_value);
          __pyx_v_value = __pyx_t_9;
          __pyx_t_9 = 0;
        }

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":603
 *             #print len(constants) + 1
 *             for name, value in find_constants(constants):
 *                 value = int(value)             # <<<<<<<<<<<<<<
 *                 python.PyObject_SetAttr(cls, name, value)
 *                 reverse_dict[value] = name
 */
        __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_4));
        __Pyx_INCREF(__pyx_v_value);
        PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_value);
        __Pyx_GIVEREF(__pyx_v_value);
        __pyx_t_9 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_v_value);
        __pyx_v_value = __pyx_t_9;
        __pyx_t_9 = 0;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":604
 *             for name, value in find_constants(constants):
 *                 value = int(value)
 *                 python.PyObject_SetAttr(cls, name, value)             # <<<<<<<<<<<<<<
 *                 reverse_dict[value] = name
 * 
 */
        PyObject_SetAttr(__pyx_v_cls, __pyx_v_name, __pyx_v_value);

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":605
 *                 value = int(value)
 *                 python.PyObject_SetAttr(cls, name, value)
 *                 reverse_dict[value] = name             # <<<<<<<<<<<<<<
 * 
 * 
 */
        if (PyDict_SetItem(((PyObject *)__pyx_v_reverse_dict), __pyx_v_value, __pyx_v_name) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_WriteUnraisable("lxml.etree.__initErrorConstants");
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_reverse_dict);
  __Pyx_DECREF(__pyx_v_find_constants);
  __Pyx_DECREF(__pyx_v_const_defs);
  __Pyx_DECREF(__pyx_v_cls);
  __Pyx_DECREF(__pyx_v_constant_tuple);
  __Pyx_DECREF(__pyx_v_constants);
  __Pyx_DECREF(__pyx_v_name);
  __Pyx_DECREF(__pyx_v_value);
  __Pyx_RefNannyFinishContext();
}

/* "src/lxml/lxml.etree.pyx":314
 *     cdef _BaseParser _parser
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         # if there are no more references to the document, it is safe
 *         # to clean the whole thing up, as all nodes have a reference to
 */

static void __pyx_pf_4lxml_5etree_9_Document___dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pf_4lxml_5etree_9_Document___dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannySetupContext("__dealloc__");

  /* "src/lxml/lxml.etree.pyx":318
 *         # to clean the whole thing up, as all nodes have a reference to
 *         # the document
 *         tree.xmlFreeDoc(self._c_doc)             # <<<<<<<<<<<<<<
 * 
 *     cdef getroot(self):
 */
  xmlFreeDoc(((struct LxmlDocument *)__pyx_v_self)->_c_doc);

  __Pyx_RefNannyFinishContext();
}

/* "src/lxml/lxml.etree.pyx":320
 *         tree.xmlFreeDoc(self._c_doc)
 * 
 *     cdef getroot(self):             # <<<<<<<<<<<<<<
 *         # return an element proxy for the document root
 *         cdef xmlNode* c_node
 */

static  PyObject *__pyx_f_4lxml_5etree_9_Document_getroot(struct LxmlDocument *__pyx_v_self) {
  xmlNode *__pyx_v_c_node;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getroot");

  /* "src/lxml/lxml.etree.pyx":323
 *         # return an element proxy for the document root
 *         cdef xmlNode* c_node
 *         c_node = tree.xmlDocGetRootElement(self._c_doc)             # <<<<<<<<<<<<<<
 *         if c_node is NULL:
 *             return None
 */
  __pyx_v_c_node = xmlDocGetRootElement(__pyx_v_self->_c_doc);

  /* "src/lxml/lxml.etree.pyx":324
 *         cdef xmlNode* c_node
 *         c_node = tree.xmlDocGetRootElement(self._c_doc)
 *         if c_node is NULL:             # <<<<<<<<<<<<<<
 *             return None
 *         return _elementFactory(self, c_node)
 */
  __pyx_t_1 = (__pyx_v_c_node == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/lxml.etree.pyx":325
 *         c_node = tree.xmlDocGetRootElement(self._c_doc)
 *         if c_node is NULL:
 *             return None             # <<<<<<<<<<<<<<
 *         return _elementFactory(self, c_node)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "src/lxml/lxml.etree.pyx":326
 *         if c_node is NULL:
 *             return None
 *         return _elementFactory(self, c_node)             # <<<<<<<<<<<<<<
 * 
 *     cdef bint hasdoctype(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(__pyx_v_self, __pyx_v_c_node)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Document.getroot");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":328
 *         return _elementFactory(self, c_node)
 * 
 *     cdef bint hasdoctype(self):             # <<<<<<<<<<<<<<
 *         # DOCTYPE gets parsed into internal subset (xmlDTD*)
 *         return self._c_doc is not NULL and self._c_doc.intSubset is not NULL
 */

static  int __pyx_f_4lxml_5etree_9_Document_hasdoctype(struct LxmlDocument *__pyx_v_self) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("hasdoctype");

  /* "src/lxml/lxml.etree.pyx":330
 *     cdef bint hasdoctype(self):
 *         # DOCTYPE gets parsed into internal subset (xmlDTD*)
 *         return self._c_doc is not NULL and self._c_doc.intSubset is not NULL             # <<<<<<<<<<<<<<
 * 
 *     cdef getdoctype(self):
 */
  __pyx_t_1 = (__pyx_v_self->_c_doc != NULL);
  if (__pyx_t_1) {
    __pyx_t_2 = (__pyx_v_self->_c_doc->intSubset != NULL);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  __pyx_r = __pyx_t_3;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":332
 *         return self._c_doc is not NULL and self._c_doc.intSubset is not NULL
 * 
 *     cdef getdoctype(self):             # <<<<<<<<<<<<<<
 *         # get doctype info: root tag, public/system ID (or None if not known)
 *         cdef tree.xmlDtd* c_dtd
 */

static  PyObject *__pyx_f_4lxml_5etree_9_Document_getdoctype(struct LxmlDocument *__pyx_v_self) {
  xmlDtd *__pyx_v_c_dtd;
  xmlNode *__pyx_v_c_root_node;
  PyObject *__pyx_v_public_id;
  PyObject *__pyx_v_sys_url;
  PyObject *__pyx_v_root_name;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("getdoctype");
  __pyx_v_public_id = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_sys_url = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_root_name = Py_None; __Pyx_INCREF(Py_None);

  /* "src/lxml/lxml.etree.pyx":336
 *         cdef tree.xmlDtd* c_dtd
 *         cdef xmlNode* c_root_node
 *         public_id = None             # <<<<<<<<<<<<<<
 *         sys_url   = None
 *         c_dtd = self._c_doc.intSubset
 */
  __Pyx_INCREF(Py_None);
  __Pyx_DECREF(__pyx_v_public_id);
  __pyx_v_public_id = Py_None;

  /* "src/lxml/lxml.etree.pyx":337
 *         cdef xmlNode* c_root_node
 *         public_id = None
 *         sys_url   = None             # <<<<<<<<<<<<<<
 *         c_dtd = self._c_doc.intSubset
 *         if c_dtd is not NULL:
 */
  __Pyx_INCREF(Py_None);
  __Pyx_DECREF(__pyx_v_sys_url);
  __pyx_v_sys_url = Py_None;

  /* "src/lxml/lxml.etree.pyx":338
 *         public_id = None
 *         sys_url   = None
 *         c_dtd = self._c_doc.intSubset             # <<<<<<<<<<<<<<
 *         if c_dtd is not NULL:
 *             if c_dtd.ExternalID is not NULL:
 */
  __pyx_v_c_dtd = __pyx_v_self->_c_doc->intSubset;

  /* "src/lxml/lxml.etree.pyx":339
 *         sys_url   = None
 *         c_dtd = self._c_doc.intSubset
 *         if c_dtd is not NULL:             # <<<<<<<<<<<<<<
 *             if c_dtd.ExternalID is not NULL:
 *                 public_id = funicode(c_dtd.ExternalID)
 */
  __pyx_t_1 = (__pyx_v_c_dtd != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/lxml.etree.pyx":340
 *         c_dtd = self._c_doc.intSubset
 *         if c_dtd is not NULL:
 *             if c_dtd.ExternalID is not NULL:             # <<<<<<<<<<<<<<
 *                 public_id = funicode(c_dtd.ExternalID)
 *             if c_dtd.SystemID is not NULL:
 */
    __pyx_t_1 = (__pyx_v_c_dtd->ExternalID != NULL);
    if (__pyx_t_1) {

      /* "src/lxml/lxml.etree.pyx":341
 *         if c_dtd is not NULL:
 *             if c_dtd.ExternalID is not NULL:
 *                 public_id = funicode(c_dtd.ExternalID)             # <<<<<<<<<<<<<<
 *             if c_dtd.SystemID is not NULL:
 *                 sys_url = funicode(c_dtd.SystemID)
 */
      __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_dtd->ExternalID); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_v_public_id);
      __pyx_v_public_id = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "src/lxml/lxml.etree.pyx":342
 *             if c_dtd.ExternalID is not NULL:
 *                 public_id = funicode(c_dtd.ExternalID)
 *             if c_dtd.SystemID is not NULL:             # <<<<<<<<<<<<<<
 *                 sys_url = funicode(c_dtd.SystemID)
 *         c_dtd = self._c_doc.extSubset
 */
    __pyx_t_1 = (__pyx_v_c_dtd->SystemID != NULL);
    if (__pyx_t_1) {

      /* "src/lxml/lxml.etree.pyx":343
 *                 public_id = funicode(c_dtd.ExternalID)
 *             if c_dtd.SystemID is not NULL:
 *                 sys_url = funicode(c_dtd.SystemID)             # <<<<<<<<<<<<<<
 *         c_dtd = self._c_doc.extSubset
 *         if c_dtd is not NULL:
 */
      __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_dtd->SystemID); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_v_sys_url);
      __pyx_v_sys_url = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L5;
    }
    __pyx_L5:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "src/lxml/lxml.etree.pyx":344
 *             if c_dtd.SystemID is not NULL:
 *                 sys_url = funicode(c_dtd.SystemID)
 *         c_dtd = self._c_doc.extSubset             # <<<<<<<<<<<<<<
 *         if c_dtd is not NULL:
 *             if not public_id and c_dtd.ExternalID is not NULL:
 */
  __pyx_v_c_dtd = __pyx_v_self->_c_doc->extSubset;

  /* "src/lxml/lxml.etree.pyx":345
 *                 sys_url = funicode(c_dtd.SystemID)
 *         c_dtd = self._c_doc.extSubset
 *         if c_dtd is not NULL:             # <<<<<<<<<<<<<<
 *             if not public_id and c_dtd.ExternalID is not NULL:
 *                 public_id = funicode(c_dtd.ExternalID)
 */
  __pyx_t_1 = (__pyx_v_c_dtd != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/lxml.etree.pyx":346
 *         c_dtd = self._c_doc.extSubset
 *         if c_dtd is not NULL:
 *             if not public_id and c_dtd.ExternalID is not NULL:             # <<<<<<<<<<<<<<
 *                 public_id = funicode(c_dtd.ExternalID)
 *             if not sys_url and c_dtd.SystemID is not NULL:
 */
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_public_id); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = (!__pyx_t_1);
    if (__pyx_t_3) {
      __pyx_t_1 = (__pyx_v_c_dtd->ExternalID != NULL);
      __pyx_t_4 = __pyx_t_1;
    } else {
      __pyx_t_4 = __pyx_t_3;
    }
    if (__pyx_t_4) {

      /* "src/lxml/lxml.etree.pyx":347
 *         if c_dtd is not NULL:
 *             if not public_id and c_dtd.ExternalID is not NULL:
 *                 public_id = funicode(c_dtd.ExternalID)             # <<<<<<<<<<<<<<
 *             if not sys_url and c_dtd.SystemID is not NULL:
 *                 sys_url = funicode(c_dtd.SystemID)
 */
      __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_dtd->ExternalID); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_v_public_id);
      __pyx_v_public_id = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "src/lxml/lxml.etree.pyx":348
 *             if not public_id and c_dtd.ExternalID is not NULL:
 *                 public_id = funicode(c_dtd.ExternalID)
 *             if not sys_url and c_dtd.SystemID is not NULL:             # <<<<<<<<<<<<<<
 *                 sys_url = funicode(c_dtd.SystemID)
 *         c_root_node = tree.xmlDocGetRootElement(self._c_doc)
 */
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_sys_url); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = (!__pyx_t_4);
    if (__pyx_t_3) {
      __pyx_t_4 = (__pyx_v_c_dtd->SystemID != NULL);
      __pyx_t_1 = __pyx_t_4;
    } else {
      __pyx_t_1 = __pyx_t_3;
    }
    if (__pyx_t_1) {

      /* "src/lxml/lxml.etree.pyx":349
 *                 public_id = funicode(c_dtd.ExternalID)
 *             if not sys_url and c_dtd.SystemID is not NULL:
 *                 sys_url = funicode(c_dtd.SystemID)             # <<<<<<<<<<<<<<
 *         c_root_node = tree.xmlDocGetRootElement(self._c_doc)
 *         if c_root_node is NULL:
 */
      __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_dtd->SystemID); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_v_sys_url);
      __pyx_v_sys_url = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L8;
    }
    __pyx_L8:;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "src/lxml/lxml.etree.pyx":350
 *             if not sys_url and c_dtd.SystemID is not NULL:
 *                 sys_url = funicode(c_dtd.SystemID)
 *         c_root_node = tree.xmlDocGetRootElement(self._c_doc)             # <<<<<<<<<<<<<<
 *         if c_root_node is NULL:
 *             root_name = None
 */
  __pyx_v_c_root_node = xmlDocGetRootElement(__pyx_v_self->_c_doc);

  /* "src/lxml/lxml.etree.pyx":351
 *                 sys_url = funicode(c_dtd.SystemID)
 *         c_root_node = tree.xmlDocGetRootElement(self._c_doc)
 *         if c_root_node is NULL:             # <<<<<<<<<<<<<<
 *             root_name = None
 *         else:
 */
  __pyx_t_1 = (__pyx_v_c_root_node == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/lxml.etree.pyx":352
 *         c_root_node = tree.xmlDocGetRootElement(self._c_doc)
 *         if c_root_node is NULL:
 *             root_name = None             # <<<<<<<<<<<<<<
 *         else:
 *             root_name = funicode(c_root_node.name)
 */
    __Pyx_INCREF(Py_None);
    __Pyx_DECREF(__pyx_v_root_name);
    __pyx_v_root_name = Py_None;
    goto __pyx_L9;
  }
  /*else*/ {

    /* "src/lxml/lxml.etree.pyx":354
 *             root_name = None
 *         else:
 *             root_name = funicode(c_root_node.name)             # <<<<<<<<<<<<<<
 *         return (root_name, public_id, sys_url)
 * 
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_root_node->name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_v_root_name);
    __pyx_v_root_name = __pyx_t_2;
    __pyx_t_2 = 0;
  }
  __pyx_L9:;

  /* "src/lxml/lxml.etree.pyx":355
 *         else:
 *             root_name = funicode(c_root_node.name)
 *         return (root_name, public_id, sys_url)             # <<<<<<<<<<<<<<
 * 
 *     cdef getxmlinfo(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(__pyx_v_root_name);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_root_name);
  __Pyx_GIVEREF(__pyx_v_root_name);
  __Pyx_INCREF(__pyx_v_public_id);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_public_id);
  __Pyx_GIVEREF(__pyx_v_public_id);
  __Pyx_INCREF(__pyx_v_sys_url);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_sys_url);
  __Pyx_GIVEREF(__pyx_v_sys_url);
  __pyx_r = ((PyObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Document.getdoctype");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_public_id);
  __Pyx_DECREF(__pyx_v_sys_url);
  __Pyx_DECREF(__pyx_v_root_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":357
 *         return (root_name, public_id, sys_url)
 * 
 *     cdef getxmlinfo(self):             # <<<<<<<<<<<<<<
 *         # return XML version and encoding (or None if not known)
 *         cdef xmlDoc* c_doc = self._c_doc
 */

static  PyObject *__pyx_f_4lxml_5etree_9_Document_getxmlinfo(struct LxmlDocument *__pyx_v_self) {
  xmlDoc *__pyx_v_c_doc;
  PyObject *__pyx_v_version;
  PyObject *__pyx_v_encoding;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getxmlinfo");
  __pyx_v_version = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_encoding = Py_None; __Pyx_INCREF(Py_None);

  /* "src/lxml/lxml.etree.pyx":359
 *     cdef getxmlinfo(self):
 *         # return XML version and encoding (or None if not known)
 *         cdef xmlDoc* c_doc = self._c_doc             # <<<<<<<<<<<<<<
 *         if c_doc.version is NULL:
 *             version = None
 */
  __pyx_v_c_doc = __pyx_v_self->_c_doc;

  /* "src/lxml/lxml.etree.pyx":360
 *         # return XML version and encoding (or None if not known)
 *         cdef xmlDoc* c_doc = self._c_doc
 *         if c_doc.version is NULL:             # <<<<<<<<<<<<<<
 *             version = None
 *         else:
 */
  __pyx_t_1 = (__pyx_v_c_doc->version == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/lxml.etree.pyx":361
 *         cdef xmlDoc* c_doc = self._c_doc
 *         if c_doc.version is NULL:
 *             version = None             # <<<<<<<<<<<<<<
 *         else:
 *             version = funicode(c_doc.version)
 */
    __Pyx_INCREF(Py_None);
    __Pyx_DECREF(__pyx_v_version);
    __pyx_v_version = Py_None;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "src/lxml/lxml.etree.pyx":363
 *             version = None
 *         else:
 *             version = funicode(c_doc.version)             # <<<<<<<<<<<<<<
 *         if c_doc.encoding is NULL:
 *             encoding = None
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_doc->version); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_v_version);
    __pyx_v_version = __pyx_t_2;
    __pyx_t_2 = 0;
  }
  __pyx_L3:;

  /* "src/lxml/lxml.etree.pyx":364
 *         else:
 *             version = funicode(c_doc.version)
 *         if c_doc.encoding is NULL:             # <<<<<<<<<<<<<<
 *             encoding = None
 *         else:
 */
  __pyx_t_1 = (__pyx_v_c_doc->encoding == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/lxml.etree.pyx":365
 *             version = funicode(c_doc.version)
 *         if c_doc.encoding is NULL:
 *             encoding = None             # <<<<<<<<<<<<<<
 *         else:
 *             encoding = funicode(c_doc.encoding)
 */
    __Pyx_INCREF(Py_None);
    __Pyx_DECREF(__pyx_v_encoding);
    __pyx_v_encoding = Py_None;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "src/lxml/lxml.etree.pyx":367
 *             encoding = None
 *         else:
 *             encoding = funicode(c_doc.encoding)             # <<<<<<<<<<<<<<
 *         return (version, encoding)
 * 
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_doc->encoding); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_v_encoding);
    __pyx_v_encoding = __pyx_t_2;
    __pyx_t_2 = 0;
  }
  __pyx_L4:;

  /* "src/lxml/lxml.etree.pyx":368
 *         else:
 *             encoding = funicode(c_doc.encoding)
 *         return (version, encoding)             # <<<<<<<<<<<<<<
 * 
 *     cdef isstandalone(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(__pyx_v_version);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_version);
  __Pyx_GIVEREF(__pyx_v_version);
  __Pyx_INCREF(__pyx_v_encoding);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_encoding);
  __Pyx_GIVEREF(__pyx_v_encoding);
  __pyx_r = ((PyObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Document.getxmlinfo");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_version);
  __Pyx_DECREF(__pyx_v_encoding);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":370
 *         return (version, encoding)
 * 
 *     cdef isstandalone(self):             # <<<<<<<<<<<<<<
 *         # returns True for "standalone=true",
 *         # False for "standalone=false", None if not provided
 */

static  PyObject *__pyx_f_4lxml_5etree_9_Document_isstandalone(struct LxmlDocument *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("isstandalone");

  /* "src/lxml/lxml.etree.pyx":373
 *         # returns True for "standalone=true",
 *         # False for "standalone=false", None if not provided
 *         if self._c_doc.standalone == -1:             # <<<<<<<<<<<<<<
 *             return None
 *         else:
 */
  __pyx_t_1 = (__pyx_v_self->_c_doc->standalone == -1);
  if (__pyx_t_1) {

    /* "src/lxml/lxml.etree.pyx":374
 *         # False for "standalone=false", None if not provided
 *         if self._c_doc.standalone == -1:
 *             return None             # <<<<<<<<<<<<<<
 *         else:
 *             return <bint>(self._c_doc.standalone == 1)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "src/lxml/lxml.etree.pyx":376
 *             return None
 *         else:
 *             return <bint>(self._c_doc.standalone == 1)             # <<<<<<<<<<<<<<
 * 
 *     cdef bytes buildNewPrefix(self):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyBool_FromLong((__pyx_v_self->_c_doc->standalone == 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Document.isstandalone");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":378
 *             return <bint>(self._c_doc.standalone == 1)
 * 
 *     cdef bytes buildNewPrefix(self):             # <<<<<<<<<<<<<<
 *         # get a new unique prefix ("nsX") for this document
 *         cdef bytes ns
 */

static  PyObject *__pyx_f_4lxml_5etree_9_Document_buildNewPrefix(struct LxmlDocument *__pyx_v_self) {
  PyObject *__pyx_v_ns;
  PyObject *__pyx_r = NULL;
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("buildNewPrefix");
  __pyx_v_ns = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);

  /* "src/lxml/lxml.etree.pyx":381
 *         # get a new unique prefix ("nsX") for this document
 *         cdef bytes ns
 *         if self._ns_counter < len(_PREFIX_CACHE):             # <<<<<<<<<<<<<<
 *             ns = _PREFIX_CACHE[self._ns_counter]
 *         else:
 */
  if (unlikely(__pyx_v_4lxml_5etree__PREFIX_CACHE == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_1 = PyTuple_GET_SIZE(((PyObject *)__pyx_v_4lxml_5etree__PREFIX_CACHE)); 
  __pyx_t_2 = (__pyx_v_self->_ns_counter < __pyx_t_1);
  if (__pyx_t_2) {

    /* "src/lxml/lxml.etree.pyx":382
 *         cdef bytes ns
 *         if self._ns_counter < len(_PREFIX_CACHE):
 *             ns = _PREFIX_CACHE[self._ns_counter]             # <<<<<<<<<<<<<<
 *         else:
 *             ns = python.PyBytes_FromFormat("ns%d", self._ns_counter)
 */
    __pyx_t_3 = __Pyx_GetItemInt_Tuple(((PyObject *)__pyx_v_4lxml_5etree__PREFIX_CACHE), __pyx_v_self->_ns_counter, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_v_ns));
    __pyx_v_ns = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "src/lxml/lxml.etree.pyx":384
 *             ns = _PREFIX_CACHE[self._ns_counter]
 *         else:
 *             ns = python.PyBytes_FromFormat("ns%d", self._ns_counter)             # <<<<<<<<<<<<<<
 *         if self._prefix_tail is not None:
 *             ns += self._prefix_tail
 */
    __pyx_t_3 = ((PyObject *)PyBytes_FromFormat(__pyx_k_57, __pyx_v_self->_ns_counter)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__pyx_v_ns));
    __pyx_v_ns = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;
  }
  __pyx_L3:;

  /* "src/lxml/lxml.etree.pyx":385
 *         else:
 *             ns = python.PyBytes_FromFormat("ns%d", self._ns_counter)
 *         if self._prefix_tail is not None:             # <<<<<<<<<<<<<<
 *             ns += self._prefix_tail
 *         self._ns_counter += 1
 */
  __pyx_t_2 = (__pyx_v_self->_prefix_tail != ((PyObject*)Py_None));
  if (__pyx_t_2) {

    /* "src/lxml/lxml.etree.pyx":386
 *             ns = python.PyBytes_FromFormat("ns%d", self._ns_counter)
 *         if self._prefix_tail is not None:
 *             ns += self._prefix_tail             # <<<<<<<<<<<<<<
 *         self._ns_counter += 1
 *         if self._ns_counter < 0:
 */
    __pyx_t_3 = PyNumber_InPlaceAdd(((PyObject *)__pyx_v_ns), ((PyObject *)__pyx_v_self->_prefix_tail)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_DECREF(((PyObject *)__pyx_v_ns));
    __pyx_v_ns = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "src/lxml/lxml.etree.pyx":387
 *         if self._prefix_tail is not None:
 *             ns += self._prefix_tail
 *         self._ns_counter += 1             # <<<<<<<<<<<<<<
 *         if self._ns_counter < 0:
 *             # overflow!
 */
  __pyx_v_self->_ns_counter = (__pyx_v_self->_ns_counter + 1);

  /* "src/lxml/lxml.etree.pyx":388
 *             ns += self._prefix_tail
 *         self._ns_counter += 1
 *         if self._ns_counter < 0:             # <<<<<<<<<<<<<<
 *             # overflow!
 *             self._ns_counter = 0
 */
  __pyx_t_2 = (__pyx_v_self->_ns_counter < 0);
  if (__pyx_t_2) {

    /* "src/lxml/lxml.etree.pyx":390
 *         if self._ns_counter < 0:
 *             # overflow!
 *             self._ns_counter = 0             # <<<<<<<<<<<<<<
 *             if self._prefix_tail is None:
 *                 self._prefix_tail = b"A"
 */
    __pyx_v_self->_ns_counter = 0;

    /* "src/lxml/lxml.etree.pyx":391
 *             # overflow!
 *             self._ns_counter = 0
 *             if self._prefix_tail is None:             # <<<<<<<<<<<<<<
 *                 self._prefix_tail = b"A"
 *             else:
 */
    __pyx_t_2 = (__pyx_v_self->_prefix_tail == ((PyObject*)Py_None));
    if (__pyx_t_2) {

      /* "src/lxml/lxml.etree.pyx":392
 *             self._ns_counter = 0
 *             if self._prefix_tail is None:
 *                 self._prefix_tail = b"A"             # <<<<<<<<<<<<<<
 *             else:
 *                 self._prefix_tail += b"A"
 */
      __Pyx_INCREF(((PyObject *)__pyx_n_b__A));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_b__A));
      __Pyx_GOTREF(__pyx_v_self->_prefix_tail);
      __Pyx_DECREF(((PyObject *)__pyx_v_self->_prefix_tail));
      __pyx_v_self->_prefix_tail = __pyx_n_b__A;
      goto __pyx_L6;
    }
    /*else*/ {

      /* "src/lxml/lxml.etree.pyx":394
 *                 self._prefix_tail = b"A"
 *             else:
 *                 self._prefix_tail += b"A"             # <<<<<<<<<<<<<<
 *         return ns
 * 
 */
      __pyx_t_3 = PyNumber_InPlaceAdd(((PyObject *)__pyx_v_self->_prefix_tail), ((PyObject *)__pyx_n_b__A)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
      __Pyx_GOTREF(__pyx_v_self->_prefix_tail);
      __Pyx_DECREF(((PyObject *)__pyx_v_self->_prefix_tail));
      __pyx_v_self->_prefix_tail = __pyx_t_3;
      __pyx_t_3 = 0;
    }
    __pyx_L6:;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "src/lxml/lxml.etree.pyx":395
 *             else:
 *                 self._prefix_tail += b"A"
 *         return ns             # <<<<<<<<<<<<<<
 * 
 *     cdef xmlNs* _findOrBuildNodeNs(self, xmlNode* c_node,
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_ns));
  __pyx_r = __pyx_v_ns;
  goto __pyx_L0;

  __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Document.buildNewPrefix");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_ns);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":397
 *         return ns
 * 
 *     cdef xmlNs* _findOrBuildNodeNs(self, xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                                    char* c_href, char* c_prefix,
 *                                    bint is_attribute) except NULL:
 */

static  xmlNs *__pyx_f_4lxml_5etree_9_Document__findOrBuildNodeNs(struct LxmlDocument *__pyx_v_self, xmlNode *__pyx_v_c_node, char *__pyx_v_c_href, char *__pyx_v_c_prefix, int __pyx_v_is_attribute) {
  xmlNs *__pyx_v_c_ns;
  PyObject *__pyx_v_dict_result;
  PyObject *__pyx_v_prefix;
  xmlNs *__pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("_findOrBuildNodeNs");
  __pyx_v_prefix = Py_None; __Pyx_INCREF(Py_None);

  /* "src/lxml/lxml.etree.pyx":406
 *         cdef xmlNs* c_doc_ns
 *         cdef python.PyObject* dict_result
 *         if c_node.type != tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *             assert c_node.type == tree.XML_ELEMENT_NODE, \
 *                 u"invalid node type %d, expected %d" % (
 */
  __pyx_t_1 = (__pyx_v_c_node->type != XML_ELEMENT_NODE);
  if (__pyx_t_1) {

    /* "src/lxml/lxml.etree.pyx":407
 *         cdef python.PyObject* dict_result
 *         if c_node.type != tree.XML_ELEMENT_NODE:
 *             assert c_node.type == tree.XML_ELEMENT_NODE, \             # <<<<<<<<<<<<<<
 *                 u"invalid node type %d, expected %d" % (
 *                 c_node.type, tree.XML_ELEMENT_NODE)
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!(__pyx_v_c_node->type == XML_ELEMENT_NODE))) {

      /* "src/lxml/lxml.etree.pyx":409
 *             assert c_node.type == tree.XML_ELEMENT_NODE, \
 *                 u"invalid node type %d, expected %d" % (
 *                 c_node.type, tree.XML_ELEMENT_NODE)             # <<<<<<<<<<<<<<
 *         # look for existing ns declaration
 *         c_ns = _searchNsByHref(c_node, c_href, is_attribute)
 */
      __pyx_t_2 = PyInt_FromLong(__pyx_v_c_node->type); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyInt_FromLong(XML_ELEMENT_NODE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __pyx_t_2 = 0;
      __pyx_t_3 = 0;
      __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_58), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_t_3));
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #endif
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "src/lxml/lxml.etree.pyx":411
 *                 c_node.type, tree.XML_ELEMENT_NODE)
 *         # look for existing ns declaration
 *         c_ns = _searchNsByHref(c_node, c_href, is_attribute)             # <<<<<<<<<<<<<<
 *         if c_ns is not NULL:
 *             if is_attribute and c_ns.prefix is NULL:
 */
  __pyx_v_c_ns = __pyx_f_4lxml_5etree__searchNsByHref(__pyx_v_c_node, __pyx_v_c_href, __pyx_v_is_attribute);

  /* "src/lxml/lxml.etree.pyx":412
 *         # look for existing ns declaration
 *         c_ns = _searchNsByHref(c_node, c_href, is_attribute)
 *         if c_ns is not NULL:             # <<<<<<<<<<<<<<
 *             if is_attribute and c_ns.prefix is NULL:
 *                 # do not put namespaced attributes into the default
 */
  __pyx_t_1 = (__pyx_v_c_ns != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/lxml.etree.pyx":413
 *         c_ns = _searchNsByHref(c_node, c_href, is_attribute)
 *         if c_ns is not NULL:
 *             if is_attribute and c_ns.prefix is NULL:             # <<<<<<<<<<<<<<
 *                 # do not put namespaced attributes into the default
 *                 # namespace as this would break serialisation
 */
    if (__pyx_v_is_attribute) {
      __pyx_t_1 = (__pyx_v_c_ns->prefix == NULL);
      __pyx_t_5 = __pyx_t_1;
    } else {
      __pyx_t_5 = __pyx_v_is_attribute;
    }
    if (__pyx_t_5) {
      goto __pyx_L5;
    }
    /*else*/ {

      /* "src/lxml/lxml.etree.pyx":418
 *                 pass
 *             else:
 *                 return c_ns             # <<<<<<<<<<<<<<
 * 
 *         # none found => determine a suitable new prefix
 */
      __pyx_r = __pyx_v_c_ns;
      goto __pyx_L0;
    }
    __pyx_L5:;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "src/lxml/lxml.etree.pyx":421
 * 
 *         # none found => determine a suitable new prefix
 *         if c_prefix is NULL:             # <<<<<<<<<<<<<<
 *             dict_result = python.PyDict_GetItem(
 *                 _DEFAULT_NAMESPACE_PREFIXES, c_href)
 */
  __pyx_t_5 = (__pyx_v_c_prefix == NULL);
  if (__pyx_t_5) {

    /* "src/lxml/lxml.etree.pyx":423
 *         if c_prefix is NULL:
 *             dict_result = python.PyDict_GetItem(
 *                 _DEFAULT_NAMESPACE_PREFIXES, c_href)             # <<<<<<<<<<<<<<
 *             if dict_result is not NULL:
 *                 prefix = <object>dict_result
 */
    __pyx_t_3 = PyBytes_FromString(__pyx_v_c_href); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __pyx_v_dict_result = PyDict_GetItem(__pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES, ((PyObject *)__pyx_t_3));
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;

    /* "src/lxml/lxml.etree.pyx":424
 *             dict_result = python.PyDict_GetItem(
 *                 _DEFAULT_NAMESPACE_PREFIXES, c_href)
 *             if dict_result is not NULL:             # <<<<<<<<<<<<<<
 *                 prefix = <object>dict_result
 *             else:
 */
    __pyx_t_5 = (__pyx_v_dict_result != NULL);
    if (__pyx_t_5) {

      /* "src/lxml/lxml.etree.pyx":425
 *                 _DEFAULT_NAMESPACE_PREFIXES, c_href)
 *             if dict_result is not NULL:
 *                 prefix = <object>dict_result             # <<<<<<<<<<<<<<
 *             else:
 *                 prefix = self.buildNewPrefix()
 */
      __Pyx_INCREF(((PyObject *)__pyx_v_dict_result));
      __Pyx_DECREF(__pyx_v_prefix);
      __pyx_v_prefix = ((PyObject *)__pyx_v_dict_result);
      goto __pyx_L7;
    }
    /*else*/ {

      /* "src/lxml/lxml.etree.pyx":427
 *                 prefix = <object>dict_result
 *             else:
 *                 prefix = self.buildNewPrefix()             # <<<<<<<<<<<<<<
 *             c_prefix = _cstr(prefix)
 * 
 */
      __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__Document *)__pyx_v_self->__pyx_vtab)->buildNewPrefix(__pyx_v_self)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_v_prefix);
      __pyx_v_prefix = __pyx_t_3;
      __pyx_t_3 = 0;
    }
    __pyx_L7:;

    /* "src/lxml/lxml.etree.pyx":428
 *             else:
 *                 prefix = self.buildNewPrefix()
 *             c_prefix = _cstr(prefix)             # <<<<<<<<<<<<<<
 * 
 *         # make sure the prefix is not in use already
 */
    __pyx_v_c_prefix = PyBytes_AS_STRING(__pyx_v_prefix);
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "src/lxml/lxml.etree.pyx":431
 * 
 *         # make sure the prefix is not in use already
 *         while tree.xmlSearchNs(self._c_doc, c_node, c_prefix) is not NULL:             # <<<<<<<<<<<<<<
 *             prefix = self.buildNewPrefix()
 *             c_prefix = _cstr(prefix)
 */
  while (1) {
    __pyx_t_5 = (xmlSearchNs(__pyx_v_self->_c_doc, __pyx_v_c_node, __pyx_v_c_prefix) != NULL);
    if (!__pyx_t_5) break;

    /* "src/lxml/lxml.etree.pyx":432
 *         # make sure the prefix is not in use already
 *         while tree.xmlSearchNs(self._c_doc, c_node, c_prefix) is not NULL:
 *             prefix = self.buildNewPrefix()             # <<<<<<<<<<<<<<
 *             c_prefix = _cstr(prefix)
 * 
 */
    __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__Document *)__pyx_v_self->__pyx_vtab)->buildNewPrefix(__pyx_v_self)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_v_prefix);
    __pyx_v_prefix = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "src/lxml/lxml.etree.pyx":433
 *         while tree.xmlSearchNs(self._c_doc, c_node, c_prefix) is not NULL:
 *             prefix = self.buildNewPrefix()
 *             c_prefix = _cstr(prefix)             # <<<<<<<<<<<<<<
 * 
 *         # declare the namespace and return it
 */
    __pyx_v_c_prefix = PyBytes_AS_STRING(__pyx_v_prefix);
  }

  /* "src/lxml/lxml.etree.pyx":436
 * 
 *         # declare the namespace and return it
 *         c_ns = tree.xmlNewNs(c_node, c_href, c_prefix)             # <<<<<<<<<<<<<<
 *         if c_ns is NULL:
 *             python.PyErr_NoMemory()
 */
  __pyx_v_c_ns = xmlNewNs(__pyx_v_c_node, __pyx_v_c_href, __pyx_v_c_prefix);

  /* "src/lxml/lxml.etree.pyx":437
 *         # declare the namespace and return it
 *         c_ns = tree.xmlNewNs(c_node, c_href, c_prefix)
 *         if c_ns is NULL:             # <<<<<<<<<<<<<<
 *             python.PyErr_NoMemory()
 *         return c_ns
 */
  __pyx_t_5 = (__pyx_v_c_ns == NULL);
  if (__pyx_t_5) {

    /* "src/lxml/lxml.etree.pyx":438
 *         c_ns = tree.xmlNewNs(c_node, c_href, c_prefix)
 *         if c_ns is NULL:
 *             python.PyErr_NoMemory()             # <<<<<<<<<<<<<<
 *         return c_ns
 * 
 */
    __pyx_t_3 = PyErr_NoMemory(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L10;
  }
  __pyx_L10:;

  /* "src/lxml/lxml.etree.pyx":439
 *         if c_ns is NULL:
 *             python.PyErr_NoMemory()
 *         return c_ns             # <<<<<<<<<<<<<<
 * 
 *     cdef int _setNodeNs(self, xmlNode* c_node, char* href) except -1:
 */
  __pyx_r = __pyx_v_c_ns;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._Document._findOrBuildNodeNs");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_prefix);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":441
 *         return c_ns
 * 
 *     cdef int _setNodeNs(self, xmlNode* c_node, char* href) except -1:             # <<<<<<<<<<<<<<
 *         u"Lookup namespace structure and set it for the node."
 *         cdef xmlNs* c_ns
 */

static  int __pyx_f_4lxml_5etree_9_Document__setNodeNs(struct LxmlDocument *__pyx_v_self, xmlNode *__pyx_v_c_node, char *__pyx_v_href) {
  xmlNs *__pyx_v_c_ns;
  int __pyx_r;
  xmlNs *__pyx_t_1;
  __Pyx_RefNannySetupContext("_setNodeNs");

  /* "src/lxml/lxml.etree.pyx":444
 *         u"Lookup namespace structure and set it for the node."
 *         cdef xmlNs* c_ns
 *         c_ns = self._findOrBuildNodeNs(c_node, href, NULL, 0)             # <<<<<<<<<<<<<<
 *         tree.xmlSetNs(c_node, c_ns)
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__Document *)__pyx_v_self->__pyx_vtab)->_findOrBuildNodeNs(__pyx_v_self, __pyx_v_c_node, __pyx_v_href, NULL, 0); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_ns = __pyx_t_1;

  /* "src/lxml/lxml.etree.pyx":445
 *         cdef xmlNs* c_ns
 *         c_ns = self._findOrBuildNodeNs(c_node, href, NULL, 0)
 *         tree.xmlSetNs(c_node, c_ns)             # <<<<<<<<<<<<<<
 * 
 * cdef tuple __initPrefixCache():
 */
  xmlSetNs(__pyx_v_c_node, __pyx_v_c_ns);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._Document._setNodeNs");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":447
 *         tree.xmlSetNs(c_node, c_ns)
 * 
 * cdef tuple __initPrefixCache():             # <<<<<<<<<<<<<<
 *     cdef int i
 *     return tuple([ python.PyBytes_FromFormat("ns%d", i)
 */

static  PyObject *__pyx_f_4lxml_5etree___initPrefixCache(void) {
  int __pyx_v_i;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__initPrefixCache");

  /* "src/lxml/lxml.etree.pyx":449
 * cdef tuple __initPrefixCache():
 *     cdef int i
 *     return tuple([ python.PyBytes_FromFormat("ns%d", i)             # <<<<<<<<<<<<<<
 *                    for i in range(30) ])
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  for (__pyx_t_2 = 0; __pyx_t_2 < 30; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;
    __pyx_t_3 = ((PyObject *)PyBytes_FromFormat(__pyx_k_57, __pyx_v_i)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (unlikely(PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_3))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_t_3 = ((PyObject *)PyList_AsTuple(__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.__initPrefixCache");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":459
 *     cdef _Document NEW_DOCUMENT "PY_NEW" (object t)
 * 
 * cdef _Document _documentFactory(xmlDoc* c_doc, _BaseParser parser):             # <<<<<<<<<<<<<<
 *     cdef _Document result
 *     result = NEW_DOCUMENT(_Document)
 */

static  struct LxmlDocument *__pyx_f_4lxml_5etree__documentFactory(xmlDoc *__pyx_v_c_doc, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser) {
  struct LxmlDocument *__pyx_v_result;
  struct LxmlDocument *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("_documentFactory");
  __Pyx_INCREF((PyObject *)__pyx_v_parser);
  __pyx_v_result = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None);

  /* "src/lxml/lxml.etree.pyx":461
 * cdef _Document _documentFactory(xmlDoc* c_doc, _BaseParser parser):
 *     cdef _Document result
 *     result = NEW_DOCUMENT(_Document)             # <<<<<<<<<<<<<<
 *     result._c_doc = c_doc
 *     result._ns_counter = 0
 */
  __pyx_t_1 = ((PyObject *)PY_NEW(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Document)))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_result));
  __pyx_v_result = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/lxml.etree.pyx":462
 *     cdef _Document result
 *     result = NEW_DOCUMENT(_Document)
 *     result._c_doc = c_doc             # <<<<<<<<<<<<<<
 *     result._ns_counter = 0
 *     result._prefix_tail = None
 */
  __pyx_v_result->_c_doc = __pyx_v_c_doc;

  /* "src/lxml/lxml.etree.pyx":463
 *     result = NEW_DOCUMENT(_Document)
 *     result._c_doc = c_doc
 *     result._ns_counter = 0             # <<<<<<<<<<<<<<
 *     result._prefix_tail = None
 *     if parser is None:
 */
  __pyx_v_result->_ns_counter = 0;

  /* "src/lxml/lxml.etree.pyx":464
 *     result._c_doc = c_doc
 *     result._ns_counter = 0
 *     result._prefix_tail = None             # <<<<<<<<<<<<<<
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_result->_prefix_tail);
  __Pyx_DECREF(((PyObject *)__pyx_v_result->_prefix_tail));
  __pyx_v_result->_prefix_tail = ((PyObject*)Py_None);

  /* "src/lxml/lxml.etree.pyx":465
 *     result._ns_counter = 0
 *     result._prefix_tail = None
 *     if parser is None:             # <<<<<<<<<<<<<<
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     result._parser = parser
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_parser) == Py_None);
  if (__pyx_t_2) {

    /* "src/lxml/lxml.etree.pyx":466
 *     result._prefix_tail = None
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()             # <<<<<<<<<<<<<<
 *     result._parser = parser
 *     return result
 */
    __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext *)__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT->__pyx_vtab)->getDefaultParser(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(((PyObject *)__pyx_v_parser));
    __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "src/lxml/lxml.etree.pyx":467
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     result._parser = parser             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_parser));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_parser));
  __Pyx_GOTREF(__pyx_v_result->_parser);
  __Pyx_DECREF(((PyObject *)__pyx_v_result->_parser));
  __pyx_v_result->_parser = __pyx_v_parser;

  /* "src/lxml/lxml.etree.pyx":468
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     result._parser = parser
 *     return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  __pyx_r = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._documentFactory");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_result);
  __Pyx_DECREF((PyObject *)__pyx_v_parser);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":474
 *     u"Document information provided by parser and DTD."
 *     cdef _Document _doc
 *     def __cinit__(self, tree):             # <<<<<<<<<<<<<<
 *         u"Create a DocInfo object for an ElementTree object or root Element."
 *         self._doc = _documentOrRaise(tree)
 */

static int __pyx_pf_4lxml_5etree_7DocInfo___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_7DocInfo___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tree = 0;
  PyObject *__pyx_v_root_name;
  PyObject *__pyx_v_public_id;
  PyObject *__pyx_v_system_url;
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__tree,0};
  __Pyx_RefNannySetupContext("__cinit__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[1] = {0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tree);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_tree = values[0];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_tree = PyTuple_GET_ITEM(__pyx_args, 0);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.DocInfo.__cinit__");
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_root_name = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_public_id = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_system_url = Py_None; __Pyx_INCREF(Py_None);

  /* "src/lxml/lxml.etree.pyx":476
 *     def __cinit__(self, tree):
 *         u"Create a DocInfo object for an ElementTree object or root Element."
 *         self._doc = _documentOrRaise(tree)             # <<<<<<<<<<<<<<
 *         root_name, public_id, system_url = self._doc.getdoctype()
 *         if not root_name and (public_id or system_url):
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v_tree)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self)->_doc);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self)->_doc));
  ((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self)->_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/lxml.etree.pyx":477
 *         u"Create a DocInfo object for an ElementTree object or root Element."
 *         self._doc = _documentOrRaise(tree)
 *         root_name, public_id, system_url = self._doc.getdoctype()             # <<<<<<<<<<<<<<
 *         if not root_name and (public_id or system_url):
 *             raise ValueError, u"Could not find root node"
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__Document *)((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self)->_doc->__pyx_vtab)->getdoctype(((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self)->_doc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyTuple_CheckExact(__pyx_t_1) && likely(PyTuple_GET_SIZE(__pyx_t_1) == 3)) {
    PyObject* tuple = __pyx_t_1;
    __pyx_t_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_GET_ITEM(tuple, 2); __Pyx_INCREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_v_root_name);
    __pyx_v_root_name = __pyx_t_2;
    __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_v_public_id);
    __pyx_v_public_id = __pyx_t_3;
    __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_v_system_url);
    __pyx_v_system_url = __pyx_t_4;
    __pyx_t_4 = 0;
  } else {
    __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_5, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_5, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_UnpackItem(__pyx_t_5, 2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_EndUnpack(__pyx_t_5, 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_v_root_name);
    __pyx_v_root_name = __pyx_t_2;
    __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_v_public_id);
    __pyx_v_public_id = __pyx_t_3;
    __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_v_system_url);
    __pyx_v_system_url = __pyx_t_4;
    __pyx_t_4 = 0;
  }

  /* "src/lxml/lxml.etree.pyx":478
 *         self._doc = _documentOrRaise(tree)
 *         root_name, public_id, system_url = self._doc.getdoctype()
 *         if not root_name and (public_id or system_url):             # <<<<<<<<<<<<<<
 *             raise ValueError, u"Could not find root node"
 * 
 */
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_root_name); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_7 = (!__pyx_t_6);
  if (__pyx_t_7) {
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_public_id); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (!__pyx_t_6) {
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_system_url); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_9 = __pyx_t_8;
    } else {
      __pyx_t_9 = __pyx_t_6;
    }
    __pyx_t_6 = __pyx_t_9;
  } else {
    __pyx_t_6 = __pyx_t_7;
  }
  if (__pyx_t_6) {

    /* "src/lxml/lxml.etree.pyx":479
 *         root_name, public_id, system_url = self._doc.getdoctype()
 *         if not root_name and (public_id or system_url):
 *             raise ValueError, u"Could not find root node"             # <<<<<<<<<<<<<<
 * 
 *     property root_name:
 */
    __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_u_59), 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L6;
  }
  __pyx_L6:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.DocInfo.__cinit__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_root_name);
  __Pyx_DECREF(__pyx_v_public_id);
  __Pyx_DECREF(__pyx_v_system_url);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":483
 *     property root_name:
 *         u"Returns the name of the root node as defined by the DOCTYPE."
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             root_name, public_id, system_url = self._doc.getdoctype()
 *             return root_name
 */

static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_9root_name___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_9root_name___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_v_root_name;
  PyObject *__pyx_v_public_id;
  PyObject *__pyx_v_system_url;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __pyx_v_root_name = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_public_id = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_system_url = Py_None; __Pyx_INCREF(Py_None);

  /* "src/lxml/lxml.etree.pyx":484
 *         u"Returns the name of the root node as defined by the DOCTYPE."
 *         def __get__(self):
 *             root_name, public_id, system_url = self._doc.getdoctype()             # <<<<<<<<<<<<<<
 *             return root_name
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__Document *)((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self)->_doc->__pyx_vtab)->getdoctype(((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self)->_doc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyTuple_CheckExact(__pyx_t_1) && likely(PyTuple_GET_SIZE(__pyx_t_1) == 3)) {
    PyObject* tuple = __pyx_t_1;
    __pyx_t_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_GET_ITEM(tuple, 2); __Pyx_INCREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_v_root_name);
    __pyx_v_root_name = __pyx_t_2;
    __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_v_public_id);
    __pyx_v_public_id = __pyx_t_3;
    __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_v_system_url);
    __pyx_v_system_url = __pyx_t_4;
    __pyx_t_4 = 0;
  } else {
    __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_5, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_5, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_UnpackItem(__pyx_t_5, 2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_EndUnpack(__pyx_t_5, 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_v_root_name);
    __pyx_v_root_name = __pyx_t_2;
    __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_v_public_id);
    __pyx_v_public_id = __pyx_t_3;
    __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_v_system_url);
    __pyx_v_system_url = __pyx_t_4;
    __pyx_t_4 = 0;
  }

  /* "src/lxml/lxml.etree.pyx":485
 *         def __get__(self):
 *             root_name, public_id, system_url = self._doc.getdoctype()
 *             return root_name             # <<<<<<<<<<<<<<
 * 
 *     property public_id:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_root_name);
  __pyx_r = __pyx_v_root_name;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.DocInfo.root_name.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_root_name);
  __Pyx_DECREF(__pyx_v_public_id);
  __Pyx_DECREF(__pyx_v_system_url);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":489
 *     property public_id:
 *         u"Returns the public ID of the DOCTYPE."
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             root_name, public_id, system_url = self._doc.getdoctype()
 *             return public_id
 */

static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_9public_id___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_9public_id___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_v_root_name;
  PyObject *__pyx_v_public_id;
  PyObject *__pyx_v_system_url;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __pyx_v_root_name = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_public_id = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_system_url = Py_None; __Pyx_INCREF(Py_None);

  /* "src/lxml/lxml.etree.pyx":490
 *         u"Returns the public ID of the DOCTYPE."
 *         def __get__(self):
 *             root_name, public_id, system_url = self._doc.getdoctype()             # <<<<<<<<<<<<<<
 *             return public_id
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__Document *)((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self)->_doc->__pyx_vtab)->getdoctype(((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self)->_doc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyTuple_CheckExact(__pyx_t_1) && likely(PyTuple_GET_SIZE(__pyx_t_1) == 3)) {
    PyObject* tuple = __pyx_t_1;
    __pyx_t_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_GET_ITEM(tuple, 2); __Pyx_INCREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_v_root_name);
    __pyx_v_root_name = __pyx_t_2;
    __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_v_public_id);
    __pyx_v_public_id = __pyx_t_3;
    __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_v_system_url);
    __pyx_v_system_url = __pyx_t_4;
    __pyx_t_4 = 0;
  } else {
    __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_5, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_5, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_UnpackItem(__pyx_t_5, 2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_EndUnpack(__pyx_t_5, 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_v_root_name);
    __pyx_v_root_name = __pyx_t_2;
    __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_v_public_id);
    __pyx_v_public_id = __pyx_t_3;
    __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_v_system_url);
    __pyx_v_system_url = __pyx_t_4;
    __pyx_t_4 = 0;
  }

  /* "src/lxml/lxml.etree.pyx":491
 *         def __get__(self):
 *             root_name, public_id, system_url = self._doc.getdoctype()
 *             return public_id             # <<<<<<<<<<<<<<
 * 
 *     property system_url:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_public_id);
  __pyx_r = __pyx_v_public_id;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.DocInfo.public_id.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_root_name);
  __Pyx_DECREF(__pyx_v_public_id);
  __Pyx_DECREF(__pyx_v_system_url);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":495
 *     property system_url:
 *         u"Returns the system ID of the DOCTYPE."
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             root_name, public_id, system_url = self._doc.getdoctype()
 *             return system_url
 */

static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_10system_url___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_10system_url___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_v_root_name;
  PyObject *__pyx_v_public_id;
  PyObject *__pyx_v_system_url;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __pyx_v_root_name = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_public_id = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_system_url = Py_None; __Pyx_INCREF(Py_None);

  /* "src/lxml/lxml.etree.pyx":496
 *         u"Returns the system ID of the DOCTYPE."
 *         def __get__(self):
 *             root_name, public_id, system_url = self._doc.getdoctype()             # <<<<<<<<<<<<<<
 *             return system_url
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__Document *)((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self)->_doc->__pyx_vtab)->getdoctype(((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self)->_doc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyTuple_CheckExact(__pyx_t_1) && likely(PyTuple_GET_SIZE(__pyx_t_1) == 3)) {
    PyObject* tuple = __pyx_t_1;
    __pyx_t_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_GET_ITEM(tuple, 2); __Pyx_INCREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_v_root_name);
    __pyx_v_root_name = __pyx_t_2;
    __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_v_public_id);
    __pyx_v_public_id = __pyx_t_3;
    __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_v_system_url);
    __pyx_v_system_url = __pyx_t_4;
    __pyx_t_4 = 0;
  } else {
    __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_5, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_5, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_UnpackItem(__pyx_t_5, 2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_EndUnpack(__pyx_t_5, 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_v_root_name);
    __pyx_v_root_name = __pyx_t_2;
    __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_v_public_id);
    __pyx_v_public_id = __pyx_t_3;
    __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_v_system_url);
    __pyx_v_system_url = __pyx_t_4;
    __pyx_t_4 = 0;
  }

  /* "src/lxml/lxml.etree.pyx":497
 *         def __get__(self):
 *             root_name, public_id, system_url = self._doc.getdoctype()
 *             return system_url             # <<<<<<<<<<<<<<
 * 
 *     property xml_version:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_system_url);
  __pyx_r = __pyx_v_system_url;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.DocInfo.system_url.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_root_name);
  __Pyx_DECREF(__pyx_v_public_id);
  __Pyx_DECREF(__pyx_v_system_url);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":501
 *     property xml_version:
 *         u"Returns the XML version as declared by the document."
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             xml_version, encoding = self._doc.getxmlinfo()
 *             return xml_version
 */

static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_11xml_version___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_11xml_version___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_v_xml_version;
  PyObject *__pyx_v_encoding;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __pyx_v_xml_version = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_encoding = Py_None; __Pyx_INCREF(Py_None);

  /* "src/lxml/lxml.etree.pyx":502
 *         u"Returns the XML version as declared by the document."
 *         def __get__(self):
 *             xml_version, encoding = self._doc.getxmlinfo()             # <<<<<<<<<<<<<<
 *             return xml_version
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__Document *)((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self)->_doc->__pyx_vtab)->getxmlinfo(((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self)->_doc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyTuple_CheckExact(__pyx_t_1) && likely(PyTuple_GET_SIZE(__pyx_t_1) == 2)) {
    PyObject* tuple = __pyx_t_1;
    __pyx_t_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_v_xml_version);
    __pyx_v_xml_version = __pyx_t_2;
    __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_v_encoding);
    __pyx_v_encoding = __pyx_t_3;
    __pyx_t_3 = 0;
  } else {
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_4, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_4, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_EndUnpack(__pyx_t_4, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_v_xml_version);
    __pyx_v_xml_version = __pyx_t_2;
    __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_v_encoding);
    __pyx_v_encoding = __pyx_t_3;
    __pyx_t_3 = 0;
  }

  /* "src/lxml/lxml.etree.pyx":503
 *         def __get__(self):
 *             xml_version, encoding = self._doc.getxmlinfo()
 *             return xml_version             # <<<<<<<<<<<<<<
 * 
 *     property encoding:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_xml_version);
  __pyx_r = __pyx_v_xml_version;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.DocInfo.xml_version.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_xml_version);
  __Pyx_DECREF(__pyx_v_encoding);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":507
 *     property encoding:
 *         u"Returns the encoding name as declared by the document."
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             xml_version, encoding = self._doc.getxmlinfo()
 *             return encoding
 */

static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_8encoding___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_8encoding___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_v_xml_version;
  PyObject *__pyx_v_encoding;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __pyx_v_xml_version = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_encoding = Py_None; __Pyx_INCREF(Py_None);

  /* "src/lxml/lxml.etree.pyx":508
 *         u"Returns the encoding name as declared by the document."
 *         def __get__(self):
 *             xml_version, encoding = self._doc.getxmlinfo()             # <<<<<<<<<<<<<<
 *             return encoding
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__Document *)((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self)->_doc->__pyx_vtab)->getxmlinfo(((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self)->_doc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyTuple_CheckExact(__pyx_t_1) && likely(PyTuple_GET_SIZE(__pyx_t_1) == 2)) {
    PyObject* tuple = __pyx_t_1;
    __pyx_t_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_v_xml_version);
    __pyx_v_xml_version = __pyx_t_2;
    __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_v_encoding);
    __pyx_v_encoding = __pyx_t_3;
    __pyx_t_3 = 0;
  } else {
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_4, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_4, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_EndUnpack(__pyx_t_4, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_v_xml_version);
    __pyx_v_xml_version = __pyx_t_2;
    __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_v_encoding);
    __pyx_v_encoding = __pyx_t_3;
    __pyx_t_3 = 0;
  }

  /* "src/lxml/lxml.etree.pyx":509
 *         def __get__(self):
 *             xml_version, encoding = self._doc.getxmlinfo()
 *             return encoding             # <<<<<<<<<<<<<<
 * 
 *     property standalone:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_encoding);
  __pyx_r = __pyx_v_encoding;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.DocInfo.encoding.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_xml_version);
  __Pyx_DECREF(__pyx_v_encoding);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":519
 *         ``standalone`` flag was set to ``'yes'`` or not.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._doc.isstandalone()
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_10standalone___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_10standalone___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__");

  /* "src/lxml/lxml.etree.pyx":520
 *         """
 *         def __get__(self):
 *             return self._doc.isstandalone()             # <<<<<<<<<<<<<<
 * 
 *     property URL:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__Document *)((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self)->_doc->__pyx_vtab)->isstandalone(((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self)->_doc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.DocInfo.standalone.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":524
 *     property URL:
 *         u"The source URL of the document (or None if unknown)."
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if self._doc._c_doc.URL is NULL:
 *                 return None
 */

static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_3URL___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_3URL___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__get__");

  /* "src/lxml/lxml.etree.pyx":525
 *         u"The source URL of the document (or None if unknown)."
 *         def __get__(self):
 *             if self._doc._c_doc.URL is NULL:             # <<<<<<<<<<<<<<
 *                 return None
 *             return _decodeFilename(self._doc._c_doc.URL)
 */
  __pyx_t_1 = (((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self)->_doc->_c_doc->URL == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/lxml.etree.pyx":526
 *         def __get__(self):
 *             if self._doc._c_doc.URL is NULL:
 *                 return None             # <<<<<<<<<<<<<<
 *             return _decodeFilename(self._doc._c_doc.URL)
 *         def __set__(self, url):
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "src/lxml/lxml.etree.pyx":527
 *             if self._doc._c_doc.URL is NULL:
 *                 return None
 *             return _decodeFilename(self._doc._c_doc.URL)             # <<<<<<<<<<<<<<
 *         def __set__(self, url):
 *             cdef char* c_oldurl
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree__decodeFilename(((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self)->_doc->_c_doc->URL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.DocInfo.URL.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":528
 *                 return None
 *             return _decodeFilename(self._doc._c_doc.URL)
 *         def __set__(self, url):             # <<<<<<<<<<<<<<
 *             cdef char* c_oldurl
 *             url = _encodeFilename(url)
 */

static int __pyx_pf_4lxml_5etree_7DocInfo_3URL_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_url); /*proto*/
static int __pyx_pf_4lxml_5etree_7DocInfo_3URL_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_url) {
  char *__pyx_v_c_oldurl;
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("__set__");
  __Pyx_INCREF(__pyx_v_url);

  /* "src/lxml/lxml.etree.pyx":530
 *         def __set__(self, url):
 *             cdef char* c_oldurl
 *             url = _encodeFilename(url)             # <<<<<<<<<<<<<<
 *             c_oldurl = self._doc._c_doc.URL
 *             if url is None:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_url); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_v_url);
  __pyx_v_url = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/lxml.etree.pyx":531
 *             cdef char* c_oldurl
 *             url = _encodeFilename(url)
 *             c_oldurl = self._doc._c_doc.URL             # <<<<<<<<<<<<<<
 *             if url is None:
 *                 self._doc._c_doc.URL = NULL
 */
  __pyx_v_c_oldurl = ((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self)->_doc->_c_doc->URL;

  /* "src/lxml/lxml.etree.pyx":532
 *             url = _encodeFilename(url)
 *             c_oldurl = self._doc._c_doc.URL
 *             if url is None:             # <<<<<<<<<<<<<<
 *                 self._doc._c_doc.URL = NULL
 *             else:
 */
  __pyx_t_2 = (__pyx_v_url == Py_None);
  if (__pyx_t_2) {

    /* "src/lxml/lxml.etree.pyx":533
 *             c_oldurl = self._doc._c_doc.URL
 *             if url is None:
 *                 self._doc._c_doc.URL = NULL             # <<<<<<<<<<<<<<
 *             else:
 *                 self._doc._c_doc.URL = tree.xmlStrdup(_cstr(url))
 */
    ((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self)->_doc->_c_doc->URL = NULL;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "src/lxml/lxml.etree.pyx":535
 *                 self._doc._c_doc.URL = NULL
 *             else:
 *                 self._doc._c_doc.URL = tree.xmlStrdup(_cstr(url))             # <<<<<<<<<<<<<<
 *             if c_oldurl is not NULL:
 *                 tree.xmlFree(c_oldurl)
 */
    ((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self)->_doc->_c_doc->URL = xmlStrdup(PyBytes_AS_STRING(__pyx_v_url));
  }
  __pyx_L5:;

  /* "src/lxml/lxml.etree.pyx":536
 *             else:
 *                 self._doc._c_doc.URL = tree.xmlStrdup(_cstr(url))
 *             if c_oldurl is not NULL:             # <<<<<<<<<<<<<<
 *                 tree.xmlFree(c_oldurl)
 * 
 */
  __pyx_t_2 = (__pyx_v_c_oldurl != NULL);
  if (__pyx_t_2) {

    /* "src/lxml/lxml.etree.pyx":537
 *                 self._doc._c_doc.URL = tree.xmlStrdup(_cstr(url))
 *             if c_oldurl is not NULL:
 *                 tree.xmlFree(c_oldurl)             # <<<<<<<<<<<<<<
 * 
 *     property doctype:
 */
    xmlFree(__pyx_v_c_oldurl);
    goto __pyx_L6;
  }
  __pyx_L6:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.DocInfo.URL.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_url);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":541
 *     property doctype:
 *         u"Returns a DOCTYPE declaration string for the document."
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             root_name, public_id, system_url = self._doc.getdoctype()
 *             if public_id:
 */

static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_7doctype___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_7doctype___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_v_root_name;
  PyObject *__pyx_v_public_id;
  PyObject *__pyx_v_system_url;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("__get__");
  __pyx_v_root_name = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_public_id = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_system_url = Py_None; __Pyx_INCREF(Py_None);

  /* "src/lxml/lxml.etree.pyx":542
 *         u"Returns a DOCTYPE declaration string for the document."
 *         def __get__(self):
 *             root_name, public_id, system_url = self._doc.getdoctype()             # <<<<<<<<<<<<<<
 *             if public_id:
 *                 if system_url:
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__Document *)((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self)->_doc->__pyx_vtab)->getdoctype(((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self)->_doc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyTuple_CheckExact(__pyx_t_1) && likely(PyTuple_GET_SIZE(__pyx_t_1) == 3)) {
    PyObject* tuple = __pyx_t_1;
    __pyx_t_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_GET_ITEM(tuple, 2); __Pyx_INCREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_v_root_name);
    __pyx_v_root_name = __pyx_t_2;
    __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_v_public_id);
    __pyx_v_public_id = __pyx_t_3;
    __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_v_system_url);
    __pyx_v_system_url = __pyx_t_4;
    __pyx_t_4 = 0;
  } else {
    __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_5, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_5, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_UnpackItem(__pyx_t_5, 2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_EndUnpack(__pyx_t_5, 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_v_root_name);
    __pyx_v_root_name = __pyx_t_2;
    __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_v_public_id);
    __pyx_v_public_id = __pyx_t_3;
    __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_v_system_url);
    __pyx_v_system_url = __pyx_t_4;
    __pyx_t_4 = 0;
  }

  /* "src/lxml/lxml.etree.pyx":543
 *         def __get__(self):
 *             root_name, public_id, system_url = self._doc.getdoctype()
 *             if public_id:             # <<<<<<<<<<<<<<
 *                 if system_url:
 *                     return u'<!DOCTYPE %s PUBLIC "%s" "%s">' % (
 */
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_public_id); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_6) {

    /* "src/lxml/lxml.etree.pyx":544
 *             root_name, public_id, system_url = self._doc.getdoctype()
 *             if public_id:
 *                 if system_url:             # <<<<<<<<<<<<<<
 *                     return u'<!DOCTYPE %s PUBLIC "%s" "%s">' % (
 *                         root_name, public_id, system_url)
 */
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_system_url); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_6) {

      /* "src/lxml/lxml.etree.pyx":545
 *             if public_id:
 *                 if system_url:
 *                     return u'<!DOCTYPE %s PUBLIC "%s" "%s">' % (             # <<<<<<<<<<<<<<
 *                         root_name, public_id, system_url)
 *                 else:
 */
      __Pyx_XDECREF(__pyx_r);

      /* "src/lxml/lxml.etree.pyx":546
 *                 if system_url:
 *                     return u'<!DOCTYPE %s PUBLIC "%s" "%s">' % (
 *                         root_name, public_id, system_url)             # <<<<<<<<<<<<<<
 *                 else:
 *                     return u'<!DOCTYPE %s PUBLIC "%s">' % (
 */
      __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      __Pyx_INCREF(__pyx_v_root_name);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_root_name);
      __Pyx_GIVEREF(__pyx_v_root_name);
      __Pyx_INCREF(__pyx_v_public_id);
      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_public_id);
      __Pyx_GIVEREF(__pyx_v_public_id);
      __Pyx_INCREF(__pyx_v_system_url);
      PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_system_url);
      __Pyx_GIVEREF(__pyx_v_system_url);
      __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_60), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
      __pyx_r = ((PyObject *)__pyx_t_4);
      __pyx_t_4 = 0;
      goto __pyx_L0;
      goto __pyx_L6;
    }
    /*else*/ {

      /* "src/lxml/lxml.etree.pyx":548
 *                         root_name, public_id, system_url)
 *                 else:
 *                     return u'<!DOCTYPE %s PUBLIC "%s">' % (             # <<<<<<<<<<<<<<
 *                         root_name, public_id)
 *             elif system_url:
 */
      __Pyx_XDECREF(__pyx_r);

      /* "src/lxml/lxml.etree.pyx":549
 *                 else:
 *                     return u'<!DOCTYPE %s PUBLIC "%s">' % (
 *                         root_name, public_id)             # <<<<<<<<<<<<<<
 *             elif system_url:
 *                 return u'<!DOCTYPE %s SYSTEM "%s">' % (
 */
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      __Pyx_INCREF(__pyx_v_root_name);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_root_name);
      __Pyx_GIVEREF(__pyx_v_root_name);
      __Pyx_INCREF(__pyx_v_public_id);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_public_id);
      __Pyx_GIVEREF(__pyx_v_public_id);
      __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_61), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __pyx_r = ((PyObject *)__pyx_t_1);
      __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __pyx_L6:;
    goto __pyx_L5;
  }

  /* "src/lxml/lxml.etree.pyx":550
 *                     return u'<!DOCTYPE %s PUBLIC "%s">' % (
 *                         root_name, public_id)
 *             elif system_url:             # <<<<<<<<<<<<<<
 *                 return u'<!DOCTYPE %s SYSTEM "%s">' % (
 *                     root_name, system_url)
 */
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_system_url); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_6) {

    /* "src/lxml/lxml.etree.pyx":551
 *                         root_name, public_id)
 *             elif system_url:
 *                 return u'<!DOCTYPE %s SYSTEM "%s">' % (             # <<<<<<<<<<<<<<
 *                     root_name, system_url)
 *             elif self._doc.hasdoctype():
 */
    __Pyx_XDECREF(__pyx_r);

    /* "src/lxml/lxml.etree.pyx":552
 *             elif system_url:
 *                 return u'<!DOCTYPE %s SYSTEM "%s">' % (
 *                     root_name, system_url)             # <<<<<<<<<<<<<<
 *             elif self._doc.hasdoctype():
 *                 return u'<!DOCTYPE %s>' % root_name
 */
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __Pyx_INCREF(__pyx_v_root_name);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_root_name);
    __Pyx_GIVEREF(__pyx_v_root_name);
    __Pyx_INCREF(__pyx_v_system_url);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_system_url);
    __Pyx_GIVEREF(__pyx_v_system_url);
    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_62), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __pyx_r = ((PyObject *)__pyx_t_4);
    __pyx_t_4 = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }

  /* "src/lxml/lxml.etree.pyx":553
 *                 return u'<!DOCTYPE %s SYSTEM "%s">' % (
 *                     root_name, system_url)
 *             elif self._doc.hasdoctype():             # <<<<<<<<<<<<<<
 *                 return u'<!DOCTYPE %s>' % root_name
 *             else:
 */
  __pyx_t_6 = ((struct __pyx_vtabstruct_4lxml_5etree__Document *)((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self)->_doc->__pyx_vtab)->hasdoctype(((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self)->_doc);
  if (__pyx_t_6) {

    /* "src/lxml/lxml.etree.pyx":554
 *                     root_name, system_url)
 *             elif self._doc.hasdoctype():
 *                 return u'<!DOCTYPE %s>' % root_name             # <<<<<<<<<<<<<<
 *             else:
 *                 return u""
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_63), __pyx_v_root_name); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __pyx_r = ((PyObject *)__pyx_t_4);
    __pyx_t_4 = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "src/lxml/lxml.etree.pyx":556
 *                 return u'<!DOCTYPE %s>' % root_name
 *             else:
 *                 return u""             # <<<<<<<<<<<<<<
 * 
 *     property internalDTD:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_kp_u_25));
    __pyx_r = ((PyObject *)__pyx_kp_u_25);
    goto __pyx_L0;
  }
  __pyx_L5:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.DocInfo.doctype.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_root_name);
  __Pyx_DECREF(__pyx_v_public_id);
  __Pyx_DECREF(__pyx_v_system_url);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":560
 *     property internalDTD:
 *         u"Returns a DTD validator based on the internal subset of the document."
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return _dtdFactory(self._doc._c_doc.intSubset)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_11internalDTD___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_11internalDTD___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__");

  /* "src/lxml/lxml.etree.pyx":561
 *         u"Returns a DTD validator based on the internal subset of the document."
 *         def __get__(self):
 *             return _dtdFactory(self._doc._c_doc.intSubset)             # <<<<<<<<<<<<<<
 * 
 *     property externalDTD:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__dtdFactory(((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self)->_doc->_c_doc->intSubset)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.DocInfo.internalDTD.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":565
 *     property externalDTD:
 *         u"Returns a DTD validator based on the external subset of the document."
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return _dtdFactory(self._doc._c_doc.extSubset)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_11externalDTD___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_11externalDTD___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__");

  /* "src/lxml/lxml.etree.pyx":566
 *         u"Returns a DTD validator based on the external subset of the document."
 *         def __get__(self):
 *             return _dtdFactory(self._doc._c_doc.extSubset)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__dtdFactory(((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self)->_doc->_c_doc->extSubset)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.DocInfo.externalDTD.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":582
 *     cdef object _tag
 * 
 *     def _init(self):             # <<<<<<<<<<<<<<
 *         u"""_init(self)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_8_Element__init(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element__init[] = "_init(self)\n\n        Called after object initialisation.  Custom subclasses may override\n        this if they recursively call _init() in the superclasses.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_8_Element__init(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("_init");

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":589
 *         """
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         #print "trying to free node:", <int>self._c_node
 *         #displayNode(self._c_node, 0)
 */

static void __pyx_pf_4lxml_5etree_8_Element_1__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pf_4lxml_5etree_8_Element_1__dealloc__(PyObject *__pyx_v_self) {
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("__dealloc__");

  /* "src/lxml/lxml.etree.pyx":592
 *         #print "trying to free node:", <int>self._c_node
 *         #displayNode(self._c_node, 0)
 *         if self._c_node is not NULL:             # <<<<<<<<<<<<<<
 *             _unregisterProxy(self)
 *             attemptDeallocation(self._c_node)
 */
  __pyx_t_1 = (((struct LxmlElement *)__pyx_v_self)->_c_node != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/lxml.etree.pyx":593
 *         #displayNode(self._c_node, 0)
 *         if self._c_node is not NULL:
 *             _unregisterProxy(self)             # <<<<<<<<<<<<<<
 *             attemptDeallocation(self._c_node)
 *         _releaseProxy(self)
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree__unregisterProxy(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "src/lxml/lxml.etree.pyx":594
 *         if self._c_node is not NULL:
 *             _unregisterProxy(self)
 *             attemptDeallocation(self._c_node)             # <<<<<<<<<<<<<<
 *         _releaseProxy(self)
 * 
 */
    __pyx_f_4lxml_5etree_attemptDeallocation(((struct LxmlElement *)__pyx_v_self)->_c_node);
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "src/lxml/lxml.etree.pyx":595
 *             _unregisterProxy(self)
 *             attemptDeallocation(self._c_node)
 *         _releaseProxy(self)             # <<<<<<<<<<<<<<
 * 
 *     # MANIPULATORS
 */
  __pyx_f_4lxml_5etree__releaseProxy(((struct LxmlElement *)__pyx_v_self));

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._Element.__dealloc__");
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "src/lxml/lxml.etree.pyx":599
 *     # MANIPULATORS
 * 
 *     def __setitem__(self, x, value):             # <<<<<<<<<<<<<<
 *         u"""__setitem__(self, x, value)
 * 
 */

static int __pyx_pf_4lxml_5etree_8_Element_2__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_value); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_2__setitem__[] = "__setitem__(self, x, value)\n\n        Replaces the given subelement index or slice.\n        ";
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_8_Element_2__setitem__;
static int __pyx_pf_4lxml_5etree_8_Element_2__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_value) {
  xmlNode *__pyx_v_c_node;
  xmlNode *__pyx_v_c_next;
  xmlDoc *__pyx_v_c_source_doc;
  struct LxmlElement *__pyx_v_element;
  int __pyx_v_left_to_right;
  Py_ssize_t __pyx_v_slicelength;
  Py_ssize_t __pyx_v_step;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("__setitem__");
  __pyx_v_element = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);

  /* "src/lxml/lxml.etree.pyx":610
 *         cdef bint left_to_right
 *         cdef Py_ssize_t slicelength, step
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         if value is None:
 *             raise ValueError, u"cannot assign None"
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":611
 *         cdef Py_ssize_t slicelength, step
 *         _assertValidNode(self)
 *         if value is None:             # <<<<<<<<<<<<<<
 *             raise ValueError, u"cannot assign None"
 *         if python.PySlice_Check(x):
 */
  __pyx_t_2 = (__pyx_v_value == Py_None);
  if (__pyx_t_2) {

    /* "src/lxml/lxml.etree.pyx":612
 *         _assertValidNode(self)
 *         if value is None:
 *             raise ValueError, u"cannot assign None"             # <<<<<<<<<<<<<<
 *         if python.PySlice_Check(x):
 *             # slice assignment
 */
    __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_u_64), 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "src/lxml/lxml.etree.pyx":613
 *         if value is None:
 *             raise ValueError, u"cannot assign None"
 *         if python.PySlice_Check(x):             # <<<<<<<<<<<<<<
 *             # slice assignment
 *             _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)
 */
  __pyx_t_2 = PySlice_Check(__pyx_v_x);
  if (__pyx_t_2) {

    /* "src/lxml/lxml.etree.pyx":615
 *         if python.PySlice_Check(x):
 *             # slice assignment
 *             _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)             # <<<<<<<<<<<<<<
 *             if step > 0:
 *                 left_to_right = 1
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree__findChildSlice(((PyObject*)__pyx_v_x), ((struct LxmlElement *)__pyx_v_self)->_c_node, (&__pyx_v_c_node), (&__pyx_v_step), (&__pyx_v_slicelength)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "src/lxml/lxml.etree.pyx":616
 *             # slice assignment
 *             _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)
 *             if step > 0:             # <<<<<<<<<<<<<<
 *                 left_to_right = 1
 *             else:
 */
    __pyx_t_2 = (__pyx_v_step > 0);
    if (__pyx_t_2) {

      /* "src/lxml/lxml.etree.pyx":617
 *             _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)
 *             if step > 0:
 *                 left_to_right = 1             # <<<<<<<<<<<<<<
 *             else:
 *                 left_to_right = 0
 */
      __pyx_v_left_to_right = 1;
      goto __pyx_L7;
    }
    /*else*/ {

      /* "src/lxml/lxml.etree.pyx":619
 *                 left_to_right = 1
 *             else:
 *                 left_to_right = 0             # <<<<<<<<<<<<<<
 *                 step = -step
 *             _replaceSlice(self, c_node, slicelength, step, left_to_right, value)
 */
      __pyx_v_left_to_right = 0;

      /* "src/lxml/lxml.etree.pyx":620
 *             else:
 *                 left_to_right = 0
 *                 step = -step             # <<<<<<<<<<<<<<
 *             _replaceSlice(self, c_node, slicelength, step, left_to_right, value)
 *             return
 */
      __pyx_v_step = (-__pyx_v_step);
    }
    __pyx_L7:;

    /* "src/lxml/lxml.etree.pyx":621
 *                 left_to_right = 0
 *                 step = -step
 *             _replaceSlice(self, c_node, slicelength, step, left_to_right, value)             # <<<<<<<<<<<<<<
 *             return
 *         else:
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree__replaceSlice(((struct LxmlElement *)__pyx_v_self), __pyx_v_c_node, __pyx_v_slicelength, __pyx_v_step, __pyx_v_left_to_right, __pyx_v_value); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "src/lxml/lxml.etree.pyx":622
 *                 step = -step
 *             _replaceSlice(self, c_node, slicelength, step, left_to_right, value)
 *             return             # <<<<<<<<<<<<<<
 *         else:
 *             # otherwise: normal item assignment
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "src/lxml/lxml.etree.pyx":625
 *         else:
 *             # otherwise: normal item assignment
 *             element = value             # <<<<<<<<<<<<<<
 *             _assertValidNode(element)
 *             c_node = _findChild(self._c_node, x)
 */
    if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_INCREF(__pyx_v_value);
    __Pyx_DECREF(((PyObject *)__pyx_v_element));
    __pyx_v_element = ((struct LxmlElement *)__pyx_v_value);

    /* "src/lxml/lxml.etree.pyx":626
 *             # otherwise: normal item assignment
 *             element = value
 *             _assertValidNode(element)             # <<<<<<<<<<<<<<
 *             c_node = _findChild(self._c_node, x)
 *             if c_node is NULL:
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "src/lxml/lxml.etree.pyx":627
 *             element = value
 *             _assertValidNode(element)
 *             c_node = _findChild(self._c_node, x)             # <<<<<<<<<<<<<<
 *             if c_node is NULL:
 *                 raise IndexError, u"list index out of range"
 */
    __pyx_t_3 = __Pyx_PyIndex_AsSsize_t(__pyx_v_x); if (unlikely((__pyx_t_3 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_c_node = __pyx_f_4lxml_5etree__findChild(((struct LxmlElement *)__pyx_v_self)->_c_node, __pyx_t_3);

    /* "src/lxml/lxml.etree.pyx":628
 *             _assertValidNode(element)
 *             c_node = _findChild(self._c_node, x)
 *             if c_node is NULL:             # <<<<<<<<<<<<<<
 *                 raise IndexError, u"list index out of range"
 *             c_source_doc = element._c_node.doc
 */
    __pyx_t_2 = (__pyx_v_c_node == NULL);
    if (__pyx_t_2) {

      /* "src/lxml/lxml.etree.pyx":629
 *             c_node = _findChild(self._c_node, x)
 *             if c_node is NULL:
 *                 raise IndexError, u"list index out of range"             # <<<<<<<<<<<<<<
 *             c_source_doc = element._c_node.doc
 *             c_next = element._c_node.next
 */
      __Pyx_Raise(__pyx_builtin_IndexError, ((PyObject *)__pyx_kp_u_65), 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "src/lxml/lxml.etree.pyx":630
 *             if c_node is NULL:
 *                 raise IndexError, u"list index out of range"
 *             c_source_doc = element._c_node.doc             # <<<<<<<<<<<<<<
 *             c_next = element._c_node.next
 *             _removeText(c_node.next)
 */
    __pyx_v_c_source_doc = __pyx_v_element->_c_node->doc;

    /* "src/lxml/lxml.etree.pyx":631
 *                 raise IndexError, u"list index out of range"
 *             c_source_doc = element._c_node.doc
 *             c_next = element._c_node.next             # <<<<<<<<<<<<<<
 *             _removeText(c_node.next)
 *             tree.xmlReplaceNode(c_node, element._c_node)
 */
    __pyx_v_c_next = __pyx_v_element->_c_node->next;

    /* "src/lxml/lxml.etree.pyx":632
 *             c_source_doc = element._c_node.doc
 *             c_next = element._c_node.next
 *             _removeText(c_node.next)             # <<<<<<<<<<<<<<
 *             tree.xmlReplaceNode(c_node, element._c_node)
 *             _moveTail(c_next, element._c_node)
 */
    __pyx_f_4lxml_5etree__removeText(__pyx_v_c_node->next);

    /* "src/lxml/lxml.etree.pyx":633
 *             c_next = element._c_node.next
 *             _removeText(c_node.next)
 *             tree.xmlReplaceNode(c_node, element._c_node)             # <<<<<<<<<<<<<<
 *             _moveTail(c_next, element._c_node)
 *             moveNodeToDocument(self._doc, c_source_doc, element._c_node)
 */
    xmlReplaceNode(__pyx_v_c_node, __pyx_v_element->_c_node);

    /* "src/lxml/lxml.etree.pyx":634
 *             _removeText(c_node.next)
 *             tree.xmlReplaceNode(c_node, element._c_node)
 *             _moveTail(c_next, element._c_node)             # <<<<<<<<<<<<<<
 *             moveNodeToDocument(self._doc, c_source_doc, element._c_node)
 *             if not attemptDeallocation(c_node):
 */
    __pyx_f_4lxml_5etree__moveTail(__pyx_v_c_next, __pyx_v_element->_c_node);

    /* "src/lxml/lxml.etree.pyx":635
 *             tree.xmlReplaceNode(c_node, element._c_node)
 *             _moveTail(c_next, element._c_node)
 *             moveNodeToDocument(self._doc, c_source_doc, element._c_node)             # <<<<<<<<<<<<<<
 *             if not attemptDeallocation(c_node):
 *                 moveNodeToDocument(self._doc, c_node.doc, c_node)
 */
    __pyx_t_4 = ((PyObject *)((struct LxmlElement *)__pyx_v_self)->_doc);
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_1 = __pyx_f_4lxml_5etree_moveNodeToDocument(((struct LxmlDocument *)__pyx_t_4), __pyx_v_c_source_doc, __pyx_v_element->_c_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "src/lxml/lxml.etree.pyx":636
 *             _moveTail(c_next, element._c_node)
 *             moveNodeToDocument(self._doc, c_source_doc, element._c_node)
 *             if not attemptDeallocation(c_node):             # <<<<<<<<<<<<<<
 *                 moveNodeToDocument(self._doc, c_node.doc, c_node)
 * 
 */
    __pyx_t_2 = (!__pyx_f_4lxml_5etree_attemptDeallocation(__pyx_v_c_node));
    if (__pyx_t_2) {

      /* "src/lxml/lxml.etree.pyx":637
 *             moveNodeToDocument(self._doc, c_source_doc, element._c_node)
 *             if not attemptDeallocation(c_node):
 *                 moveNodeToDocument(self._doc, c_node.doc, c_node)             # <<<<<<<<<<<<<<
 * 
 *     def __delitem__(self, x):
 */
      __pyx_t_4 = ((PyObject *)((struct LxmlElement *)__pyx_v_self)->_doc);
      __Pyx_INCREF(__pyx_t_4);
      __pyx_t_1 = __pyx_f_4lxml_5etree_moveNodeToDocument(((struct LxmlDocument *)__pyx_t_4), __pyx_v_c_node->doc, __pyx_v_c_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L9;
    }
    __pyx_L9:;
  }
  __pyx_L6:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._Element.__setitem__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_element);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":639
 *                 moveNodeToDocument(self._doc, c_node.doc, c_node)
 * 
 *     def __delitem__(self, x):             # <<<<<<<<<<<<<<
 *         u"""__delitem__(self, x)
 * 
 */

static int __pyx_pf_4lxml_5etree_8_Element_3__delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_3__delitem__[] = "__delitem__(self, x)\n\n        Deletes the given subelement or a slice.\n        ";
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_8_Element_3__delitem__;
static int __pyx_pf_4lxml_5etree_8_Element_3__delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  xmlNode *__pyx_v_c_node;
  xmlNode *__pyx_v_c_next;
  Py_ssize_t __pyx_v_step;
  Py_ssize_t __pyx_v_slicelength;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  __Pyx_RefNannySetupContext("__delitem__");

  /* "src/lxml/lxml.etree.pyx":647
 *         cdef xmlNode* c_next
 *         cdef Py_ssize_t step, slicelength
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         if python.PySlice_Check(x):
 *             # slice deletion
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":648
 *         cdef Py_ssize_t step, slicelength
 *         _assertValidNode(self)
 *         if python.PySlice_Check(x):             # <<<<<<<<<<<<<<
 *             # slice deletion
 *             if _isFullSlice(<slice>x):
 */
  __pyx_t_2 = PySlice_Check(__pyx_v_x);
  if (__pyx_t_2) {

    /* "src/lxml/lxml.etree.pyx":650
 *         if python.PySlice_Check(x):
 *             # slice deletion
 *             if _isFullSlice(<slice>x):             # <<<<<<<<<<<<<<
 *                 c_node = self._c_node.children
 *                 if c_node is not NULL:
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree__isFullSlice(((PyObject*)__pyx_v_x));
    if (__pyx_t_2) {

      /* "src/lxml/lxml.etree.pyx":651
 *             # slice deletion
 *             if _isFullSlice(<slice>x):
 *                 c_node = self._c_node.children             # <<<<<<<<<<<<<<
 *                 if c_node is not NULL:
 *                     if not _isElement(c_node):
 */
      __pyx_v_c_node = ((struct LxmlElement *)__pyx_v_self)->_c_node->children;

      /* "src/lxml/lxml.etree.pyx":652
 *             if _isFullSlice(<slice>x):
 *                 c_node = self._c_node.children
 *                 if c_node is not NULL:             # <<<<<<<<<<<<<<
 *                     if not _isElement(c_node):
 *                         c_node = _nextElement(c_node)
 */
      __pyx_t_2 = (__pyx_v_c_node != NULL);
      if (__pyx_t_2) {

        /* "src/lxml/lxml.etree.pyx":653
 *                 c_node = self._c_node.children
 *                 if c_node is not NULL:
 *                     if not _isElement(c_node):             # <<<<<<<<<<<<<<
 *                         c_node = _nextElement(c_node)
 *                     while c_node is not NULL:
 */
        __pyx_t_2 = (!_isElement(__pyx_v_c_node));
        if (__pyx_t_2) {

          /* "src/lxml/lxml.etree.pyx":654
 *                 if c_node is not NULL:
 *                     if not _isElement(c_node):
 *                         c_node = _nextElement(c_node)             # <<<<<<<<<<<<<<
 *                     while c_node is not NULL:
 *                         c_next = _nextElement(c_node)
 */
          __pyx_v_c_node = __pyx_f_4lxml_5etree__nextElement(__pyx_v_c_node);
          goto __pyx_L8;
        }
        __pyx_L8:;

        /* "src/lxml/lxml.etree.pyx":655
 *                     if not _isElement(c_node):
 *                         c_node = _nextElement(c_node)
 *                     while c_node is not NULL:             # <<<<<<<<<<<<<<
 *                         c_next = _nextElement(c_node)
 *                         _removeNode(self._doc, c_node)
 */
        while (1) {
          __pyx_t_2 = (__pyx_v_c_node != NULL);
          if (!__pyx_t_2) break;

          /* "src/lxml/lxml.etree.pyx":656
 *                         c_node = _nextElement(c_node)
 *                     while c_node is not NULL:
 *                         c_next = _nextElement(c_node)             # <<<<<<<<<<<<<<
 *                         _removeNode(self._doc, c_node)
 *                         c_node = c_next
 */
          __pyx_v_c_next = __pyx_f_4lxml_5etree__nextElement(__pyx_v_c_node);

          /* "src/lxml/lxml.etree.pyx":657
 *                     while c_node is not NULL:
 *                         c_next = _nextElement(c_node)
 *                         _removeNode(self._doc, c_node)             # <<<<<<<<<<<<<<
 *                         c_node = c_next
 *             else:
 */
          __pyx_t_3 = ((PyObject *)((struct LxmlElement *)__pyx_v_self)->_doc);
          __Pyx_INCREF(__pyx_t_3);
          __pyx_t_1 = __pyx_f_4lxml_5etree__removeNode(((struct LxmlDocument *)__pyx_t_3), __pyx_v_c_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

          /* "src/lxml/lxml.etree.pyx":658
 *                         c_next = _nextElement(c_node)
 *                         _removeNode(self._doc, c_node)
 *                         c_node = c_next             # <<<<<<<<<<<<<<
 *             else:
 *                 _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)
 */
          __pyx_v_c_node = __pyx_v_c_next;
        }
        goto __pyx_L7;
      }
      __pyx_L7:;
      goto __pyx_L6;
    }
    /*else*/ {

      /* "src/lxml/lxml.etree.pyx":660
 *                         c_node = c_next
 *             else:
 *                 _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)             # <<<<<<<<<<<<<<
 *                 _deleteSlice(self._doc, c_node, slicelength, step)
 *         else:
 */
      __pyx_t_1 = __pyx_f_4lxml_5etree__findChildSlice(((PyObject*)__pyx_v_x), ((struct LxmlElement *)__pyx_v_self)->_c_node, (&__pyx_v_c_node), (&__pyx_v_step), (&__pyx_v_slicelength)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "src/lxml/lxml.etree.pyx":661
 *             else:
 *                 _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)
 *                 _deleteSlice(self._doc, c_node, slicelength, step)             # <<<<<<<<<<<<<<
 *         else:
 *             # item deletion
 */
      __pyx_t_3 = ((PyObject *)((struct LxmlElement *)__pyx_v_self)->_doc);
      __Pyx_INCREF(__pyx_t_3);
      __pyx_t_1 = __pyx_f_4lxml_5etree__deleteSlice(((struct LxmlDocument *)__pyx_t_3), __pyx_v_c_node, __pyx_v_slicelength, __pyx_v_step); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __pyx_L6:;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "src/lxml/lxml.etree.pyx":664
 *         else:
 *             # item deletion
 *             c_node = _findChild(self._c_node, x)             # <<<<<<<<<<<<<<
 *             if c_node is NULL:
 *                 raise IndexError, u"index out of range: %d" % x
 */
    __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_v_x); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_c_node = __pyx_f_4lxml_5etree__findChild(((struct LxmlElement *)__pyx_v_self)->_c_node, __pyx_t_4);

    /* "src/lxml/lxml.etree.pyx":665
 *             # item deletion
 *             c_node = _findChild(self._c_node, x)
 *             if c_node is NULL:             # <<<<<<<<<<<<<<
 *                 raise IndexError, u"index out of range: %d" % x
 *             _removeText(c_node.next)
 */
    __pyx_t_2 = (__pyx_v_c_node == NULL);
    if (__pyx_t_2) {

      /* "src/lxml/lxml.etree.pyx":666
 *             c_node = _findChild(self._c_node, x)
 *             if c_node is NULL:
 *                 raise IndexError, u"index out of range: %d" % x             # <<<<<<<<<<<<<<
 *             _removeText(c_node.next)
 *             _removeNode(self._doc, c_node)
 */
      __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_66), __pyx_v_x); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
      __Pyx_Raise(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_3), 0);
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L11;
    }
    __pyx_L11:;

    /* "src/lxml/lxml.etree.pyx":667
 *             if c_node is NULL:
 *                 raise IndexError, u"index out of range: %d" % x
 *             _removeText(c_node.next)             # <<<<<<<<<<<<<<
 *             _removeNode(self._doc, c_node)
 * 
 */
    __pyx_f_4lxml_5etree__removeText(__pyx_v_c_node->next);

    /* "src/lxml/lxml.etree.pyx":668
 *                 raise IndexError, u"index out of range: %d" % x
 *             _removeText(c_node.next)
 *             _removeNode(self._doc, c_node)             # <<<<<<<<<<<<<<
 * 
 *     def __deepcopy__(self, memo):
 */
    __pyx_t_3 = ((PyObject *)((struct LxmlElement *)__pyx_v_self)->_doc);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_1 = __pyx_f_4lxml_5etree__removeNode(((struct LxmlDocument *)__pyx_t_3), __pyx_v_c_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_L5:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Element.__delitem__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":670
 *             _removeNode(self._doc, c_node)
 * 
 *     def __deepcopy__(self, memo):             # <<<<<<<<<<<<<<
 *         u"__deepcopy__(self, memo)"
 *         return self.__copy__()
 */

static PyObject *__pyx_pf_4lxml_5etree_8_Element_4__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_4__deepcopy__[] = "__deepcopy__(self, memo)";
static PyObject *__pyx_pf_4lxml_5etree_8_Element_4__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__deepcopy__");

  /* "src/lxml/lxml.etree.pyx":672
 *     def __deepcopy__(self, memo):
 *         u"__deepcopy__(self, memo)"
 *         return self.__copy__()             # <<<<<<<<<<<<<<
 * 
 *     def __copy__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____copy__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Element.__deepcopy__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":674
 *         return self.__copy__()
 * 
 *     def __copy__(self):             # <<<<<<<<<<<<<<
 *         u"__copy__(self)"
 *         cdef xmlDoc* c_doc
 */

static PyObject *__pyx_pf_4lxml_5etree_8_Element_5__copy__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_5__copy__[] = "__copy__(self)";
static PyObject *__pyx_pf_4lxml_5etree_8_Element_5__copy__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  xmlDoc *__pyx_v_c_doc;
  xmlNode *__pyx_v_c_node;
  struct LxmlDocument *__pyx_v_new_doc;
  PyObject *__pyx_v_root;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  xmlDoc *__pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  __Pyx_RefNannySetupContext("__copy__");
  __pyx_v_new_doc = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_root = Py_None; __Pyx_INCREF(Py_None);

  /* "src/lxml/lxml.etree.pyx":679
 *         cdef xmlNode* c_node
 *         cdef _Document new_doc
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         c_doc = _copyDocRoot(self._doc._c_doc, self._c_node) # recursive
 *         new_doc = _documentFactory(c_doc, self._doc._parser)
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 679; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":680
 *         cdef _Document new_doc
 *         _assertValidNode(self)
 *         c_doc = _copyDocRoot(self._doc._c_doc, self._c_node) # recursive             # <<<<<<<<<<<<<<
 *         new_doc = _documentFactory(c_doc, self._doc._parser)
 *         root = new_doc.getroot()
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__copyDocRoot(((struct LxmlElement *)__pyx_v_self)->_doc->_c_doc, ((struct LxmlElement *)__pyx_v_self)->_c_node); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_doc = __pyx_t_2;

  /* "src/lxml/lxml.etree.pyx":681
 *         _assertValidNode(self)
 *         c_doc = _copyDocRoot(self._doc._c_doc, self._c_node) # recursive
 *         new_doc = _documentFactory(c_doc, self._doc._parser)             # <<<<<<<<<<<<<<
 *         root = new_doc.getroot()
 *         if root is not None:
 */
  __pyx_t_3 = ((PyObject *)((struct LxmlElement *)__pyx_v_self)->_doc->_parser);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_3))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_v_new_doc));
  __pyx_v_new_doc = ((struct LxmlDocument *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "src/lxml/lxml.etree.pyx":682
 *         c_doc = _copyDocRoot(self._doc._c_doc, self._c_node) # recursive
 *         new_doc = _documentFactory(c_doc, self._doc._parser)
 *         root = new_doc.getroot()             # <<<<<<<<<<<<<<
 *         if root is not None:
 *             return root
 */
  __pyx_t_4 = ((struct __pyx_vtabstruct_4lxml_5etree__Document *)__pyx_v_new_doc->__pyx_vtab)->getroot(__pyx_v_new_doc); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_v_root);
  __pyx_v_root = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "src/lxml/lxml.etree.pyx":683
 *         new_doc = _documentFactory(c_doc, self._doc._parser)
 *         root = new_doc.getroot()
 *         if root is not None:             # <<<<<<<<<<<<<<
 *             return root
 *         # Comment/PI
 */
  __pyx_t_5 = (__pyx_v_root != Py_None);
  if (__pyx_t_5) {

    /* "src/lxml/lxml.etree.pyx":684
 *         root = new_doc.getroot()
 *         if root is not None:
 *             return root             # <<<<<<<<<<<<<<
 *         # Comment/PI
 *         c_node = c_doc.children
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_root);
    __pyx_r = __pyx_v_root;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "src/lxml/lxml.etree.pyx":686
 *             return root
 *         # Comment/PI
 *         c_node = c_doc.children             # <<<<<<<<<<<<<<
 *         while c_node is not NULL and c_node.type != self._c_node.type:
 *             c_node = c_node.next
 */
  __pyx_v_c_node = __pyx_v_c_doc->children;

  /* "src/lxml/lxml.etree.pyx":687
 *         # Comment/PI
 *         c_node = c_doc.children
 *         while c_node is not NULL and c_node.type != self._c_node.type:             # <<<<<<<<<<<<<<
 *             c_node = c_node.next
 *         if c_node is NULL:
 */
  while (1) {
    __pyx_t_5 = (__pyx_v_c_node != NULL);
    if (__pyx_t_5) {
      __pyx_t_6 = (__pyx_v_c_node->type != ((struct LxmlElement *)__pyx_v_self)->_c_node->type);
      __pyx_t_7 = __pyx_t_6;
    } else {
      __pyx_t_7 = __pyx_t_5;
    }
    if (!__pyx_t_7) break;

    /* "src/lxml/lxml.etree.pyx":688
 *         c_node = c_doc.children
 *         while c_node is not NULL and c_node.type != self._c_node.type:
 *             c_node = c_node.next             # <<<<<<<<<<<<<<
 *         if c_node is NULL:
 *             return None
 */
    __pyx_v_c_node = __pyx_v_c_node->next;
  }

  /* "src/lxml/lxml.etree.pyx":689
 *         while c_node is not NULL and c_node.type != self._c_node.type:
 *             c_node = c_node.next
 *         if c_node is NULL:             # <<<<<<<<<<<<<<
 *             return None
 *         return _elementFactory(new_doc, c_node)
 */
  __pyx_t_7 = (__pyx_v_c_node == NULL);
  if (__pyx_t_7) {

    /* "src/lxml/lxml.etree.pyx":690
 *             c_node = c_node.next
 *         if c_node is NULL:
 *             return None             # <<<<<<<<<<<<<<
 *         return _elementFactory(new_doc, c_node)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
    goto __pyx_L8;
  }
  __pyx_L8:;

  /* "src/lxml/lxml.etree.pyx":691
 *         if c_node is NULL:
 *             return None
 *         return _elementFactory(new_doc, c_node)             # <<<<<<<<<<<<<<
 * 
 *     def set(self, key, value):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(__pyx_v_new_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._Element.__copy__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_new_doc);
  __Pyx_DECREF(__pyx_v_root);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":693
 *         return _elementFactory(new_doc, c_node)
 * 
 *     def set(self, key, value):             # <<<<<<<<<<<<<<
 *         u"""set(self, key, value)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_8_Element_6set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_6set[] = "set(self, key, value)\n\n        Sets an element attribute.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_8_Element_6set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_value = 0;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__key,&__pyx_n_s__value,0};
  __Pyx_RefNannySetupContext("set");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__key);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__value);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 693; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "set") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 693; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_key = values[0];
    __pyx_v_value = values[1];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_key = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_value = PyTuple_GET_ITEM(__pyx_args, 1);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 693; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._Element.set");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "src/lxml/lxml.etree.pyx":698
 *         Sets an element attribute.
 *         """
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         _setAttributeValue(self, key, value)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":699
 *         """
 *         _assertValidNode(self)
 *         _setAttributeValue(self, key, value)             # <<<<<<<<<<<<<<
 * 
 *     def append(self, _Element element not None):
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__setAttributeValue(((struct LxmlElement *)__pyx_v_self), __pyx_v_key, __pyx_v_value); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._Element.set");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":701
 *         _setAttributeValue(self, key, value)
 * 
 *     def append(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         u"""append(self, element)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_8_Element_7append(PyObject *__pyx_v_self, PyObject *__pyx_v_element); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_7append[] = "append(self, element)\n\n        Adds a subelement to the end of this element.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_8_Element_7append(PyObject *__pyx_v_self, PyObject *__pyx_v_element) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("append");
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_element), __pyx_ptype_4lxml_5etree__Element, 0, "element", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":706
 *         Adds a subelement to the end of this element.
 *         """
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         _assertValidNode(element)
 *         _appendChild(self, element)
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":707
 *         """
 *         _assertValidNode(self)
 *         _assertValidNode(element)             # <<<<<<<<<<<<<<
 *         _appendChild(self, element)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_element)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":708
 *         _assertValidNode(self)
 *         _assertValidNode(element)
 *         _appendChild(self, element)             # <<<<<<<<<<<<<<
 * 
 *     def addnext(self, _Element element not None):
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__appendChild(((struct LxmlElement *)__pyx_v_self), ((struct LxmlElement *)__pyx_v_element)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._Element.append");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":710
 *         _appendChild(self, element)
 * 
 *     def addnext(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         u"""addnext(self, element)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_8_Element_8addnext(PyObject *__pyx_v_self, PyObject *__pyx_v_element); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_8addnext[] = "addnext(self, element)\n\n        Adds the element as a following sibling directly after this\n        element.\n\n        This is normally used to set a processing instruction or comment after\n        the root node of a document.  Note that tail text is automatically\n        discarded when adding at the root level.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_8_Element_8addnext(PyObject *__pyx_v_self, PyObject *__pyx_v_element) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("addnext");
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_element), __pyx_ptype_4lxml_5etree__Element, 0, "element", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":720
 *         discarded when adding at the root level.
 *         """
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         _assertValidNode(element)
 *         if self._c_node.parent != NULL and not _isElement(self._c_node.parent):
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":721
 *         """
 *         _assertValidNode(self)
 *         _assertValidNode(element)             # <<<<<<<<<<<<<<
 *         if self._c_node.parent != NULL and not _isElement(self._c_node.parent):
 *             if element._c_node.type != tree.XML_PI_NODE:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_element)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":722
 *         _assertValidNode(self)
 *         _assertValidNode(element)
 *         if self._c_node.parent != NULL and not _isElement(self._c_node.parent):             # <<<<<<<<<<<<<<
 *             if element._c_node.type != tree.XML_PI_NODE:
 *                 if element._c_node.type != tree.XML_COMMENT_NODE:
 */
  __pyx_t_2 = (((struct LxmlElement *)__pyx_v_self)->_c_node->parent != NULL);
  if (__pyx_t_2) {
    __pyx_t_3 = (!_isElement(((struct LxmlElement *)__pyx_v_self)->_c_node->parent));
    __pyx_t_4 = __pyx_t_3;
  } else {
    __pyx_t_4 = __pyx_t_2;
  }
  if (__pyx_t_4) {

    /* "src/lxml/lxml.etree.pyx":723
 *         _assertValidNode(element)
 *         if self._c_node.parent != NULL and not _isElement(self._c_node.parent):
 *             if element._c_node.type != tree.XML_PI_NODE:             # <<<<<<<<<<<<<<
 *                 if element._c_node.type != tree.XML_COMMENT_NODE:
 *                     raise TypeError, u"Only processing instructions and comments can be siblings of the root element"
 */
    __pyx_t_4 = (((struct LxmlElement *)__pyx_v_element)->_c_node->type != XML_PI_NODE);
    if (__pyx_t_4) {

      /* "src/lxml/lxml.etree.pyx":724
 *         if self._c_node.parent != NULL and not _isElement(self._c_node.parent):
 *             if element._c_node.type != tree.XML_PI_NODE:
 *                 if element._c_node.type != tree.XML_COMMENT_NODE:             # <<<<<<<<<<<<<<
 *                     raise TypeError, u"Only processing instructions and comments can be siblings of the root element"
 *             element.tail = None
 */
      __pyx_t_4 = (((struct LxmlElement *)__pyx_v_element)->_c_node->type != XML_COMMENT_NODE);
      if (__pyx_t_4) {

        /* "src/lxml/lxml.etree.pyx":725
 *             if element._c_node.type != tree.XML_PI_NODE:
 *                 if element._c_node.type != tree.XML_COMMENT_NODE:
 *                     raise TypeError, u"Only processing instructions and comments can be siblings of the root element"             # <<<<<<<<<<<<<<
 *             element.tail = None
 *         _appendSibling(self, element)
 */
        __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_u_67), 0);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L7;
      }
      __pyx_L7:;
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "src/lxml/lxml.etree.pyx":726
 *                 if element._c_node.type != tree.XML_COMMENT_NODE:
 *                     raise TypeError, u"Only processing instructions and comments can be siblings of the root element"
 *             element.tail = None             # <<<<<<<<<<<<<<
 *         _appendSibling(self, element)
 * 
 */
    if (PyObject_SetAttr(__pyx_v_element, __pyx_n_s__tail, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "src/lxml/lxml.etree.pyx":727
 *                     raise TypeError, u"Only processing instructions and comments can be siblings of the root element"
 *             element.tail = None
 *         _appendSibling(self, element)             # <<<<<<<<<<<<<<
 * 
 *     def addprevious(self, _Element element not None):
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__appendSibling(((struct LxmlElement *)__pyx_v_self), ((struct LxmlElement *)__pyx_v_element)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._Element.addnext");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":729
 *         _appendSibling(self, element)
 * 
 *     def addprevious(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         u"""addprevious(self, element)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_8_Element_9addprevious(PyObject *__pyx_v_self, PyObject *__pyx_v_element); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_9addprevious[] = "addprevious(self, element)\n\n        Adds the element as a preceding sibling directly before this\n        element.\n\n        This is normally used to set a processing instruction or comment\n        before the root node of a document.  Note that tail text is\n        automatically discarded when adding at the root level.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_8_Element_9addprevious(PyObject *__pyx_v_self, PyObject *__pyx_v_element) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("addprevious");
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_element), __pyx_ptype_4lxml_5etree__Element, 0, "element", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":739
 *         automatically discarded when adding at the root level.
 *         """
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         _assertValidNode(element)
 *         if self._c_node.parent != NULL and not _isElement(self._c_node.parent):
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":740
 *         """
 *         _assertValidNode(self)
 *         _assertValidNode(element)             # <<<<<<<<<<<<<<
 *         if self._c_node.parent != NULL and not _isElement(self._c_node.parent):
 *             if element._c_node.type != tree.XML_PI_NODE:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_element)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":741
 *         _assertValidNode(self)
 *         _assertValidNode(element)
 *         if self._c_node.parent != NULL and not _isElement(self._c_node.parent):             # <<<<<<<<<<<<<<
 *             if element._c_node.type != tree.XML_PI_NODE:
 *                 if element._c_node.type != tree.XML_COMMENT_NODE:
 */
  __pyx_t_2 = (((struct LxmlElement *)__pyx_v_self)->_c_node->parent != NULL);
  if (__pyx_t_2) {
    __pyx_t_3 = (!_isElement(((struct LxmlElement *)__pyx_v_self)->_c_node->parent));
    __pyx_t_4 = __pyx_t_3;
  } else {
    __pyx_t_4 = __pyx_t_2;
  }
  if (__pyx_t_4) {

    /* "src/lxml/lxml.etree.pyx":742
 *         _assertValidNode(element)
 *         if self._c_node.parent != NULL and not _isElement(self._c_node.parent):
 *             if element._c_node.type != tree.XML_PI_NODE:             # <<<<<<<<<<<<<<
 *                 if element._c_node.type != tree.XML_COMMENT_NODE:
 *                     raise TypeError, u"Only processing instructions and comments can be siblings of the root element"
 */
    __pyx_t_4 = (((struct LxmlElement *)__pyx_v_element)->_c_node->type != XML_PI_NODE);
    if (__pyx_t_4) {

      /* "src/lxml/lxml.etree.pyx":743
 *         if self._c_node.parent != NULL and not _isElement(self._c_node.parent):
 *             if element._c_node.type != tree.XML_PI_NODE:
 *                 if element._c_node.type != tree.XML_COMMENT_NODE:             # <<<<<<<<<<<<<<
 *                     raise TypeError, u"Only processing instructions and comments can be siblings of the root element"
 *             element.tail = None
 */
      __pyx_t_4 = (((struct LxmlElement *)__pyx_v_element)->_c_node->type != XML_COMMENT_NODE);
      if (__pyx_t_4) {

        /* "src/lxml/lxml.etree.pyx":744
 *             if element._c_node.type != tree.XML_PI_NODE:
 *                 if element._c_node.type != tree.XML_COMMENT_NODE:
 *                     raise TypeError, u"Only processing instructions and comments can be siblings of the root element"             # <<<<<<<<<<<<<<
 *             element.tail = None
 *         _prependSibling(self, element)
 */
        __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_u_67), 0);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L7;
      }
      __pyx_L7:;
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "src/lxml/lxml.etree.pyx":745
 *                 if element._c_node.type != tree.XML_COMMENT_NODE:
 *                     raise TypeError, u"Only processing instructions and comments can be siblings of the root element"
 *             element.tail = None             # <<<<<<<<<<<<<<
 *         _prependSibling(self, element)
 * 
 */
    if (PyObject_SetAttr(__pyx_v_element, __pyx_n_s__tail, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "src/lxml/lxml.etree.pyx":746
 *                     raise TypeError, u"Only processing instructions and comments can be siblings of the root element"
 *             element.tail = None
 *         _prependSibling(self, element)             # <<<<<<<<<<<<<<
 * 
 *     def extend(self, elements):
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__prependSibling(((struct LxmlElement *)__pyx_v_self), ((struct LxmlElement *)__pyx_v_element)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._Element.addprevious");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":748
 *         _prependSibling(self, element)
 * 
 *     def extend(self, elements):             # <<<<<<<<<<<<<<
 *         u"""extend(self, elements)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_8_Element_10extend(PyObject *__pyx_v_self, PyObject *__pyx_v_elements); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_10extend[] = "extend(self, elements)\n\n        Extends the current children by the elements in the iterable.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_8_Element_10extend(PyObject *__pyx_v_self, PyObject *__pyx_v_elements) {
  struct LxmlElement *__pyx_v_element;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("extend");
  __pyx_v_element = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);

  /* "src/lxml/lxml.etree.pyx":754
 *         """
 *         cdef _Element element
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         for element in elements:
 *             if element is None:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":755
 *         cdef _Element element
 *         _assertValidNode(self)
 *         for element in elements:             # <<<<<<<<<<<<<<
 *             if element is None:
 *                 raise TypeError, u"Node must not be None"
 */
  if (PyList_CheckExact(__pyx_v_elements) || PyTuple_CheckExact(__pyx_v_elements)) {
    __pyx_t_2 = 0; __pyx_t_3 = __pyx_v_elements; __Pyx_INCREF(__pyx_t_3);
  } else {
    __pyx_t_2 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_elements); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
  }
  for (;;) {
    if (likely(PyList_CheckExact(__pyx_t_3))) {
      if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_3)) break;
      __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++;
    } else if (likely(PyTuple_CheckExact(__pyx_t_3))) {
      if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
      __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++;
    } else {
      __pyx_t_4 = PyIter_Next(__pyx_t_3);
      if (!__pyx_t_4) {
        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_v_element));
    __pyx_v_element = ((struct LxmlElement *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "src/lxml/lxml.etree.pyx":756
 *         _assertValidNode(self)
 *         for element in elements:
 *             if element is None:             # <<<<<<<<<<<<<<
 *                 raise TypeError, u"Node must not be None"
 *             _assertValidNode(element)
 */
    __pyx_t_5 = (((PyObject *)__pyx_v_element) == Py_None);
    if (__pyx_t_5) {

      /* "src/lxml/lxml.etree.pyx":757
 *         for element in elements:
 *             if element is None:
 *                 raise TypeError, u"Node must not be None"             # <<<<<<<<<<<<<<
 *             _assertValidNode(element)
 *             _appendChild(self, element)
 */
      __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_u_28), 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "src/lxml/lxml.etree.pyx":758
 *             if element is None:
 *                 raise TypeError, u"Node must not be None"
 *             _assertValidNode(element)             # <<<<<<<<<<<<<<
 *             _appendChild(self, element)
 * 
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "src/lxml/lxml.etree.pyx":759
 *                 raise TypeError, u"Node must not be None"
 *             _assertValidNode(element)
 *             _appendChild(self, element)             # <<<<<<<<<<<<<<
 * 
 *     def clear(self):
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree__appendChild(((struct LxmlElement *)__pyx_v_self), __pyx_v_element); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._Element.extend");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_element);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":761
 *             _appendChild(self, element)
 * 
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         u"""clear(self)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_8_Element_11clear(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_11clear[] = "clear(self)\n\n        Resets an element.  This function removes all subelements, clears\n        all attributes and sets the text and tail properties to None.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_8_Element_11clear(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  xmlAttr *__pyx_v_c_attr;
  xmlAttr *__pyx_v_c_attr_next;
  xmlNode *__pyx_v_c_node;
  xmlNode *__pyx_v_c_node_next;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("clear");

  /* "src/lxml/lxml.etree.pyx":771
 *         cdef xmlNode* c_node
 *         cdef xmlNode* c_node_next
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         c_node = self._c_node
 *         # remove self.text and self.tail
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":772
 *         cdef xmlNode* c_node_next
 *         _assertValidNode(self)
 *         c_node = self._c_node             # <<<<<<<<<<<<<<
 *         # remove self.text and self.tail
 *         _removeText(c_node.children)
 */
  __pyx_v_c_node = ((struct LxmlElement *)__pyx_v_self)->_c_node;

  /* "src/lxml/lxml.etree.pyx":774
 *         c_node = self._c_node
 *         # remove self.text and self.tail
 *         _removeText(c_node.children)             # <<<<<<<<<<<<<<
 *         _removeText(c_node.next)
 *         # remove all attributes
 */
  __pyx_f_4lxml_5etree__removeText(__pyx_v_c_node->children);

  /* "src/lxml/lxml.etree.pyx":775
 *         # remove self.text and self.tail
 *         _removeText(c_node.children)
 *         _removeText(c_node.next)             # <<<<<<<<<<<<<<
 *         # remove all attributes
 *         c_attr = c_node.properties
 */
  __pyx_f_4lxml_5etree__removeText(__pyx_v_c_node->next);

  /* "src/lxml/lxml.etree.pyx":777
 *         _removeText(c_node.next)
 *         # remove all attributes
 *         c_attr = c_node.properties             # <<<<<<<<<<<<<<
 *         while c_attr is not NULL:
 *             c_attr_next = c_attr.next
 */
  __pyx_v_c_attr = __pyx_v_c_node->properties;

  /* "src/lxml/lxml.etree.pyx":778
 *         # remove all attributes
 *         c_attr = c_node.properties
 *         while c_attr is not NULL:             # <<<<<<<<<<<<<<
 *             c_attr_next = c_attr.next
 *             tree.xmlRemoveProp(c_attr)
 */
  while (1) {
    __pyx_t_2 = (__pyx_v_c_attr != NULL);
    if (!__pyx_t_2) break;

    /* "src/lxml/lxml.etree.pyx":779
 *         c_attr = c_node.properties
 *         while c_attr is not NULL:
 *             c_attr_next = c_attr.next             # <<<<<<<<<<<<<<
 *             tree.xmlRemoveProp(c_attr)
 *             c_attr = c_attr_next
 */
    __pyx_v_c_attr_next = __pyx_v_c_attr->next;

    /* "src/lxml/lxml.etree.pyx":780
 *         while c_attr is not NULL:
 *             c_attr_next = c_attr.next
 *             tree.xmlRemoveProp(c_attr)             # <<<<<<<<<<<<<<
 *             c_attr = c_attr_next
 *         # remove all subelements
 */
    xmlRemoveProp(__pyx_v_c_attr);

    /* "src/lxml/lxml.etree.pyx":781
 *             c_attr_next = c_attr.next
 *             tree.xmlRemoveProp(c_attr)
 *             c_attr = c_attr_next             # <<<<<<<<<<<<<<
 *         # remove all subelements
 *         c_node = c_node.children
 */
    __pyx_v_c_attr = __pyx_v_c_attr_next;
  }

  /* "src/lxml/lxml.etree.pyx":783
 *             c_attr = c_attr_next
 *         # remove all subelements
 *         c_node = c_node.children             # <<<<<<<<<<<<<<
 *         if c_node is not NULL:
 *             if not _isElement(c_node):
 */
  __pyx_v_c_node = __pyx_v_c_node->children;

  /* "src/lxml/lxml.etree.pyx":784
 *         # remove all subelements
 *         c_node = c_node.children
 *         if c_node is not NULL:             # <<<<<<<<<<<<<<
 *             if not _isElement(c_node):
 *                 c_node = _nextElement(c_node)
 */
  __pyx_t_2 = (__pyx_v_c_node != NULL);
  if (__pyx_t_2) {

    /* "src/lxml/lxml.etree.pyx":785
 *         c_node = c_node.children
 *         if c_node is not NULL:
 *             if not _isElement(c_node):             # <<<<<<<<<<<<<<
 *                 c_node = _nextElement(c_node)
 *             while c_node is not NULL:
 */
    __pyx_t_2 = (!_isElement(__pyx_v_c_node));
    if (__pyx_t_2) {

      /* "src/lxml/lxml.etree.pyx":786
 *         if c_node is not NULL:
 *             if not _isElement(c_node):
 *                 c_node = _nextElement(c_node)             # <<<<<<<<<<<<<<
 *             while c_node is not NULL:
 *                 c_node_next = _nextElement(c_node)
 */
      __pyx_v_c_node = __pyx_f_4lxml_5etree__nextElement(__pyx_v_c_node);
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "src/lxml/lxml.etree.pyx":787
 *             if not _isElement(c_node):
 *                 c_node = _nextElement(c_node)
 *             while c_node is not NULL:             # <<<<<<<<<<<<<<
 *                 c_node_next = _nextElement(c_node)
 *                 _removeNode(self._doc, c_node)
 */
    while (1) {
      __pyx_t_2 = (__pyx_v_c_node != NULL);
      if (!__pyx_t_2) break;

      /* "src/lxml/lxml.etree.pyx":788
 *                 c_node = _nextElement(c_node)
 *             while c_node is not NULL:
 *                 c_node_next = _nextElement(c_node)             # <<<<<<<<<<<<<<
 *                 _removeNode(self._doc, c_node)
 *                 c_node = c_node_next
 */
      __pyx_v_c_node_next = __pyx_f_4lxml_5etree__nextElement(__pyx_v_c_node);

      /* "src/lxml/lxml.etree.pyx":789
 *             while c_node is not NULL:
 *                 c_node_next = _nextElement(c_node)
 *                 _removeNode(self._doc, c_node)             # <<<<<<<<<<<<<<
 *                 c_node = c_node_next
 * 
 */
      __pyx_t_3 = ((PyObject *)((struct LxmlElement *)__pyx_v_self)->_doc);
      __Pyx_INCREF(__pyx_t_3);
      __pyx_t_1 = __pyx_f_4lxml_5etree__removeNode(((struct LxmlDocument *)__pyx_t_3), __pyx_v_c_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "src/lxml/lxml.etree.pyx":790
 *                 c_node_next = _nextElement(c_node)
 *                 _removeNode(self._doc, c_node)
 *                 c_node = c_node_next             # <<<<<<<<<<<<<<
 * 
 *     def insert(self, index, _Element element not None):
 */
      __pyx_v_c_node = __pyx_v_c_node_next;
    }
    goto __pyx_L7;
  }
  __pyx_L7:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Element.clear");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":792
 *                 c_node = c_node_next
 * 
 *     def insert(self, index, _Element element not None):             # <<<<<<<<<<<<<<
 *         u"""insert(self, index, element)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_8_Element_12insert(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_12insert[] = "insert(self, index, element)\n\n        Inserts a subelement at the given position in this element\n        ";
static PyObject *__pyx_pf_4lxml_5etree_8_Element_12insert(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_index = 0;
  struct LxmlElement *__pyx_v_element = 0;
  xmlNode *__pyx_v_c_node;
  xmlNode *__pyx_v_c_next;
  xmlDoc *__pyx_v_c_source_doc;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__index,&__pyx_n_s__element,0};
  __Pyx_RefNannySetupContext("insert");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__index);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__element);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("insert", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "insert") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_index = values[0];
    __pyx_v_element = ((struct LxmlElement *)values[1]);
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_index = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_element = ((struct LxmlElement *)PyTuple_GET_ITEM(__pyx_args, 1));
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("insert", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._Element.insert");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_element), __pyx_ptype_4lxml_5etree__Element, 0, "element", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":800
 *         cdef xmlNode* c_next
 *         cdef xmlDoc* c_source_doc
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         _assertValidNode(element)
 *         c_node = _findChild(self._c_node, index)
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":801
 *         cdef xmlDoc* c_source_doc
 *         _assertValidNode(self)
 *         _assertValidNode(element)             # <<<<<<<<<<<<<<
 *         c_node = _findChild(self._c_node, index)
 *         if c_node is NULL:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":802
 *         _assertValidNode(self)
 *         _assertValidNode(element)
 *         c_node = _findChild(self._c_node, index)             # <<<<<<<<<<<<<<
 *         if c_node is NULL:
 *             _appendChild(self, element)
 */
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_node = __pyx_f_4lxml_5etree__findChild(((struct LxmlElement *)__pyx_v_self)->_c_node, __pyx_t_2);

  /* "src/lxml/lxml.etree.pyx":803
 *         _assertValidNode(element)
 *         c_node = _findChild(self._c_node, index)
 *         if c_node is NULL:             # <<<<<<<<<<<<<<
 *             _appendChild(self, element)
 *             return
 */
  __pyx_t_3 = (__pyx_v_c_node == NULL);
  if (__pyx_t_3) {

    /* "src/lxml/lxml.etree.pyx":804
 *         c_node = _findChild(self._c_node, index)
 *         if c_node is NULL:
 *             _appendChild(self, element)             # <<<<<<<<<<<<<<
 *             return
 *         c_source_doc = c_node.doc
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree__appendChild(((struct LxmlElement *)__pyx_v_self), __pyx_v_element); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "src/lxml/lxml.etree.pyx":805
 *         if c_node is NULL:
 *             _appendChild(self, element)
 *             return             # <<<<<<<<<<<<<<
 *         c_source_doc = c_node.doc
 *         c_next = element._c_node.next
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "src/lxml/lxml.etree.pyx":806
 *             _appendChild(self, element)
 *             return
 *         c_source_doc = c_node.doc             # <<<<<<<<<<<<<<
 *         c_next = element._c_node.next
 *         tree.xmlAddPrevSibling(c_node, element._c_node)
 */
  __pyx_v_c_source_doc = __pyx_v_c_node->doc;

  /* "src/lxml/lxml.etree.pyx":807
 *             return
 *         c_source_doc = c_node.doc
 *         c_next = element._c_node.next             # <<<<<<<<<<<<<<
 *         tree.xmlAddPrevSibling(c_node, element._c_node)
 *         _moveTail(c_next, element._c_node)
 */
  __pyx_v_c_next = __pyx_v_element->_c_node->next;

  /* "src/lxml/lxml.etree.pyx":808
 *         c_source_doc = c_node.doc
 *         c_next = element._c_node.next
 *         tree.xmlAddPrevSibling(c_node, element._c_node)             # <<<<<<<<<<<<<<
 *         _moveTail(c_next, element._c_node)
 *         moveNodeToDocument(self._doc, c_source_doc, element._c_node)
 */
  xmlAddPrevSibling(__pyx_v_c_node, __pyx_v_element->_c_node);

  /* "src/lxml/lxml.etree.pyx":809
 *         c_next = element._c_node.next
 *         tree.xmlAddPrevSibling(c_node, element._c_node)
 *         _moveTail(c_next, element._c_node)             # <<<<<<<<<<<<<<
 *         moveNodeToDocument(self._doc, c_source_doc, element._c_node)
 * 
 */
  __pyx_f_4lxml_5etree__moveTail(__pyx_v_c_next, __pyx_v_element->_c_node);

  /* "src/lxml/lxml.etree.pyx":810
 *         tree.xmlAddPrevSibling(c_node, element._c_node)
 *         _moveTail(c_next, element._c_node)
 *         moveNodeToDocument(self._doc, c_source_doc, element._c_node)             # <<<<<<<<<<<<<<
 * 
 *     def remove(self, _Element element not None):
 */
  __pyx_t_4 = ((PyObject *)((struct LxmlElement *)__pyx_v_self)->_doc);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_1 = __pyx_f_4lxml_5etree_moveNodeToDocument(((struct LxmlDocument *)__pyx_t_4), __pyx_v_c_source_doc, __pyx_v_element->_c_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._Element.insert");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":812
 *         moveNodeToDocument(self._doc, c_source_doc, element._c_node)
 * 
 *     def remove(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         u"""remove(self, element)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_8_Element_13remove(PyObject *__pyx_v_self, PyObject *__pyx_v_element); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_13remove[] = "remove(self, element)\n\n        Removes a matching subelement. Unlike the find methods, this\n        method compares elements based on identity, not on tag value\n        or contents.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_8_Element_13remove(PyObject *__pyx_v_self, PyObject *__pyx_v_element) {
  xmlNode *__pyx_v_c_node;
  xmlNode *__pyx_v_c_next;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("remove");
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_element), __pyx_ptype_4lxml_5etree__Element, 0, "element", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":821
 *         cdef xmlNode* c_node
 *         cdef xmlNode* c_next
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         _assertValidNode(element)
 *         c_node = element._c_node
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":822
 *         cdef xmlNode* c_next
 *         _assertValidNode(self)
 *         _assertValidNode(element)             # <<<<<<<<<<<<<<
 *         c_node = element._c_node
 *         if c_node.parent is not self._c_node:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_element)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":823
 *         _assertValidNode(self)
 *         _assertValidNode(element)
 *         c_node = element._c_node             # <<<<<<<<<<<<<<
 *         if c_node.parent is not self._c_node:
 *             raise ValueError, u"Element is not a child of this node."
 */
  __pyx_v_c_node = ((struct LxmlElement *)__pyx_v_element)->_c_node;

  /* "src/lxml/lxml.etree.pyx":824
 *         _assertValidNode(element)
 *         c_node = element._c_node
 *         if c_node.parent is not self._c_node:             # <<<<<<<<<<<<<<
 *             raise ValueError, u"Element is not a child of this node."
 *         c_next = element._c_node.next
 */
  __pyx_t_2 = (__pyx_v_c_node->parent != ((struct LxmlElement *)__pyx_v_self)->_c_node);
  if (__pyx_t_2) {

    /* "src/lxml/lxml.etree.pyx":825
 *         c_node = element._c_node
 *         if c_node.parent is not self._c_node:
 *             raise ValueError, u"Element is not a child of this node."             # <<<<<<<<<<<<<<
 *         c_next = element._c_node.next
 *         tree.xmlUnlinkNode(c_node)
 */
    __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_u_68), 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "src/lxml/lxml.etree.pyx":826
 *         if c_node.parent is not self._c_node:
 *             raise ValueError, u"Element is not a child of this node."
 *         c_next = element._c_node.next             # <<<<<<<<<<<<<<
 *         tree.xmlUnlinkNode(c_node)
 *         _moveTail(c_next, c_node)
 */
  __pyx_v_c_next = ((struct LxmlElement *)__pyx_v_element)->_c_node->next;

  /* "src/lxml/lxml.etree.pyx":827
 *             raise ValueError, u"Element is not a child of this node."
 *         c_next = element._c_node.next
 *         tree.xmlUnlinkNode(c_node)             # <<<<<<<<<<<<<<
 *         _moveTail(c_next, c_node)
 *         # fix namespace declarations
 */
  xmlUnlinkNode(__pyx_v_c_node);

  /* "src/lxml/lxml.etree.pyx":828
 *         c_next = element._c_node.next
 *         tree.xmlUnlinkNode(c_node)
 *         _moveTail(c_next, c_node)             # <<<<<<<<<<<<<<
 *         # fix namespace declarations
 *         moveNodeToDocument(self._doc, c_node.doc, c_node)
 */
  __pyx_f_4lxml_5etree__moveTail(__pyx_v_c_next, __pyx_v_c_node);

  /* "src/lxml/lxml.etree.pyx":830
 *         _moveTail(c_next, c_node)
 *         # fix namespace declarations
 *         moveNodeToDocument(self._doc, c_node.doc, c_node)             # <<<<<<<<<<<<<<
 * 
 *     def replace(self, _Element old_element not None,
 */
  __pyx_t_3 = ((PyObject *)((struct LxmlElement *)__pyx_v_self)->_doc);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_1 = __pyx_f_4lxml_5etree_moveNodeToDocument(((struct LxmlDocument *)__pyx_t_3), __pyx_v_c_node->doc, __pyx_v_c_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Element.remove");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":832
 *         moveNodeToDocument(self._doc, c_node.doc, c_node)
 * 
 *     def replace(self, _Element old_element not None,             # <<<<<<<<<<<<<<
 *                 _Element new_element not None):
 *         u"""replace(self, old_element, new_element)
 */

static PyObject *__pyx_pf_4lxml_5etree_8_Element_14replace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_14replace[] = "replace(self, old_element, new_element)\n\n        Replaces a subelement with the element passed as second argument.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_8_Element_14replace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct LxmlElement *__pyx_v_old_element = 0;
  struct LxmlElement *__pyx_v_new_element = 0;
  xmlNode *__pyx_v_c_old_node;
  xmlNode *__pyx_v_c_old_next;
  xmlNode *__pyx_v_c_new_node;
  xmlNode *__pyx_v_c_new_next;
  xmlDoc *__pyx_v_c_source_doc;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__old_element,&__pyx_n_s__new_element,0};
  __Pyx_RefNannySetupContext("replace");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__old_element);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__new_element);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("replace", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "replace") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_old_element = ((struct LxmlElement *)values[0]);
    __pyx_v_new_element = ((struct LxmlElement *)values[1]);
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_old_element = ((struct LxmlElement *)PyTuple_GET_ITEM(__pyx_args, 0));
    __pyx_v_new_element = ((struct LxmlElement *)PyTuple_GET_ITEM(__pyx_args, 1));
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("replace", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._Element.replace");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_old_element), __pyx_ptype_4lxml_5etree__Element, 0, "old_element", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_new_element), __pyx_ptype_4lxml_5etree__Element, 0, "new_element", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":843
 *         cdef xmlNode* c_new_next
 *         cdef xmlDoc* c_source_doc
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         _assertValidNode(old_element)
 *         _assertValidNode(new_element)
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":844
 *         cdef xmlDoc* c_source_doc
 *         _assertValidNode(self)
 *         _assertValidNode(old_element)             # <<<<<<<<<<<<<<
 *         _assertValidNode(new_element)
 *         c_old_node = old_element._c_node
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_old_element); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":845
 *         _assertValidNode(self)
 *         _assertValidNode(old_element)
 *         _assertValidNode(new_element)             # <<<<<<<<<<<<<<
 *         c_old_node = old_element._c_node
 *         if c_old_node.parent is not self._c_node:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_new_element); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":846
 *         _assertValidNode(old_element)
 *         _assertValidNode(new_element)
 *         c_old_node = old_element._c_node             # <<<<<<<<<<<<<<
 *         if c_old_node.parent is not self._c_node:
 *             raise ValueError, u"Element is not a child of this node."
 */
  __pyx_v_c_old_node = __pyx_v_old_element->_c_node;

  /* "src/lxml/lxml.etree.pyx":847
 *         _assertValidNode(new_element)
 *         c_old_node = old_element._c_node
 *         if c_old_node.parent is not self._c_node:             # <<<<<<<<<<<<<<
 *             raise ValueError, u"Element is not a child of this node."
 *         c_old_next = c_old_node.next
 */
  __pyx_t_2 = (__pyx_v_c_old_node->parent != ((struct LxmlElement *)__pyx_v_self)->_c_node);
  if (__pyx_t_2) {

    /* "src/lxml/lxml.etree.pyx":848
 *         c_old_node = old_element._c_node
 *         if c_old_node.parent is not self._c_node:
 *             raise ValueError, u"Element is not a child of this node."             # <<<<<<<<<<<<<<
 *         c_old_next = c_old_node.next
 *         c_new_node = new_element._c_node
 */
    __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_u_68), 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "src/lxml/lxml.etree.pyx":849
 *         if c_old_node.parent is not self._c_node:
 *             raise ValueError, u"Element is not a child of this node."
 *         c_old_next = c_old_node.next             # <<<<<<<<<<<<<<
 *         c_new_node = new_element._c_node
 *         c_new_next = c_new_node.next
 */
  __pyx_v_c_old_next = __pyx_v_c_old_node->next;

  /* "src/lxml/lxml.etree.pyx":850
 *             raise ValueError, u"Element is not a child of this node."
 *         c_old_next = c_old_node.next
 *         c_new_node = new_element._c_node             # <<<<<<<<<<<<<<
 *         c_new_next = c_new_node.next
 *         c_source_doc = c_new_node.doc
 */
  __pyx_v_c_new_node = __pyx_v_new_element->_c_node;

  /* "src/lxml/lxml.etree.pyx":851
 *         c_old_next = c_old_node.next
 *         c_new_node = new_element._c_node
 *         c_new_next = c_new_node.next             # <<<<<<<<<<<<<<
 *         c_source_doc = c_new_node.doc
 *         tree.xmlReplaceNode(c_old_node, c_new_node)
 */
  __pyx_v_c_new_next = __pyx_v_c_new_node->next;

  /* "src/lxml/lxml.etree.pyx":852
 *         c_new_node = new_element._c_node
 *         c_new_next = c_new_node.next
 *         c_source_doc = c_new_node.doc             # <<<<<<<<<<<<<<
 *         tree.xmlReplaceNode(c_old_node, c_new_node)
 *         _moveTail(c_new_next, c_new_node)
 */
  __pyx_v_c_source_doc = __pyx_v_c_new_node->doc;

  /* "src/lxml/lxml.etree.pyx":853
 *         c_new_next = c_new_node.next
 *         c_source_doc = c_new_node.doc
 *         tree.xmlReplaceNode(c_old_node, c_new_node)             # <<<<<<<<<<<<<<
 *         _moveTail(c_new_next, c_new_node)
 *         _moveTail(c_old_next, c_old_node)
 */
  xmlReplaceNode(__pyx_v_c_old_node, __pyx_v_c_new_node);

  /* "src/lxml/lxml.etree.pyx":854
 *         c_source_doc = c_new_node.doc
 *         tree.xmlReplaceNode(c_old_node, c_new_node)
 *         _moveTail(c_new_next, c_new_node)             # <<<<<<<<<<<<<<
 *         _moveTail(c_old_next, c_old_node)
 *         moveNodeToDocument(self._doc, c_source_doc, c_new_node)
 */
  __pyx_f_4lxml_5etree__moveTail(__pyx_v_c_new_next, __pyx_v_c_new_node);

  /* "src/lxml/lxml.etree.pyx":855
 *         tree.xmlReplaceNode(c_old_node, c_new_node)
 *         _moveTail(c_new_next, c_new_node)
 *         _moveTail(c_old_next, c_old_node)             # <<<<<<<<<<<<<<
 *         moveNodeToDocument(self._doc, c_source_doc, c_new_node)
 *         # fix namespace declarations
 */
  __pyx_f_4lxml_5etree__moveTail(__pyx_v_c_old_next, __pyx_v_c_old_node);

  /* "src/lxml/lxml.etree.pyx":856
 *         _moveTail(c_new_next, c_new_node)
 *         _moveTail(c_old_next, c_old_node)
 *         moveNodeToDocument(self._doc, c_source_doc, c_new_node)             # <<<<<<<<<<<<<<
 *         # fix namespace declarations
 *         moveNodeToDocument(self._doc, c_old_node.doc, c_old_node)
 */
  __pyx_t_3 = ((PyObject *)((struct LxmlElement *)__pyx_v_self)->_doc);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_1 = __pyx_f_4lxml_5etree_moveNodeToDocument(((struct LxmlDocument *)__pyx_t_3), __pyx_v_c_source_doc, __pyx_v_c_new_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":858
 *         moveNodeToDocument(self._doc, c_source_doc, c_new_node)
 *         # fix namespace declarations
 *         moveNodeToDocument(self._doc, c_old_node.doc, c_old_node)             # <<<<<<<<<<<<<<
 * 
 *     # PROPERTIES
 */
  __pyx_t_3 = ((PyObject *)((struct LxmlElement *)__pyx_v_self)->_doc);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_1 = __pyx_f_4lxml_5etree_moveNodeToDocument(((struct LxmlDocument *)__pyx_t_3), __pyx_v_c_old_node->doc, __pyx_v_c_old_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Element.replace");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":864
 *         u"""Element tag
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if self._tag is not None:
 *                 return self._tag
 */

static PyObject *__pyx_pf_4lxml_5etree_8_Element_3tag___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_8_Element_3tag___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__get__");

  /* "src/lxml/lxml.etree.pyx":865
 *         """
 *         def __get__(self):
 *             if self._tag is not None:             # <<<<<<<<<<<<<<
 *                 return self._tag
 *             _assertValidNode(self)
 */
  __pyx_t_1 = (((struct LxmlElement *)__pyx_v_self)->_tag != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/lxml.etree.pyx":866
 *         def __get__(self):
 *             if self._tag is not None:
 *                 return self._tag             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             self._tag = _namespacedName(self._c_node)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((struct LxmlElement *)__pyx_v_self)->_tag);
    __pyx_r = ((struct LxmlElement *)__pyx_v_self)->_tag;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "src/lxml/lxml.etree.pyx":867
 *             if self._tag is not None:
 *                 return self._tag
 *             _assertValidNode(self)             # <<<<<<<<<<<<<<
 *             self._tag = _namespacedName(self._c_node)
 *             return self._tag
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":868
 *                 return self._tag
 *             _assertValidNode(self)
 *             self._tag = _namespacedName(self._c_node)             # <<<<<<<<<<<<<<
 *             return self._tag
 * 
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree__namespacedName(((struct LxmlElement *)__pyx_v_self)->_c_node); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(((struct LxmlElement *)__pyx_v_self)->_tag);
  __Pyx_DECREF(((struct LxmlElement *)__pyx_v_self)->_tag);
  ((struct LxmlElement *)__pyx_v_self)->_tag = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":869
 *             _assertValidNode(self)
 *             self._tag = _namespacedName(self._c_node)
 *             return self._tag             # <<<<<<<<<<<<<<
 * 
 *         def __set__(self, value):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((struct LxmlElement *)__pyx_v_self)->_tag);
  __pyx_r = ((struct LxmlElement *)__pyx_v_self)->_tag;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Element.tag.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":871
 *             return self._tag
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             cdef _BaseParser parser
 *             _assertValidNode(self)
 */

static int __pyx_pf_4lxml_5etree_8_Element_3tag_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_4lxml_5etree_8_Element_3tag_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser;
  PyObject *__pyx_v_ns;
  PyObject *__pyx_v_name;
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("__set__");
  __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_ns = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_name = Py_None; __Pyx_INCREF(Py_None);

  /* "src/lxml/lxml.etree.pyx":873
 *         def __set__(self, value):
 *             cdef _BaseParser parser
 *             _assertValidNode(self)             # <<<<<<<<<<<<<<
 *             ns, name = _getNsTag(value)
 *             parser = self._doc._parser
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":874
 *             cdef _BaseParser parser
 *             _assertValidNode(self)
 *             ns, name = _getNsTag(value)             # <<<<<<<<<<<<<<
 *             parser = self._doc._parser
 *             if parser is not None and parser._for_html:
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__getNsTag(__pyx_v_value)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (likely(__pyx_t_2 != Py_None) && likely(PyTuple_GET_SIZE(__pyx_t_2) == 2)) {
    PyObject* tuple = __pyx_t_2;
    __pyx_t_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_v_ns);
    __pyx_v_ns = __pyx_t_3;
    __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_v_name);
    __pyx_v_name = __pyx_t_4;
    __pyx_t_4 = 0;
  } else {
    __Pyx_UnpackTupleError(__pyx_t_2, 2);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "src/lxml/lxml.etree.pyx":875
 *             _assertValidNode(self)
 *             ns, name = _getNsTag(value)
 *             parser = self._doc._parser             # <<<<<<<<<<<<<<
 *             if parser is not None and parser._for_html:
 *                 _htmlTagValidOrRaise(name)
 */
  __Pyx_INCREF(((PyObject *)((struct LxmlElement *)__pyx_v_self)->_doc->_parser));
  __Pyx_DECREF(((PyObject *)__pyx_v_parser));
  __pyx_v_parser = ((struct LxmlElement *)__pyx_v_self)->_doc->_parser;

  /* "src/lxml/lxml.etree.pyx":876
 *             ns, name = _getNsTag(value)
 *             parser = self._doc._parser
 *             if parser is not None and parser._for_html:             # <<<<<<<<<<<<<<
 *                 _htmlTagValidOrRaise(name)
 *             else:
 */
  __pyx_t_5 = (((PyObject *)__pyx_v_parser) != Py_None);
  if (__pyx_t_5) {
    __pyx_t_6 = __pyx_v_parser->_for_html;
  } else {
    __pyx_t_6 = __pyx_t_5;
  }
  if (__pyx_t_6) {

    /* "src/lxml/lxml.etree.pyx":877
 *             parser = self._doc._parser
 *             if parser is not None and parser._for_html:
 *                 _htmlTagValidOrRaise(name)             # <<<<<<<<<<<<<<
 *             else:
 *                 _tagValidOrRaise(name)
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree__htmlTagValidOrRaise(__pyx_v_name); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  /*else*/ {

    /* "src/lxml/lxml.etree.pyx":879
 *                 _htmlTagValidOrRaise(name)
 *             else:
 *                 _tagValidOrRaise(name)             # <<<<<<<<<<<<<<
 *             self._tag = value
 *             tree.xmlNodeSetName(self._c_node, _cstr(name))
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree__tagValidOrRaise(__pyx_v_name); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L5:;

  /* "src/lxml/lxml.etree.pyx":880
 *             else:
 *                 _tagValidOrRaise(name)
 *             self._tag = value             # <<<<<<<<<<<<<<
 *             tree.xmlNodeSetName(self._c_node, _cstr(name))
 *             if ns is None:
 */
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct LxmlElement *)__pyx_v_self)->_tag);
  __Pyx_DECREF(((struct LxmlElement *)__pyx_v_self)->_tag);
  ((struct LxmlElement *)__pyx_v_self)->_tag = __pyx_v_value;

  /* "src/lxml/lxml.etree.pyx":881
 *                 _tagValidOrRaise(name)
 *             self._tag = value
 *             tree.xmlNodeSetName(self._c_node, _cstr(name))             # <<<<<<<<<<<<<<
 *             if ns is None:
 *                 self._c_node.ns = NULL
 */
  xmlNodeSetName(((struct LxmlElement *)__pyx_v_self)->_c_node, PyBytes_AS_STRING(__pyx_v_name));

  /* "src/lxml/lxml.etree.pyx":882
 *             self._tag = value
 *             tree.xmlNodeSetName(self._c_node, _cstr(name))
 *             if ns is None:             # <<<<<<<<<<<<<<
 *                 self._c_node.ns = NULL
 *             else:
 */
  __pyx_t_6 = (__pyx_v_ns == Py_None);
  if (__pyx_t_6) {

    /* "src/lxml/lxml.etree.pyx":883
 *             tree.xmlNodeSetName(self._c_node, _cstr(name))
 *             if ns is None:
 *                 self._c_node.ns = NULL             # <<<<<<<<<<<<<<
 *             else:
 *                 self._doc._setNodeNs(self._c_node, _cstr(ns))
 */
    ((struct LxmlElement *)__pyx_v_self)->_c_node->ns = NULL;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "src/lxml/lxml.etree.pyx":885
 *                 self._c_node.ns = NULL
 *             else:
 *                 self._doc._setNodeNs(self._c_node, _cstr(ns))             # <<<<<<<<<<<<<<
 * 
 *     property attrib:
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__Document *)((struct LxmlElement *)__pyx_v_self)->_doc->__pyx_vtab)->_setNodeNs(((struct LxmlElement *)__pyx_v_self)->_doc, ((struct LxmlElement *)__pyx_v_self)->_c_node, PyBytes_AS_STRING(__pyx_v_ns)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 885; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L6:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._Element.tag.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_parser);
  __Pyx_DECREF(__pyx_v_ns);
  __Pyx_DECREF(__pyx_v_name);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":891
 *         keys(), values() and items() to access element attributes.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             return _Attrib(self)
 */

static PyObject *__pyx_pf_4lxml_5etree_8_Element_6attrib___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_8_Element_6attrib___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__get__");

  /* "src/lxml/lxml.etree.pyx":892
 *         """
 *         def __get__(self):
 *             _assertValidNode(self)             # <<<<<<<<<<<<<<
 *             return _Attrib(self)
 *             ## cdef python.PyObject* ref
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":893
 *         def __get__(self):
 *             _assertValidNode(self)
 *             return _Attrib(self)             # <<<<<<<<<<<<<<
 *             ## cdef python.PyObject* ref
 *             ## if self._attrib is not None:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Attrib)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Element.attrib.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":907
 *         the value None, if there was no text.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             return _collectText(self._c_node.children)
 */

static PyObject *__pyx_pf_4lxml_5etree_8_Element_4text___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_8_Element_4text___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__get__");

  /* "src/lxml/lxml.etree.pyx":908
 *         """
 *         def __get__(self):
 *             _assertValidNode(self)             # <<<<<<<<<<<<<<
 *             return _collectText(self._c_node.children)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":909
 *         def __get__(self):
 *             _assertValidNode(self)
 *             return _collectText(self._c_node.children)             # <<<<<<<<<<<<<<
 * 
 *         def __set__(self, value):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree__collectText(((struct LxmlElement *)__pyx_v_self)->_c_node->children); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Element.text.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":911
 *             return _collectText(self._c_node.children)
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             if isinstance(value, QName):
 */

static int __pyx_pf_4lxml_5etree_8_Element_4text_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_4lxml_5etree_8_Element_4text_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("__set__");
  __Pyx_INCREF(__pyx_v_value);

  /* "src/lxml/lxml.etree.pyx":912
 * 
 *         def __set__(self, value):
 *             _assertValidNode(self)             # <<<<<<<<<<<<<<
 *             if isinstance(value, QName):
 *                 value = python.PyUnicode_FromEncodedObject(
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":913
 *         def __set__(self, value):
 *             _assertValidNode(self)
 *             if isinstance(value, QName):             # <<<<<<<<<<<<<<
 *                 value = python.PyUnicode_FromEncodedObject(
 *                     _resolveQNameText(self, value), 'UTF-8', 'strict')
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_value, ((PyObject*)__pyx_ptype_4lxml_5etree_QName)); 
  if (__pyx_t_2) {

    /* "src/lxml/lxml.etree.pyx":915
 *             if isinstance(value, QName):
 *                 value = python.PyUnicode_FromEncodedObject(
 *                     _resolveQNameText(self, value), 'UTF-8', 'strict')             # <<<<<<<<<<<<<<
 *             _setNodeText(self._c_node, value)
 * 
 */
    __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__resolveQNameText(((struct LxmlElement *)__pyx_v_self), __pyx_v_value)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = ((PyObject *)PyUnicode_FromEncodedObject(__pyx_t_3, __pyx_k_31, __pyx_k__strict)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 914; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_v_value);
    __pyx_v_value = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "src/lxml/lxml.etree.pyx":916
 *                 value = python.PyUnicode_FromEncodedObject(
 *                     _resolveQNameText(self, value), 'UTF-8', 'strict')
 *             _setNodeText(self._c_node, value)             # <<<<<<<<<<<<<<
 * 
 *         # using 'del el.text' is the wrong thing to do
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__setNodeText(((struct LxmlElement *)__pyx_v_self)->_c_node, __pyx_v_value); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._Element.text.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_value);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":927
 *         there was no text.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             return _collectText(self._c_node.next)
 */

static PyObject *__pyx_pf_4lxml_5etree_8_Element_4tail___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_8_Element_4tail___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__get__");

  /* "src/lxml/lxml.etree.pyx":928
 *         """
 *         def __get__(self):
 *             _assertValidNode(self)             # <<<<<<<<<<<<<<
 *             return _collectText(self._c_node.next)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":929
 *         def __get__(self):
 *             _assertValidNode(self)
 *             return _collectText(self._c_node.next)             # <<<<<<<<<<<<<<
 * 
 *         def __set__(self, value):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree__collectText(((struct LxmlElement *)__pyx_v_self)->_c_node->next); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Element.tail.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":931
 *             return _collectText(self._c_node.next)
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             _setTailText(self._c_node, value)
 */

static int __pyx_pf_4lxml_5etree_8_Element_4tail_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_4lxml_5etree_8_Element_4tail_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__set__");

  /* "src/lxml/lxml.etree.pyx":932
 * 
 *         def __set__(self, value):
 *             _assertValidNode(self)             # <<<<<<<<<<<<<<
 *             _setTailText(self._c_node, value)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":933
 *         def __set__(self, value):
 *             _assertValidNode(self)
 *             _setTailText(self._c_node, value)             # <<<<<<<<<<<<<<
 * 
 *         # using 'del el.tail' is the wrong thing to do
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__setTailText(((struct LxmlElement *)__pyx_v_self)->_c_node, __pyx_v_value); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._Element.tail.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":943
 *         u"""Namespace prefix or None.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if self._c_node.ns is not NULL:
 *                 if self._c_node.ns.prefix is not NULL:
 */

static PyObject *__pyx_pf_4lxml_5etree_8_Element_6prefix___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_8_Element_6prefix___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__get__");

  /* "src/lxml/lxml.etree.pyx":944
 *         """
 *         def __get__(self):
 *             if self._c_node.ns is not NULL:             # <<<<<<<<<<<<<<
 *                 if self._c_node.ns.prefix is not NULL:
 *                     return funicode(self._c_node.ns.prefix)
 */
  __pyx_t_1 = (((struct LxmlElement *)__pyx_v_self)->_c_node->ns != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/lxml.etree.pyx":945
 *         def __get__(self):
 *             if self._c_node.ns is not NULL:
 *                 if self._c_node.ns.prefix is not NULL:             # <<<<<<<<<<<<<<
 *                     return funicode(self._c_node.ns.prefix)
 *             return None
 */
    __pyx_t_1 = (((struct LxmlElement *)__pyx_v_self)->_c_node->ns->prefix != NULL);
    if (__pyx_t_1) {

      /* "src/lxml/lxml.etree.pyx":946
 *             if self._c_node.ns is not NULL:
 *                 if self._c_node.ns.prefix is not NULL:
 *                     return funicode(self._c_node.ns.prefix)             # <<<<<<<<<<<<<<
 *             return None
 * 
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(((struct LxmlElement *)__pyx_v_self)->_c_node->ns->prefix); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;
      goto __pyx_L6;
    }
    __pyx_L6:;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "src/lxml/lxml.etree.pyx":947
 *                 if self._c_node.ns.prefix is not NULL:
 *                     return funicode(self._c_node.ns.prefix)
 *             return None             # <<<<<<<<<<<<<<
 * 
 *     # not in ElementTree, read-only
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_None);
  __pyx_r = Py_None;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Element.prefix.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":953
 *         u"""Original line number as found by the parser or None if unknown.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef long line
 *             _assertValidNode(self)
 */

static PyObject *__pyx_pf_4lxml_5etree_8_Element_10sourceline___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_8_Element_10sourceline___get__(PyObject *__pyx_v_self) {
  long __pyx_v_line;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__get__");

  /* "src/lxml/lxml.etree.pyx":955
 *         def __get__(self):
 *             cdef long line
 *             _assertValidNode(self)             # <<<<<<<<<<<<<<
 *             line = tree.xmlGetLineNo(self._c_node)
 *             if line > 0:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":956
 *             cdef long line
 *             _assertValidNode(self)
 *             line = tree.xmlGetLineNo(self._c_node)             # <<<<<<<<<<<<<<
 *             if line > 0:
 *                 return line
 */
  __pyx_v_line = xmlGetLineNo(((struct LxmlElement *)__pyx_v_self)->_c_node);

  /* "src/lxml/lxml.etree.pyx":957
 *             _assertValidNode(self)
 *             line = tree.xmlGetLineNo(self._c_node)
 *             if line > 0:             # <<<<<<<<<<<<<<
 *                 return line
 *             else:
 */
  __pyx_t_2 = (__pyx_v_line > 0);
  if (__pyx_t_2) {

    /* "src/lxml/lxml.etree.pyx":958
 *             line = tree.xmlGetLineNo(self._c_node)
 *             if line > 0:
 *                 return line             # <<<<<<<<<<<<<<
 *             else:
 *                 return None
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = PyInt_FromLong(__pyx_v_line); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "src/lxml/lxml.etree.pyx":960
 *                 return line
 *             else:
 *                 return None             # <<<<<<<<<<<<<<
 * 
 *         def __set__(self, line):
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }
  __pyx_L5:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Element.sourceline.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":962
 *                 return None
 * 
 *         def __set__(self, line):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             if line < 0:
 */

static int __pyx_pf_4lxml_5etree_8_Element_10sourceline_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_line); /*proto*/
static int __pyx_pf_4lxml_5etree_8_Element_10sourceline_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_line) {
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  unsigned short __pyx_t_4;
  __Pyx_RefNannySetupContext("__set__");

  /* "src/lxml/lxml.etree.pyx":963
 * 
 *         def __set__(self, line):
 *             _assertValidNode(self)             # <<<<<<<<<<<<<<
 *             if line < 0:
 *                 self._c_node.line = 0
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":964
 *         def __set__(self, line):
 *             _assertValidNode(self)
 *             if line < 0:             # <<<<<<<<<<<<<<
 *                 self._c_node.line = 0
 *             else:
 */
  __pyx_t_2 = PyObject_RichCompare(__pyx_v_line, __pyx_int_0, Py_LT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 964; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 964; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "src/lxml/lxml.etree.pyx":965
 *             _assertValidNode(self)
 *             if line < 0:
 *                 self._c_node.line = 0             # <<<<<<<<<<<<<<
 *             else:
 *                 self._c_node.line = line
 */
    ((struct LxmlElement *)__pyx_v_self)->_c_node->line = 0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "src/lxml/lxml.etree.pyx":967
 *                 self._c_node.line = 0
 *             else:
 *                 self._c_node.line = line             # <<<<<<<<<<<<<<
 * 
 *     # not in ElementTree, read-only
 */
    __pyx_t_4 = __Pyx_PyInt_AsUnsignedShort(__pyx_v_line); if (unlikely((__pyx_t_4 == (unsigned short)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    ((struct LxmlElement *)__pyx_v_self)->_c_node->line = __pyx_t_4;
  }
  __pyx_L5:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Element.sourceline.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":977
 *         Note that changing the returned dict has no effect on the Element.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef xmlNode* c_node
 *             cdef xmlNs* c_ns
 */

static PyObject *__pyx_pf_4lxml_5etree_8_Element_5nsmap___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_8_Element_5nsmap___get__(PyObject *__pyx_v_self) {
  xmlNode *__pyx_v_c_node;
  xmlNs *__pyx_v_c_ns;
  PyObject *__pyx_v_nsmap = 0;
  PyObject *__pyx_v_prefix;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("__get__");
  __pyx_v_prefix = Py_None; __Pyx_INCREF(Py_None);

  /* "src/lxml/lxml.etree.pyx":980
 *             cdef xmlNode* c_node
 *             cdef xmlNs* c_ns
 *             cdef dict nsmap = {}             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             c_node = self._c_node
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_nsmap = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/lxml.etree.pyx":981
 *             cdef xmlNs* c_ns
 *             cdef dict nsmap = {}
 *             _assertValidNode(self)             # <<<<<<<<<<<<<<
 *             c_node = self._c_node
 *             while c_node is not NULL and c_node.type == tree.XML_ELEMENT_NODE:
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 981; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":982
 *             cdef dict nsmap = {}
 *             _assertValidNode(self)
 *             c_node = self._c_node             # <<<<<<<<<<<<<<
 *             while c_node is not NULL and c_node.type == tree.XML_ELEMENT_NODE:
 *                 c_ns = c_node.nsDef
 */
  __pyx_v_c_node = ((struct LxmlElement *)__pyx_v_self)->_c_node;

  /* "src/lxml/lxml.etree.pyx":983
 *             _assertValidNode(self)
 *             c_node = self._c_node
 *             while c_node is not NULL and c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *                 c_ns = c_node.nsDef
 *                 while c_ns is not NULL:
 */
  while (1) {
    __pyx_t_3 = (__pyx_v_c_node != NULL);
    if (__pyx_t_3) {
      __pyx_t_4 = (__pyx_v_c_node->type == XML_ELEMENT_NODE);
      __pyx_t_5 = __pyx_t_4;
    } else {
      __pyx_t_5 = __pyx_t_3;
    }
    if (!__pyx_t_5) break;

    /* "src/lxml/lxml.etree.pyx":984
 *             c_node = self._c_node
 *             while c_node is not NULL and c_node.type == tree.XML_ELEMENT_NODE:
 *                 c_ns = c_node.nsDef             # <<<<<<<<<<<<<<
 *                 while c_ns is not NULL:
 *                     if c_ns.prefix is NULL:
 */
    __pyx_v_c_ns = __pyx_v_c_node->nsDef;

    /* "src/lxml/lxml.etree.pyx":985
 *             while c_node is not NULL and c_node.type == tree.XML_ELEMENT_NODE:
 *                 c_ns = c_node.nsDef
 *                 while c_ns is not NULL:             # <<<<<<<<<<<<<<
 *                     if c_ns.prefix is NULL:
 *                         prefix = None
 */
    while (1) {
      __pyx_t_5 = (__pyx_v_c_ns != NULL);
      if (!__pyx_t_5) break;

      /* "src/lxml/lxml.etree.pyx":986
 *                 c_ns = c_node.nsDef
 *                 while c_ns is not NULL:
 *                     if c_ns.prefix is NULL:             # <<<<<<<<<<<<<<
 *                         prefix = None
 *                     else:
 */
      __pyx_t_5 = (__pyx_v_c_ns->prefix == NULL);
      if (__pyx_t_5) {

        /* "src/lxml/lxml.etree.pyx":987
 *                 while c_ns is not NULL:
 *                     if c_ns.prefix is NULL:
 *                         prefix = None             # <<<<<<<<<<<<<<
 *                     else:
 *                         prefix = funicode(c_ns.prefix)
 */
        __Pyx_INCREF(Py_None);
        __Pyx_DECREF(__pyx_v_prefix);
        __pyx_v_prefix = Py_None;
        goto __pyx_L9;
      }
      /*else*/ {

        /* "src/lxml/lxml.etree.pyx":989
 *                         prefix = None
 *                     else:
 *                         prefix = funicode(c_ns.prefix)             # <<<<<<<<<<<<<<
 *                     if prefix not in nsmap:
 *                         nsmap[prefix] = funicode(c_ns.href)
 */
        __pyx_t_1 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_ns->prefix); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_v_prefix);
        __pyx_v_prefix = __pyx_t_1;
        __pyx_t_1 = 0;
      }
      __pyx_L9:;

      /* "src/lxml/lxml.etree.pyx":990
 *                     else:
 *                         prefix = funicode(c_ns.prefix)
 *                     if prefix not in nsmap:             # <<<<<<<<<<<<<<
 *                         nsmap[prefix] = funicode(c_ns.href)
 *                     c_ns = c_ns.next
 */
      if (unlikely(__pyx_v_nsmap == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
      }
      __pyx_t_5 = (__Pyx_NegateNonNeg(PyDict_Contains(((PyObject *)__pyx_v_nsmap), __pyx_v_prefix))); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (__pyx_t_5) {

        /* "src/lxml/lxml.etree.pyx":991
 *                         prefix = funicode(c_ns.prefix)
 *                     if prefix not in nsmap:
 *                         nsmap[prefix] = funicode(c_ns.href)             # <<<<<<<<<<<<<<
 *                     c_ns = c_ns.next
 *                 c_node = c_node.parent
 */
        __pyx_t_1 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_ns->href); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        if (PyDict_SetItem(((PyObject *)__pyx_v_nsmap), __pyx_v_prefix, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L10;
      }
      __pyx_L10:;

      /* "src/lxml/lxml.etree.pyx":992
 *                     if prefix not in nsmap:
 *                         nsmap[prefix] = funicode(c_ns.href)
 *                     c_ns = c_ns.next             # <<<<<<<<<<<<<<
 *                 c_node = c_node.parent
 *             return nsmap
 */
      __pyx_v_c_ns = __pyx_v_c_ns->next;
    }

    /* "src/lxml/lxml.etree.pyx":993
 *                         nsmap[prefix] = funicode(c_ns.href)
 *                     c_ns = c_ns.next
 *                 c_node = c_node.parent             # <<<<<<<<<<<<<<
 *             return nsmap
 * 
 */
    __pyx_v_c_node = __pyx_v_c_node->parent;
  }

  /* "src/lxml/lxml.etree.pyx":994
 *                     c_ns = c_ns.next
 *                 c_node = c_node.parent
 *             return nsmap             # <<<<<<<<<<<<<<
 * 
 *     # not in ElementTree, read-only
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_nsmap));
  __pyx_r = ((PyObject *)__pyx_v_nsmap);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._Element.nsmap.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nsmap);
  __Pyx_DECREF(__pyx_v_prefix);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1008
 *         Element, regardless of the document type (XML or HTML).
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef char* c_base
 *             _assertValidNode(self)
 */

static PyObject *__pyx_pf_4lxml_5etree_8_Element_4base___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_8_Element_4base___get__(PyObject *__pyx_v_self) {
  char *__pyx_v_c_base;
  PyObject *__pyx_v_base;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __pyx_v_base = Py_None; __Pyx_INCREF(Py_None);

  /* "src/lxml/lxml.etree.pyx":1010
 *         def __get__(self):
 *             cdef char* c_base
 *             _assertValidNode(self)             # <<<<<<<<<<<<<<
 *             c_base = tree.xmlNodeGetBase(self._doc._c_doc, self._c_node)
 *             if c_base is NULL:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1010; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":1011
 *             cdef char* c_base
 *             _assertValidNode(self)
 *             c_base = tree.xmlNodeGetBase(self._doc._c_doc, self._c_node)             # <<<<<<<<<<<<<<
 *             if c_base is NULL:
 *                 if self._doc._c_doc.URL is NULL:
 */
  __pyx_v_c_base = xmlNodeGetBase(((struct LxmlElement *)__pyx_v_self)->_doc->_c_doc, ((struct LxmlElement *)__pyx_v_self)->_c_node);

  /* "src/lxml/lxml.etree.pyx":1012
 *             _assertValidNode(self)
 *             c_base = tree.xmlNodeGetBase(self._doc._c_doc, self._c_node)
 *             if c_base is NULL:             # <<<<<<<<<<<<<<
 *                 if self._doc._c_doc.URL is NULL:
 *                     return None
 */
  __pyx_t_2 = (__pyx_v_c_base == NULL);
  if (__pyx_t_2) {

    /* "src/lxml/lxml.etree.pyx":1013
 *             c_base = tree.xmlNodeGetBase(self._doc._c_doc, self._c_node)
 *             if c_base is NULL:
 *                 if self._doc._c_doc.URL is NULL:             # <<<<<<<<<<<<<<
 *                     return None
 *                 return _decodeFilename(self._doc._c_doc.URL)
 */
    __pyx_t_2 = (((struct LxmlElement *)__pyx_v_self)->_doc->_c_doc->URL == NULL);
    if (__pyx_t_2) {

      /* "src/lxml/lxml.etree.pyx":1014
 *             if c_base is NULL:
 *                 if self._doc._c_doc.URL is NULL:
 *                     return None             # <<<<<<<<<<<<<<
 *                 return _decodeFilename(self._doc._c_doc.URL)
 *             base = _decodeFilename(c_base)
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_None);
      __pyx_r = Py_None;
      goto __pyx_L0;
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "src/lxml/lxml.etree.pyx":1015
 *                 if self._doc._c_doc.URL is NULL:
 *                     return None
 *                 return _decodeFilename(self._doc._c_doc.URL)             # <<<<<<<<<<<<<<
 *             base = _decodeFilename(c_base)
 *             tree.xmlFree(c_base)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __pyx_f_4lxml_5etree__decodeFilename(((struct LxmlElement *)__pyx_v_self)->_doc->_c_doc->URL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "src/lxml/lxml.etree.pyx":1016
 *                     return None
 *                 return _decodeFilename(self._doc._c_doc.URL)
 *             base = _decodeFilename(c_base)             # <<<<<<<<<<<<<<
 *             tree.xmlFree(c_base)
 *             return base
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree__decodeFilename(__pyx_v_c_base); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_v_base);
  __pyx_v_base = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":1017
 *                 return _decodeFilename(self._doc._c_doc.URL)
 *             base = _decodeFilename(c_base)
 *             tree.xmlFree(c_base)             # <<<<<<<<<<<<<<
 *             return base
 * 
 */
  xmlFree(__pyx_v_c_base);

  /* "src/lxml/lxml.etree.pyx":1018
 *             base = _decodeFilename(c_base)
 *             tree.xmlFree(c_base)
 *             return base             # <<<<<<<<<<<<<<
 * 
 *         def __set__(self, url):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_base);
  __pyx_r = __pyx_v_base;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Element.base.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_base);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1020
 *             return base
 * 
 *         def __set__(self, url):             # <<<<<<<<<<<<<<
 *             cdef char* c_base
 *             _assertValidNode(self)
 */

static int __pyx_pf_4lxml_5etree_8_Element_4base_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_url); /*proto*/
static int __pyx_pf_4lxml_5etree_8_Element_4base_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_url) {
  char *__pyx_v_c_base;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__set__");
  __Pyx_INCREF(__pyx_v_url);

  /* "src/lxml/lxml.etree.pyx":1022
 *         def __set__(self, url):
 *             cdef char* c_base
 *             _assertValidNode(self)             # <<<<<<<<<<<<<<
 *             if url is None:
 *                 c_base = NULL
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":1023
 *             cdef char* c_base
 *             _assertValidNode(self)
 *             if url is None:             # <<<<<<<<<<<<<<
 *                 c_base = NULL
 *             else:
 */
  __pyx_t_2 = (__pyx_v_url == Py_None);
  if (__pyx_t_2) {

    /* "src/lxml/lxml.etree.pyx":1024
 *             _assertValidNode(self)
 *             if url is None:
 *                 c_base = NULL             # <<<<<<<<<<<<<<
 *             else:
 *                 url = _encodeFilename(url)
 */
    __pyx_v_c_base = NULL;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "src/lxml/lxml.etree.pyx":1026
 *                 c_base = NULL
 *             else:
 *                 url = _encodeFilename(url)             # <<<<<<<<<<<<<<
 *                 c_base = _cstr(url)
 *             tree.xmlNodeSetBase(self._c_node, c_base)
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_url); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_v_url);
    __pyx_v_url = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "src/lxml/lxml.etree.pyx":1027
 *             else:
 *                 url = _encodeFilename(url)
 *                 c_base = _cstr(url)             # <<<<<<<<<<<<<<
 *             tree.xmlNodeSetBase(self._c_node, c_base)
 * 
 */
    __pyx_v_c_base = PyBytes_AS_STRING(__pyx_v_url);
  }
  __pyx_L5:;

  /* "src/lxml/lxml.etree.pyx":1028
 *                 url = _encodeFilename(url)
 *                 c_base = _cstr(url)
 *             tree.xmlNodeSetBase(self._c_node, c_base)             # <<<<<<<<<<<<<<
 * 
 *     # ACCESSORS
 */
  xmlNodeSetBase(((struct LxmlElement *)__pyx_v_self)->_c_node, __pyx_v_c_base);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Element.base.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_url);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1031
 * 
 *     # ACCESSORS
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         u"__repr__(self)"
 *         return u"<Element %s at 0x%x>" % (self.tag, id(self))
 */

static PyObject *__pyx_pf_4lxml_5etree_8_Element_15__repr__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_15__repr__[] = "__repr__(self)";
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_8_Element_15__repr__;
static PyObject *__pyx_pf_4lxml_5etree_8_Element_15__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__repr__");

  /* "src/lxml/lxml.etree.pyx":1033
 *     def __repr__(self):
 *         u"__repr__(self)"
 *         return u"<Element %s at 0x%x>" % (self.tag, id(self))             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__tag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1033; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1033; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __pyx_t_3 = PyObject_Call(__pyx_builtin_id, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1033; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1033; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_1 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_69), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1033; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_r = ((PyObject *)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Element.__repr__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1035
 *         return u"<Element %s at 0x%x>" % (self.tag, id(self))
 * 
 *     def __getitem__(self, x):             # <<<<<<<<<<<<<<
 *         u"""Returns the subelement at the given position or the requested
 *         slice.
 */

static PyObject *__pyx_pf_4lxml_5etree_8_Element_16__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_16__getitem__[] = "Returns the subelement at the given position or the requested\n        slice.\n        ";
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_8_Element_16__getitem__;
static PyObject *__pyx_pf_4lxml_5etree_8_Element_16__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  xmlNode *__pyx_v_c_node;
  Py_ssize_t __pyx_v_step;
  Py_ssize_t __pyx_v_slicelength;
  Py_ssize_t __pyx_v_c;
  Py_ssize_t __pyx_v_i;
  _node_to_node_function __pyx_v_next_element;
  PyObject *__pyx_v_result;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  __Pyx_RefNannySetupContext("__getitem__");
  __pyx_v_result = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);

  /* "src/lxml/lxml.etree.pyx":1044
 *         cdef _node_to_node_function next_element
 *         cdef list result
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         if python.PySlice_Check(x):
 *             # slicing
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":1045
 *         cdef list result
 *         _assertValidNode(self)
 *         if python.PySlice_Check(x):             # <<<<<<<<<<<<<<
 *             # slicing
 *             if _isFullSlice(<slice>x):
 */
  __pyx_t_2 = PySlice_Check(__pyx_v_x);
  if (__pyx_t_2) {

    /* "src/lxml/lxml.etree.pyx":1047
 *         if python.PySlice_Check(x):
 *             # slicing
 *             if _isFullSlice(<slice>x):             # <<<<<<<<<<<<<<
 *                 return _collectChildren(self)
 *             _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree__isFullSlice(((PyObject*)__pyx_v_x));
    if (__pyx_t_2) {

      /* "src/lxml/lxml.etree.pyx":1048
 *             # slicing
 *             if _isFullSlice(<slice>x):
 *                 return _collectChildren(self)             # <<<<<<<<<<<<<<
 *             _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)
 *             if c_node is NULL:
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __pyx_f_4lxml_5etree__collectChildren(((struct LxmlElement *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L0;
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "src/lxml/lxml.etree.pyx":1049
 *             if _isFullSlice(<slice>x):
 *                 return _collectChildren(self)
 *             _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)             # <<<<<<<<<<<<<<
 *             if c_node is NULL:
 *                 return []
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree__findChildSlice(((PyObject*)__pyx_v_x), ((struct LxmlElement *)__pyx_v_self)->_c_node, (&__pyx_v_c_node), (&__pyx_v_step), (&__pyx_v_slicelength)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1049; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "src/lxml/lxml.etree.pyx":1050
 *                 return _collectChildren(self)
 *             _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)
 *             if c_node is NULL:             # <<<<<<<<<<<<<<
 *                 return []
 *             if step > 0:
 */
    __pyx_t_2 = (__pyx_v_c_node == NULL);
    if (__pyx_t_2) {

      /* "src/lxml/lxml.etree.pyx":1051
 *             _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)
 *             if c_node is NULL:
 *                 return []             # <<<<<<<<<<<<<<
 *             if step > 0:
 *                 next_element = _nextElement
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
      __pyx_r = ((PyObject *)__pyx_t_3);
      __pyx_t_3 = 0;
      goto __pyx_L0;
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "src/lxml/lxml.etree.pyx":1052
 *             if c_node is NULL:
 *                 return []
 *             if step > 0:             # <<<<<<<<<<<<<<
 *                 next_element = _nextElement
 *             else:
 */
    __pyx_t_2 = (__pyx_v_step > 0);
    if (__pyx_t_2) {

      /* "src/lxml/lxml.etree.pyx":1053
 *                 return []
 *             if step > 0:
 *                 next_element = _nextElement             # <<<<<<<<<<<<<<
 *             else:
 *                 step = -step
 */
      __pyx_v_next_element = __pyx_f_4lxml_5etree__nextElement;
      goto __pyx_L8;
    }
    /*else*/ {

      /* "src/lxml/lxml.etree.pyx":1055
 *                 next_element = _nextElement
 *             else:
 *                 step = -step             # <<<<<<<<<<<<<<
 *                 next_element = _previousElement
 *             result = []
 */
      __pyx_v_step = (-__pyx_v_step);

      /* "src/lxml/lxml.etree.pyx":1056
 *             else:
 *                 step = -step
 *                 next_element = _previousElement             # <<<<<<<<<<<<<<
 *             result = []
 *             c = 0
 */
      __pyx_v_next_element = __pyx_f_4lxml_5etree__previousElement;
    }
    __pyx_L8:;

    /* "src/lxml/lxml.etree.pyx":1057
 *                 step = -step
 *                 next_element = _previousElement
 *             result = []             # <<<<<<<<<<<<<<
 *             c = 0
 *             while c_node is not NULL and c < slicelength:
 */
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_DECREF(((PyObject *)__pyx_v_result));
    __pyx_v_result = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "src/lxml/lxml.etree.pyx":1058
 *                 next_element = _previousElement
 *             result = []
 *             c = 0             # <<<<<<<<<<<<<<
 *             while c_node is not NULL and c < slicelength:
 *                 result.append(_elementFactory(self._doc, c_node))
 */
    __pyx_v_c = 0;

    /* "src/lxml/lxml.etree.pyx":1059
 *             result = []
 *             c = 0
 *             while c_node is not NULL and c < slicelength:             # <<<<<<<<<<<<<<
 *                 result.append(_elementFactory(self._doc, c_node))
 *                 c = c + 1
 */
    while (1) {
      __pyx_t_2 = (__pyx_v_c_node != NULL);
      if (__pyx_t_2) {
        __pyx_t_4 = (__pyx_v_c < __pyx_v_slicelength);
        __pyx_t_5 = __pyx_t_4;
      } else {
        __pyx_t_5 = __pyx_t_2;
      }
      if (!__pyx_t_5) break;

      /* "src/lxml/lxml.etree.pyx":1060
 *             c = 0
 *             while c_node is not NULL and c < slicelength:
 *                 result.append(_elementFactory(self._doc, c_node))             # <<<<<<<<<<<<<<
 *                 c = c + 1
 *                 for i from 0 <= i < step:
 */
      if (unlikely(__pyx_v_result == Py_None)) {
        PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1060; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
      }
      __pyx_t_3 = ((PyObject *)((struct LxmlElement *)__pyx_v_self)->_doc);
      __Pyx_INCREF(__pyx_t_3);
      __pyx_t_6 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_3), __pyx_v_c_node)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1060; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_1 = PyList_Append(__pyx_v_result, __pyx_t_6); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1060; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "src/lxml/lxml.etree.pyx":1061
 *             while c_node is not NULL and c < slicelength:
 *                 result.append(_elementFactory(self._doc, c_node))
 *                 c = c + 1             # <<<<<<<<<<<<<<
 *                 for i from 0 <= i < step:
 *                     c_node = next_element(c_node)
 */
      __pyx_v_c = (__pyx_v_c + 1);

      /* "src/lxml/lxml.etree.pyx":1062
 *                 result.append(_elementFactory(self._doc, c_node))
 *                 c = c + 1
 *                 for i from 0 <= i < step:             # <<<<<<<<<<<<<<
 *                     c_node = next_element(c_node)
 *             return result
 */
      __pyx_t_7 = __pyx_v_step;
      for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_7; __pyx_v_i++) {

        /* "src/lxml/lxml.etree.pyx":1063
 *                 c = c + 1
 *                 for i from 0 <= i < step:
 *                     c_node = next_element(c_node)             # <<<<<<<<<<<<<<
 *             return result
 *         else:
 */
        __pyx_v_c_node = __pyx_v_next_element(__pyx_v_c_node);
      }
    }

    /* "src/lxml/lxml.etree.pyx":1064
 *                 for i from 0 <= i < step:
 *                     c_node = next_element(c_node)
 *             return result             # <<<<<<<<<<<<<<
 *         else:
 *             # indexing
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_result));
    __pyx_r = ((PyObject *)__pyx_v_result);
    goto __pyx_L0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "src/lxml/lxml.etree.pyx":1067
 *         else:
 *             # indexing
 *             c_node = _findChild(self._c_node, x)             # <<<<<<<<<<<<<<
 *             if c_node is NULL:
 *                 raise IndexError, u"list index out of range"
 */
    __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_x); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_c_node = __pyx_f_4lxml_5etree__findChild(((struct LxmlElement *)__pyx_v_self)->_c_node, __pyx_t_7);

    /* "src/lxml/lxml.etree.pyx":1068
 *             # indexing
 *             c_node = _findChild(self._c_node, x)
 *             if c_node is NULL:             # <<<<<<<<<<<<<<
 *                 raise IndexError, u"list index out of range"
 *             return _elementFactory(self._doc, c_node)
 */
    __pyx_t_5 = (__pyx_v_c_node == NULL);
    if (__pyx_t_5) {

      /* "src/lxml/lxml.etree.pyx":1069
 *             c_node = _findChild(self._c_node, x)
 *             if c_node is NULL:
 *                 raise IndexError, u"list index out of range"             # <<<<<<<<<<<<<<
 *             return _elementFactory(self._doc, c_node)
 * 
 */
      __Pyx_Raise(__pyx_builtin_IndexError, ((PyObject *)__pyx_kp_u_65), 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L13;
    }
    __pyx_L13:;

    /* "src/lxml/lxml.etree.pyx":1070
 *             if c_node is NULL:
 *                 raise IndexError, u"list index out of range"
 *             return _elementFactory(self._doc, c_node)             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_6 = ((PyObject *)((struct LxmlElement *)__pyx_v_self)->_doc);
    __Pyx_INCREF(__pyx_t_6);
    __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_6), __pyx_v_c_node)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }
  __pyx_L5:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._Element.__getitem__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1072
 *             return _elementFactory(self._doc, c_node)
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         u"""__len__(self)
 * 
 */

static Py_ssize_t __pyx_pf_4lxml_5etree_8_Element_17__len__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_17__len__[] = "__len__(self)\n\n        Returns the number of subelements.\n        ";
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_8_Element_17__len__;
static Py_ssize_t __pyx_pf_4lxml_5etree_8_Element_17__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__len__");

  /* "src/lxml/lxml.etree.pyx":1077
 *         Returns the number of subelements.
 *         """
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         return _countElements(self._c_node.children)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":1078
 *         """
 *         _assertValidNode(self)
 *         return _countElements(self._c_node.children)             # <<<<<<<<<<<<<<
 * 
 *     def __nonzero__(self):
 */
  __pyx_r = __pyx_f_4lxml_5etree__countElements(((struct LxmlElement *)__pyx_v_self)->_c_node->children);
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._Element.__len__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1080
 *         return _countElements(self._c_node.children)
 * 
 *     def __nonzero__(self):             # <<<<<<<<<<<<<<
 *         #u"__nonzero__(self)" # currently fails in Py3.1
 *         import warnings
 */

static int __pyx_pf_4lxml_5etree_8_Element_18__nonzero__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pf_4lxml_5etree_8_Element_18__nonzero__(PyObject *__pyx_v_self) {
  PyObject *__pyx_v_warnings;
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("__nonzero__");
  __pyx_v_warnings = Py_None; __Pyx_INCREF(Py_None);

  /* "src/lxml/lxml.etree.pyx":1082
 *     def __nonzero__(self):
 *         #u"__nonzero__(self)" # currently fails in Py3.1
 *         import warnings             # <<<<<<<<<<<<<<
 *         warnings.warn(
 *             u"The behavior of this method will change in future versions. "
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__warnings), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_v_warnings);
  __pyx_v_warnings = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/lxml.etree.pyx":1083
 *         #u"__nonzero__(self)" # currently fails in Py3.1
 *         import warnings
 *         warnings.warn(             # <<<<<<<<<<<<<<
 *             u"The behavior of this method will change in future versions. "
 *             u"Use specific 'len(elem)' or 'elem is not None' test instead.",
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_warnings, __pyx_n_s__warn); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);

  /* "src/lxml/lxml.etree.pyx":1087
 *             u"Use specific 'len(elem)' or 'elem is not None' test instead.",
 *             FutureWarning
 *             )             # <<<<<<<<<<<<<<
 *         # emulate old behaviour
 *         _assertValidNode(self)
 */
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_70));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_u_70));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_70));
  __Pyx_INCREF(__pyx_builtin_FutureWarning);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_builtin_FutureWarning);
  __Pyx_GIVEREF(__pyx_builtin_FutureWarning);
  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":1089
 *             )
 *         # emulate old behaviour
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         return _hasChild(self._c_node)
 * 
 */
  __pyx_t_4 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":1090
 *         # emulate old behaviour
 *         _assertValidNode(self)
 *         return _hasChild(self._c_node)             # <<<<<<<<<<<<<<
 * 
 *     def __contains__(self, element):
 */
  __pyx_r = __pyx_f_4lxml_5etree__hasChild(((struct LxmlElement *)__pyx_v_self)->_c_node);
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Element.__nonzero__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_warnings);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1092
 *         return _hasChild(self._c_node)
 * 
 *     def __contains__(self, element):             # <<<<<<<<<<<<<<
 *         u"__contains__(self, element)"
 *         cdef xmlNode* c_node
 */

static int __pyx_pf_4lxml_5etree_8_Element_19__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_element); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_19__contains__[] = "__contains__(self, element)";
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_8_Element_19__contains__;
static int __pyx_pf_4lxml_5etree_8_Element_19__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_element) {
  xmlNode *__pyx_v_c_node;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("__contains__");

  /* "src/lxml/lxml.etree.pyx":1095
 *         u"__contains__(self, element)"
 *         cdef xmlNode* c_node
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         if not isinstance(element, _Element):
 *             return 0
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1095; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":1096
 *         cdef xmlNode* c_node
 *         _assertValidNode(self)
 *         if not isinstance(element, _Element):             # <<<<<<<<<<<<<<
 *             return 0
 *         c_node = (<_Element>element)._c_node
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_element, ((PyObject*)__pyx_ptype_4lxml_5etree__Element)); 
  __pyx_t_3 = (!__pyx_t_2);
  if (__pyx_t_3) {

    /* "src/lxml/lxml.etree.pyx":1097
 *         _assertValidNode(self)
 *         if not isinstance(element, _Element):
 *             return 0             # <<<<<<<<<<<<<<
 *         c_node = (<_Element>element)._c_node
 *         return c_node is not NULL and c_node.parent is self._c_node
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "src/lxml/lxml.etree.pyx":1098
 *         if not isinstance(element, _Element):
 *             return 0
 *         c_node = (<_Element>element)._c_node             # <<<<<<<<<<<<<<
 *         return c_node is not NULL and c_node.parent is self._c_node
 * 
 */
  __pyx_v_c_node = ((struct LxmlElement *)__pyx_v_element)->_c_node;

  /* "src/lxml/lxml.etree.pyx":1099
 *             return 0
 *         c_node = (<_Element>element)._c_node
 *         return c_node is not NULL and c_node.parent is self._c_node             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __pyx_t_3 = (__pyx_v_c_node != NULL);
  if (__pyx_t_3) {
    __pyx_t_2 = (__pyx_v_c_node->parent == ((struct LxmlElement *)__pyx_v_self)->_c_node);
    __pyx_t_4 = __pyx_t_2;
  } else {
    __pyx_t_4 = __pyx_t_3;
  }
  __pyx_r = __pyx_t_4;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._Element.__contains__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1101
 *         return c_node is not NULL and c_node.parent is self._c_node
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         u"__iter__(self)"
 *         return ElementChildIterator(self)
 */

static PyObject *__pyx_pf_4lxml_5etree_8_Element_20__iter__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_20__iter__[] = "__iter__(self)";
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_8_Element_20__iter__;
static PyObject *__pyx_pf_4lxml_5etree_8_Element_20__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__iter__");

  /* "src/lxml/lxml.etree.pyx":1103
 *     def __iter__(self):
 *         u"__iter__(self)"
 *         return ElementChildIterator(self)             # <<<<<<<<<<<<<<
 * 
 *     def __reversed__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_ElementChildIterator)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Element.__iter__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1105
 *         return ElementChildIterator(self)
 * 
 *     def __reversed__(self):             # <<<<<<<<<<<<<<
 *         u"__reversed__(self)"
 *         return ElementChildIterator(self, reversed=True)
 */

static PyObject *__pyx_pf_4lxml_5etree_8_Element_21__reversed__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_21__reversed__[] = "__reversed__(self)";
static PyObject *__pyx_pf_4lxml_5etree_8_Element_21__reversed__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__reversed__");

  /* "src/lxml/lxml.etree.pyx":1107
 *     def __reversed__(self):
 *         u"__reversed__(self)"
 *         return ElementChildIterator(self, reversed=True)             # <<<<<<<<<<<<<<
 * 
 *     def index(self, _Element child not None, start=None, stop=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__reversed), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_ElementChildIterator)), ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Element.__reversed__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1109
 *         return ElementChildIterator(self, reversed=True)
 * 
 *     def index(self, _Element child not None, start=None, stop=None):             # <<<<<<<<<<<<<<
 *         u"""index(self, child, start=None, stop=None)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_8_Element_22index(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_22index[] = "index(self, child, start=None, stop=None)\n\n        Find the position of the child within the parent.\n\n        This method is not part of the original ElementTree API.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_8_Element_22index(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct LxmlElement *__pyx_v_child = 0;
  PyObject *__pyx_v_start = 0;
  PyObject *__pyx_v_stop = 0;
  Py_ssize_t __pyx_v_k;
  Py_ssize_t __pyx_v_l;
  Py_ssize_t __pyx_v_c_start;
  Py_ssize_t __pyx_v_c_stop;
  xmlNode *__pyx_v_c_child;
  xmlNode *__pyx_v_c_start_node;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  int __pyx_t_8;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__child,&__pyx_n_s__start,&__pyx_n_s__stop,0};
  __Pyx_RefNannySetupContext("index");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__child);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start);
        if (value) { values[1] = value; kw_args--; }
      }
      case  2:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stop);
        if (value) { values[2] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "index") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1109; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_child = ((struct LxmlElement *)values[0]);
    __pyx_v_start = values[1];
    __pyx_v_stop = values[2];
  } else {
    __pyx_v_start = ((PyObject *)Py_None);
    __pyx_v_stop = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: __pyx_v_stop = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: __pyx_v_start = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v_child = ((struct LxmlElement *)PyTuple_GET_ITEM(__pyx_args, 0));
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("index", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1109; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._Element.index");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_child), __pyx_ptype_4lxml_5etree__Element, 0, "child", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":1120
 *         cdef xmlNode* c_child
 *         cdef xmlNode* c_start_node
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         _assertValidNode(child)
 *         c_child = child._c_node
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":1121
 *         cdef xmlNode* c_start_node
 *         _assertValidNode(self)
 *         _assertValidNode(child)             # <<<<<<<<<<<<<<
 *         c_child = child._c_node
 *         if c_child.parent is not self._c_node:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_child); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":1122
 *         _assertValidNode(self)
 *         _assertValidNode(child)
 *         c_child = child._c_node             # <<<<<<<<<<<<<<
 *         if c_child.parent is not self._c_node:
 *             raise ValueError, u"Element is not a child of this node."
 */
  __pyx_v_c_child = __pyx_v_child->_c_node;

  /* "src/lxml/lxml.etree.pyx":1123
 *         _assertValidNode(child)
 *         c_child = child._c_node
 *         if c_child.parent is not self._c_node:             # <<<<<<<<<<<<<<
 *             raise ValueError, u"Element is not a child of this node."
 * 
 */
  __pyx_t_2 = (__pyx_v_c_child->parent != ((struct LxmlElement *)__pyx_v_self)->_c_node);
  if (__pyx_t_2) {

    /* "src/lxml/lxml.etree.pyx":1124
 *         c_child = child._c_node
 *         if c_child.parent is not self._c_node:
 *             raise ValueError, u"Element is not a child of this node."             # <<<<<<<<<<<<<<
 * 
 *         # handle the unbounded search straight away (normal case)
 */
    __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_u_68), 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "src/lxml/lxml.etree.pyx":1127
 * 
 *         # handle the unbounded search straight away (normal case)
 *         if stop is None and (start is None or start == 0):             # <<<<<<<<<<<<<<
 *             k = 0
 *             c_child = c_child.prev
 */
  __pyx_t_2 = (__pyx_v_stop == Py_None);
  if (__pyx_t_2) {
    __pyx_t_3 = (__pyx_v_start == Py_None);
    if (!__pyx_t_3) {
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_start, __pyx_int_0, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __pyx_t_5;
    } else {
      __pyx_t_6 = __pyx_t_3;
    }
    __pyx_t_3 = __pyx_t_6;
  } else {
    __pyx_t_3 = __pyx_t_2;
  }
  if (__pyx_t_3) {

    /* "src/lxml/lxml.etree.pyx":1128
 *         # handle the unbounded search straight away (normal case)
 *         if stop is None and (start is None or start == 0):
 *             k = 0             # <<<<<<<<<<<<<<
 *             c_child = c_child.prev
 *             while c_child is not NULL:
 */
    __pyx_v_k = 0;

    /* "src/lxml/lxml.etree.pyx":1129
 *         if stop is None and (start is None or start == 0):
 *             k = 0
 *             c_child = c_child.prev             # <<<<<<<<<<<<<<
 *             while c_child is not NULL:
 *                 if _isElement(c_child):
 */
    __pyx_v_c_child = __pyx_v_c_child->prev;

    /* "src/lxml/lxml.etree.pyx":1130
 *             k = 0
 *             c_child = c_child.prev
 *             while c_child is not NULL:             # <<<<<<<<<<<<<<
 *                 if _isElement(c_child):
 *                     k = k + 1
 */
    while (1) {
      __pyx_t_3 = (__pyx_v_c_child != NULL);
      if (!__pyx_t_3) break;

      /* "src/lxml/lxml.etree.pyx":1131
 *             c_child = c_child.prev
 *             while c_child is not NULL:
 *                 if _isElement(c_child):             # <<<<<<<<<<<<<<
 *                     k = k + 1
 *                 c_child = c_child.prev
 */
      __pyx_t_3 = _isElement(__pyx_v_c_child);
      if (__pyx_t_3) {

        /* "src/lxml/lxml.etree.pyx":1132
 *             while c_child is not NULL:
 *                 if _isElement(c_child):
 *                     k = k + 1             # <<<<<<<<<<<<<<
 *                 c_child = c_child.prev
 *             return k
 */
        __pyx_v_k = (__pyx_v_k + 1);
        goto __pyx_L10;
      }
      __pyx_L10:;

      /* "src/lxml/lxml.etree.pyx":1133
 *                 if _isElement(c_child):
 *                     k = k + 1
 *                 c_child = c_child.prev             # <<<<<<<<<<<<<<
 *             return k
 * 
 */
      __pyx_v_c_child = __pyx_v_c_child->prev;
    }

    /* "src/lxml/lxml.etree.pyx":1134
 *                     k = k + 1
 *                 c_child = c_child.prev
 *             return k             # <<<<<<<<<<<<<<
 * 
 *         # check indices
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_k); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "src/lxml/lxml.etree.pyx":1137
 * 
 *         # check indices
 *         if start is None:             # <<<<<<<<<<<<<<
 *             c_start = 0
 *         else:
 */
  __pyx_t_3 = (__pyx_v_start == Py_None);
  if (__pyx_t_3) {

    /* "src/lxml/lxml.etree.pyx":1138
 *         # check indices
 *         if start is None:
 *             c_start = 0             # <<<<<<<<<<<<<<
 *         else:
 *             c_start = start
 */
    __pyx_v_c_start = 0;
    goto __pyx_L11;
  }
  /*else*/ {

    /* "src/lxml/lxml.etree.pyx":1140
 *             c_start = 0
 *         else:
 *             c_start = start             # <<<<<<<<<<<<<<
 *         if stop is None:
 *             c_stop = 0
 */
    __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_start); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_c_start = __pyx_t_7;
  }
  __pyx_L11:;

  /* "src/lxml/lxml.etree.pyx":1141
 *         else:
 *             c_start = start
 *         if stop is None:             # <<<<<<<<<<<<<<
 *             c_stop = 0
 *         else:
 */
  __pyx_t_3 = (__pyx_v_stop == Py_None);
  if (__pyx_t_3) {

    /* "src/lxml/lxml.etree.pyx":1142
 *             c_start = start
 *         if stop is None:
 *             c_stop = 0             # <<<<<<<<<<<<<<
 *         else:
 *             c_stop = stop
 */
    __pyx_v_c_stop = 0;
    goto __pyx_L12;
  }
  /*else*/ {

    /* "src/lxml/lxml.etree.pyx":1144
 *             c_stop = 0
 *         else:
 *             c_stop = stop             # <<<<<<<<<<<<<<
 *             if c_stop == 0 or \
 *                    c_start >= c_stop and (c_stop > 0 or c_start < 0):
 */
    __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_stop); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_c_stop = __pyx_t_7;

    /* "src/lxml/lxml.etree.pyx":1145
 *         else:
 *             c_stop = stop
 *             if c_stop == 0 or \             # <<<<<<<<<<<<<<
 *                    c_start >= c_stop and (c_stop > 0 or c_start < 0):
 *                 raise ValueError, u"list.index(x): x not in slice"
 */
    __pyx_t_3 = (__pyx_v_c_stop == 0);
    if (!__pyx_t_3) {

      /* "src/lxml/lxml.etree.pyx":1146
 *             c_stop = stop
 *             if c_stop == 0 or \
 *                    c_start >= c_stop and (c_stop > 0 or c_start < 0):             # <<<<<<<<<<<<<<
 *                 raise ValueError, u"list.index(x): x not in slice"
 * 
 */
      __pyx_t_2 = (__pyx_v_c_start >= __pyx_v_c_stop);
      if (__pyx_t_2) {
        __pyx_t_6 = (__pyx_v_c_stop > 0);
        if (!__pyx_t_6) {
          __pyx_t_5 = (__pyx_v_c_start < 0);
          __pyx_t_8 = __pyx_t_5;
        } else {
          __pyx_t_8 = __pyx_t_6;
        }
        __pyx_t_6 = __pyx_t_8;
      } else {
        __pyx_t_6 = __pyx_t_2;
      }
      __pyx_t_2 = __pyx_t_6;
    } else {
      __pyx_t_2 = __pyx_t_3;
    }
    if (__pyx_t_2) {

      /* "src/lxml/lxml.etree.pyx":1147
 *             if c_stop == 0 or \
 *                    c_start >= c_stop and (c_stop > 0 or c_start < 0):
 *                 raise ValueError, u"list.index(x): x not in slice"             # <<<<<<<<<<<<<<
 * 
 *         # for negative slice indices, check slice before searching index
 */
      __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_u_71), 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L13;
    }
    __pyx_L13:;
  }
  __pyx_L12:;

  /* "src/lxml/lxml.etree.pyx":1150
 * 
 *         # for negative slice indices, check slice before searching index
 *         if c_start < 0 or c_stop < 0:             # <<<<<<<<<<<<<<
 *             # start from right, at most up to leftmost(c_start, c_stop)
 *             if c_start < c_stop:
 */
  __pyx_t_2 = (__pyx_v_c_start < 0);
  if (!__pyx_t_2) {
    __pyx_t_3 = (__pyx_v_c_stop < 0);
    __pyx_t_6 = __pyx_t_3;
  } else {
    __pyx_t_6 = __pyx_t_2;
  }
  if (__pyx_t_6) {

    /* "src/lxml/lxml.etree.pyx":1152
 *         if c_start < 0 or c_stop < 0:
 *             # start from right, at most up to leftmost(c_start, c_stop)
 *             if c_start < c_stop:             # <<<<<<<<<<<<<<
 *                 k = -c_start
 *             else:
 */
    __pyx_t_6 = (__pyx_v_c_start < __pyx_v_c_stop);
    if (__pyx_t_6) {

      /* "src/lxml/lxml.etree.pyx":1153
 *             # start from right, at most up to leftmost(c_start, c_stop)
 *             if c_start < c_stop:
 *                 k = -c_start             # <<<<<<<<<<<<<<
 *             else:
 *                 k = -c_stop
 */
      __pyx_v_k = (-__pyx_v_c_start);
      goto __pyx_L15;
    }
    /*else*/ {

      /* "src/lxml/lxml.etree.pyx":1155
 *                 k = -c_start
 *             else:
 *                 k = -c_stop             # <<<<<<<<<<<<<<
 *             c_start_node = self._c_node.last
 *             l = 1
 */
      __pyx_v_k = (-__pyx_v_c_stop);
    }
    __pyx_L15:;

    /* "src/lxml/lxml.etree.pyx":1156
 *             else:
 *                 k = -c_stop
 *             c_start_node = self._c_node.last             # <<<<<<<<<<<<<<
 *             l = 1
 *             while c_start_node != c_child and l < k:
 */
    __pyx_v_c_start_node = ((struct LxmlElement *)__pyx_v_self)->_c_node->last;

    /* "src/lxml/lxml.etree.pyx":1157
 *                 k = -c_stop
 *             c_start_node = self._c_node.last
 *             l = 1             # <<<<<<<<<<<<<<
 *             while c_start_node != c_child and l < k:
 *                 if _isElement(c_start_node):
 */
    __pyx_v_l = 1;

    /* "src/lxml/lxml.etree.pyx":1158
 *             c_start_node = self._c_node.last
 *             l = 1
 *             while c_start_node != c_child and l < k:             # <<<<<<<<<<<<<<
 *                 if _isElement(c_start_node):
 *                     l = l + 1
 */
    while (1) {
      __pyx_t_6 = (__pyx_v_c_start_node != __pyx_v_c_child);
      if (__pyx_t_6) {
        __pyx_t_2 = (__pyx_v_l < __pyx_v_k);
        __pyx_t_3 = __pyx_t_2;
      } else {
        __pyx_t_3 = __pyx_t_6;
      }
      if (!__pyx_t_3) break;

      /* "src/lxml/lxml.etree.pyx":1159
 *             l = 1
 *             while c_start_node != c_child and l < k:
 *                 if _isElement(c_start_node):             # <<<<<<<<<<<<<<
 *                     l = l + 1
 *                 c_start_node = c_start_node.prev
 */
      __pyx_t_3 = _isElement(__pyx_v_c_start_node);
      if (__pyx_t_3) {

        /* "src/lxml/lxml.etree.pyx":1160
 *             while c_start_node != c_child and l < k:
 *                 if _isElement(c_start_node):
 *                     l = l + 1             # <<<<<<<<<<<<<<
 *                 c_start_node = c_start_node.prev
 *             if c_start_node == c_child:
 */
        __pyx_v_l = (__pyx_v_l + 1);
        goto __pyx_L18;
      }
      __pyx_L18:;

      /* "src/lxml/lxml.etree.pyx":1161
 *                 if _isElement(c_start_node):
 *                     l = l + 1
 *                 c_start_node = c_start_node.prev             # <<<<<<<<<<<<<<
 *             if c_start_node == c_child:
 *                 # found! before slice end?
 */
      __pyx_v_c_start_node = __pyx_v_c_start_node->prev;
    }

    /* "src/lxml/lxml.etree.pyx":1162
 *                     l = l + 1
 *                 c_start_node = c_start_node.prev
 *             if c_start_node == c_child:             # <<<<<<<<<<<<<<
 *                 # found! before slice end?
 *                 if c_stop < 0 and l <= -c_stop:
 */
    __pyx_t_3 = (__pyx_v_c_start_node == __pyx_v_c_child);
    if (__pyx_t_3) {

      /* "src/lxml/lxml.etree.pyx":1164
 *             if c_start_node == c_child:
 *                 # found! before slice end?
 *                 if c_stop < 0 and l <= -c_stop:             # <<<<<<<<<<<<<<
 *                     raise ValueError, u"list.index(x): x not in slice"
 *             elif c_start < 0:
 */
      __pyx_t_3 = (__pyx_v_c_stop < 0);
      if (__pyx_t_3) {
        __pyx_t_6 = (__pyx_v_l <= (-__pyx_v_c_stop));
        __pyx_t_2 = __pyx_t_6;
      } else {
        __pyx_t_2 = __pyx_t_3;
      }
      if (__pyx_t_2) {

        /* "src/lxml/lxml.etree.pyx":1165
 *                 # found! before slice end?
 *                 if c_stop < 0 and l <= -c_stop:
 *                     raise ValueError, u"list.index(x): x not in slice"             # <<<<<<<<<<<<<<
 *             elif c_start < 0:
 *                 raise ValueError, u"list.index(x): x not in slice"
 */
        __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_u_71), 0);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L20;
      }
      __pyx_L20:;
      goto __pyx_L19;
    }

    /* "src/lxml/lxml.etree.pyx":1166
 *                 if c_stop < 0 and l <= -c_stop:
 *                     raise ValueError, u"list.index(x): x not in slice"
 *             elif c_start < 0:             # <<<<<<<<<<<<<<
 *                 raise ValueError, u"list.index(x): x not in slice"
 * 
 */
    __pyx_t_2 = (__pyx_v_c_start < 0);
    if (__pyx_t_2) {

      /* "src/lxml/lxml.etree.pyx":1167
 *                     raise ValueError, u"list.index(x): x not in slice"
 *             elif c_start < 0:
 *                 raise ValueError, u"list.index(x): x not in slice"             # <<<<<<<<<<<<<<
 * 
 *         # now determine the index backwards from child
 */
      __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_u_71), 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L19;
    }
    __pyx_L19:;
    goto __pyx_L14;
  }
  __pyx_L14:;

  /* "src/lxml/lxml.etree.pyx":1170
 * 
 *         # now determine the index backwards from child
 *         c_child = c_child.prev             # <<<<<<<<<<<<<<
 *         k = 0
 *         if c_stop > 0:
 */
  __pyx_v_c_child = __pyx_v_c_child->prev;

  /* "src/lxml/lxml.etree.pyx":1171
 *         # now determine the index backwards from child
 *         c_child = c_child.prev
 *         k = 0             # <<<<<<<<<<<<<<
 *         if c_stop > 0:
 *             # we can optimize: stop after c_stop elements if not found
 */
  __pyx_v_k = 0;

  /* "src/lxml/lxml.etree.pyx":1172
 *         c_child = c_child.prev
 *         k = 0
 *         if c_stop > 0:             # <<<<<<<<<<<<<<
 *             # we can optimize: stop after c_stop elements if not found
 *             while c_child != NULL and k < c_stop:
 */
  __pyx_t_2 = (__pyx_v_c_stop > 0);
  if (__pyx_t_2) {

    /* "src/lxml/lxml.etree.pyx":1174
 *         if c_stop > 0:
 *             # we can optimize: stop after c_stop elements if not found
 *             while c_child != NULL and k < c_stop:             # <<<<<<<<<<<<<<
 *                 if _isElement(c_child):
 *                     k = k + 1
 */
    while (1) {
      __pyx_t_2 = (__pyx_v_c_child != NULL);
      if (__pyx_t_2) {
        __pyx_t_3 = (__pyx_v_k < __pyx_v_c_stop);
        __pyx_t_6 = __pyx_t_3;
      } else {
        __pyx_t_6 = __pyx_t_2;
      }
      if (!__pyx_t_6) break;

      /* "src/lxml/lxml.etree.pyx":1175
 *             # we can optimize: stop after c_stop elements if not found
 *             while c_child != NULL and k < c_stop:
 *                 if _isElement(c_child):             # <<<<<<<<<<<<<<
 *                     k = k + 1
 *                 c_child = c_child.prev
 */
      __pyx_t_6 = _isElement(__pyx_v_c_child);
      if (__pyx_t_6) {

        /* "src/lxml/lxml.etree.pyx":1176
 *             while c_child != NULL and k < c_stop:
 *                 if _isElement(c_child):
 *                     k = k + 1             # <<<<<<<<<<<<<<
 *                 c_child = c_child.prev
 *             if k < c_stop:
 */
        __pyx_v_k = (__pyx_v_k + 1);
        goto __pyx_L24;
      }
      __pyx_L24:;

      /* "src/lxml/lxml.etree.pyx":1177
 *                 if _isElement(c_child):
 *                     k = k + 1
 *                 c_child = c_child.prev             # <<<<<<<<<<<<<<
 *             if k < c_stop:
 *                 return k
 */
      __pyx_v_c_child = __pyx_v_c_child->prev;
    }

    /* "src/lxml/lxml.etree.pyx":1178
 *                     k = k + 1
 *                 c_child = c_child.prev
 *             if k < c_stop:             # <<<<<<<<<<<<<<
 *                 return k
 *         else:
 */
    __pyx_t_6 = (__pyx_v_k < __pyx_v_c_stop);
    if (__pyx_t_6) {

      /* "src/lxml/lxml.etree.pyx":1179
 *                 c_child = c_child.prev
 *             if k < c_stop:
 *                 return k             # <<<<<<<<<<<<<<
 *         else:
 *             # traverse all
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_k); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L0;
      goto __pyx_L25;
    }
    __pyx_L25:;
    goto __pyx_L21;
  }
  /*else*/ {

    /* "src/lxml/lxml.etree.pyx":1182
 *         else:
 *             # traverse all
 *             while c_child != NULL:             # <<<<<<<<<<<<<<
 *                 if _isElement(c_child):
 *                     k = k + 1
 */
    while (1) {
      __pyx_t_6 = (__pyx_v_c_child != NULL);
      if (!__pyx_t_6) break;

      /* "src/lxml/lxml.etree.pyx":1183
 *             # traverse all
 *             while c_child != NULL:
 *                 if _isElement(c_child):             # <<<<<<<<<<<<<<
 *                     k = k + 1
 *                 c_child = c_child.prev
 */
      __pyx_t_6 = _isElement(__pyx_v_c_child);
      if (__pyx_t_6) {

        /* "src/lxml/lxml.etree.pyx":1184
 *             while c_child != NULL:
 *                 if _isElement(c_child):
 *                     k = k + 1             # <<<<<<<<<<<<<<
 *                 c_child = c_child.prev
 *             if c_start > 0:
 */
        __pyx_v_k = (__pyx_v_k + 1);
        goto __pyx_L28;
      }
      __pyx_L28:;

      /* "src/lxml/lxml.etree.pyx":1185
 *                 if _isElement(c_child):
 *                     k = k + 1
 *                 c_child = c_child.prev             # <<<<<<<<<<<<<<
 *             if c_start > 0:
 *                 if k >= c_start:
 */
      __pyx_v_c_child = __pyx_v_c_child->prev;
    }

    /* "src/lxml/lxml.etree.pyx":1186
 *                     k = k + 1
 *                 c_child = c_child.prev
 *             if c_start > 0:             # <<<<<<<<<<<<<<
 *                 if k >= c_start:
 *                     return k
 */
    __pyx_t_6 = (__pyx_v_c_start > 0);
    if (__pyx_t_6) {

      /* "src/lxml/lxml.etree.pyx":1187
 *                 c_child = c_child.prev
 *             if c_start > 0:
 *                 if k >= c_start:             # <<<<<<<<<<<<<<
 *                     return k
 *             else:
 */
      __pyx_t_6 = (__pyx_v_k >= __pyx_v_c_start);
      if (__pyx_t_6) {

        /* "src/lxml/lxml.etree.pyx":1188
 *             if c_start > 0:
 *                 if k >= c_start:
 *                     return k             # <<<<<<<<<<<<<<
 *             else:
 *                 return k
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_k); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_r = __pyx_t_4;
        __pyx_t_4 = 0;
        goto __pyx_L0;
        goto __pyx_L30;
      }
      __pyx_L30:;
      goto __pyx_L29;
    }
    /*else*/ {

      /* "src/lxml/lxml.etree.pyx":1190
 *                     return k
 *             else:
 *                 return k             # <<<<<<<<<<<<<<
 *         if c_start != 0 or c_stop != 0:
 *             raise ValueError, u"list.index(x): x not in slice"
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_k); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L0;
    }
    __pyx_L29:;
  }
  __pyx_L21:;

  /* "src/lxml/lxml.etree.pyx":1191
 *             else:
 *                 return k
 *         if c_start != 0 or c_stop != 0:             # <<<<<<<<<<<<<<
 *             raise ValueError, u"list.index(x): x not in slice"
 *         else:
 */
  __pyx_t_6 = (__pyx_v_c_start != 0);
  if (!__pyx_t_6) {
    __pyx_t_2 = (__pyx_v_c_stop != 0);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_6;
  }
  if (__pyx_t_3) {

    /* "src/lxml/lxml.etree.pyx":1192
 *                 return k
 *         if c_start != 0 or c_stop != 0:
 *             raise ValueError, u"list.index(x): x not in slice"             # <<<<<<<<<<<<<<
 *         else:
 *             raise ValueError, u"list.index(x): x not in list"
 */
    __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_u_71), 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L31;
  }
  /*else*/ {

    /* "src/lxml/lxml.etree.pyx":1194
 *             raise ValueError, u"list.index(x): x not in slice"
 *         else:
 *             raise ValueError, u"list.index(x): x not in list"             # <<<<<<<<<<<<<<
 * 
 *     def get(self, key, default=None):
 */
    __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_u_72), 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L31:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._Element.index");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1196
 *             raise ValueError, u"list.index(x): x not in list"
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         u"""get(self, key, default=None)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_8_Element_23get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_23get[] = "get(self, key, default=None)\n\n        Gets an element attribute.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_8_Element_23get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_default = 0;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__key,&__pyx_n_s__default,0};
  __Pyx_RefNannySetupContext("get");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__key);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__default);
        if (value) { values[1] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "get") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1196; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_key = values[0];
    __pyx_v_default = values[1];
  } else {
    __pyx_v_default = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_default = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v_key = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1196; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._Element.get");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "src/lxml/lxml.etree.pyx":1201
 *         Gets an element attribute.
 *         """
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         return _getAttributeValue(self, key, default)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":1202
 *         """
 *         _assertValidNode(self)
 *         return _getAttributeValue(self, key, default)             # <<<<<<<<<<<<<<
 * 
 *     def keys(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree__getAttributeValue(((struct LxmlElement *)__pyx_v_self), __pyx_v_key, __pyx_v_default); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Element.get");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1204
 *         return _getAttributeValue(self, key, default)
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         u"""keys(self)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_8_Element_24keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_24keys[] = "keys(self)\n\n        Gets a list of attribute names.  The names are returned in an\n        arbitrary order (just like for an ordinary Python dictionary).\n        ";
static PyObject *__pyx_pf_4lxml_5etree_8_Element_24keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("keys");

  /* "src/lxml/lxml.etree.pyx":1210
 *         arbitrary order (just like for an ordinary Python dictionary).
 *         """
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         return _collectAttributes(self._c_node, 1)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":1211
 *         """
 *         _assertValidNode(self)
 *         return _collectAttributes(self._c_node, 1)             # <<<<<<<<<<<<<<
 * 
 *     def values(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__collectAttributes(((struct LxmlElement *)__pyx_v_self)->_c_node, 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Element.keys");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1213
 *         return _collectAttributes(self._c_node, 1)
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         u"""values(self)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_8_Element_25values(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_25values[] = "values(self)\n\n        Gets element attribute values as a sequence of strings.  The\n        attributes are returned in an arbitrary order.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_8_Element_25values(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("values");

  /* "src/lxml/lxml.etree.pyx":1219
 *         attributes are returned in an arbitrary order.
 *         """
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         return _collectAttributes(self._c_node, 2)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":1220
 *         """
 *         _assertValidNode(self)
 *         return _collectAttributes(self._c_node, 2)             # <<<<<<<<<<<<<<
 * 
 *     def items(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__collectAttributes(((struct LxmlElement *)__pyx_v_self)->_c_node, 2)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Element.values");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1222
 *         return _collectAttributes(self._c_node, 2)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         u"""items(self)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_8_Element_26items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_26items[] = "items(self)\n\n        Gets element attributes, as a sequence. The attributes are returned in\n        an arbitrary order.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_8_Element_26items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("items");

  /* "src/lxml/lxml.etree.pyx":1228
 *         an arbitrary order.
 *         """
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         return _collectAttributes(self._c_node, 3)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":1229
 *         """
 *         _assertValidNode(self)
 *         return _collectAttributes(self._c_node, 3)             # <<<<<<<<<<<<<<
 * 
 *     def getchildren(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__collectAttributes(((struct LxmlElement *)__pyx_v_self)->_c_node, 3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Element.items");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1231
 *         return _collectAttributes(self._c_node, 3)
 * 
 *     def getchildren(self):             # <<<<<<<<<<<<<<
 *         u"""getchildren(self)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_8_Element_27getchildren(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_27getchildren[] = "getchildren(self)\n\n        Returns all direct children.  The elements are returned in document\n        order.\n\n        :deprecated: Note that this method has been deprecated as of\n          ElementTree 1.3 and lxml 2.0.  New code should use\n          ``list(element)`` or simply iterate over elements.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_8_Element_27getchildren(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getchildren");

  /* "src/lxml/lxml.etree.pyx":1241
 *           ``list(element)`` or simply iterate over elements.
 *         """
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         return _collectChildren(self)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":1242
 *         """
 *         _assertValidNode(self)
 *         return _collectChildren(self)             # <<<<<<<<<<<<<<
 * 
 *     def getparent(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree__collectChildren(((struct LxmlElement *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Element.getchildren");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1244
 *         return _collectChildren(self)
 * 
 *     def getparent(self):             # <<<<<<<<<<<<<<
 *         u"""getparent(self)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_8_Element_28getparent(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_28getparent[] = "getparent(self)\n\n        Returns the parent of this element or None for the root element.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_8_Element_28getparent(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  xmlNode *__pyx_v_c_node;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("getparent");

  /* "src/lxml/lxml.etree.pyx":1251
 *         cdef xmlNode* c_node
 *         #_assertValidNode(self) # not needed
 *         c_node = _parentElement(self._c_node)             # <<<<<<<<<<<<<<
 *         if c_node is NULL:
 *             return None
 */
  __pyx_v_c_node = __pyx_f_4lxml_5etree__parentElement(((struct LxmlElement *)__pyx_v_self)->_c_node);

  /* "src/lxml/lxml.etree.pyx":1252
 *         #_assertValidNode(self) # not needed
 *         c_node = _parentElement(self._c_node)
 *         if c_node is NULL:             # <<<<<<<<<<<<<<
 *             return None
 *         return _elementFactory(self._doc, c_node)
 */
  __pyx_t_1 = (__pyx_v_c_node == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/lxml.etree.pyx":1253
 *         c_node = _parentElement(self._c_node)
 *         if c_node is NULL:
 *             return None             # <<<<<<<<<<<<<<
 *         return _elementFactory(self._doc, c_node)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "src/lxml/lxml.etree.pyx":1254
 *         if c_node is NULL:
 *             return None
 *         return _elementFactory(self._doc, c_node)             # <<<<<<<<<<<<<<
 * 
 *     def getnext(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)((struct LxmlElement *)__pyx_v_self)->_doc);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_2), __pyx_v_c_node)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Element.getparent");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1256
 *         return _elementFactory(self._doc, c_node)
 * 
 *     def getnext(self):             # <<<<<<<<<<<<<<
 *         u"""getnext(self)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_8_Element_29getnext(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_29getnext[] = "getnext(self)\n\n        Returns the following sibling of this element or None.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_8_Element_29getnext(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  xmlNode *__pyx_v_c_node;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("getnext");

  /* "src/lxml/lxml.etree.pyx":1263
 *         cdef xmlNode* c_node
 *         #_assertValidNode(self) # not needed
 *         c_node = _nextElement(self._c_node)             # <<<<<<<<<<<<<<
 *         if c_node is NULL:
 *             return None
 */
  __pyx_v_c_node = __pyx_f_4lxml_5etree__nextElement(((struct LxmlElement *)__pyx_v_self)->_c_node);

  /* "src/lxml/lxml.etree.pyx":1264
 *         #_assertValidNode(self) # not needed
 *         c_node = _nextElement(self._c_node)
 *         if c_node is NULL:             # <<<<<<<<<<<<<<
 *             return None
 *         return _elementFactory(self._doc, c_node)
 */
  __pyx_t_1 = (__pyx_v_c_node == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/lxml.etree.pyx":1265
 *         c_node = _nextElement(self._c_node)
 *         if c_node is NULL:
 *             return None             # <<<<<<<<<<<<<<
 *         return _elementFactory(self._doc, c_node)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "src/lxml/lxml.etree.pyx":1266
 *         if c_node is NULL:
 *             return None
 *         return _elementFactory(self._doc, c_node)             # <<<<<<<<<<<<<<
 * 
 *     def getprevious(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)((struct LxmlElement *)__pyx_v_self)->_doc);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_2), __pyx_v_c_node)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Element.getnext");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1268
 *         return _elementFactory(self._doc, c_node)
 * 
 *     def getprevious(self):             # <<<<<<<<<<<<<<
 *         u"""getprevious(self)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_8_Element_30getprevious(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_30getprevious[] = "getprevious(self)\n\n        Returns the preceding sibling of this element or None.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_8_Element_30getprevious(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  xmlNode *__pyx_v_c_node;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("getprevious");

  /* "src/lxml/lxml.etree.pyx":1275
 *         cdef xmlNode* c_node
 *         #_assertValidNode(self) # not needed
 *         c_node = _previousElement(self._c_node)             # <<<<<<<<<<<<<<
 *         if c_node is NULL:
 *             return None
 */
  __pyx_v_c_node = __pyx_f_4lxml_5etree__previousElement(((struct LxmlElement *)__pyx_v_self)->_c_node);

  /* "src/lxml/lxml.etree.pyx":1276
 *         #_assertValidNode(self) # not needed
 *         c_node = _previousElement(self._c_node)
 *         if c_node is NULL:             # <<<<<<<<<<<<<<
 *             return None
 *         return _elementFactory(self._doc, c_node)
 */
  __pyx_t_1 = (__pyx_v_c_node == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/lxml.etree.pyx":1277
 *         c_node = _previousElement(self._c_node)
 *         if c_node is NULL:
 *             return None             # <<<<<<<<<<<<<<
 *         return _elementFactory(self._doc, c_node)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "src/lxml/lxml.etree.pyx":1278
 *         if c_node is NULL:
 *             return None
 *         return _elementFactory(self._doc, c_node)             # <<<<<<<<<<<<<<
 * 
 *     def itersiblings(self, tag=None, *, preceding=False):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)((struct LxmlElement *)__pyx_v_self)->_doc);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_2), __pyx_v_c_node)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Element.getprevious");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1280
 *         return _elementFactory(self._doc, c_node)
 * 
 *     def itersiblings(self, tag=None, *, preceding=False):             # <<<<<<<<<<<<<<
 *         u"""itersiblings(self, tag=None, preceding=False)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_8_Element_31itersiblings(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_31itersiblings[] = "itersiblings(self, tag=None, preceding=False)\n\n        Iterate over the following or preceding siblings of this element.\n\n        The direction is determined by the 'preceding' keyword which\n        defaults to False, i.e. forward iteration over the following\n        siblings.  When True, the iterator yields the preceding\n        siblings in reverse document order, i.e. starting right before\n        the current element and going left.  The generated elements\n        can be restricted to a specific tag name with the 'tag'\n        keyword.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_8_Element_31itersiblings(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_preceding = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__tag,&__pyx_n_s__preceding,0};
  __Pyx_RefNannySetupContext("itersiblings");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = __pyx_k_73;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tag);
        if (value) { values[0] = value; kw_args--; }
      }
    }
    while (kw_args > 0) {
      PyObject* value;
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__preceding);
      if (value) { values[1] = value; if (!(--kw_args)) break; }
      break;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "itersiblings") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1280; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_tag = values[0];
    __pyx_v_preceding = values[1];
  } else {
    __pyx_v_tag = ((PyObject *)Py_None);
    __pyx_v_preceding = __pyx_k_73;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: __pyx_v_tag = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("itersiblings", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1280; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._Element.itersiblings");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "src/lxml/lxml.etree.pyx":1293
 *         keyword.
 *         """
 *         return SiblingsIterator(self, tag, preceding=preceding)             # <<<<<<<<<<<<<<
 * 
 *     def iterancestors(self, tag=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __Pyx_INCREF(__pyx_v_tag);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_tag);
  __Pyx_GIVEREF(__pyx_v_tag);
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__preceding), __pyx_v_preceding) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_SiblingsIterator)), ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Element.itersiblings");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1295
 *         return SiblingsIterator(self, tag, preceding=preceding)
 * 
 *     def iterancestors(self, tag=None):             # <<<<<<<<<<<<<<
 *         u"""iterancestors(self, tag=None)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_8_Element_32iterancestors(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_32iterancestors[] = "iterancestors(self, tag=None)\n\n        Iterate over the ancestors of this element (from parent to parent).\n\n        The generated elements can be restricted to a specific tag name with\n        the 'tag' keyword.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_8_Element_32iterancestors(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__tag,0};
  __Pyx_RefNannySetupContext("iterancestors");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[1] = {0};
    values[0] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tag);
        if (value) { values[0] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "iterancestors") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1295; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_tag = values[0];
  } else {
    __pyx_v_tag = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: __pyx_v_tag = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("iterancestors", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1295; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._Element.iterancestors");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "src/lxml/lxml.etree.pyx":1303
 *         the 'tag' keyword.
 *         """
 *         return AncestorsIterator(self, tag)             # <<<<<<<<<<<<<<
 * 
 *     def iterdescendants(self, tag=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __Pyx_INCREF(__pyx_v_tag);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_tag);
  __Pyx_GIVEREF(__pyx_v_tag);
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_AncestorsIterator)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Element.iterancestors");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1305
 *         return AncestorsIterator(self, tag)
 * 
 *     def iterdescendants(self, tag=None):             # <<<<<<<<<<<<<<
 *         u"""iterdescendants(self, tag=None)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_8_Element_33iterdescendants(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_33iterdescendants[] = "iterdescendants(self, tag=None)\n\n        Iterate over the descendants of this element in document order.\n\n        As opposed to ``el.iter()``, this iterator does not yield the element\n        itself.  The generated elements can be restricted to a specific tag\n        name with the 'tag' keyword.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_8_Element_33iterdescendants(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__tag,0};
  __Pyx_RefNannySetupContext("iterdescendants");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[1] = {0};
    values[0] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tag);
        if (value) { values[0] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "iterdescendants") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1305; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_tag = values[0];
  } else {
    __pyx_v_tag = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: __pyx_v_tag = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("iterdescendants", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1305; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._Element.iterdescendants");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "src/lxml/lxml.etree.pyx":1314
 *         name with the 'tag' keyword.
 *         """
 *         return ElementDepthFirstIterator(self, tag, inclusive=False)             # <<<<<<<<<<<<<<
 * 
 *     def iterchildren(self, tag=None, *, reversed=False):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __Pyx_INCREF(__pyx_v_tag);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_tag);
  __Pyx_GIVEREF(__pyx_v_tag);
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__inclusive), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_ElementDepthFirstIterator)), ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Element.iterdescendants");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1316
 *         return ElementDepthFirstIterator(self, tag, inclusive=False)
 * 
 *     def iterchildren(self, tag=None, *, reversed=False):             # <<<<<<<<<<<<<<
 *         u"""iterchildren(self, tag=None, reversed=False)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_8_Element_34iterchildren(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_34iterchildren[] = "iterchildren(self, tag=None, reversed=False)\n\n        Iterate over the children of this element.\n\n        As opposed to using normal iteration on this element, the generated\n        elements can be restricted to a specific tag name with the 'tag'\n        keyword and reversed with the 'reversed' keyword.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_8_Element_34iterchildren(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_reversed = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__tag,&__pyx_n_s__reversed,0};
  __Pyx_RefNannySetupContext("iterchildren");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = __pyx_k_74;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tag);
        if (value) { values[0] = value; kw_args--; }
      }
    }
    while (kw_args > 0) {
      PyObject* value;
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reversed);
      if (value) { values[1] = value; if (!(--kw_args)) break; }
      break;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "iterchildren") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1316; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_tag = values[0];
    __pyx_v_reversed = values[1];
  } else {
    __pyx_v_tag = ((PyObject *)Py_None);
    __pyx_v_reversed = __pyx_k_74;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: __pyx_v_tag = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("iterchildren", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1316; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._Element.iterchildren");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "src/lxml/lxml.etree.pyx":1325
 *         keyword and reversed with the 'reversed' keyword.
 *         """
 *         return ElementChildIterator(self, tag, reversed=reversed)             # <<<<<<<<<<<<<<
 * 
 *     def getroottree(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __Pyx_INCREF(__pyx_v_tag);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_tag);
  __Pyx_GIVEREF(__pyx_v_tag);
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__reversed), __pyx_v_reversed) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_ElementChildIterator)), ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Element.iterchildren");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1327
 *         return ElementChildIterator(self, tag, reversed=reversed)
 * 
 *     def getroottree(self):             # <<<<<<<<<<<<<<
 *         u"""getroottree(self)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_8_Element_35getroottree(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_35getroottree[] = "getroottree(self)\n\n        Return an ElementTree for the root node of the document that\n        contains this element.\n\n        This is the same as following element.getparent() up the tree until it\n        returns None (for the root element) and then build an ElementTree for\n        the last parent that was returned.";
static PyObject *__pyx_pf_4lxml_5etree_8_Element_35getroottree(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("getroottree");

  /* "src/lxml/lxml.etree.pyx":1336
 *         returns None (for the root element) and then build an ElementTree for
 *         the last parent that was returned."""
 *         _assertValidDoc(self._doc)             # <<<<<<<<<<<<<<
 *         return _elementTreeFactory(self._doc, None)
 * 
 */
  __pyx_t_1 = ((PyObject *)((struct LxmlElement *)__pyx_v_self)->_doc);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidDoc(((struct LxmlDocument *)__pyx_t_1)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/lxml.etree.pyx":1337
 *         the last parent that was returned."""
 *         _assertValidDoc(self._doc)
 *         return _elementTreeFactory(self._doc, None)             # <<<<<<<<<<<<<<
 * 
 *     def getiterator(self, tag=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)((struct LxmlElement *)__pyx_v_self)->_doc);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__elementTreeFactory(((struct LxmlDocument *)__pyx_t_1), ((struct LxmlElement *)Py_None))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Element.getroottree");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1339
 *         return _elementTreeFactory(self._doc, None)
 * 
 *     def getiterator(self, tag=None):             # <<<<<<<<<<<<<<
 *         u"""getiterator(self, tag=None)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_8_Element_36getiterator(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_36getiterator[] = "getiterator(self, tag=None)\n\n        Returns a sequence or iterator of all elements in the subtree in\n        document order (depth first pre-order), starting with this\n        element.\n\n        Can be restricted to find only elements with a specific tag\n        (pass ``tag=\"xyz\"``) or from a namespace (pass ``tag=\"{ns}*\"``).\n\n        You can also pass the Element, Comment, ProcessingInstruction and\n        Entity factory functions to look only for the specific element type.\n\n        :deprecated: Note that this method is deprecated as of\n          ElementTree 1.3 and lxml 2.0.  It returns an iterator in\n          lxml, which diverges from the original ElementTree\n          behaviour.  If you want an efficient iterator, use the\n          ``element.iter()`` method instead.  You should only use this\n          method in new code if you require backwards compatibility\n          with older versions of lxml or ElementTree.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_8_Element_36getiterator(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__tag,0};
  __Pyx_RefNannySetupContext("getiterator");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[1] = {0};
    values[0] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tag);
        if (value) { values[0] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "getiterator") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1339; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_tag = values[0];
  } else {
    __pyx_v_tag = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: __pyx_v_tag = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getiterator", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1339; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._Element.getiterator");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "src/lxml/lxml.etree.pyx":1360
 *           with older versions of lxml or ElementTree.
 *         """
 *         return ElementDepthFirstIterator(self, tag)             # <<<<<<<<<<<<<<
 * 
 *     def iter(self, tag=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __Pyx_INCREF(__pyx_v_tag);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_tag);
  __Pyx_GIVEREF(__pyx_v_tag);
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_ElementDepthFirstIterator)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Element.getiterator");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1362
 *         return ElementDepthFirstIterator(self, tag)
 * 
 *     def iter(self, tag=None):             # <<<<<<<<<<<<<<
 *         u"""iter(self, tag=None)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_8_Element_37iter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_37iter[] = "iter(self, tag=None)\n\n        Iterate over all elements in the subtree in document order (depth\n        first pre-order), starting with this element.\n\n        Can be restricted to find only elements with a specific tag\n        (pass ``tag=\"xyz\"``) or from a namespace (pass ``tag=\"{ns}*\"``).\n\n        You can also pass the Element, Comment, ProcessingInstruction and\n        Entity factory functions to look only for the specific element type.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_8_Element_37iter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__tag,0};
  __Pyx_RefNannySetupContext("iter");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[1] = {0};
    values[0] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tag);
        if (value) { values[0] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "iter") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1362; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_tag = values[0];
  } else {
    __pyx_v_tag = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: __pyx_v_tag = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("iter", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1362; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._Element.iter");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "src/lxml/lxml.etree.pyx":1374
 *         Entity factory functions to look only for the specific element type.
 *         """
 *         return ElementDepthFirstIterator(self, tag)             # <<<<<<<<<<<<<<
 * 
 *     def itertext(self, tag=None, *, with_tail=True):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __Pyx_INCREF(__pyx_v_tag);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_tag);
  __Pyx_GIVEREF(__pyx_v_tag);
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_ElementDepthFirstIterator)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Element.iter");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1376
 *         return ElementDepthFirstIterator(self, tag)
 * 
 *     def itertext(self, tag=None, *, with_tail=True):             # <<<<<<<<<<<<<<
 *         u"""itertext(self, tag=None, with_tail=True)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_8_Element_38itertext(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_38itertext[] = "itertext(self, tag=None, with_tail=True)\n\n        Iterates over the text content of a subtree.\n\n        You can pass the ``tag`` keyword argument to restrict text content to\n        a specific tag name.\n\n        You can set the ``with_tail`` keyword argument to ``False`` to skip\n        over tail text.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_8_Element_38itertext(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_with_tail = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__tag,&__pyx_n_s__with_tail,0};
  __Pyx_RefNannySetupContext("itertext");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = __pyx_k_75;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tag);
        if (value) { values[0] = value; kw_args--; }
      }
    }
    while (kw_args > 0) {
      PyObject* value;
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__with_tail);
      if (value) { values[1] = value; if (!(--kw_args)) break; }
      break;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "itertext") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1376; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_tag = values[0];
    __pyx_v_with_tail = values[1];
  } else {
    __pyx_v_tag = ((PyObject *)Py_None);
    __pyx_v_with_tail = __pyx_k_75;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: __pyx_v_tag = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("itertext", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1376; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._Element.itertext");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "src/lxml/lxml.etree.pyx":1387
 *         over tail text.
 *         """
 *         return ElementTextIterator(self, tag, with_tail=with_tail)             # <<<<<<<<<<<<<<
 * 
 *     def makeelement(self, _tag, attrib=None, nsmap=None, **_extra):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __Pyx_INCREF(__pyx_v_tag);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_tag);
  __Pyx_GIVEREF(__pyx_v_tag);
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__with_tail), __pyx_v_with_tail) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_ElementTextIterator)), ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Element.itertext");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1389
 *         return ElementTextIterator(self, tag, with_tail=with_tail)
 * 
 *     def makeelement(self, _tag, attrib=None, nsmap=None, **_extra):             # <<<<<<<<<<<<<<
 *         u"""makeelement(self, _tag, attrib=None, nsmap=None, **_extra)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_8_Element_39makeelement(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_39makeelement[] = "makeelement(self, _tag, attrib=None, nsmap=None, **_extra)\n\n        Creates a new element associated with the same document.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_8_Element_39makeelement(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v__tag = 0;
  PyObject *__pyx_v_attrib = 0;
  PyObject *__pyx_v_nsmap = 0;
  PyObject *__pyx_v__extra = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s___tag,&__pyx_n_s__attrib,&__pyx_n_s__nsmap,0};
  __Pyx_RefNannySetupContext("makeelement");
  __pyx_v__extra = PyDict_New(); if (unlikely(!__pyx_v__extra)) return NULL;
  __Pyx_GOTREF(__pyx_v__extra);
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s___tag);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__attrib);
        if (value) { values[1] = value; kw_args--; }
      }
      case  2:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nsmap);
        if (value) { values[2] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v__extra, values, PyTuple_GET_SIZE(__pyx_args), "makeelement") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1389; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v__tag = values[0];
    __pyx_v_attrib = values[1];
    __pyx_v_nsmap = values[2];
  } else {
    __pyx_v_attrib = ((PyObject *)Py_None);
    __pyx_v_nsmap = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: __pyx_v_nsmap = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: __pyx_v_attrib = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v__tag = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("makeelement", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1389; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v__extra);
  __Pyx_AddTraceback("lxml.etree._Element.makeelement");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "src/lxml/lxml.etree.pyx":1394
 *         Creates a new element associated with the same document.
 *         """
 *         _assertValidDoc(self._doc)             # <<<<<<<<<<<<<<
 *         return _makeElement(_tag, NULL, self._doc, None, None, None,
 *                             attrib, nsmap, _extra)
 */
  __pyx_t_1 = ((PyObject *)((struct LxmlElement *)__pyx_v_self)->_doc);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidDoc(((struct LxmlDocument *)__pyx_t_1)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/lxml.etree.pyx":1395
 *         """
 *         _assertValidDoc(self._doc)
 *         return _makeElement(_tag, NULL, self._doc, None, None, None,             # <<<<<<<<<<<<<<
 *                             attrib, nsmap, _extra)
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)((struct LxmlElement *)__pyx_v_self)->_doc);
  __Pyx_INCREF(__pyx_t_1);

  /* "src/lxml/lxml.etree.pyx":1396
 *         _assertValidDoc(self._doc)
 *         return _makeElement(_tag, NULL, self._doc, None, None, None,
 *                             attrib, nsmap, _extra)             # <<<<<<<<<<<<<<
 * 
 *     def find(self, path, namespaces=None):
 */
  __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__makeElement(__pyx_v__tag, NULL, ((struct LxmlDocument *)__pyx_t_1), ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None), Py_None, Py_None, __pyx_v_attrib, __pyx_v_nsmap, ((PyObject *)__pyx_v__extra))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Element.makeelement");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v__extra);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1398
 *                             attrib, nsmap, _extra)
 * 
 *     def find(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         u"""find(self, path, namespaces=None)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_8_Element_40find(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_40find[] = "find(self, path, namespaces=None)\n\n        Finds the first matching subelement, by tag name or path.\n\n        The optional ``namespaces`` argument accepts a\n        prefix-to-namespace mapping that allows the usage of XPath\n        prefixes in the path expression.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_8_Element_40find(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_path = 0;
  PyObject *__pyx_v_namespaces = 0;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__path,&__pyx_n_s__namespaces,0};
  __Pyx_RefNannySetupContext("find");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__path);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__namespaces);
        if (value) { values[1] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "find") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1398; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_path = values[0];
    __pyx_v_namespaces = values[1];
  } else {
    __pyx_v_namespaces = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_namespaces = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v_path = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("find", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1398; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._Element.find");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF(__pyx_v_path);

  /* "src/lxml/lxml.etree.pyx":1407
 *         prefixes in the path expression.
 *         """
 *         if isinstance(path, QName):             # <<<<<<<<<<<<<<
 *             path = (<QName>path).text
 *         return _elementpath.find(self, path, namespaces)
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_path, ((PyObject*)__pyx_ptype_4lxml_5etree_QName)); 
  if (__pyx_t_1) {

    /* "src/lxml/lxml.etree.pyx":1408
 *         """
 *         if isinstance(path, QName):
 *             path = (<QName>path).text             # <<<<<<<<<<<<<<
 *         return _elementpath.find(self, path, namespaces)
 * 
 */
    __Pyx_INCREF(((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_path)->text);
    __Pyx_DECREF(__pyx_v_path);
    __pyx_v_path = ((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_path)->text;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "src/lxml/lxml.etree.pyx":1409
 *         if isinstance(path, QName):
 *             path = (<QName>path).text
 *         return _elementpath.find(self, path, namespaces)             # <<<<<<<<<<<<<<
 * 
 *     def findtext(self, path, default=None, namespaces=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_4lxml_5etree__elementpath, __pyx_n_s__find); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __Pyx_INCREF(__pyx_v_path);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_path);
  __Pyx_GIVEREF(__pyx_v_path);
  __Pyx_INCREF(__pyx_v_namespaces);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_namespaces);
  __Pyx_GIVEREF(__pyx_v_namespaces);
  __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._Element.find");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_path);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1411
 *         return _elementpath.find(self, path, namespaces)
 * 
 *     def findtext(self, path, default=None, namespaces=None):             # <<<<<<<<<<<<<<
 *         u"""findtext(self, path, default=None, namespaces=None)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_8_Element_41findtext(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_41findtext[] = "findtext(self, path, default=None, namespaces=None)\n\n        Finds text for the first matching subelement, by tag name or path.\n\n        The optional ``namespaces`` argument accepts a\n        prefix-to-namespace mapping that allows the usage of XPath\n        prefixes in the path expression.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_8_Element_41findtext(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_path = 0;
  PyObject *__pyx_v_default = 0;
  PyObject *__pyx_v_namespaces = 0;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__path,&__pyx_n_s__default,&__pyx_n_s__namespaces,0};
  __Pyx_RefNannySetupContext("findtext");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__path);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__default);
        if (value) { values[1] = value; kw_args--; }
      }
      case  2:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__namespaces);
        if (value) { values[2] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "findtext") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1411; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_path = values[0];
    __pyx_v_default = values[1];
    __pyx_v_namespaces = values[2];
  } else {
    __pyx_v_default = ((PyObject *)Py_None);
    __pyx_v_namespaces = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: __pyx_v_namespaces = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: __pyx_v_default = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v_path = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("findtext", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1411; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._Element.findtext");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF(__pyx_v_path);

  /* "src/lxml/lxml.etree.pyx":1420
 *         prefixes in the path expression.
 *         """
 *         if isinstance(path, QName):             # <<<<<<<<<<<<<<
 *             path = (<QName>path).text
 *         return _elementpath.findtext(self, path, default, namespaces)
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_path, ((PyObject*)__pyx_ptype_4lxml_5etree_QName)); 
  if (__pyx_t_1) {

    /* "src/lxml/lxml.etree.pyx":1421
 *         """
 *         if isinstance(path, QName):
 *             path = (<QName>path).text             # <<<<<<<<<<<<<<
 *         return _elementpath.findtext(self, path, default, namespaces)
 * 
 */
    __Pyx_INCREF(((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_path)->text);
    __Pyx_DECREF(__pyx_v_path);
    __pyx_v_path = ((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_path)->text;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "src/lxml/lxml.etree.pyx":1422
 *         if isinstance(path, QName):
 *             path = (<QName>path).text
 *         return _elementpath.findtext(self, path, default, namespaces)             # <<<<<<<<<<<<<<
 * 
 *     def findall(self, path, namespaces=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_4lxml_5etree__elementpath, __pyx_n_s__findtext); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __Pyx_INCREF(__pyx_v_path);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_path);
  __Pyx_GIVEREF(__pyx_v_path);
  __Pyx_INCREF(__pyx_v_default);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_default);
  __Pyx_GIVEREF(__pyx_v_default);
  __Pyx_INCREF(__pyx_v_namespaces);
  PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_v_namespaces);
  __Pyx_GIVEREF(__pyx_v_namespaces);
  __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._Element.findtext");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_path);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1424
 *         return _elementpath.findtext(self, path, default, namespaces)
 * 
 *     def findall(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         u"""findall(self, path, namespaces=None)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_8_Element_42findall(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_42findall[] = "findall(self, path, namespaces=None)\n\n        Finds all matching subelements, by tag name or path.\n\n        The optional ``namespaces`` argument accepts a\n        prefix-to-namespace mapping that allows the usage of XPath\n        prefixes in the path expression.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_8_Element_42findall(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_path = 0;
  PyObject *__pyx_v_namespaces = 0;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__path,&__pyx_n_s__namespaces,0};
  __Pyx_RefNannySetupContext("findall");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__path);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__namespaces);
        if (value) { values[1] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "findall") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1424; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_path = values[0];
    __pyx_v_namespaces = values[1];
  } else {
    __pyx_v_namespaces = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_namespaces = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v_path = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("findall", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1424; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._Element.findall");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF(__pyx_v_path);

  /* "src/lxml/lxml.etree.pyx":1433
 *         prefixes in the path expression.
 *         """
 *         if isinstance(path, QName):             # <<<<<<<<<<<<<<
 *             path = (<QName>path).text
 *         return _elementpath.findall(self, path, namespaces)
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_path, ((PyObject*)__pyx_ptype_4lxml_5etree_QName)); 
  if (__pyx_t_1) {

    /* "src/lxml/lxml.etree.pyx":1434
 *         """
 *         if isinstance(path, QName):
 *             path = (<QName>path).text             # <<<<<<<<<<<<<<
 *         return _elementpath.findall(self, path, namespaces)
 * 
 */
    __Pyx_INCREF(((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_path)->text);
    __Pyx_DECREF(__pyx_v_path);
    __pyx_v_path = ((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_path)->text;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "src/lxml/lxml.etree.pyx":1435
 *         if isinstance(path, QName):
 *             path = (<QName>path).text
 *         return _elementpath.findall(self, path, namespaces)             # <<<<<<<<<<<<<<
 * 
 *     def iterfind(self, path, namespaces=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_4lxml_5etree__elementpath, __pyx_n_s__findall); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __Pyx_INCREF(__pyx_v_path);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_path);
  __Pyx_GIVEREF(__pyx_v_path);
  __Pyx_INCREF(__pyx_v_namespaces);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_namespaces);
  __Pyx_GIVEREF(__pyx_v_namespaces);
  __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._Element.findall");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_path);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1437
 *         return _elementpath.findall(self, path, namespaces)
 * 
 *     def iterfind(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         u"""iterfind(self, path, namespaces=None)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_8_Element_43iterfind(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_43iterfind[] = "iterfind(self, path, namespaces=None)\n\n        Iterates over all matching subelements, by tag name or path.\n\n        The optional ``namespaces`` argument accepts a\n        prefix-to-namespace mapping that allows the usage of XPath\n        prefixes in the path expression.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_8_Element_43iterfind(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_path = 0;
  PyObject *__pyx_v_namespaces = 0;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__path,&__pyx_n_s__namespaces,0};
  __Pyx_RefNannySetupContext("iterfind");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__path);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__namespaces);
        if (value) { values[1] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "iterfind") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1437; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_path = values[0];
    __pyx_v_namespaces = values[1];
  } else {
    __pyx_v_namespaces = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_namespaces = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v_path = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("iterfind", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1437; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._Element.iterfind");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF(__pyx_v_path);

  /* "src/lxml/lxml.etree.pyx":1446
 *         prefixes in the path expression.
 *         """
 *         if isinstance(path, QName):             # <<<<<<<<<<<<<<
 *             path = (<QName>path).text
 *         return _elementpath.iterfind(self, path, namespaces)
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_path, ((PyObject*)__pyx_ptype_4lxml_5etree_QName)); 
  if (__pyx_t_1) {

    /* "src/lxml/lxml.etree.pyx":1447
 *         """
 *         if isinstance(path, QName):
 *             path = (<QName>path).text             # <<<<<<<<<<<<<<
 *         return _elementpath.iterfind(self, path, namespaces)
 * 
 */
    __Pyx_INCREF(((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_path)->text);
    __Pyx_DECREF(__pyx_v_path);
    __pyx_v_path = ((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_path)->text;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "src/lxml/lxml.etree.pyx":1448
 *         if isinstance(path, QName):
 *             path = (<QName>path).text
 *         return _elementpath.iterfind(self, path, namespaces)             # <<<<<<<<<<<<<<
 * 
 *     def xpath(self, _path, *, namespaces=None, extensions=None,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_4lxml_5etree__elementpath, __pyx_n_s__iterfind); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __Pyx_INCREF(__pyx_v_path);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_path);
  __Pyx_GIVEREF(__pyx_v_path);
  __Pyx_INCREF(__pyx_v_namespaces);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_namespaces);
  __Pyx_GIVEREF(__pyx_v_namespaces);
  __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._Element.iterfind");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_path);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1450
 *         return _elementpath.iterfind(self, path, namespaces)
 * 
 *     def xpath(self, _path, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *               smart_strings=True, **_variables):
 *         u"""xpath(self, _path, namespaces=None, extensions=None, smart_strings=True, **_variables)
 */

static PyObject *__pyx_pf_4lxml_5etree_8_Element_44xpath(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_44xpath[] = "xpath(self, _path, namespaces=None, extensions=None, smart_strings=True, **_variables)\n\n        Evaluate an xpath expression using the element as context node.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_8_Element_44xpath(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v__path = 0;
  PyObject *__pyx_v_namespaces = 0;
  PyObject *__pyx_v_extensions = 0;
  PyObject *__pyx_v_smart_strings = 0;
  PyObject *__pyx_v__variables = 0;
  PyObject *__pyx_v_evaluator;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s___path,&__pyx_n_s__namespaces,&__pyx_n_s__extensions,&__pyx_n_s__smart_strings,0};
  __Pyx_RefNannySetupContext("xpath");
  __pyx_v__variables = PyDict_New(); if (unlikely(!__pyx_v__variables)) return NULL;
  __Pyx_GOTREF(__pyx_v__variables);
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[4] = {0,0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    values[3] = __pyx_k_76;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s___path);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v__variables, values, PyTuple_GET_SIZE(__pyx_args), "xpath") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1450; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v__path = values[0];
    __pyx_v_namespaces = values[1];
    __pyx_v_extensions = values[2];
    __pyx_v_smart_strings = values[3];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v__path = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_namespaces = ((PyObject *)Py_None);
    __pyx_v_extensions = ((PyObject *)Py_None);
    __pyx_v_smart_strings = __pyx_k_76;
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("xpath", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1450; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v__variables);
  __Pyx_AddTraceback("lxml.etree._Element.xpath");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_evaluator = Py_None; __Pyx_INCREF(Py_None);

  /* "src/lxml/lxml.etree.pyx":1456
 *         Evaluate an xpath expression using the element as context node.
 *         """
 *         evaluator = XPathElementEvaluator(self, namespaces=namespaces,             # <<<<<<<<<<<<<<
 *                                           extensions=extensions,
 *                                           smart_strings=smart_strings)
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__namespaces), __pyx_v_namespaces) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":1457
 *         """
 *         evaluator = XPathElementEvaluator(self, namespaces=namespaces,
 *                                           extensions=extensions,             # <<<<<<<<<<<<<<
 *                                           smart_strings=smart_strings)
 *         return evaluator(_path, **_variables)
 */
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__extensions), __pyx_v_extensions) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":1458
 *         evaluator = XPathElementEvaluator(self, namespaces=namespaces,
 *                                           extensions=extensions,
 *                                           smart_strings=smart_strings)             # <<<<<<<<<<<<<<
 *         return evaluator(_path, **_variables)
 * 
 */
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__smart_strings), __pyx_v_smart_strings) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_XPathElementEvaluator)), ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_v_evaluator);
  __pyx_v_evaluator = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":1459
 *                                           extensions=extensions,
 *                                           smart_strings=smart_strings)
 *         return evaluator(_path, **_variables)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(__pyx_v__path);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v__path);
  __Pyx_GIVEREF(__pyx_v__path);
  __pyx_t_2 = PyEval_CallObjectWithKeywords(__pyx_v_evaluator, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_v__variables)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Element.xpath");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v__variables);
  __Pyx_DECREF(__pyx_v_evaluator);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1466
 *     cdef object NEW_ELEMENT "PY_NEW" (object t)
 * 
 * cdef _Element _elementFactory(_Document doc, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     cdef _Element result
 *     result = getProxy(c_node)
 */

static  struct LxmlElement *__pyx_f_4lxml_5etree__elementFactory(struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node) {
  struct LxmlElement *__pyx_v_result;
  PyObject *__pyx_v_element_class;
  struct LxmlElement *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("_elementFactory");
  __pyx_v_result = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_element_class = Py_None; __Pyx_INCREF(Py_None);

  /* "src/lxml/lxml.etree.pyx":1468
 * cdef _Element _elementFactory(_Document doc, xmlNode* c_node):
 *     cdef _Element result
 *     result = getProxy(c_node)             # <<<<<<<<<<<<<<
 *     if result is not None:
 *         return result
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree_getProxy(__pyx_v_c_node)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_result));
  __pyx_v_result = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/lxml.etree.pyx":1469
 *     cdef _Element result
 *     result = getProxy(c_node)
 *     if result is not None:             # <<<<<<<<<<<<<<
 *         return result
 *     if c_node is NULL:
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_result) != Py_None);
  if (__pyx_t_2) {

    /* "src/lxml/lxml.etree.pyx":1470
 *     result = getProxy(c_node)
 *     if result is not None:
 *         return result             # <<<<<<<<<<<<<<
 *     if c_node is NULL:
 *         return None
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __Pyx_INCREF(((PyObject *)__pyx_v_result));
    __pyx_r = __pyx_v_result;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "src/lxml/lxml.etree.pyx":1471
 *     if result is not None:
 *         return result
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  __pyx_t_2 = (__pyx_v_c_node == NULL);
  if (__pyx_t_2) {

    /* "src/lxml/lxml.etree.pyx":1472
 *         return result
 *     if c_node is NULL:
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     element_class = LOOKUP_ELEMENT_CLASS(
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __Pyx_INCREF(Py_None);
    __pyx_r = ((struct LxmlElement *)Py_None);
    goto __pyx_L0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "src/lxml/lxml.etree.pyx":1475
 * 
 *     element_class = LOOKUP_ELEMENT_CLASS(
 *         ELEMENT_CLASS_LOOKUP_STATE, doc, c_node)             # <<<<<<<<<<<<<<
 *     if hasProxy(c_node):
 *         # prevent re-entry race condition - we just called into Python
 */
  __pyx_t_1 = __pyx_v_4lxml_5etree_LOOKUP_ELEMENT_CLASS(__pyx_v_4lxml_5etree_ELEMENT_CLASS_LOOKUP_STATE, __pyx_v_doc, __pyx_v_c_node); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_v_element_class);
  __pyx_v_element_class = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/lxml.etree.pyx":1476
 *     element_class = LOOKUP_ELEMENT_CLASS(
 *         ELEMENT_CLASS_LOOKUP_STATE, doc, c_node)
 *     if hasProxy(c_node):             # <<<<<<<<<<<<<<
 *         # prevent re-entry race condition - we just called into Python
 *         return getProxy(c_node)
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree_hasProxy(__pyx_v_c_node);
  if (__pyx_t_3) {

    /* "src/lxml/lxml.etree.pyx":1478
 *     if hasProxy(c_node):
 *         # prevent re-entry race condition - we just called into Python
 *         return getProxy(c_node)             # <<<<<<<<<<<<<<
 *     result = NEW_ELEMENT(element_class)
 *     if hasProxy(c_node):
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree_getProxy(__pyx_v_c_node)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = ((struct LxmlElement *)__pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "src/lxml/lxml.etree.pyx":1479
 *         # prevent re-entry race condition - we just called into Python
 *         return getProxy(c_node)
 *     result = NEW_ELEMENT(element_class)             # <<<<<<<<<<<<<<
 *     if hasProxy(c_node):
 *         # prevent re-entry race condition - we just called into Python
 */
  __pyx_t_1 = PY_NEW(__pyx_v_element_class); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_v_result));
  __pyx_v_result = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/lxml.etree.pyx":1480
 *         return getProxy(c_node)
 *     result = NEW_ELEMENT(element_class)
 *     if hasProxy(c_node):             # <<<<<<<<<<<<<<
 *         # prevent re-entry race condition - we just called into Python
 *         result._c_node = NULL
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree_hasProxy(__pyx_v_c_node);
  if (__pyx_t_3) {

    /* "src/lxml/lxml.etree.pyx":1482
 *     if hasProxy(c_node):
 *         # prevent re-entry race condition - we just called into Python
 *         result._c_node = NULL             # <<<<<<<<<<<<<<
 *         return getProxy(c_node)
 * 
 */
    __pyx_v_result->_c_node = NULL;

    /* "src/lxml/lxml.etree.pyx":1483
 *         # prevent re-entry race condition - we just called into Python
 *         result._c_node = NULL
 *         return getProxy(c_node)             # <<<<<<<<<<<<<<
 * 
 *     _registerProxy(result, doc, c_node)
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree_getProxy(__pyx_v_c_node)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = ((struct LxmlElement *)__pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "src/lxml/lxml.etree.pyx":1485
 *         return getProxy(c_node)
 * 
 *     _registerProxy(result, doc, c_node)             # <<<<<<<<<<<<<<
 *     if element_class is not _Element:
 *         result._init()
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree__registerProxy(__pyx_v_result, __pyx_v_doc, __pyx_v_c_node); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":1486
 * 
 *     _registerProxy(result, doc, c_node)
 *     if element_class is not _Element:             # <<<<<<<<<<<<<<
 *         result._init()
 *     return result
 */
  __pyx_t_2 = (__pyx_v_element_class != ((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Element)));
  if (__pyx_t_2) {

    /* "src/lxml/lxml.etree.pyx":1487
 *     _registerProxy(result, doc, c_node)
 *     if element_class is not _Element:
 *         result._init()             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_result), __pyx_n_s___init); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "src/lxml/lxml.etree.pyx":1488
 *     if element_class is not _Element:
 *         result._init()
 *     return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  __pyx_r = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._elementFactory");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_result);
  __Pyx_DECREF(__pyx_v_element_class);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1492
 * 
 * cdef class __ContentOnlyElement(_Element):
 *     cdef int _raiseImmutable(self) except -1:             # <<<<<<<<<<<<<<
 *         raise TypeError, u"this element does not have children or attributes"
 * 
 */

static  int __pyx_f_4lxml_5etree_20__ContentOnlyElement__raiseImmutable(struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("_raiseImmutable");

  /* "src/lxml/lxml.etree.pyx":1493
 * cdef class __ContentOnlyElement(_Element):
 *     cdef int _raiseImmutable(self) except -1:
 *         raise TypeError, u"this element does not have children or attributes"             # <<<<<<<<<<<<<<
 * 
 *     def set(self, key, value):
 */
  __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_u_77), 0);
  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.__ContentOnlyElement._raiseImmutable");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1495
 *         raise TypeError, u"this element does not have children or attributes"
 * 
 *     def set(self, key, value):             # <<<<<<<<<<<<<<
 *         u"set(self, key, value)"
 *         self._raiseImmutable()
 */

static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_20__ContentOnlyElement_set[] = "set(self, key, value)";
static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_value = 0;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__key,&__pyx_n_s__value,0};
  __Pyx_RefNannySetupContext("set");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__key);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__value);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1495; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "set") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1495; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_key = values[0];
    __pyx_v_value = values[1];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_key = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_value = PyTuple_GET_ITEM(__pyx_args, 1);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1495; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.__ContentOnlyElement.set");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "src/lxml/lxml.etree.pyx":1497
 *     def set(self, key, value):
 *         u"set(self, key, value)"
 *         self._raiseImmutable()             # <<<<<<<<<<<<<<
 * 
 *     def append(self, value):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree___ContentOnlyElement *)((struct __pyx_obj_4lxml_5etree___ContentOnlyElement *)__pyx_v_self)->__pyx_vtab)->_raiseImmutable(((struct __pyx_obj_4lxml_5etree___ContentOnlyElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.__ContentOnlyElement.set");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1499
 *         self._raiseImmutable()
 * 
 *     def append(self, value):             # <<<<<<<<<<<<<<
 *         u"append(self, value)"
 *         self._raiseImmutable()
 */

static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_1append(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static char __pyx_doc_4lxml_5etree_20__ContentOnlyElement_1append[] = "append(self, value)";
static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_1append(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("append");

  /* "src/lxml/lxml.etree.pyx":1501
 *     def append(self, value):
 *         u"append(self, value)"
 *         self._raiseImmutable()             # <<<<<<<<<<<<<<
 * 
 *     def insert(self, index, value):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree___ContentOnlyElement *)((struct __pyx_obj_4lxml_5etree___ContentOnlyElement *)__pyx_v_self)->__pyx_vtab)->_raiseImmutable(((struct __pyx_obj_4lxml_5etree___ContentOnlyElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.__ContentOnlyElement.append");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1503
 *         self._raiseImmutable()
 * 
 *     def insert(self, index, value):             # <<<<<<<<<<<<<<
 *         u"insert(self, index, value)"
 *         self._raiseImmutable()
 */

static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_2insert(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_20__ContentOnlyElement_2insert[] = "insert(self, index, value)";
static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_2insert(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_index = 0;
  PyObject *__pyx_v_value = 0;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__index,&__pyx_n_s__value,0};
  __Pyx_RefNannySetupContext("insert");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__index);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__value);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("insert", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1503; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "insert") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1503; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_index = values[0];
    __pyx_v_value = values[1];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_index = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_value = PyTuple_GET_ITEM(__pyx_args, 1);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("insert", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1503; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.__ContentOnlyElement.insert");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "src/lxml/lxml.etree.pyx":1505
 *     def insert(self, index, value):
 *         u"insert(self, index, value)"
 *         self._raiseImmutable()             # <<<<<<<<<<<<<<
 * 
 *     def __setitem__(self, index, value):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree___ContentOnlyElement *)((struct __pyx_obj_4lxml_5etree___ContentOnlyElement *)__pyx_v_self)->__pyx_vtab)->_raiseImmutable(((struct __pyx_obj_4lxml_5etree___ContentOnlyElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.__ContentOnlyElement.insert");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1507
 *         self._raiseImmutable()
 * 
 *     def __setitem__(self, index, value):             # <<<<<<<<<<<<<<
 *         u"__setitem__(self, index, value)"
 *         self._raiseImmutable()
 */

static int __pyx_pf_4lxml_5etree_20__ContentOnlyElement_3__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/
static char __pyx_doc_4lxml_5etree_20__ContentOnlyElement_3__setitem__[] = "__setitem__(self, index, value)";
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_20__ContentOnlyElement_3__setitem__;
static int __pyx_pf_4lxml_5etree_20__ContentOnlyElement_3__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
  int __pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__setitem__");

  /* "src/lxml/lxml.etree.pyx":1509
 *     def __setitem__(self, index, value):
 *         u"__setitem__(self, index, value)"
 *         self._raiseImmutable()             # <<<<<<<<<<<<<<
 * 
 *     property attrib:
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree___ContentOnlyElement *)((struct __pyx_obj_4lxml_5etree___ContentOnlyElement *)__pyx_v_self)->__pyx_vtab)->_raiseImmutable(((struct __pyx_obj_4lxml_5etree___ContentOnlyElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.__ContentOnlyElement.__setitem__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1512
 * 
 *     property attrib:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return {}
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_6attrib___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_6attrib___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__");

  /* "src/lxml/lxml.etree.pyx":1513
 *     property attrib:
 *         def __get__(self):
 *             return {}             # <<<<<<<<<<<<<<
 * 
 *     property text:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1513; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_r = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.__ContentOnlyElement.attrib.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1516
 * 
 *     property text:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             if self._c_node.content is NULL:
 */

static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_4text___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_4text___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__get__");

  /* "src/lxml/lxml.etree.pyx":1517
 *     property text:
 *         def __get__(self):
 *             _assertValidNode(self)             # <<<<<<<<<<<<<<
 *             if self._c_node.content is NULL:
 *                 return ''
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":1518
 *         def __get__(self):
 *             _assertValidNode(self)
 *             if self._c_node.content is NULL:             # <<<<<<<<<<<<<<
 *                 return ''
 *             else:
 */
  __pyx_t_2 = (((struct __pyx_obj_4lxml_5etree___ContentOnlyElement *)__pyx_v_self)->__pyx_base._c_node->content == NULL);
  if (__pyx_t_2) {

    /* "src/lxml/lxml.etree.pyx":1519
 *             _assertValidNode(self)
 *             if self._c_node.content is NULL:
 *                 return ''             # <<<<<<<<<<<<<<
 *             else:
 *                 return funicode(self._c_node.content)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_25));
    __pyx_r = ((PyObject *)__pyx_kp_s_25);
    goto __pyx_L0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "src/lxml/lxml.etree.pyx":1521
 *                 return ''
 *             else:
 *                 return funicode(self._c_node.content)             # <<<<<<<<<<<<<<
 * 
 *         def __set__(self, value):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(((struct __pyx_obj_4lxml_5etree___ContentOnlyElement *)__pyx_v_self)->__pyx_base._c_node->content); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }
  __pyx_L5:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.__ContentOnlyElement.text.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1523
 *                 return funicode(self._c_node.content)
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             cdef tree.xmlDict* c_dict
 *             cdef char* c_text
 */

static int __pyx_pf_4lxml_5etree_20__ContentOnlyElement_4text_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_4lxml_5etree_20__ContentOnlyElement_4text_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  char *__pyx_v_c_text;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__set__");
  __Pyx_INCREF(__pyx_v_value);

  /* "src/lxml/lxml.etree.pyx":1526
 *             cdef tree.xmlDict* c_dict
 *             cdef char* c_text
 *             _assertValidNode(self)             # <<<<<<<<<<<<<<
 *             if value is None:
 *                 c_text = NULL
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":1527
 *             cdef char* c_text
 *             _assertValidNode(self)
 *             if value is None:             # <<<<<<<<<<<<<<
 *                 c_text = NULL
 *             else:
 */
  __pyx_t_2 = (__pyx_v_value == Py_None);
  if (__pyx_t_2) {

    /* "src/lxml/lxml.etree.pyx":1528
 *             _assertValidNode(self)
 *             if value is None:
 *                 c_text = NULL             # <<<<<<<<<<<<<<
 *             else:
 *                 value = _utf8(value)
 */
    __pyx_v_c_text = NULL;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "src/lxml/lxml.etree.pyx":1530
 *                 c_text = NULL
 *             else:
 *                 value = _utf8(value)             # <<<<<<<<<<<<<<
 *                 c_text = _cstr(value)
 *             tree.xmlNodeSetContent(self._c_node, c_text)
 */
    __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_v_value)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_v_value);
    __pyx_v_value = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "src/lxml/lxml.etree.pyx":1531
 *             else:
 *                 value = _utf8(value)
 *                 c_text = _cstr(value)             # <<<<<<<<<<<<<<
 *             tree.xmlNodeSetContent(self._c_node, c_text)
 * 
 */
    __pyx_v_c_text = PyBytes_AS_STRING(__pyx_v_value);
  }
  __pyx_L5:;

  /* "src/lxml/lxml.etree.pyx":1532
 *                 value = _utf8(value)
 *                 c_text = _cstr(value)
 *             tree.xmlNodeSetContent(self._c_node, c_text)             # <<<<<<<<<<<<<<
 * 
 *     # ACCESSORS
 */
  xmlNodeSetContent(((struct __pyx_obj_4lxml_5etree___ContentOnlyElement *)__pyx_v_self)->__pyx_base._c_node, __pyx_v_c_text);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.__ContentOnlyElement.text.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_value);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1535
 * 
 *     # ACCESSORS
 *     def __getitem__(self, x):             # <<<<<<<<<<<<<<
 *         u"__getitem__(self, x)"
 *         if python.PySlice_Check(x):
 */

static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_4__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_4lxml_5etree_20__ContentOnlyElement_4__getitem__[] = "__getitem__(self, x)";
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_20__ContentOnlyElement_4__getitem__;
static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_4__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__getitem__");

  /* "src/lxml/lxml.etree.pyx":1537
 *     def __getitem__(self, x):
 *         u"__getitem__(self, x)"
 *         if python.PySlice_Check(x):             # <<<<<<<<<<<<<<
 *             return []
 *         else:
 */
  __pyx_t_1 = PySlice_Check(__pyx_v_x);
  if (__pyx_t_1) {

    /* "src/lxml/lxml.etree.pyx":1538
 *         u"__getitem__(self, x)"
 *         if python.PySlice_Check(x):
 *             return []             # <<<<<<<<<<<<<<
 *         else:
 *             raise IndexError, u"list index out of range"
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __pyx_r = ((PyObject *)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "src/lxml/lxml.etree.pyx":1540
 *             return []
 *         else:
 *             raise IndexError, u"list index out of range"             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
    __Pyx_Raise(__pyx_builtin_IndexError, ((PyObject *)__pyx_kp_u_65), 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L5:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.__ContentOnlyElement.__getitem__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1542
 *             raise IndexError, u"list index out of range"
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         u"__len__(self)"
 *         return 0
 */

static Py_ssize_t __pyx_pf_4lxml_5etree_20__ContentOnlyElement_5__len__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_4lxml_5etree_20__ContentOnlyElement_5__len__[] = "__len__(self)";
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_20__ContentOnlyElement_5__len__;
static Py_ssize_t __pyx_pf_4lxml_5etree_20__ContentOnlyElement_5__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannySetupContext("__len__");

  /* "src/lxml/lxml.etree.pyx":1544
 *     def __len__(self):
 *         u"__len__(self)"
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     def get(self, key, default=None):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1546
 *         return 0
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         u"get(self, key, default=None)"
 *         return None
 */

static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_6get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_20__ContentOnlyElement_6get[] = "get(self, key, default=None)";
static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_6get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_default = 0;
  PyObject *__pyx_r = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__key,&__pyx_n_s__default,0};
  __Pyx_RefNannySetupContext("get");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__key);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__default);
        if (value) { values[1] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "get") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1546; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_key = values[0];
    __pyx_v_default = values[1];
  } else {
    __pyx_v_default = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_default = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v_key = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1546; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.__ContentOnlyElement.get");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "src/lxml/lxml.etree.pyx":1548
 *     def get(self, key, default=None):
 *         u"get(self, key, default=None)"
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     def keys(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_None);
  __pyx_r = Py_None;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1550
 *         return None
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         u"keys(self)"
 *         return []
 */

static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_7keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_20__ContentOnlyElement_7keys[] = "keys(self)";
static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_7keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("keys");

  /* "src/lxml/lxml.etree.pyx":1552
 *     def keys(self):
 *         u"keys(self)"
 *         return []             # <<<<<<<<<<<<<<
 * 
 *     def items(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_r = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.__ContentOnlyElement.keys");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1554
 *         return []
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         u"items(self)"
 *         return []
 */

static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_8items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_20__ContentOnlyElement_8items[] = "items(self)";
static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_8items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("items");

  /* "src/lxml/lxml.etree.pyx":1556
 *     def items(self):
 *         u"items(self)"
 *         return []             # <<<<<<<<<<<<<<
 * 
 *     def values(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_r = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.__ContentOnlyElement.items");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1558
 *         return []
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         u"values(self)"
 *         return []
 */

static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_9values(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_20__ContentOnlyElement_9values[] = "values(self)";
static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_9values(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("values");

  /* "src/lxml/lxml.etree.pyx":1560
 *     def values(self):
 *         u"values(self)"
 *         return []             # <<<<<<<<<<<<<<
 * 
 * cdef class _Comment(__ContentOnlyElement):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_r = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.__ContentOnlyElement.values");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1564
 * cdef class _Comment(__ContentOnlyElement):
 *     property tag:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return Comment
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_8_Comment_3tag___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_8_Comment_3tag___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__");

  /* "src/lxml/lxml.etree.pyx":1565
 *     property tag:
 *         def __get__(self):
 *             return Comment             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__Comment); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._Comment.tag.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1567
 *             return Comment
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return u"<!--%s-->" % self.text
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_8_Comment___repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_8_Comment___repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__repr__");

  /* "src/lxml/lxml.etree.pyx":1568
 * 
 *     def __repr__(self):
 *         return u"<!--%s-->" % self.text             # <<<<<<<<<<<<<<
 * 
 * cdef class _ProcessingInstruction(__ContentOnlyElement):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__text); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1568; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_78), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1568; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = ((PyObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Comment.__repr__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1572
 * cdef class _ProcessingInstruction(__ContentOnlyElement):
 *     property tag:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return ProcessingInstruction
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_22_ProcessingInstruction_3tag___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_22_ProcessingInstruction_3tag___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__");

  /* "src/lxml/lxml.etree.pyx":1573
 *     property tag:
 *         def __get__(self):
 *             return ProcessingInstruction             # <<<<<<<<<<<<<<
 * 
 *     property target:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s_79); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ProcessingInstruction.tag.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1577
 *     property target:
 *         # not in ElementTree
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             return funicode(self._c_node.name)
 */

static PyObject *__pyx_pf_4lxml_5etree_22_ProcessingInstruction_6target___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_22_ProcessingInstruction_6target___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__get__");

  /* "src/lxml/lxml.etree.pyx":1578
 *         # not in ElementTree
 *         def __get__(self):
 *             _assertValidNode(self)             # <<<<<<<<<<<<<<
 *             return funicode(self._c_node.name)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":1579
 *         def __get__(self):
 *             _assertValidNode(self)
 *             return funicode(self._c_node.name)             # <<<<<<<<<<<<<<
 * 
 *         def __set__(self, value):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(((struct __pyx_obj_4lxml_5etree__ProcessingInstruction *)__pyx_v_self)->__pyx_base.__pyx_base._c_node->name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ProcessingInstruction.target.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1581
 *             return funicode(self._c_node.name)
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             value = _utf8(value)
 */

static int __pyx_pf_4lxml_5etree_22_ProcessingInstruction_6target_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_4lxml_5etree_22_ProcessingInstruction_6target_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  char *__pyx_v_c_text;
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__set__");
  __Pyx_INCREF(__pyx_v_value);

  /* "src/lxml/lxml.etree.pyx":1582
 * 
 *         def __set__(self, value):
 *             _assertValidNode(self)             # <<<<<<<<<<<<<<
 *             value = _utf8(value)
 *             c_text = _cstr(value)
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1582; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":1583
 *         def __set__(self, value):
 *             _assertValidNode(self)
 *             value = _utf8(value)             # <<<<<<<<<<<<<<
 *             c_text = _cstr(value)
 *             tree.xmlNodeSetName(self._c_node, c_text)
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_v_value)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_v_value);
  __pyx_v_value = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "src/lxml/lxml.etree.pyx":1584
 *             _assertValidNode(self)
 *             value = _utf8(value)
 *             c_text = _cstr(value)             # <<<<<<<<<<<<<<
 *             tree.xmlNodeSetName(self._c_node, c_text)
 * 
 */
  __pyx_v_c_text = PyBytes_AS_STRING(__pyx_v_value);

  /* "src/lxml/lxml.etree.pyx":1585
 *             value = _utf8(value)
 *             c_text = _cstr(value)
 *             tree.xmlNodeSetName(self._c_node, c_text)             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  xmlNodeSetName(((struct __pyx_obj_4lxml_5etree__ProcessingInstruction *)__pyx_v_self)->__pyx_base.__pyx_base._c_node, __pyx_v_c_text);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ProcessingInstruction.target.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_value);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1587
 *             tree.xmlNodeSetName(self._c_node, c_text)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         text = self.text
 *         if text:
 */

static PyObject *__pyx_pf_4lxml_5etree_22_ProcessingInstruction___repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_22_ProcessingInstruction___repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_v_text;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__repr__");
  __pyx_v_text = Py_None; __Pyx_INCREF(Py_None);

  /* "src/lxml/lxml.etree.pyx":1588
 * 
 *     def __repr__(self):
 *         text = self.text             # <<<<<<<<<<<<<<
 *         if text:
 *             return u"<?%s %s?>" % (self.target, text)
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__text); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_v_text);
  __pyx_v_text = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/lxml.etree.pyx":1589
 *     def __repr__(self):
 *         text = self.text
 *         if text:             # <<<<<<<<<<<<<<
 *             return u"<?%s %s?>" % (self.target, text)
 *         else:
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_text); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_2) {

    /* "src/lxml/lxml.etree.pyx":1590
 *         text = self.text
 *         if text:
 *             return u"<?%s %s?>" % (self.target, text)             # <<<<<<<<<<<<<<
 *         else:
 *             return u"<?%s?>" % self.target
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__target); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_text);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_text);
    __Pyx_GIVEREF(__pyx_v_text);
    __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_80), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __pyx_r = ((PyObject *)__pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "src/lxml/lxml.etree.pyx":1592
 *             return u"<?%s %s?>" % (self.target, text)
 *         else:
 *             return u"<?%s?>" % self.target             # <<<<<<<<<<<<<<
 * 
 * cdef class _Entity(__ContentOnlyElement):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__target); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_81), __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_r = ((PyObject *)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }
  __pyx_L5:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ProcessingInstruction.__repr__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_text);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1596
 * cdef class _Entity(__ContentOnlyElement):
 *     property tag:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return Entity
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_7_Entity_3tag___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_7_Entity_3tag___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__");

  /* "src/lxml/lxml.etree.pyx":1597
 *     property tag:
 *         def __get__(self):
 *             return Entity             # <<<<<<<<<<<<<<
 * 
 *     property name:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__Entity); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._Entity.tag.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1601
 *     property name:
 *         # not in ElementTree
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             return funicode(self._c_node.name)
 */

static PyObject *__pyx_pf_4lxml_5etree_7_Entity_4name___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_7_Entity_4name___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__get__");

  /* "src/lxml/lxml.etree.pyx":1602
 *         # not in ElementTree
 *         def __get__(self):
 *             _assertValidNode(self)             # <<<<<<<<<<<<<<
 *             return funicode(self._c_node.name)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":1603
 *         def __get__(self):
 *             _assertValidNode(self)
 *             return funicode(self._c_node.name)             # <<<<<<<<<<<<<<
 * 
 *         def __set__(self, value):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(((struct __pyx_obj_4lxml_5etree__Entity *)__pyx_v_self)->__pyx_base.__pyx_base._c_node->name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1603; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Entity.name.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1605
 *             return funicode(self._c_node.name)
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             value_utf = _utf8(value)
 */

static int __pyx_pf_4lxml_5etree_7_Entity_4name_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_4lxml_5etree_7_Entity_4name_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  PyObject *__pyx_v_value_utf;
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("__set__");
  __pyx_v_value_utf = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);

  /* "src/lxml/lxml.etree.pyx":1606
 * 
 *         def __set__(self, value):
 *             _assertValidNode(self)             # <<<<<<<<<<<<<<
 *             value_utf = _utf8(value)
 *             assert u'&' not in value and u';' not in value, \
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1606; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":1607
 *         def __set__(self, value):
 *             _assertValidNode(self)
 *             value_utf = _utf8(value)             # <<<<<<<<<<<<<<
 *             assert u'&' not in value and u';' not in value, \
 *                 u"Invalid entity name '%s'" % value
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_v_value)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1607; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_v_value_utf));
  __pyx_v_value_utf = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/lxml.etree.pyx":1608
 *             _assertValidNode(self)
 *             value_utf = _utf8(value)
 *             assert u'&' not in value and u';' not in value, \             # <<<<<<<<<<<<<<
 *                 u"Invalid entity name '%s'" % value
 *             tree.xmlNodeSetName(self._c_node, _cstr(value_utf))
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  __pyx_t_3 = (__Pyx_NegateNonNeg(PySequence_Contains(__pyx_v_value, ((PyObject *)__pyx_kp_u_82)))); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1608; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_3) {
    __pyx_t_4 = (__Pyx_NegateNonNeg(PySequence_Contains(__pyx_v_value, ((PyObject *)__pyx_kp_u_83)))); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1608; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = __pyx_t_4;
  } else {
    __pyx_t_5 = __pyx_t_3;
  }
  if (unlikely(!__pyx_t_5)) {

    /* "src/lxml/lxml.etree.pyx":1609
 *             value_utf = _utf8(value)
 *             assert u'&' not in value and u';' not in value, \
 *                 u"Invalid entity name '%s'" % value             # <<<<<<<<<<<<<<
 *             tree.xmlNodeSetName(self._c_node, _cstr(value_utf))
 * 
 */
    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_84), __pyx_v_value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_t_2));
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1608; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif

  /* "src/lxml/lxml.etree.pyx":1610
 *             assert u'&' not in value and u';' not in value, \
 *                 u"Invalid entity name '%s'" % value
 *             tree.xmlNodeSetName(self._c_node, _cstr(value_utf))             # <<<<<<<<<<<<<<
 * 
 *     property text:
 */
  xmlNodeSetName(((struct __pyx_obj_4lxml_5etree__Entity *)__pyx_v_self)->__pyx_base.__pyx_base._c_node, PyBytes_AS_STRING(((PyObject *)__pyx_v_value_utf)));

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Entity.name.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_value_utf);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1615
 *         # FIXME: should this be None or '&[VALUE];' or the resolved
 *         # entity value ?
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             return u'&%s;' % funicode(self._c_node.name)
 */

static PyObject *__pyx_pf_4lxml_5etree_7_Entity_4text___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_7_Entity_4text___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__get__");

  /* "src/lxml/lxml.etree.pyx":1616
 *         # entity value ?
 *         def __get__(self):
 *             _assertValidNode(self)             # <<<<<<<<<<<<<<
 *             return u'&%s;' % funicode(self._c_node.name)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":1617
 *         def __get__(self):
 *             _assertValidNode(self)
 *             return u'&%s;' % funicode(self._c_node.name)             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(((struct __pyx_obj_4lxml_5etree__Entity *)__pyx_v_self)->__pyx_base.__pyx_base._c_node->name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1617; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_85), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1617; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = ((PyObject *)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Entity.text.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1619
 *             return u'&%s;' % funicode(self._c_node.name)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return u"&%s;" % self.name
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_7_Entity___repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_7_Entity___repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__repr__");

  /* "src/lxml/lxml.etree.pyx":1620
 * 
 *     def __repr__(self):
 *         return u"&%s;" % self.name             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1620; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_85), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1620; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = ((PyObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Entity.__repr__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1643
 *     cdef readonly object localname
 *     cdef readonly object namespace
 *     def __init__(self, text_or_uri_or_element, tag=None):             # <<<<<<<<<<<<<<
 *         if not _isString(text_or_uri_or_element):
 *             if isinstance(text_or_uri_or_element, _Element):
 */

static int __pyx_pf_4lxml_5etree_5QName___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_5QName___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_text_or_uri_or_element = 0;
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_ns_utf;
  PyObject *__pyx_v_tag_utf;
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_86,&__pyx_n_s__tag,0};
  __Pyx_RefNannySetupContext("__init__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_86);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tag);
        if (value) { values[1] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1643; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_text_or_uri_or_element = values[0];
    __pyx_v_tag = values[1];
  } else {
    __pyx_v_tag = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_tag = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v_text_or_uri_or_element = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1643; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.QName.__init__");
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF(__pyx_v_text_or_uri_or_element);
  __pyx_v_ns_utf = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_tag_utf = Py_None; __Pyx_INCREF(Py_None);

  /* "src/lxml/lxml.etree.pyx":1644
 *     cdef readonly object namespace
 *     def __init__(self, text_or_uri_or_element, tag=None):
 *         if not _isString(text_or_uri_or_element):             # <<<<<<<<<<<<<<
 *             if isinstance(text_or_uri_or_element, _Element):
 *                 text_or_uri_or_element = (<_Element>text_or_uri_or_element).tag
 */
  __pyx_t_1 = (!_isString(__pyx_v_text_or_uri_or_element));
  if (__pyx_t_1) {

    /* "src/lxml/lxml.etree.pyx":1645
 *     def __init__(self, text_or_uri_or_element, tag=None):
 *         if not _isString(text_or_uri_or_element):
 *             if isinstance(text_or_uri_or_element, _Element):             # <<<<<<<<<<<<<<
 *                 text_or_uri_or_element = (<_Element>text_or_uri_or_element).tag
 *                 if not _isString(text_or_uri_or_element):
 */
    __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_text_or_uri_or_element, ((PyObject*)__pyx_ptype_4lxml_5etree__Element)); 
    if (__pyx_t_1) {

      /* "src/lxml/lxml.etree.pyx":1646
 *         if not _isString(text_or_uri_or_element):
 *             if isinstance(text_or_uri_or_element, _Element):
 *                 text_or_uri_or_element = (<_Element>text_or_uri_or_element).tag             # <<<<<<<<<<<<<<
 *                 if not _isString(text_or_uri_or_element):
 *                     raise ValueError, (u"Invalid input tag of type %r" %
 */
      __pyx_t_2 = PyObject_GetAttr(__pyx_v_text_or_uri_or_element, __pyx_n_s__tag); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_v_text_or_uri_or_element);
      __pyx_v_text_or_uri_or_element = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "src/lxml/lxml.etree.pyx":1647
 *             if isinstance(text_or_uri_or_element, _Element):
 *                 text_or_uri_or_element = (<_Element>text_or_uri_or_element).tag
 *                 if not _isString(text_or_uri_or_element):             # <<<<<<<<<<<<<<
 *                     raise ValueError, (u"Invalid input tag of type %r" %
 *                                        type(text_or_uri_or_element))
 */
      __pyx_t_1 = (!_isString(__pyx_v_text_or_uri_or_element));
      if (__pyx_t_1) {

        /* "src/lxml/lxml.etree.pyx":1649
 *                 if not _isString(text_or_uri_or_element):
 *                     raise ValueError, (u"Invalid input tag of type %r" %
 *                                        type(text_or_uri_or_element))             # <<<<<<<<<<<<<<
 *             elif isinstance(text_or_uri_or_element, QName):
 *                 text_or_uri_or_element = (<QName>text_or_uri_or_element).text
 */
        __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_87), ((PyObject *)Py_TYPE(__pyx_v_text_or_uri_or_element))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1648; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_2));
        __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), 0);
        __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1648; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L8;
      }
      __pyx_L8:;
      goto __pyx_L7;
    }

    /* "src/lxml/lxml.etree.pyx":1650
 *                     raise ValueError, (u"Invalid input tag of type %r" %
 *                                        type(text_or_uri_or_element))
 *             elif isinstance(text_or_uri_or_element, QName):             # <<<<<<<<<<<<<<
 *                 text_or_uri_or_element = (<QName>text_or_uri_or_element).text
 *             else:
 */
    __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_text_or_uri_or_element, ((PyObject*)__pyx_ptype_4lxml_5etree_QName)); 
    if (__pyx_t_1) {

      /* "src/lxml/lxml.etree.pyx":1651
 *                                        type(text_or_uri_or_element))
 *             elif isinstance(text_or_uri_or_element, QName):
 *                 text_or_uri_or_element = (<QName>text_or_uri_or_element).text             # <<<<<<<<<<<<<<
 *             else:
 *                 text_or_uri_or_element = unicode(text_or_uri_or_element)
 */
      __Pyx_INCREF(((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_text_or_uri_or_element)->text);
      __Pyx_DECREF(__pyx_v_text_or_uri_or_element);
      __pyx_v_text_or_uri_or_element = ((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_text_or_uri_or_element)->text;
      goto __pyx_L7;
    }
    /*else*/ {

      /* "src/lxml/lxml.etree.pyx":1653
 *                 text_or_uri_or_element = (<QName>text_or_uri_or_element).text
 *             else:
 *                 text_or_uri_or_element = unicode(text_or_uri_or_element)             # <<<<<<<<<<<<<<
 * 
 *         ns_utf, tag_utf = _getNsTag(text_or_uri_or_element)
 */
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __Pyx_INCREF(__pyx_v_text_or_uri_or_element);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_text_or_uri_or_element);
      __Pyx_GIVEREF(__pyx_v_text_or_uri_or_element);
      __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_v_text_or_uri_or_element);
      __pyx_v_text_or_uri_or_element = __pyx_t_3;
      __pyx_t_3 = 0;
    }
    __pyx_L7:;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "src/lxml/lxml.etree.pyx":1655
 *                 text_or_uri_or_element = unicode(text_or_uri_or_element)
 * 
 *         ns_utf, tag_utf = _getNsTag(text_or_uri_or_element)             # <<<<<<<<<<<<<<
 *         if tag is not None:
 *             # either ('ns', 'tag') or ('{ns}oldtag', 'newtag')
 */
  __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__getNsTag(__pyx_v_text_or_uri_or_element)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (likely(__pyx_t_3 != Py_None) && likely(PyTuple_GET_SIZE(__pyx_t_3) == 2)) {
    PyObject* tuple = __pyx_t_3;
    __pyx_t_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_2);
    __pyx_t_4 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_v_ns_utf);
    __pyx_v_ns_utf = __pyx_t_2;
    __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_v_tag_utf);
    __pyx_v_tag_utf = __pyx_t_4;
    __pyx_t_4 = 0;
  } else {
    __Pyx_UnpackTupleError(__pyx_t_3, 2);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "src/lxml/lxml.etree.pyx":1656
 * 
 *         ns_utf, tag_utf = _getNsTag(text_or_uri_or_element)
 *         if tag is not None:             # <<<<<<<<<<<<<<
 *             # either ('ns', 'tag') or ('{ns}oldtag', 'newtag')
 *             if ns_utf is None:
 */
  __pyx_t_1 = (__pyx_v_tag != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/lxml.etree.pyx":1658
 *         if tag is not None:
 *             # either ('ns', 'tag') or ('{ns}oldtag', 'newtag')
 *             if ns_utf is None:             # <<<<<<<<<<<<<<
 *                 ns_utf = tag_utf # case 1: namespace ended up as tag name
 *             tag_utf = _utf8(tag)
 */
    __pyx_t_1 = (__pyx_v_ns_utf == Py_None);
    if (__pyx_t_1) {

      /* "src/lxml/lxml.etree.pyx":1659
 *             # either ('ns', 'tag') or ('{ns}oldtag', 'newtag')
 *             if ns_utf is None:
 *                 ns_utf = tag_utf # case 1: namespace ended up as tag name             # <<<<<<<<<<<<<<
 *             tag_utf = _utf8(tag)
 *         _tagValidOrRaise(tag_utf)
 */
      __Pyx_INCREF(__pyx_v_tag_utf);
      __Pyx_DECREF(__pyx_v_ns_utf);
      __pyx_v_ns_utf = __pyx_v_tag_utf;
      goto __pyx_L10;
    }
    __pyx_L10:;

    /* "src/lxml/lxml.etree.pyx":1660
 *             if ns_utf is None:
 *                 ns_utf = tag_utf # case 1: namespace ended up as tag name
 *             tag_utf = _utf8(tag)             # <<<<<<<<<<<<<<
 *         _tagValidOrRaise(tag_utf)
 *         self.localname = python.PyUnicode_FromEncodedObject(
 */
    __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_v_tag)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_v_tag_utf);
    __pyx_v_tag_utf = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L9;
  }
  __pyx_L9:;

  /* "src/lxml/lxml.etree.pyx":1661
 *                 ns_utf = tag_utf # case 1: namespace ended up as tag name
 *             tag_utf = _utf8(tag)
 *         _tagValidOrRaise(tag_utf)             # <<<<<<<<<<<<<<
 *         self.localname = python.PyUnicode_FromEncodedObject(
 *             tag_utf, 'UTF-8', NULL)
 */
  __pyx_t_5 = __pyx_f_4lxml_5etree__tagValidOrRaise(__pyx_v_tag_utf); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":1663
 *         _tagValidOrRaise(tag_utf)
 *         self.localname = python.PyUnicode_FromEncodedObject(
 *             tag_utf, 'UTF-8', NULL)             # <<<<<<<<<<<<<<
 *         if ns_utf is None:
 *             self.namespace = None
 */
  __pyx_t_3 = ((PyObject *)PyUnicode_FromEncodedObject(__pyx_v_tag_utf, __pyx_k_31, NULL)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);

  /* "src/lxml/lxml.etree.pyx":1662
 *             tag_utf = _utf8(tag)
 *         _tagValidOrRaise(tag_utf)
 *         self.localname = python.PyUnicode_FromEncodedObject(             # <<<<<<<<<<<<<<
 *             tag_utf, 'UTF-8', NULL)
 *         if ns_utf is None:
 */
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_self)->localname);
  __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_self)->localname);
  ((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_self)->localname = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":1664
 *         self.localname = python.PyUnicode_FromEncodedObject(
 *             tag_utf, 'UTF-8', NULL)
 *         if ns_utf is None:             # <<<<<<<<<<<<<<
 *             self.namespace = None
 *             self.text = self.localname
 */
  __pyx_t_1 = (__pyx_v_ns_utf == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/lxml.etree.pyx":1665
 *             tag_utf, 'UTF-8', NULL)
 *         if ns_utf is None:
 *             self.namespace = None             # <<<<<<<<<<<<<<
 *             self.text = self.localname
 *         else:
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_self)->namespace);
    __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_self)->namespace);
    ((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_self)->namespace = Py_None;

    /* "src/lxml/lxml.etree.pyx":1666
 *         if ns_utf is None:
 *             self.namespace = None
 *             self.text = self.localname             # <<<<<<<<<<<<<<
 *         else:
 *             self.namespace = python.PyUnicode_FromEncodedObject(
 */
    __Pyx_INCREF(((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_self)->localname);
    __Pyx_GIVEREF(((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_self)->localname);
    __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_self)->text);
    __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_self)->text);
    ((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_self)->text = ((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_self)->localname;
    goto __pyx_L11;
  }
  /*else*/ {

    /* "src/lxml/lxml.etree.pyx":1669
 *         else:
 *             self.namespace = python.PyUnicode_FromEncodedObject(
 *                 ns_utf, 'UTF-8', NULL)             # <<<<<<<<<<<<<<
 *             self.text = u"{%s}%s" % (self.namespace, self.localname)
 *     def __str__(self):
 */
    __pyx_t_3 = ((PyObject *)PyUnicode_FromEncodedObject(__pyx_v_ns_utf, __pyx_k_31, NULL)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);

    /* "src/lxml/lxml.etree.pyx":1668
 *             self.text = self.localname
 *         else:
 *             self.namespace = python.PyUnicode_FromEncodedObject(             # <<<<<<<<<<<<<<
 *                 ns_utf, 'UTF-8', NULL)
 *             self.text = u"{%s}%s" % (self.namespace, self.localname)
 */
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_self)->namespace);
    __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_self)->namespace);
    ((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_self)->namespace = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "src/lxml/lxml.etree.pyx":1670
 *             self.namespace = python.PyUnicode_FromEncodedObject(
 *                 ns_utf, 'UTF-8', NULL)
 *             self.text = u"{%s}%s" % (self.namespace, self.localname)             # <<<<<<<<<<<<<<
 *     def __str__(self):
 *         return self.text
 */
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1670; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_INCREF(((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_self)->namespace);
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_self)->namespace);
    __Pyx_GIVEREF(((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_self)->namespace);
    __Pyx_INCREF(((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_self)->localname);
    PyTuple_SET_ITEM(__pyx_t_3, 1, ((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_self)->localname);
    __Pyx_GIVEREF(((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_self)->localname);
    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_40), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1670; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
    __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_self)->text);
    __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_self)->text);
    ((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_self)->text = ((PyObject *)__pyx_t_4);
    __pyx_t_4 = 0;
  }
  __pyx_L11:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.QName.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_ns_utf);
  __Pyx_DECREF(__pyx_v_tag_utf);
  __Pyx_DECREF(__pyx_v_text_or_uri_or_element);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1671
 *                 ns_utf, 'UTF-8', NULL)
 *             self.text = u"{%s}%s" % (self.namespace, self.localname)
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return self.text
 *     def __hash__(self):
 */

static PyObject *__pyx_pf_4lxml_5etree_5QName_1__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_5QName_1__str__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("__str__");

  /* "src/lxml/lxml.etree.pyx":1672
 *             self.text = u"{%s}%s" % (self.namespace, self.localname)
 *     def __str__(self):
 *         return self.text             # <<<<<<<<<<<<<<
 *     def __hash__(self):
 *         return self.text.__hash__()
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_self)->text);
  __pyx_r = ((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_self)->text;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1673
 *     def __str__(self):
 *         return self.text
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return self.text.__hash__()
 *     def __richcmp__(one, other, int op):
 */

static long __pyx_pf_4lxml_5etree_5QName_2__hash__(PyObject *__pyx_v_self); /*proto*/
static long __pyx_pf_4lxml_5etree_5QName_2__hash__(PyObject *__pyx_v_self) {
  long __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  long __pyx_t_3;
  __Pyx_RefNannySetupContext("__hash__");

  /* "src/lxml/lxml.etree.pyx":1674
 *         return self.text
 *     def __hash__(self):
 *         return self.text.__hash__()             # <<<<<<<<<<<<<<
 *     def __richcmp__(one, other, int op):
 *         if not _isString(one):
 */
  __pyx_t_1 = PyObject_GetAttr(((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_self)->text, __pyx_n_s____hash__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1674; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1674; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyInt_AsLong(__pyx_t_2); if (unlikely((__pyx_t_3 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1674; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.QName.__hash__");
  __pyx_r = -1;
  __pyx_L0:;
  if (unlikely(__pyx_r == -1) && !PyErr_Occurred()) __pyx_r = -2;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1675
 *     def __hash__(self):
 *         return self.text.__hash__()
 *     def __richcmp__(one, other, int op):             # <<<<<<<<<<<<<<
 *         if not _isString(one):
 *             one = unicode(one)
 */

static PyObject *__pyx_pf_4lxml_5etree_5QName_3__richcmp__(PyObject *__pyx_v_one, PyObject *__pyx_v_other, int __pyx_v_op); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_5QName_3__richcmp__(PyObject *__pyx_v_one, PyObject *__pyx_v_other, int __pyx_v_op) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__richcmp__");
  __Pyx_INCREF(__pyx_v_one);
  __Pyx_INCREF(__pyx_v_other);

  /* "src/lxml/lxml.etree.pyx":1676
 *         return self.text.__hash__()
 *     def __richcmp__(one, other, int op):
 *         if not _isString(one):             # <<<<<<<<<<<<<<
 *             one = unicode(one)
 *         if not _isString(other):
 */
  __pyx_t_1 = (!_isString(__pyx_v_one));
  if (__pyx_t_1) {

    /* "src/lxml/lxml.etree.pyx":1677
 *     def __richcmp__(one, other, int op):
 *         if not _isString(one):
 *             one = unicode(one)             # <<<<<<<<<<<<<<
 *         if not _isString(other):
 *             other = unicode(other)
 */
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1677; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __Pyx_INCREF(__pyx_v_one);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_one);
    __Pyx_GIVEREF(__pyx_v_one);
    __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1677; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_v_one);
    __pyx_v_one = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "src/lxml/lxml.etree.pyx":1678
 *         if not _isString(one):
 *             one = unicode(one)
 *         if not _isString(other):             # <<<<<<<<<<<<<<
 *             other = unicode(other)
 *         return python.PyObject_RichCompare(one, other, op)
 */
  __pyx_t_1 = (!_isString(__pyx_v_other));
  if (__pyx_t_1) {

    /* "src/lxml/lxml.etree.pyx":1679
 *             one = unicode(one)
 *         if not _isString(other):
 *             other = unicode(other)             # <<<<<<<<<<<<<<
 *         return python.PyObject_RichCompare(one, other, op)
 * 
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1679; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_INCREF(__pyx_v_other);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_other);
    __Pyx_GIVEREF(__pyx_v_other);
    __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1679; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_v_other);
    __pyx_v_other = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "src/lxml/lxml.etree.pyx":1680
 *         if not _isString(other):
 *             other = unicode(other)
 *         return python.PyObject_RichCompare(one, other, op)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyObject_RichCompare(__pyx_v_one, __pyx_v_other, __pyx_v_op); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.QName.__richcmp__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_one);
  __Pyx_DECREF(__pyx_v_other);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1640
 *     prefix and set a qualified text value.
 *     """
 *     cdef readonly object text             # <<<<<<<<<<<<<<
 *     cdef readonly object localname
 *     cdef readonly object namespace
 */

static PyObject *__pyx_pf_4lxml_5etree_5QName_4text___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_5QName_4text___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_self)->text);
  __pyx_r = ((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_self)->text;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1641
 *     """
 *     cdef readonly object text
 *     cdef readonly object localname             # <<<<<<<<<<<<<<
 *     cdef readonly object namespace
 *     def __init__(self, text_or_uri_or_element, tag=None):
 */

static PyObject *__pyx_pf_4lxml_5etree_5QName_9localname___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_5QName_9localname___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_self)->localname);
  __pyx_r = ((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_self)->localname;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1642
 *     cdef readonly object text
 *     cdef readonly object localname
 *     cdef readonly object namespace             # <<<<<<<<<<<<<<
 *     def __init__(self, text_or_uri_or_element, tag=None):
 *         if not _isString(text_or_uri_or_element):
 */

static PyObject *__pyx_pf_4lxml_5etree_5QName_9namespace___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_5QName_9namespace___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_self)->namespace);
  __pyx_r = ((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_self)->namespace;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1692
 *     # to honour tree restructuring.  _doc can happily be None!
 * 
 *     cdef _assertHasRoot(self):             # <<<<<<<<<<<<<<
 *         u"""We have to take care here: the document may not have a root node!
 *         This can happen if ElementTree() is called without any argument and
 */

static  PyObject *__pyx_f_4lxml_5etree_12_ElementTree__assertHasRoot(struct LxmlElementTree *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_assertHasRoot");

  /* "src/lxml/lxml.etree.pyx":1698
 *         the caller program.
 *         """
 *         assert self._context_node is not None, \             # <<<<<<<<<<<<<<
 *                u"ElementTree not initialized, missing root"
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  __pyx_t_1 = (((PyObject *)__pyx_v_self->_context_node) != Py_None);
  if (unlikely(!__pyx_t_1)) {
    PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_u_88));
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._ElementTree._assertHasRoot");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1701
 *                u"ElementTree not initialized, missing root"
 * 
 *     def parse(self, source, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *         u"""parse(self, source, parser=None, base_url=None)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_parse(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_12_ElementTree_parse[] = "parse(self, source, parser=None, base_url=None)\n\n        Updates self with the content of source and returns its root\n        ";
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_parse(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_source = 0;
  struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser = 0;
  PyObject *__pyx_v_base_url = 0;
  struct LxmlDocument *__pyx_v_doc = 0;
  PyObject *__pyx_v_result_container;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__source,&__pyx_n_s__parser,&__pyx_n_s__base_url,0};
  __Pyx_RefNannySetupContext("parse");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    values[1] = (PyObject *)((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None);
    values[2] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__source);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parser);
        if (value) { values[1] = value; kw_args--; }
      }
    }
    while (kw_args > 0) {
      PyObject* value;
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__base_url);
      if (value) { values[2] = value; if (!(--kw_args)) break; }
      break;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "parse") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1701; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_source = values[0];
    __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)values[1]);
    __pyx_v_base_url = values[2];
  } else {
    __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None);
    __pyx_v_base_url = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)PyTuple_GET_ITEM(__pyx_args, 1));
      case  1: __pyx_v_source = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("parse", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1701; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._ElementTree.parse");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_result_container = Py_None; __Pyx_INCREF(Py_None);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parser), __pyx_ptype_4lxml_5etree__BaseParser, 1, "parser", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":1706
 *         Updates self with the content of source and returns its root
 *         """
 *         cdef _Document doc = None             # <<<<<<<<<<<<<<
 *         try:
 *             doc = _parseDocument(source, parser, base_url)
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_doc = ((struct LxmlDocument *)Py_None);

  /* "src/lxml/lxml.etree.pyx":1707
 *         """
 *         cdef _Document doc = None
 *         try:             # <<<<<<<<<<<<<<
 *             doc = _parseDocument(source, parser, base_url)
 *             self._context_node = doc.getroot()
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "src/lxml/lxml.etree.pyx":1708
 *         cdef _Document doc = None
 *         try:
 *             doc = _parseDocument(source, parser, base_url)             # <<<<<<<<<<<<<<
 *             self._context_node = doc.getroot()
 *             if self._context_node is None:
 */
      __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__parseDocument(__pyx_v_source, __pyx_v_parser, __pyx_v_base_url)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1708; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(((PyObject *)__pyx_v_doc));
      __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "src/lxml/lxml.etree.pyx":1709
 *         try:
 *             doc = _parseDocument(source, parser, base_url)
 *             self._context_node = doc.getroot()             # <<<<<<<<<<<<<<
 *             if self._context_node is None:
 *                 self._doc = doc
 */
      __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__Document *)__pyx_v_doc->__pyx_vtab)->getroot(__pyx_v_doc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1709; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1709; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GIVEREF(__pyx_t_1);
      __Pyx_GOTREF(((struct LxmlElementTree *)__pyx_v_self)->_context_node);
      __Pyx_DECREF(((PyObject *)((struct LxmlElementTree *)__pyx_v_self)->_context_node));
      ((struct LxmlElementTree *)__pyx_v_self)->_context_node = ((struct LxmlElement *)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "src/lxml/lxml.etree.pyx":1710
 *             doc = _parseDocument(source, parser, base_url)
 *             self._context_node = doc.getroot()
 *             if self._context_node is None:             # <<<<<<<<<<<<<<
 *                 self._doc = doc
 *         except _TargetParserResult, result_container:
 */
      __pyx_t_2 = (((PyObject *)((struct LxmlElementTree *)__pyx_v_self)->_context_node) == Py_None);
      if (__pyx_t_2) {

        /* "src/lxml/lxml.etree.pyx":1711
 *             self._context_node = doc.getroot()
 *             if self._context_node is None:
 *                 self._doc = doc             # <<<<<<<<<<<<<<
 *         except _TargetParserResult, result_container:
 *             # raises a TypeError if we don't get an _Element
 */
        __Pyx_INCREF(((PyObject *)__pyx_v_doc));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_doc));
        __Pyx_GOTREF(((struct LxmlElementTree *)__pyx_v_self)->_doc);
        __Pyx_DECREF(((PyObject *)((struct LxmlElementTree *)__pyx_v_self)->_doc));
        ((struct LxmlElementTree *)__pyx_v_self)->_doc = __pyx_v_doc;
        goto __pyx_L14;
      }
      __pyx_L14:;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L13_try_end;
    __pyx_L6_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "src/lxml/lxml.etree.pyx":1712
 *             if self._context_node is None:
 *                 self._doc = doc
 *         except _TargetParserResult, result_container:             # <<<<<<<<<<<<<<
 *             # raises a TypeError if we don't get an _Element
 *             self._context_node = result_container.result
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___TargetParserResult); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1712; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyErr_ExceptionMatches(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_3) {
      __Pyx_AddTraceback("lxml.etree._ElementTree.parse");
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_4, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1712; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_v_result_container);
      __pyx_v_result_container = __pyx_t_4;

      /* "src/lxml/lxml.etree.pyx":1714
 *         except _TargetParserResult, result_container:
 *             # raises a TypeError if we don't get an _Element
 *             self._context_node = result_container.result             # <<<<<<<<<<<<<<
 *         return self._context_node
 * 
 */
      __pyx_t_6 = PyObject_GetAttr(__pyx_v_result_container, __pyx_n_s__result); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1714; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_GOTREF(__pyx_t_6);
      if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1714; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_GIVEREF(__pyx_t_6);
      __Pyx_GOTREF(((struct LxmlElementTree *)__pyx_v_self)->_context_node);
      __Pyx_DECREF(((PyObject *)((struct LxmlElementTree *)__pyx_v_self)->_context_node));
      ((struct LxmlElementTree *)__pyx_v_self)->_context_node = ((struct LxmlElement *)__pyx_t_6);
      __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L7_exception_handled;
    }
    __pyx_L8_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L7_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L13_try_end:;
  }

  /* "src/lxml/lxml.etree.pyx":1715
 *             # raises a TypeError if we don't get an _Element
 *             self._context_node = result_container.result
 *         return self._context_node             # <<<<<<<<<<<<<<
 * 
 *     def _setroot(self, _Element root not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct LxmlElementTree *)__pyx_v_self)->_context_node));
  __pyx_r = ((PyObject *)((struct LxmlElementTree *)__pyx_v_self)->_context_node);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._ElementTree.parse");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_DECREF(__pyx_v_result_container);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1717
 *         return self._context_node
 * 
 *     def _setroot(self, _Element root not None):             # <<<<<<<<<<<<<<
 *         u"""_setroot(self, root)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_1_setroot(PyObject *__pyx_v_self, PyObject *__pyx_v_root); /*proto*/
static char __pyx_doc_4lxml_5etree_12_ElementTree_1_setroot[] = "_setroot(self, root)\n\n        Relocate the ElementTree to a new root node.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_1_setroot(PyObject *__pyx_v_self, PyObject *__pyx_v_root) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("_setroot");
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_root), __pyx_ptype_4lxml_5etree__Element, 0, "root", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1717; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":1722
 *         Relocate the ElementTree to a new root node.
 *         """
 *         _assertValidNode(root)             # <<<<<<<<<<<<<<
 *         if root._c_node.type != tree.XML_ELEMENT_NODE:
 *             raise TypeError, u"Only elements can be the root of an ElementTree"
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_root)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":1723
 *         """
 *         _assertValidNode(root)
 *         if root._c_node.type != tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *             raise TypeError, u"Only elements can be the root of an ElementTree"
 *         self._context_node = root
 */
  __pyx_t_2 = (((struct LxmlElement *)__pyx_v_root)->_c_node->type != XML_ELEMENT_NODE);
  if (__pyx_t_2) {

    /* "src/lxml/lxml.etree.pyx":1724
 *         _assertValidNode(root)
 *         if root._c_node.type != tree.XML_ELEMENT_NODE:
 *             raise TypeError, u"Only elements can be the root of an ElementTree"             # <<<<<<<<<<<<<<
 *         self._context_node = root
 *         self._doc = None
 */
    __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_u_89), 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "src/lxml/lxml.etree.pyx":1725
 *         if root._c_node.type != tree.XML_ELEMENT_NODE:
 *             raise TypeError, u"Only elements can be the root of an ElementTree"
 *         self._context_node = root             # <<<<<<<<<<<<<<
 *         self._doc = None
 * 
 */
  __Pyx_INCREF(__pyx_v_root);
  __Pyx_GIVEREF(__pyx_v_root);
  __Pyx_GOTREF(((struct LxmlElementTree *)__pyx_v_self)->_context_node);
  __Pyx_DECREF(((PyObject *)((struct LxmlElementTree *)__pyx_v_self)->_context_node));
  ((struct LxmlElementTree *)__pyx_v_self)->_context_node = ((struct LxmlElement *)__pyx_v_root);

  /* "src/lxml/lxml.etree.pyx":1726
 *             raise TypeError, u"Only elements can be the root of an ElementTree"
 *         self._context_node = root
 *         self._doc = None             # <<<<<<<<<<<<<<
 * 
 *     def getroot(self):
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct LxmlElementTree *)__pyx_v_self)->_doc);
  __Pyx_DECREF(((PyObject *)((struct LxmlElementTree *)__pyx_v_self)->_doc));
  ((struct LxmlElementTree *)__pyx_v_self)->_doc = ((struct LxmlDocument *)Py_None);

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._ElementTree._setroot");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1728
 *         self._doc = None
 * 
 *     def getroot(self):             # <<<<<<<<<<<<<<
 *         u"""getroot(self)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_2getroot(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_12_ElementTree_2getroot[] = "getroot(self)\n\n        Gets the root element for this tree.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_2getroot(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("getroot");

  /* "src/lxml/lxml.etree.pyx":1733
 *         Gets the root element for this tree.
 *         """
 *         return self._context_node             # <<<<<<<<<<<<<<
 * 
 *     def __copy__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct LxmlElementTree *)__pyx_v_self)->_context_node));
  __pyx_r = ((PyObject *)((struct LxmlElementTree *)__pyx_v_self)->_context_node);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1735
 *         return self._context_node
 * 
 *     def __copy__(self):             # <<<<<<<<<<<<<<
 *         return _elementTreeFactory(self._doc, self._context_node)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_3__copy__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_3__copy__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__copy__");

  /* "src/lxml/lxml.etree.pyx":1736
 * 
 *     def __copy__(self):
 *         return _elementTreeFactory(self._doc, self._context_node)             # <<<<<<<<<<<<<<
 * 
 *     def __deepcopy__(self, memo):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)((struct LxmlElementTree *)__pyx_v_self)->_doc);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = ((PyObject *)((struct LxmlElementTree *)__pyx_v_self)->_context_node);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__elementTreeFactory(((struct LxmlDocument *)__pyx_t_1), ((struct LxmlElement *)__pyx_t_2))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ElementTree.__copy__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1738
 *         return _elementTreeFactory(self._doc, self._context_node)
 * 
 *     def __deepcopy__(self, memo):             # <<<<<<<<<<<<<<
 *         cdef _Element root
 *         cdef _Document doc
 */

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_4__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_4__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo) {
  struct LxmlElement *__pyx_v_root;
  struct LxmlDocument *__pyx_v_doc;
  xmlDoc *__pyx_v_c_doc;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("__deepcopy__");
  __pyx_v_root = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_doc = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None);

  /* "src/lxml/lxml.etree.pyx":1742
 *         cdef _Document doc
 *         cdef xmlDoc* c_doc
 *         if self._context_node is not None:             # <<<<<<<<<<<<<<
 *             root = self._context_node.__copy__()
 *             _copyNonElementSiblings(self._context_node._c_node, root._c_node)
 */
  __pyx_t_1 = (((PyObject *)((struct LxmlElementTree *)__pyx_v_self)->_context_node) != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/lxml.etree.pyx":1743
 *         cdef xmlDoc* c_doc
 *         if self._context_node is not None:
 *             root = self._context_node.__copy__()             # <<<<<<<<<<<<<<
 *             _copyNonElementSiblings(self._context_node._c_node, root._c_node)
 *             doc = root._doc
 */
    __pyx_t_2 = PyObject_GetAttr(((PyObject *)((struct LxmlElementTree *)__pyx_v_self)->_context_node), __pyx_n_s____copy__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1743; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1743; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1743; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_v_root));
    __pyx_v_root = ((struct LxmlElement *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "src/lxml/lxml.etree.pyx":1744
 *         if self._context_node is not None:
 *             root = self._context_node.__copy__()
 *             _copyNonElementSiblings(self._context_node._c_node, root._c_node)             # <<<<<<<<<<<<<<
 *             doc = root._doc
 *             c_doc = self._context_node._doc._c_doc
 */
    __pyx_t_4 = __pyx_f_4lxml_5etree__copyNonElementSiblings(((struct LxmlElementTree *)__pyx_v_self)->_context_node->_c_node, __pyx_v_root->_c_node); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "src/lxml/lxml.etree.pyx":1745
 *             root = self._context_node.__copy__()
 *             _copyNonElementSiblings(self._context_node._c_node, root._c_node)
 *             doc = root._doc             # <<<<<<<<<<<<<<
 *             c_doc = self._context_node._doc._c_doc
 *             if c_doc.intSubset is not NULL and doc._c_doc.intSubset is NULL:
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_root->_doc));
    __Pyx_DECREF(((PyObject *)__pyx_v_doc));
    __pyx_v_doc = __pyx_v_root->_doc;

    /* "src/lxml/lxml.etree.pyx":1746
 *             _copyNonElementSiblings(self._context_node._c_node, root._c_node)
 *             doc = root._doc
 *             c_doc = self._context_node._doc._c_doc             # <<<<<<<<<<<<<<
 *             if c_doc.intSubset is not NULL and doc._c_doc.intSubset is NULL:
 *                 doc._c_doc.intSubset = tree.xmlCopyDtd(c_doc.intSubset)
 */
    __pyx_v_c_doc = ((struct LxmlElementTree *)__pyx_v_self)->_context_node->_doc->_c_doc;

    /* "src/lxml/lxml.etree.pyx":1747
 *             doc = root._doc
 *             c_doc = self._context_node._doc._c_doc
 *             if c_doc.intSubset is not NULL and doc._c_doc.intSubset is NULL:             # <<<<<<<<<<<<<<
 *                 doc._c_doc.intSubset = tree.xmlCopyDtd(c_doc.intSubset)
 *                 if doc._c_doc.intSubset is NULL:
 */
    __pyx_t_1 = (__pyx_v_c_doc->intSubset != NULL);
    if (__pyx_t_1) {
      __pyx_t_5 = (__pyx_v_doc->_c_doc->intSubset == NULL);
      __pyx_t_6 = __pyx_t_5;
    } else {
      __pyx_t_6 = __pyx_t_1;
    }
    if (__pyx_t_6) {

      /* "src/lxml/lxml.etree.pyx":1748
 *             c_doc = self._context_node._doc._c_doc
 *             if c_doc.intSubset is not NULL and doc._c_doc.intSubset is NULL:
 *                 doc._c_doc.intSubset = tree.xmlCopyDtd(c_doc.intSubset)             # <<<<<<<<<<<<<<
 *                 if doc._c_doc.intSubset is NULL:
 *                     python.PyErr_NoMemory()
 */
      __pyx_v_doc->_c_doc->intSubset = xmlCopyDtd(__pyx_v_c_doc->intSubset);

      /* "src/lxml/lxml.etree.pyx":1749
 *             if c_doc.intSubset is not NULL and doc._c_doc.intSubset is NULL:
 *                 doc._c_doc.intSubset = tree.xmlCopyDtd(c_doc.intSubset)
 *                 if doc._c_doc.intSubset is NULL:             # <<<<<<<<<<<<<<
 *                     python.PyErr_NoMemory()
 *             if c_doc.extSubset is not NULL and not doc._c_doc.extSubset is NULL:
 */
      __pyx_t_6 = (__pyx_v_doc->_c_doc->intSubset == NULL);
      if (__pyx_t_6) {

        /* "src/lxml/lxml.etree.pyx":1750
 *                 doc._c_doc.intSubset = tree.xmlCopyDtd(c_doc.intSubset)
 *                 if doc._c_doc.intSubset is NULL:
 *                     python.PyErr_NoMemory()             # <<<<<<<<<<<<<<
 *             if c_doc.extSubset is not NULL and not doc._c_doc.extSubset is NULL:
 *                 doc._c_doc.extSubset = tree.xmlCopyDtd(c_doc.extSubset)
 */
        __pyx_t_3 = PyErr_NoMemory(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        goto __pyx_L7;
      }
      __pyx_L7:;
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "src/lxml/lxml.etree.pyx":1751
 *                 if doc._c_doc.intSubset is NULL:
 *                     python.PyErr_NoMemory()
 *             if c_doc.extSubset is not NULL and not doc._c_doc.extSubset is NULL:             # <<<<<<<<<<<<<<
 *                 doc._c_doc.extSubset = tree.xmlCopyDtd(c_doc.extSubset)
 *                 if doc._c_doc.extSubset is NULL:
 */
    __pyx_t_6 = (__pyx_v_c_doc->extSubset != NULL);
    if (__pyx_t_6) {
      __pyx_t_1 = (!(__pyx_v_doc->_c_doc->extSubset == NULL));
      __pyx_t_5 = __pyx_t_1;
    } else {
      __pyx_t_5 = __pyx_t_6;
    }
    if (__pyx_t_5) {

      /* "src/lxml/lxml.etree.pyx":1752
 *                     python.PyErr_NoMemory()
 *             if c_doc.extSubset is not NULL and not doc._c_doc.extSubset is NULL:
 *                 doc._c_doc.extSubset = tree.xmlCopyDtd(c_doc.extSubset)             # <<<<<<<<<<<<<<
 *                 if doc._c_doc.extSubset is NULL:
 *                     python.PyErr_NoMemory()
 */
      __pyx_v_doc->_c_doc->extSubset = xmlCopyDtd(__pyx_v_c_doc->extSubset);

      /* "src/lxml/lxml.etree.pyx":1753
 *             if c_doc.extSubset is not NULL and not doc._c_doc.extSubset is NULL:
 *                 doc._c_doc.extSubset = tree.xmlCopyDtd(c_doc.extSubset)
 *                 if doc._c_doc.extSubset is NULL:             # <<<<<<<<<<<<<<
 *                     python.PyErr_NoMemory()
 *             return _elementTreeFactory(None, root)
 */
      __pyx_t_5 = (__pyx_v_doc->_c_doc->extSubset == NULL);
      if (__pyx_t_5) {

        /* "src/lxml/lxml.etree.pyx":1754
 *                 doc._c_doc.extSubset = tree.xmlCopyDtd(c_doc.extSubset)
 *                 if doc._c_doc.extSubset is NULL:
 *                     python.PyErr_NoMemory()             # <<<<<<<<<<<<<<
 *             return _elementTreeFactory(None, root)
 *         elif self._doc is not None:
 */
        __pyx_t_3 = PyErr_NoMemory(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        goto __pyx_L9;
      }
      __pyx_L9:;
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "src/lxml/lxml.etree.pyx":1755
 *                 if doc._c_doc.extSubset is NULL:
 *                     python.PyErr_NoMemory()
 *             return _elementTreeFactory(None, root)             # <<<<<<<<<<<<<<
 *         elif self._doc is not None:
 *             _assertValidDoc(self._doc)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__elementTreeFactory(((struct LxmlDocument *)Py_None), __pyx_v_root)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }

  /* "src/lxml/lxml.etree.pyx":1756
 *                     python.PyErr_NoMemory()
 *             return _elementTreeFactory(None, root)
 *         elif self._doc is not None:             # <<<<<<<<<<<<<<
 *             _assertValidDoc(self._doc)
 *             c_doc = tree.xmlCopyDoc(self._doc._c_doc, 1)
 */
  __pyx_t_5 = (((PyObject *)((struct LxmlElementTree *)__pyx_v_self)->_doc) != Py_None);
  if (__pyx_t_5) {

    /* "src/lxml/lxml.etree.pyx":1757
 *             return _elementTreeFactory(None, root)
 *         elif self._doc is not None:
 *             _assertValidDoc(self._doc)             # <<<<<<<<<<<<<<
 *             c_doc = tree.xmlCopyDoc(self._doc._c_doc, 1)
 *             if c_doc is NULL:
 */
    __pyx_t_3 = ((PyObject *)((struct LxmlElementTree *)__pyx_v_self)->_doc);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = __pyx_f_4lxml_5etree__assertValidDoc(((struct LxmlDocument *)__pyx_t_3)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/lxml.etree.pyx":1758
 *         elif self._doc is not None:
 *             _assertValidDoc(self._doc)
 *             c_doc = tree.xmlCopyDoc(self._doc._c_doc, 1)             # <<<<<<<<<<<<<<
 *             if c_doc is NULL:
 *                 python.PyErr_NoMemory()
 */
    __pyx_v_c_doc = xmlCopyDoc(((struct LxmlElementTree *)__pyx_v_self)->_doc->_c_doc, 1);

    /* "src/lxml/lxml.etree.pyx":1759
 *             _assertValidDoc(self._doc)
 *             c_doc = tree.xmlCopyDoc(self._doc._c_doc, 1)
 *             if c_doc is NULL:             # <<<<<<<<<<<<<<
 *                 python.PyErr_NoMemory()
 *             doc = _documentFactory(c_doc, self._doc._parser)
 */
    __pyx_t_5 = (__pyx_v_c_doc == NULL);
    if (__pyx_t_5) {

      /* "src/lxml/lxml.etree.pyx":1760
 *             c_doc = tree.xmlCopyDoc(self._doc._c_doc, 1)
 *             if c_doc is NULL:
 *                 python.PyErr_NoMemory()             # <<<<<<<<<<<<<<
 *             doc = _documentFactory(c_doc, self._doc._parser)
 *             return _elementTreeFactory(doc, None)
 */
      __pyx_t_3 = PyErr_NoMemory(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L10;
    }
    __pyx_L10:;

    /* "src/lxml/lxml.etree.pyx":1761
 *             if c_doc is NULL:
 *                 python.PyErr_NoMemory()
 *             doc = _documentFactory(c_doc, self._doc._parser)             # <<<<<<<<<<<<<<
 *             return _elementTreeFactory(doc, None)
 *         else:
 */
    __pyx_t_3 = ((PyObject *)((struct LxmlElementTree *)__pyx_v_self)->_doc->_parser);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_3))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1761; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_v_doc));
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/lxml.etree.pyx":1762
 *                 python.PyErr_NoMemory()
 *             doc = _documentFactory(c_doc, self._doc._parser)
 *             return _elementTreeFactory(doc, None)             # <<<<<<<<<<<<<<
 *         else:
 *             # so what ...
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__elementTreeFactory(__pyx_v_doc, ((struct LxmlElement *)Py_None))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1762; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "src/lxml/lxml.etree.pyx":1765
 *         else:
 *             # so what ...
 *             return self             # <<<<<<<<<<<<<<
 * 
 *     # not in ElementTree, read-only
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_self);
    __pyx_r = __pyx_v_self;
    goto __pyx_L0;
  }
  __pyx_L5:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ElementTree.__deepcopy__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_root);
  __Pyx_DECREF((PyObject *)__pyx_v_doc);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1774
 *         not for trees that were built manually.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self._assertHasRoot()
 *             return DocInfo(self._context_node._doc)
 */

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_7docinfo___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_7docinfo___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__get__");

  /* "src/lxml/lxml.etree.pyx":1775
 *         """
 *         def __get__(self):
 *             self._assertHasRoot()             # <<<<<<<<<<<<<<
 *             return DocInfo(self._context_node._doc)
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ElementTree *)((struct LxmlElementTree *)__pyx_v_self)->__pyx_vtab)->_assertHasRoot(((struct LxmlElementTree *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/lxml.etree.pyx":1776
 *         def __get__(self):
 *             self._assertHasRoot()
 *             return DocInfo(self._context_node._doc)             # <<<<<<<<<<<<<<
 * 
 *     # not in ElementTree, read-only
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1776; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(((PyObject *)((struct LxmlElementTree *)__pyx_v_self)->_context_node->_doc));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((struct LxmlElementTree *)__pyx_v_self)->_context_node->_doc));
  __Pyx_GIVEREF(((PyObject *)((struct LxmlElementTree *)__pyx_v_self)->_context_node->_doc));
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_DocInfo)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1776; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ElementTree.docinfo.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1782
 *         u"""The parser that was used to parse the document in this ElementTree.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if self._context_node is not None and \
 *                    self._context_node._doc is not None:
 */

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_6parser___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_6parser___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("__get__");

  /* "src/lxml/lxml.etree.pyx":1783
 *         """
 *         def __get__(self):
 *             if self._context_node is not None and \             # <<<<<<<<<<<<<<
 *                    self._context_node._doc is not None:
 *                 return self._context_node._doc._parser
 */
  __pyx_t_1 = (((PyObject *)((struct LxmlElementTree *)__pyx_v_self)->_context_node) != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/lxml.etree.pyx":1784
 *         def __get__(self):
 *             if self._context_node is not None and \
 *                    self._context_node._doc is not None:             # <<<<<<<<<<<<<<
 *                 return self._context_node._doc._parser
 *             if self._doc is not None:
 */
    __pyx_t_2 = (((PyObject *)((struct LxmlElementTree *)__pyx_v_self)->_context_node->_doc) != Py_None);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "src/lxml/lxml.etree.pyx":1785
 *             if self._context_node is not None and \
 *                    self._context_node._doc is not None:
 *                 return self._context_node._doc._parser             # <<<<<<<<<<<<<<
 *             if self._doc is not None:
 *                 return self._doc._parser
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)((struct LxmlElementTree *)__pyx_v_self)->_context_node->_doc->_parser));
    __pyx_r = ((PyObject *)((struct LxmlElementTree *)__pyx_v_self)->_context_node->_doc->_parser);
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "src/lxml/lxml.etree.pyx":1786
 *                    self._context_node._doc is not None:
 *                 return self._context_node._doc._parser
 *             if self._doc is not None:             # <<<<<<<<<<<<<<
 *                 return self._doc._parser
 *             return None
 */
  __pyx_t_3 = (((PyObject *)((struct LxmlElementTree *)__pyx_v_self)->_doc) != Py_None);
  if (__pyx_t_3) {

    /* "src/lxml/lxml.etree.pyx":1787
 *                 return self._context_node._doc._parser
 *             if self._doc is not None:
 *                 return self._doc._parser             # <<<<<<<<<<<<<<
 *             return None
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)((struct LxmlElementTree *)__pyx_v_self)->_doc->_parser));
    __pyx_r = ((PyObject *)((struct LxmlElementTree *)__pyx_v_self)->_doc->_parser);
    goto __pyx_L0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "src/lxml/lxml.etree.pyx":1788
 *             if self._doc is not None:
 *                 return self._doc._parser
 *             return None             # <<<<<<<<<<<<<<
 * 
 *     def write(self, file, *, encoding=None, method=u"xml",
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_None);
  __pyx_r = Py_None;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1790
 *             return None
 * 
 *     def write(self, file, *, encoding=None, method=u"xml",             # <<<<<<<<<<<<<<
 *               pretty_print=False, xml_declaration=None, with_tail=True,
 *               standalone=None, docstring=None, compression=0,
 */

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_5write(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_12_ElementTree_5write[] = "write(self, file, encoding=None, method=\"xml\",\n                  pretty_print=False, xml_declaration=None, with_tail=True,\n                  standalone=None, compression=0,\n                  exclusive=False, with_comments=True)\n\n        Write the tree to a filename, file or file-like object.\n\n        Defaults to ASCII encoding and writing a declaration as needed.\n\n        The keyword argument 'method' selects the output method:\n        'xml', 'html', 'text' or 'c14n'.  Default is 'xml'.\n\n        The ``exclusive`` and ``with_comments`` arguments are only\n        used with C14N output, where they request exclusive and\n        uncommented C14N serialisation respectively.\n\n        Passing a boolean value to the ``standalone`` option will\n        output an XML declaration with the corresponding\n        ``standalone`` flag.\n\n        The ``compression`` option enables GZip compression level 1-9.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_5write(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_file = 0;
  PyObject *__pyx_v_encoding = 0;
  PyObject *__pyx_v_method = 0;
  PyObject *__pyx_v_pretty_print = 0;
  PyObject *__pyx_v_xml_declaration = 0;
  PyObject *__pyx_v_with_tail = 0;
  PyObject *__pyx_v_standalone = 0;
  PyObject *__pyx_v_docstring = 0;
  PyObject *__pyx_v_compression = 0;
  PyObject *__pyx_v_exclusive = 0;
  PyObject *__pyx_v_with_comments = 0;
  int __pyx_v_write_declaration;
  int __pyx_v_is_standalone;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__file,&__pyx_n_s__encoding,&__pyx_n_s__method,&__pyx_n_s__pretty_print,&__pyx_n_s__xml_declaration,&__pyx_n_s__with_tail,&__pyx_n_s__standalone,&__pyx_n_s__docstring,&__pyx_n_s__compression,&__pyx_n_s__exclusive,&__pyx_n_s__with_comments,0};
  __Pyx_RefNannySetupContext("write");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[11] = {0,0,0,0,0,0,0,0,0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)__pyx_n_u__xml);
    values[3] = __pyx_k_90;

    /* "src/lxml/lxml.etree.pyx":1791
 * 
 *     def write(self, file, *, encoding=None, method=u"xml",
 *               pretty_print=False, xml_declaration=None, with_tail=True,             # <<<<<<<<<<<<<<
 *               standalone=None, docstring=None, compression=0,
 *               exclusive=False, with_comments=True):
 */
    values[4] = ((PyObject *)Py_None);
    values[5] = __pyx_k_91;

    /* "src/lxml/lxml.etree.pyx":1792
 *     def write(self, file, *, encoding=None, method=u"xml",
 *               pretty_print=False, xml_declaration=None, with_tail=True,
 *               standalone=None, docstring=None, compression=0,             # <<<<<<<<<<<<<<
 *               exclusive=False, with_comments=True):
 *         u"""write(self, file, encoding=None, method="xml",
 */
    values[6] = ((PyObject *)Py_None);
    values[7] = ((PyObject *)Py_None);
    values[8] = ((PyObject *)__pyx_int_0);
    values[9] = __pyx_k_92;
    values[10] = __pyx_k_93;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__file);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
    }
    while (kw_args > 0) {
      PyObject* value;
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__encoding);
      if (value) { values[1] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__method);
      if (value) { values[2] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pretty_print);
      if (value) { values[3] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xml_declaration);
      if (value) { values[4] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__with_tail);
      if (value) { values[5] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__standalone);
      if (value) { values[6] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__docstring);
      if (value) { values[7] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__compression);
      if (value) { values[8] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__exclusive);
      if (value) { values[9] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__with_comments);
      if (value) { values[10] = value; if (!(--kw_args)) break; }
      break;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "write") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1790; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_file = values[0];
    __pyx_v_encoding = values[1];
    __pyx_v_method = values[2];
    __pyx_v_pretty_print = values[3];
    __pyx_v_xml_declaration = values[4];
    __pyx_v_with_tail = values[5];
    __pyx_v_standalone = values[6];
    __pyx_v_docstring = values[7];
    __pyx_v_compression = values[8];
    __pyx_v_exclusive = values[9];
    __pyx_v_with_comments = values[10];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_file = PyTuple_GET_ITEM(__pyx_args, 0);

    /* "src/lxml/lxml.etree.pyx":1790
 *             return None
 * 
 *     def write(self, file, *, encoding=None, method=u"xml",             # <<<<<<<<<<<<<<
 *               pretty_print=False, xml_declaration=None, with_tail=True,
 *               standalone=None, docstring=None, compression=0,
 */
    __pyx_v_encoding = ((PyObject *)Py_None);
    __pyx_v_method = ((PyObject *)__pyx_n_u__xml);
    __pyx_v_pretty_print = __pyx_k_90;

    /* "src/lxml/lxml.etree.pyx":1791
 * 
 *     def write(self, file, *, encoding=None, method=u"xml",
 *               pretty_print=False, xml_declaration=None, with_tail=True,             # <<<<<<<<<<<<<<
 *               standalone=None, docstring=None, compression=0,
 *               exclusive=False, with_comments=True):
 */
    __pyx_v_xml_declaration = ((PyObject *)Py_None);
    __pyx_v_with_tail = __pyx_k_91;

    /* "src/lxml/lxml.etree.pyx":1792
 *     def write(self, file, *, encoding=None, method=u"xml",
 *               pretty_print=False, xml_declaration=None, with_tail=True,
 *               standalone=None, docstring=None, compression=0,             # <<<<<<<<<<<<<<
 *               exclusive=False, with_comments=True):
 *         u"""write(self, file, encoding=None, method="xml",
 */
    __pyx_v_standalone = ((PyObject *)Py_None);
    __pyx_v_docstring = ((PyObject *)Py_None);
    __pyx_v_compression = ((PyObject *)__pyx_int_0);
    __pyx_v_exclusive = __pyx_k_92;
    __pyx_v_with_comments = __pyx_k_93;
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("write", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1790; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._ElementTree.write");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF(__pyx_v_encoding);
  __Pyx_INCREF(__pyx_v_compression);

  /* "src/lxml/lxml.etree.pyx":1818
 *         cdef bint write_declaration
 *         cdef int is_standalone
 *         self._assertHasRoot()             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._context_node)
 *         if compression is None or compression < 0:
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ElementTree *)((struct LxmlElementTree *)__pyx_v_self)->__pyx_vtab)->_assertHasRoot(((struct LxmlElementTree *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/lxml.etree.pyx":1819
 *         cdef int is_standalone
 *         self._assertHasRoot()
 *         _assertValidNode(self._context_node)             # <<<<<<<<<<<<<<
 *         if compression is None or compression < 0:
 *             compression = 0
 */
  __pyx_t_1 = ((PyObject *)((struct LxmlElementTree *)__pyx_v_self)->_context_node);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_t_1)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1819; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/lxml.etree.pyx":1820
 *         self._assertHasRoot()
 *         _assertValidNode(self._context_node)
 *         if compression is None or compression < 0:             # <<<<<<<<<<<<<<
 *             compression = 0
 *         # C14N serialisation
 */
  __pyx_t_3 = (__pyx_v_compression == Py_None);
  if (!__pyx_t_3) {
    __pyx_t_1 = PyObject_RichCompare(__pyx_v_compression, __pyx_int_0, Py_LT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = __pyx_t_4;
  } else {
    __pyx_t_5 = __pyx_t_3;
  }
  if (__pyx_t_5) {

    /* "src/lxml/lxml.etree.pyx":1821
 *         _assertValidNode(self._context_node)
 *         if compression is None or compression < 0:
 *             compression = 0             # <<<<<<<<<<<<<<
 *         # C14N serialisation
 *         if method == 'c14n':
 */
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_DECREF(__pyx_v_compression);
    __pyx_v_compression = __pyx_int_0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "src/lxml/lxml.etree.pyx":1823
 *             compression = 0
 *         # C14N serialisation
 *         if method == 'c14n':             # <<<<<<<<<<<<<<
 *             if encoding is not None:
 *                 raise ValueError("Cannot specify encoding with C14N")
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_method, ((PyObject *)__pyx_n_s__c14n), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_5) {

    /* "src/lxml/lxml.etree.pyx":1824
 *         # C14N serialisation
 *         if method == 'c14n':
 *             if encoding is not None:             # <<<<<<<<<<<<<<
 *                 raise ValueError("Cannot specify encoding with C14N")
 *             if xml_declaration:
 */
    __pyx_t_5 = (__pyx_v_encoding != Py_None);
    if (__pyx_t_5) {

      /* "src/lxml/lxml.etree.pyx":1825
 *         if method == 'c14n':
 *             if encoding is not None:
 *                 raise ValueError("Cannot specify encoding with C14N")             # <<<<<<<<<<<<<<
 *             if xml_declaration:
 *                 raise ValueError("Cannot enable XML declaration in C14N")
 */
      __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_95), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_Raise(__pyx_t_1, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "src/lxml/lxml.etree.pyx":1826
 *             if encoding is not None:
 *                 raise ValueError("Cannot specify encoding with C14N")
 *             if xml_declaration:             # <<<<<<<<<<<<<<
 *                 raise ValueError("Cannot enable XML declaration in C14N")
 *             _tofilelikeC14N(file, self._context_node, exclusive, with_comments,
 */
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_xml_declaration); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_5) {

      /* "src/lxml/lxml.etree.pyx":1827
 *                 raise ValueError("Cannot specify encoding with C14N")
 *             if xml_declaration:
 *                 raise ValueError("Cannot enable XML declaration in C14N")             # <<<<<<<<<<<<<<
 *             _tofilelikeC14N(file, self._context_node, exclusive, with_comments,
 *                             compression)
 */
      __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_97), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_Raise(__pyx_t_1, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L9;
    }
    __pyx_L9:;

    /* "src/lxml/lxml.etree.pyx":1828
 *             if xml_declaration:
 *                 raise ValueError("Cannot enable XML declaration in C14N")
 *             _tofilelikeC14N(file, self._context_node, exclusive, with_comments,             # <<<<<<<<<<<<<<
 *                             compression)
 *             return
 */
    __pyx_t_1 = ((PyObject *)((struct LxmlElementTree *)__pyx_v_self)->_context_node);
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_exclusive); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_with_comments); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "src/lxml/lxml.etree.pyx":1829
 *                 raise ValueError("Cannot enable XML declaration in C14N")
 *             _tofilelikeC14N(file, self._context_node, exclusive, with_comments,
 *                             compression)             # <<<<<<<<<<<<<<
 *             return
 *         if not with_comments:
 */
    __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_v_compression); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_6 = __pyx_f_4lxml_5etree__tofilelikeC14N(__pyx_v_file, ((struct LxmlElement *)__pyx_t_1), __pyx_t_5, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "src/lxml/lxml.etree.pyx":1830
 *             _tofilelikeC14N(file, self._context_node, exclusive, with_comments,
 *                             compression)
 *             return             # <<<<<<<<<<<<<<
 *         if not with_comments:
 *             raise ValueError("Can only discard comments in C14N serialisation")
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "src/lxml/lxml.etree.pyx":1831
 *                             compression)
 *             return
 *         if not with_comments:             # <<<<<<<<<<<<<<
 *             raise ValueError("Can only discard comments in C14N serialisation")
 *         # suppress decl. in default case (purely for ElementTree compatibility)
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_with_comments); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = (!__pyx_t_3);
  if (__pyx_t_5) {

    /* "src/lxml/lxml.etree.pyx":1832
 *             return
 *         if not with_comments:
 *             raise ValueError("Can only discard comments in C14N serialisation")             # <<<<<<<<<<<<<<
 *         # suppress decl. in default case (purely for ElementTree compatibility)
 *         if xml_declaration is not None:
 */
    __pyx_t_6 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_99), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_Raise(__pyx_t_6, 0, 0);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L10;
  }
  __pyx_L10:;

  /* "src/lxml/lxml.etree.pyx":1834
 *             raise ValueError("Can only discard comments in C14N serialisation")
 *         # suppress decl. in default case (purely for ElementTree compatibility)
 *         if xml_declaration is not None:             # <<<<<<<<<<<<<<
 *             write_declaration = xml_declaration
 *             if encoding is None:
 */
  __pyx_t_5 = (__pyx_v_xml_declaration != Py_None);
  if (__pyx_t_5) {

    /* "src/lxml/lxml.etree.pyx":1835
 *         # suppress decl. in default case (purely for ElementTree compatibility)
 *         if xml_declaration is not None:
 *             write_declaration = xml_declaration             # <<<<<<<<<<<<<<
 *             if encoding is None:
 *                 encoding = u'ASCII'
 */
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_xml_declaration); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_write_declaration = __pyx_t_5;

    /* "src/lxml/lxml.etree.pyx":1836
 *         if xml_declaration is not None:
 *             write_declaration = xml_declaration
 *             if encoding is None:             # <<<<<<<<<<<<<<
 *                 encoding = u'ASCII'
 *         elif encoding is None:
 */
    __pyx_t_5 = (__pyx_v_encoding == Py_None);
    if (__pyx_t_5) {

      /* "src/lxml/lxml.etree.pyx":1837
 *             write_declaration = xml_declaration
 *             if encoding is None:
 *                 encoding = u'ASCII'             # <<<<<<<<<<<<<<
 *         elif encoding is None:
 *             encoding = u'ASCII'
 */
      __Pyx_INCREF(((PyObject *)__pyx_n_u__ASCII));
      __Pyx_DECREF(__pyx_v_encoding);
      __pyx_v_encoding = ((PyObject *)__pyx_n_u__ASCII);
      goto __pyx_L12;
    }
    __pyx_L12:;
    goto __pyx_L11;
  }

  /* "src/lxml/lxml.etree.pyx":1838
 *             if encoding is None:
 *                 encoding = u'ASCII'
 *         elif encoding is None:             # <<<<<<<<<<<<<<
 *             encoding = u'ASCII'
 *             write_declaration = 0
 */
  __pyx_t_5 = (__pyx_v_encoding == Py_None);
  if (__pyx_t_5) {

    /* "src/lxml/lxml.etree.pyx":1839
 *                 encoding = u'ASCII'
 *         elif encoding is None:
 *             encoding = u'ASCII'             # <<<<<<<<<<<<<<
 *             write_declaration = 0
 *         else:
 */
    __Pyx_INCREF(((PyObject *)__pyx_n_u__ASCII));
    __Pyx_DECREF(__pyx_v_encoding);
    __pyx_v_encoding = ((PyObject *)__pyx_n_u__ASCII);

    /* "src/lxml/lxml.etree.pyx":1840
 *         elif encoding is None:
 *             encoding = u'ASCII'
 *             write_declaration = 0             # <<<<<<<<<<<<<<
 *         else:
 *             encoding = encoding.upper()
 */
    __pyx_v_write_declaration = 0;
    goto __pyx_L11;
  }
  /*else*/ {

    /* "src/lxml/lxml.etree.pyx":1842
 *             write_declaration = 0
 *         else:
 *             encoding = encoding.upper()             # <<<<<<<<<<<<<<
 *             write_declaration = encoding not in \
 *                                   (u'US-ASCII', u'ASCII', u'UTF8', u'UTF-8')
 */
    __pyx_t_6 = PyObject_GetAttr(__pyx_v_encoding, __pyx_n_s__upper); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_1 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_v_encoding);
    __pyx_v_encoding = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "src/lxml/lxml.etree.pyx":1843
 *         else:
 *             encoding = encoding.upper()
 *             write_declaration = encoding not in \             # <<<<<<<<<<<<<<
 *                                   (u'US-ASCII', u'ASCII', u'UTF8', u'UTF-8')
 *         if standalone is None:
 */
    __Pyx_INCREF(__pyx_v_encoding);
    __pyx_t_1 = __pyx_v_encoding;
    __pyx_t_5 = __Pyx_PyUnicode_Equals(__pyx_t_1, ((PyObject *)__pyx_kp_u_100), Py_NE); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = __pyx_t_5;
    if (__pyx_t_3) {
      __pyx_t_5 = __Pyx_PyUnicode_Equals(__pyx_t_1, ((PyObject *)__pyx_n_u__ASCII), Py_NE); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_4 = __pyx_t_5;
      __pyx_t_5 = __pyx_t_4;
    } else {
      __pyx_t_5 = __pyx_t_3;
    }
    if (__pyx_t_5) {
      __pyx_t_3 = __Pyx_PyUnicode_Equals(__pyx_t_1, ((PyObject *)__pyx_n_u__UTF8), Py_NE); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_4 = __pyx_t_3;
      __pyx_t_3 = __pyx_t_4;
    } else {
      __pyx_t_3 = __pyx_t_5;
    }
    if (__pyx_t_3) {
      __pyx_t_5 = __Pyx_PyUnicode_Equals(__pyx_t_1, ((PyObject *)__pyx_kp_u_31), Py_NE); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_4 = __pyx_t_5;
      __pyx_t_5 = __pyx_t_4;
    } else {
      __pyx_t_5 = __pyx_t_3;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_write_declaration = __pyx_t_5;
  }
  __pyx_L11:;

  /* "src/lxml/lxml.etree.pyx":1845
 *             write_declaration = encoding not in \
 *                                   (u'US-ASCII', u'ASCII', u'UTF8', u'UTF-8')
 *         if standalone is None:             # <<<<<<<<<<<<<<
 *             is_standalone = -1
 *         elif standalone:
 */
  __pyx_t_5 = (__pyx_v_standalone == Py_None);
  if (__pyx_t_5) {

    /* "src/lxml/lxml.etree.pyx":1846
 *                                   (u'US-ASCII', u'ASCII', u'UTF8', u'UTF-8')
 *         if standalone is None:
 *             is_standalone = -1             # <<<<<<<<<<<<<<
 *         elif standalone:
 *             write_declaration = 1
 */
    __pyx_v_is_standalone = -1;
    goto __pyx_L13;
  }

  /* "src/lxml/lxml.etree.pyx":1847
 *         if standalone is None:
 *             is_standalone = -1
 *         elif standalone:             # <<<<<<<<<<<<<<
 *             write_declaration = 1
 *             is_standalone = 1
 */
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_standalone); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_5) {

    /* "src/lxml/lxml.etree.pyx":1848
 *             is_standalone = -1
 *         elif standalone:
 *             write_declaration = 1             # <<<<<<<<<<<<<<
 *             is_standalone = 1
 *         else:
 */
    __pyx_v_write_declaration = 1;

    /* "src/lxml/lxml.etree.pyx":1849
 *         elif standalone:
 *             write_declaration = 1
 *             is_standalone = 1             # <<<<<<<<<<<<<<
 *         else:
 *             write_declaration = 1
 */
    __pyx_v_is_standalone = 1;
    goto __pyx_L13;
  }
  /*else*/ {

    /* "src/lxml/lxml.etree.pyx":1851
 *             is_standalone = 1
 *         else:
 *             write_declaration = 1             # <<<<<<<<<<<<<<
 *             is_standalone = 0
 *         _tofilelike(file, self._context_node, encoding, docstring, method,
 */
    __pyx_v_write_declaration = 1;

    /* "src/lxml/lxml.etree.pyx":1852
 *         else:
 *             write_declaration = 1
 *             is_standalone = 0             # <<<<<<<<<<<<<<
 *         _tofilelike(file, self._context_node, encoding, docstring, method,
 *                     write_declaration, 1, pretty_print, with_tail,
 */
    __pyx_v_is_standalone = 0;
  }
  __pyx_L13:;

  /* "src/lxml/lxml.etree.pyx":1853
 *             write_declaration = 1
 *             is_standalone = 0
 *         _tofilelike(file, self._context_node, encoding, docstring, method,             # <<<<<<<<<<<<<<
 *                     write_declaration, 1, pretty_print, with_tail,
 *                     is_standalone, compression)
 */
  __pyx_t_1 = ((PyObject *)((struct LxmlElementTree *)__pyx_v_self)->_context_node);
  __Pyx_INCREF(__pyx_t_1);

  /* "src/lxml/lxml.etree.pyx":1854
 *             is_standalone = 0
 *         _tofilelike(file, self._context_node, encoding, docstring, method,
 *                     write_declaration, 1, pretty_print, with_tail,             # <<<<<<<<<<<<<<
 *                     is_standalone, compression)
 * 
 */
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_pretty_print); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_with_tail); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":1855
 *         _tofilelike(file, self._context_node, encoding, docstring, method,
 *                     write_declaration, 1, pretty_print, with_tail,
 *                     is_standalone, compression)             # <<<<<<<<<<<<<<
 * 
 *     def getpath(self, _Element element not None):
 */
  __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_v_compression); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = __pyx_f_4lxml_5etree__tofilelike(__pyx_v_file, ((struct LxmlElement *)__pyx_t_1), __pyx_v_encoding, __pyx_v_docstring, __pyx_v_method, __pyx_v_write_declaration, 1, __pyx_t_5, __pyx_t_3, __pyx_v_is_standalone, __pyx_t_2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._ElementTree.write");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_encoding);
  __Pyx_DECREF(__pyx_v_compression);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1857
 *                     is_standalone, compression)
 * 
 *     def getpath(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         u"""getpath(self, element)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_6getpath(PyObject *__pyx_v_self, PyObject *__pyx_v_element); /*proto*/
static char __pyx_doc_4lxml_5etree_12_ElementTree_6getpath[] = "getpath(self, element)\n\n        Returns a structural, absolute XPath expression to find that element.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_6getpath(PyObject *__pyx_v_self, PyObject *__pyx_v_element) {
  struct LxmlDocument *__pyx_v_doc;
  struct LxmlElement *__pyx_v_root;
  xmlDoc *__pyx_v_c_doc;
  char *__pyx_v_c_path;
  PyObject *__pyx_v_path;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  xmlDoc *__pyx_t_4;
  __Pyx_RefNannySetupContext("getpath");
  __pyx_v_doc = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_root = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_path = Py_None; __Pyx_INCREF(Py_None);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_element), __pyx_ptype_4lxml_5etree__Element, 0, "element", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":1866
 *         cdef xmlDoc* c_doc
 *         cdef char* c_path
 *         _assertValidNode(element)             # <<<<<<<<<<<<<<
 *         if self._context_node is not None:
 *             root = self._context_node
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_element)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":1867
 *         cdef char* c_path
 *         _assertValidNode(element)
 *         if self._context_node is not None:             # <<<<<<<<<<<<<<
 *             root = self._context_node
 *             doc = root._doc
 */
  __pyx_t_2 = (((PyObject *)((struct LxmlElementTree *)__pyx_v_self)->_context_node) != Py_None);
  if (__pyx_t_2) {

    /* "src/lxml/lxml.etree.pyx":1868
 *         _assertValidNode(element)
 *         if self._context_node is not None:
 *             root = self._context_node             # <<<<<<<<<<<<<<
 *             doc = root._doc
 *         elif self._doc is not None:
 */
    __Pyx_INCREF(((PyObject *)((struct LxmlElementTree *)__pyx_v_self)->_context_node));
    __Pyx_DECREF(((PyObject *)__pyx_v_root));
    __pyx_v_root = ((struct LxmlElementTree *)__pyx_v_self)->_context_node;

    /* "src/lxml/lxml.etree.pyx":1869
 *         if self._context_node is not None:
 *             root = self._context_node
 *             doc = root._doc             # <<<<<<<<<<<<<<
 *         elif self._doc is not None:
 *             doc = self._doc
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_root->_doc));
    __Pyx_DECREF(((PyObject *)__pyx_v_doc));
    __pyx_v_doc = __pyx_v_root->_doc;
    goto __pyx_L5;
  }

  /* "src/lxml/lxml.etree.pyx":1870
 *             root = self._context_node
 *             doc = root._doc
 *         elif self._doc is not None:             # <<<<<<<<<<<<<<
 *             doc = self._doc
 *             root = doc.getroot()
 */
  __pyx_t_2 = (((PyObject *)((struct LxmlElementTree *)__pyx_v_self)->_doc) != Py_None);
  if (__pyx_t_2) {

    /* "src/lxml/lxml.etree.pyx":1871
 *             doc = root._doc
 *         elif self._doc is not None:
 *             doc = self._doc             # <<<<<<<<<<<<<<
 *             root = doc.getroot()
 *         else:
 */
    __Pyx_INCREF(((PyObject *)((struct LxmlElementTree *)__pyx_v_self)->_doc));
    __Pyx_DECREF(((PyObject *)__pyx_v_doc));
    __pyx_v_doc = ((struct LxmlElementTree *)__pyx_v_self)->_doc;

    /* "src/lxml/lxml.etree.pyx":1872
 *         elif self._doc is not None:
 *             doc = self._doc
 *             root = doc.getroot()             # <<<<<<<<<<<<<<
 *         else:
 *             raise ValueError, u"Element is not in this tree."
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree__Document *)__pyx_v_doc->__pyx_vtab)->getroot(__pyx_v_doc); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_v_root));
    __pyx_v_root = ((struct LxmlElement *)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "src/lxml/lxml.etree.pyx":1874
 *             root = doc.getroot()
 *         else:
 *             raise ValueError, u"Element is not in this tree."             # <<<<<<<<<<<<<<
 *         _assertValidDoc(doc)
 *         _assertValidNode(root)
 */
    __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_u_101), 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L5:;

  /* "src/lxml/lxml.etree.pyx":1875
 *         else:
 *             raise ValueError, u"Element is not in this tree."
 *         _assertValidDoc(doc)             # <<<<<<<<<<<<<<
 *         _assertValidNode(root)
 *         if element._doc is not doc:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDoc(__pyx_v_doc); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":1876
 *             raise ValueError, u"Element is not in this tree."
 *         _assertValidDoc(doc)
 *         _assertValidNode(root)             # <<<<<<<<<<<<<<
 *         if element._doc is not doc:
 *             raise ValueError, u"Element is not in this tree."
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_root); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":1877
 *         _assertValidDoc(doc)
 *         _assertValidNode(root)
 *         if element._doc is not doc:             # <<<<<<<<<<<<<<
 *             raise ValueError, u"Element is not in this tree."
 * 
 */
  __pyx_t_2 = (((struct LxmlElement *)__pyx_v_element)->_doc != __pyx_v_doc);
  if (__pyx_t_2) {

    /* "src/lxml/lxml.etree.pyx":1878
 *         _assertValidNode(root)
 *         if element._doc is not doc:
 *             raise ValueError, u"Element is not in this tree."             # <<<<<<<<<<<<<<
 * 
 *         c_doc = _fakeRootDoc(doc._c_doc, root._c_node)
 */
    __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_u_101), 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "src/lxml/lxml.etree.pyx":1880
 *             raise ValueError, u"Element is not in this tree."
 * 
 *         c_doc = _fakeRootDoc(doc._c_doc, root._c_node)             # <<<<<<<<<<<<<<
 *         c_path = tree.xmlGetNodePath(element._c_node)
 *         _destroyFakeDoc(doc._c_doc, c_doc)
 */
  __pyx_t_4 = __pyx_f_4lxml_5etree__fakeRootDoc(__pyx_v_doc->_c_doc, __pyx_v_root->_c_node); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_doc = __pyx_t_4;

  /* "src/lxml/lxml.etree.pyx":1881
 * 
 *         c_doc = _fakeRootDoc(doc._c_doc, root._c_node)
 *         c_path = tree.xmlGetNodePath(element._c_node)             # <<<<<<<<<<<<<<
 *         _destroyFakeDoc(doc._c_doc, c_doc)
 *         if c_path is NULL:
 */
  __pyx_v_c_path = xmlGetNodePath(((struct LxmlElement *)__pyx_v_element)->_c_node);

  /* "src/lxml/lxml.etree.pyx":1882
 *         c_doc = _fakeRootDoc(doc._c_doc, root._c_node)
 *         c_path = tree.xmlGetNodePath(element._c_node)
 *         _destroyFakeDoc(doc._c_doc, c_doc)             # <<<<<<<<<<<<<<
 *         if c_path is NULL:
 *             python.PyErr_NoMemory()
 */
  __pyx_f_4lxml_5etree__destroyFakeDoc(__pyx_v_doc->_c_doc, __pyx_v_c_doc);

  /* "src/lxml/lxml.etree.pyx":1883
 *         c_path = tree.xmlGetNodePath(element._c_node)
 *         _destroyFakeDoc(doc._c_doc, c_doc)
 *         if c_path is NULL:             # <<<<<<<<<<<<<<
 *             python.PyErr_NoMemory()
 *         path = funicode(c_path)
 */
  __pyx_t_2 = (__pyx_v_c_path == NULL);
  if (__pyx_t_2) {

    /* "src/lxml/lxml.etree.pyx":1884
 *         _destroyFakeDoc(doc._c_doc, c_doc)
 *         if c_path is NULL:
 *             python.PyErr_NoMemory()             # <<<<<<<<<<<<<<
 *         path = funicode(c_path)
 *         tree.xmlFree(c_path)
 */
    __pyx_t_3 = PyErr_NoMemory(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1884; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "src/lxml/lxml.etree.pyx":1885
 *         if c_path is NULL:
 *             python.PyErr_NoMemory()
 *         path = funicode(c_path)             # <<<<<<<<<<<<<<
 *         tree.xmlFree(c_path)
 *         return path
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_path); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1885; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_v_path);
  __pyx_v_path = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":1886
 *             python.PyErr_NoMemory()
 *         path = funicode(c_path)
 *         tree.xmlFree(c_path)             # <<<<<<<<<<<<<<
 *         return path
 * 
 */
  xmlFree(__pyx_v_c_path);

  /* "src/lxml/lxml.etree.pyx":1887
 *         path = funicode(c_path)
 *         tree.xmlFree(c_path)
 *         return path             # <<<<<<<<<<<<<<
 * 
 *     def getiterator(self, tag=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_path);
  __pyx_r = __pyx_v_path;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ElementTree.getpath");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_doc);
  __Pyx_DECREF((PyObject *)__pyx_v_root);
  __Pyx_DECREF(__pyx_v_path);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1889
 *         return path
 * 
 *     def getiterator(self, tag=None):             # <<<<<<<<<<<<<<
 *         u"""getiterator(self, tag=None)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_7getiterator(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_12_ElementTree_7getiterator[] = "getiterator(self, tag=None)\n\n        Returns a sequence or iterator of all elements in document order\n        (depth first pre-order), starting with the root element.\n\n        Can be restricted to find only elements with a specific tag\n        (pass ``tag=\"xyz\"`` or ``tag=\"{ns}xyz\"``) or from a namespace\n        (pass ``tag=\"{ns}*\"``).\n\n        You can also pass the Element, Comment, ProcessingInstruction and\n        Entity factory functions to look only for the specific element type.\n\n        :deprecated: Note that this method is deprecated as of\n          ElementTree 1.3 and lxml 2.0.  It returns an iterator in\n          lxml, which diverges from the original ElementTree\n          behaviour.  If you want an efficient iterator, use the\n          ``tree.iter()`` method instead.  You should only use this\n          method in new code if you require backwards compatibility\n          with older versions of lxml or ElementTree.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_7getiterator(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_root;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__tag,0};
  __Pyx_RefNannySetupContext("getiterator");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[1] = {0};
    values[0] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tag);
        if (value) { values[0] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "getiterator") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1889; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_tag = values[0];
  } else {
    __pyx_v_tag = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: __pyx_v_tag = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getiterator", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1889; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._ElementTree.getiterator");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_root = Py_None; __Pyx_INCREF(Py_None);

  /* "src/lxml/lxml.etree.pyx":1910
 *           with older versions of lxml or ElementTree.
 *         """
 *         root = self.getroot()             # <<<<<<<<<<<<<<
 *         if root is None:
 *             return ()
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__getroot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1910; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1910; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_v_root);
  __pyx_v_root = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "src/lxml/lxml.etree.pyx":1911
 *         """
 *         root = self.getroot()
 *         if root is None:             # <<<<<<<<<<<<<<
 *             return ()
 *         return root.getiterator(tag)
 */
  __pyx_t_3 = (__pyx_v_root == Py_None);
  if (__pyx_t_3) {

    /* "src/lxml/lxml.etree.pyx":1912
 *         root = self.getroot()
 *         if root is None:
 *             return ()             # <<<<<<<<<<<<<<
 *         return root.getiterator(tag)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_empty_tuple));
    __pyx_r = ((PyObject *)__pyx_empty_tuple);
    goto __pyx_L0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "src/lxml/lxml.etree.pyx":1913
 *         if root is None:
 *             return ()
 *         return root.getiterator(tag)             # <<<<<<<<<<<<<<
 * 
 *     def iter(self, tag=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_root, __pyx_n_s__getiterator); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1913; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1913; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_tag);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_tag);
  __Pyx_GIVEREF(__pyx_v_tag);
  __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1913; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._ElementTree.getiterator");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_root);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1915
 *         return root.getiterator(tag)
 * 
 *     def iter(self, tag=None):             # <<<<<<<<<<<<<<
 *         u"""iter(self, tag=None)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_8iter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_12_ElementTree_8iter[] = "iter(self, tag=None)\n\n        Creates an iterator for the root element.  The iterator loops over\n        all elements in this tree, in document order.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_8iter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_root;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__tag,0};
  __Pyx_RefNannySetupContext("iter");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[1] = {0};
    values[0] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tag);
        if (value) { values[0] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "iter") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1915; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_tag = values[0];
  } else {
    __pyx_v_tag = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: __pyx_v_tag = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("iter", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1915; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._ElementTree.iter");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_root = Py_None; __Pyx_INCREF(Py_None);

  /* "src/lxml/lxml.etree.pyx":1921
 *         all elements in this tree, in document order.
 *         """
 *         root = self.getroot()             # <<<<<<<<<<<<<<
 *         if root is None:
 *             return ()
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__getroot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_v_root);
  __pyx_v_root = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "src/lxml/lxml.etree.pyx":1922
 *         """
 *         root = self.getroot()
 *         if root is None:             # <<<<<<<<<<<<<<
 *             return ()
 *         return root.iter(tag)
 */
  __pyx_t_3 = (__pyx_v_root == Py_None);
  if (__pyx_t_3) {

    /* "src/lxml/lxml.etree.pyx":1923
 *         root = self.getroot()
 *         if root is None:
 *             return ()             # <<<<<<<<<<<<<<
 *         return root.iter(tag)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_empty_tuple));
    __pyx_r = ((PyObject *)__pyx_empty_tuple);
    goto __pyx_L0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "src/lxml/lxml.etree.pyx":1924
 *         if root is None:
 *             return ()
 *         return root.iter(tag)             # <<<<<<<<<<<<<<
 * 
 *     def find(self, path, namespaces=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_root, __pyx_n_s__iter); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_tag);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_tag);
  __Pyx_GIVEREF(__pyx_v_tag);
  __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._ElementTree.iter");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_root);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1926
 *         return root.iter(tag)
 * 
 *     def find(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         u"""find(self, path, namespaces=None)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_9find(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_12_ElementTree_9find[] = "find(self, path, namespaces=None)\n\n        Finds the first toplevel element with given tag.  Same as\n        ``tree.getroot().find(path)``.\n\n        The optional ``namespaces`` argument accepts a\n        prefix-to-namespace mapping that allows the usage of XPath\n        prefixes in the path expression.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_9find(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_path = 0;
  PyObject *__pyx_v_namespaces = 0;
  PyObject *__pyx_v_root;
  PyObject *__pyx_v_start;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__path,&__pyx_n_s__namespaces,0};
  __Pyx_RefNannySetupContext("find");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__path);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__namespaces);
        if (value) { values[1] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "find") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1926; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_path = values[0];
    __pyx_v_namespaces = values[1];
  } else {
    __pyx_v_namespaces = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_namespaces = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v_path = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("find", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1926; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._ElementTree.find");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF(__pyx_v_path);
  __pyx_v_root = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_start = Py_None; __Pyx_INCREF(Py_None);

  /* "src/lxml/lxml.etree.pyx":1936
 *         prefixes in the path expression.
 *         """
 *         self._assertHasRoot()             # <<<<<<<<<<<<<<
 *         root = self.getroot()
 *         if _isString(path):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ElementTree *)((struct LxmlElementTree *)__pyx_v_self)->__pyx_vtab)->_assertHasRoot(((struct LxmlElementTree *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1936; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/lxml.etree.pyx":1937
 *         """
 *         self._assertHasRoot()
 *         root = self.getroot()             # <<<<<<<<<<<<<<
 *         if _isString(path):
 *             start = path[:1]
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__getroot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1937; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1937; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_v_root);
  __pyx_v_root = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "src/lxml/lxml.etree.pyx":1938
 *         self._assertHasRoot()
 *         root = self.getroot()
 *         if _isString(path):             # <<<<<<<<<<<<<<
 *             start = path[:1]
 *             if start == u"/":
 */
  __pyx_t_3 = _isString(__pyx_v_path);
  if (__pyx_t_3) {

    /* "src/lxml/lxml.etree.pyx":1939
 *         root = self.getroot()
 *         if _isString(path):
 *             start = path[:1]             # <<<<<<<<<<<<<<
 *             if start == u"/":
 *                 path = u"." + path
 */
    __pyx_t_2 = __Pyx_PySequence_GetSlice(__pyx_v_path, 0, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1939; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_v_start);
    __pyx_v_start = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "src/lxml/lxml.etree.pyx":1940
 *         if _isString(path):
 *             start = path[:1]
 *             if start == u"/":             # <<<<<<<<<<<<<<
 *                 path = u"." + path
 *             elif start == b"/":
 */
    __pyx_t_3 = __Pyx_PyUnicode_Equals(__pyx_v_start, ((PyObject *)__pyx_kp_u_102), Py_EQ); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_3) {

      /* "src/lxml/lxml.etree.pyx":1941
 *             start = path[:1]
 *             if start == u"/":
 *                 path = u"." + path             # <<<<<<<<<<<<<<
 *             elif start == b"/":
 *                 path = b"." + path
 */
      __pyx_t_2 = PyNumber_Add(((PyObject *)__pyx_kp_u_5), __pyx_v_path); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_v_path);
      __pyx_v_path = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L7;
    }

    /* "src/lxml/lxml.etree.pyx":1942
 *             if start == u"/":
 *                 path = u"." + path
 *             elif start == b"/":             # <<<<<<<<<<<<<<
 *                 path = b"." + path
 *         return root.find(path, namespaces)
 */
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_start, ((PyObject *)__pyx_kp_b_102), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_3) {

      /* "src/lxml/lxml.etree.pyx":1943
 *                 path = u"." + path
 *             elif start == b"/":
 *                 path = b"." + path             # <<<<<<<<<<<<<<
 *         return root.find(path, namespaces)
 * 
 */
      __pyx_t_2 = PyNumber_Add(((PyObject *)__pyx_kp_b_5), __pyx_v_path); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1943; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_v_path);
      __pyx_v_path = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L7;
    }
    __pyx_L7:;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "src/lxml/lxml.etree.pyx":1944
 *             elif start == b"/":
 *                 path = b"." + path
 *         return root.find(path, namespaces)             # <<<<<<<<<<<<<<
 * 
 *     def findtext(self, path, default=None, namespaces=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_root, __pyx_n_s__find); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1944; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1944; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_path);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_path);
  __Pyx_GIVEREF(__pyx_v_path);
  __Pyx_INCREF(__pyx_v_namespaces);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_namespaces);
  __Pyx_GIVEREF(__pyx_v_namespaces);
  __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1944; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._ElementTree.find");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_root);
  __Pyx_DECREF(__pyx_v_start);
  __Pyx_DECREF(__pyx_v_path);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1946
 *         return root.find(path, namespaces)
 * 
 *     def findtext(self, path, default=None, namespaces=None):             # <<<<<<<<<<<<<<
 *         u"""findtext(self, path, default=None, namespaces=None)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_10findtext(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_12_ElementTree_10findtext[] = "findtext(self, path, default=None, namespaces=None)\n\n        Finds the text for the first element matching the ElementPath\n        expression.  Same as getroot().findtext(path)\n\n        The optional ``namespaces`` argument accepts a\n        prefix-to-namespace mapping that allows the usage of XPath\n        prefixes in the path expression.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_10findtext(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_path = 0;
  PyObject *__pyx_v_default = 0;
  PyObject *__pyx_v_namespaces = 0;
  PyObject *__pyx_v_root;
  PyObject *__pyx_v_start;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__path,&__pyx_n_s__default,&__pyx_n_s__namespaces,0};
  __Pyx_RefNannySetupContext("findtext");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__path);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__default);
        if (value) { values[1] = value; kw_args--; }
      }
      case  2:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__namespaces);
        if (value) { values[2] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "findtext") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1946; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_path = values[0];
    __pyx_v_default = values[1];
    __pyx_v_namespaces = values[2];
  } else {
    __pyx_v_default = ((PyObject *)Py_None);
    __pyx_v_namespaces = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: __pyx_v_namespaces = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: __pyx_v_default = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v_path = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("findtext", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1946; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._ElementTree.findtext");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF(__pyx_v_path);
  __pyx_v_root = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_start = Py_None; __Pyx_INCREF(Py_None);

  /* "src/lxml/lxml.etree.pyx":1956
 *         prefixes in the path expression.
 *         """
 *         self._assertHasRoot()             # <<<<<<<<<<<<<<
 *         root = self.getroot()
 *         if _isString(path):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ElementTree *)((struct LxmlElementTree *)__pyx_v_self)->__pyx_vtab)->_assertHasRoot(((struct LxmlElementTree *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1956; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/lxml.etree.pyx":1957
 *         """
 *         self._assertHasRoot()
 *         root = self.getroot()             # <<<<<<<<<<<<<<
 *         if _isString(path):
 *             start = path[:1]
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__getroot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_v_root);
  __pyx_v_root = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "src/lxml/lxml.etree.pyx":1958
 *         self._assertHasRoot()
 *         root = self.getroot()
 *         if _isString(path):             # <<<<<<<<<<<<<<
 *             start = path[:1]
 *             if start == u"/":
 */
  __pyx_t_3 = _isString(__pyx_v_path);
  if (__pyx_t_3) {

    /* "src/lxml/lxml.etree.pyx":1959
 *         root = self.getroot()
 *         if _isString(path):
 *             start = path[:1]             # <<<<<<<<<<<<<<
 *             if start == u"/":
 *                 path = u"." + path
 */
    __pyx_t_2 = __Pyx_PySequence_GetSlice(__pyx_v_path, 0, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1959; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_v_start);
    __pyx_v_start = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "src/lxml/lxml.etree.pyx":1960
 *         if _isString(path):
 *             start = path[:1]
 *             if start == u"/":             # <<<<<<<<<<<<<<
 *                 path = u"." + path
 *             elif start == b"/":
 */
    __pyx_t_3 = __Pyx_PyUnicode_Equals(__pyx_v_start, ((PyObject *)__pyx_kp_u_102), Py_EQ); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_3) {

      /* "src/lxml/lxml.etree.pyx":1961
 *             start = path[:1]
 *             if start == u"/":
 *                 path = u"." + path             # <<<<<<<<<<<<<<
 *             elif start == b"/":
 *                 path = b"." + path
 */
      __pyx_t_2 = PyNumber_Add(((PyObject *)__pyx_kp_u_5), __pyx_v_path); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1961; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_v_path);
      __pyx_v_path = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L7;
    }

    /* "src/lxml/lxml.etree.pyx":1962
 *             if start == u"/":
 *                 path = u"." + path
 *             elif start == b"/":             # <<<<<<<<<<<<<<
 *                 path = b"." + path
 *         return root.findtext(path, default, namespaces)
 */
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_start, ((PyObject *)__pyx_kp_b_102), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1962; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1962; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_3) {

      /* "src/lxml/lxml.etree.pyx":1963
 *                 path = u"." + path
 *             elif start == b"/":
 *                 path = b"." + path             # <<<<<<<<<<<<<<
 *         return root.findtext(path, default, namespaces)
 * 
 */
      __pyx_t_2 = PyNumber_Add(((PyObject *)__pyx_kp_b_5), __pyx_v_path); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_v_path);
      __pyx_v_path = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L7;
    }
    __pyx_L7:;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "src/lxml/lxml.etree.pyx":1964
 *             elif start == b"/":
 *                 path = b"." + path
 *         return root.findtext(path, default, namespaces)             # <<<<<<<<<<<<<<
 * 
 *     def findall(self, path, namespaces=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_root, __pyx_n_s__findtext); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1964; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1964; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_path);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_path);
  __Pyx_GIVEREF(__pyx_v_path);
  __Pyx_INCREF(__pyx_v_default);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_default);
  __Pyx_GIVEREF(__pyx_v_default);
  __Pyx_INCREF(__pyx_v_namespaces);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_namespaces);
  __Pyx_GIVEREF(__pyx_v_namespaces);
  __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1964; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._ElementTree.findtext");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_root);
  __Pyx_DECREF(__pyx_v_start);
  __Pyx_DECREF(__pyx_v_path);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1966
 *         return root.findtext(path, default, namespaces)
 * 
 *     def findall(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         u"""findall(self, path, namespaces=None)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_11findall(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_12_ElementTree_11findall[] = "findall(self, path, namespaces=None)\n\n        Finds all elements matching the ElementPath expression.  Same as\n        getroot().findall(path).\n\n        The optional ``namespaces`` argument accepts a\n        prefix-to-namespace mapping that allows the usage of XPath\n        prefixes in the path expression.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_11findall(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_path = 0;
  PyObject *__pyx_v_namespaces = 0;
  PyObject *__pyx_v_root;
  PyObject *__pyx_v_start;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__path,&__pyx_n_s__namespaces,0};
  __Pyx_RefNannySetupContext("findall");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__path);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__namespaces);
        if (value) { values[1] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "findall") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1966; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_path = values[0];
    __pyx_v_namespaces = values[1];
  } else {
    __pyx_v_namespaces = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_namespaces = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v_path = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("findall", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1966; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._ElementTree.findall");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF(__pyx_v_path);
  __pyx_v_root = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_start = Py_None; __Pyx_INCREF(Py_None);

  /* "src/lxml/lxml.etree.pyx":1976
 *         prefixes in the path expression.
 *         """
 *         self._assertHasRoot()             # <<<<<<<<<<<<<<
 *         root = self.getroot()
 *         if _isString(path):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ElementTree *)((struct LxmlElementTree *)__pyx_v_self)->__pyx_vtab)->_assertHasRoot(((struct LxmlElementTree *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1976; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/lxml.etree.pyx":1977
 *         """
 *         self._assertHasRoot()
 *         root = self.getroot()             # <<<<<<<<<<<<<<
 *         if _isString(path):
 *             start = path[:1]
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__getroot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_v_root);
  __pyx_v_root = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "src/lxml/lxml.etree.pyx":1978
 *         self._assertHasRoot()
 *         root = self.getroot()
 *         if _isString(path):             # <<<<<<<<<<<<<<
 *             start = path[:1]
 *             if start == u"/":
 */
  __pyx_t_3 = _isString(__pyx_v_path);
  if (__pyx_t_3) {

    /* "src/lxml/lxml.etree.pyx":1979
 *         root = self.getroot()
 *         if _isString(path):
 *             start = path[:1]             # <<<<<<<<<<<<<<
 *             if start == u"/":
 *                 path = u"." + path
 */
    __pyx_t_2 = __Pyx_PySequence_GetSlice(__pyx_v_path, 0, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1979; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_v_start);
    __pyx_v_start = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "src/lxml/lxml.etree.pyx":1980
 *         if _isString(path):
 *             start = path[:1]
 *             if start == u"/":             # <<<<<<<<<<<<<<
 *                 path = u"." + path
 *             elif start == b"/":
 */
    __pyx_t_3 = __Pyx_PyUnicode_Equals(__pyx_v_start, ((PyObject *)__pyx_kp_u_102), Py_EQ); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_3) {

      /* "src/lxml/lxml.etree.pyx":1981
 *             start = path[:1]
 *             if start == u"/":
 *                 path = u"." + path             # <<<<<<<<<<<<<<
 *             elif start == b"/":
 *                 path = b"." + path
 */
      __pyx_t_2 = PyNumber_Add(((PyObject *)__pyx_kp_u_5), __pyx_v_path); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1981; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_v_path);
      __pyx_v_path = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L7;
    }

    /* "src/lxml/lxml.etree.pyx":1982
 *             if start == u"/":
 *                 path = u"." + path
 *             elif start == b"/":             # <<<<<<<<<<<<<<
 *                 path = b"." + path
 *         return root.findall(path, namespaces)
 */
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_start, ((PyObject *)__pyx_kp_b_102), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_3) {

      /* "src/lxml/lxml.etree.pyx":1983
 *                 path = u"." + path
 *             elif start == b"/":
 *                 path = b"." + path             # <<<<<<<<<<<<<<
 *         return root.findall(path, namespaces)
 * 
 */
      __pyx_t_2 = PyNumber_Add(((PyObject *)__pyx_kp_b_5), __pyx_v_path); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_v_path);
      __pyx_v_path = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L7;
    }
    __pyx_L7:;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "src/lxml/lxml.etree.pyx":1984
 *             elif start == b"/":
 *                 path = b"." + path
 *         return root.findall(path, namespaces)             # <<<<<<<<<<<<<<
 * 
 *     def iterfind(self, path, namespaces=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_root, __pyx_n_s__findall); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_path);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_path);
  __Pyx_GIVEREF(__pyx_v_path);
  __Pyx_INCREF(__pyx_v_namespaces);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_namespaces);
  __Pyx_GIVEREF(__pyx_v_namespaces);
  __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._ElementTree.findall");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_root);
  __Pyx_DECREF(__pyx_v_start);
  __Pyx_DECREF(__pyx_v_path);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":1986
 *         return root.findall(path, namespaces)
 * 
 *     def iterfind(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         u"""iterfind(self, path, namespaces=None)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_12iterfind(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_12_ElementTree_12iterfind[] = "iterfind(self, path, namespaces=None)\n\n        Iterates over all elements matching the ElementPath expression.\n        Same as getroot().iterfind(path).\n\n        The optional ``namespaces`` argument accepts a\n        prefix-to-namespace mapping that allows the usage of XPath\n        prefixes in the path expression.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_12iterfind(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_path = 0;
  PyObject *__pyx_v_namespaces = 0;
  PyObject *__pyx_v_root;
  PyObject *__pyx_v_start;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__path,&__pyx_n_s__namespaces,0};
  __Pyx_RefNannySetupContext("iterfind");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__path);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__namespaces);
        if (value) { values[1] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "iterfind") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1986; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_path = values[0];
    __pyx_v_namespaces = values[1];
  } else {
    __pyx_v_namespaces = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_namespaces = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v_path = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("iterfind", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1986; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._ElementTree.iterfind");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF(__pyx_v_path);
  __pyx_v_root = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_start = Py_None; __Pyx_INCREF(Py_None);

  /* "src/lxml/lxml.etree.pyx":1996
 *         prefixes in the path expression.
 *         """
 *         self._assertHasRoot()             # <<<<<<<<<<<<<<
 *         root = self.getroot()
 *         if _isString(path):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ElementTree *)((struct LxmlElementTree *)__pyx_v_self)->__pyx_vtab)->_assertHasRoot(((struct LxmlElementTree *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1996; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/lxml.etree.pyx":1997
 *         """
 *         self._assertHasRoot()
 *         root = self.getroot()             # <<<<<<<<<<<<<<
 *         if _isString(path):
 *             start = path[:1]
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__getroot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1997; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1997; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_v_root);
  __pyx_v_root = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "src/lxml/lxml.etree.pyx":1998
 *         self._assertHasRoot()
 *         root = self.getroot()
 *         if _isString(path):             # <<<<<<<<<<<<<<
 *             start = path[:1]
 *             if start == u"/":
 */
  __pyx_t_3 = _isString(__pyx_v_path);
  if (__pyx_t_3) {

    /* "src/lxml/lxml.etree.pyx":1999
 *         root = self.getroot()
 *         if _isString(path):
 *             start = path[:1]             # <<<<<<<<<<<<<<
 *             if start == u"/":
 *                 path = u"." + path
 */
    __pyx_t_2 = __Pyx_PySequence_GetSlice(__pyx_v_path, 0, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_v_start);
    __pyx_v_start = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "src/lxml/lxml.etree.pyx":2000
 *         if _isString(path):
 *             start = path[:1]
 *             if start == u"/":             # <<<<<<<<<<<<<<
 *                 path = u"." + path
 *             elif start == b"/":
 */
    __pyx_t_3 = __Pyx_PyUnicode_Equals(__pyx_v_start, ((PyObject *)__pyx_kp_u_102), Py_EQ); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2000; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_3) {

      /* "src/lxml/lxml.etree.pyx":2001
 *             start = path[:1]
 *             if start == u"/":
 *                 path = u"." + path             # <<<<<<<<<<<<<<
 *             elif start == b"/":
 *                 path = b"." + path
 */
      __pyx_t_2 = PyNumber_Add(((PyObject *)__pyx_kp_u_5), __pyx_v_path); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2001; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_v_path);
      __pyx_v_path = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L7;
    }

    /* "src/lxml/lxml.etree.pyx":2002
 *             if start == u"/":
 *                 path = u"." + path
 *             elif start == b"/":             # <<<<<<<<<<<<<<
 *                 path = b"." + path
 *         return root.iterfind(path, namespaces)
 */
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_start, ((PyObject *)__pyx_kp_b_102), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2002; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2002; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_3) {

      /* "src/lxml/lxml.etree.pyx":2003
 *                 path = u"." + path
 *             elif start == b"/":
 *                 path = b"." + path             # <<<<<<<<<<<<<<
 *         return root.iterfind(path, namespaces)
 * 
 */
      __pyx_t_2 = PyNumber_Add(((PyObject *)__pyx_kp_b_5), __pyx_v_path); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2003; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_v_path);
      __pyx_v_path = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L7;
    }
    __pyx_L7:;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "src/lxml/lxml.etree.pyx":2004
 *             elif start == b"/":
 *                 path = b"." + path
 *         return root.iterfind(path, namespaces)             # <<<<<<<<<<<<<<
 * 
 *     def xpath(self, _path, *, namespaces=None, extensions=None,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_root, __pyx_n_s__iterfind); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2004; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2004; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_path);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_path);
  __Pyx_GIVEREF(__pyx_v_path);
  __Pyx_INCREF(__pyx_v_namespaces);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_namespaces);
  __Pyx_GIVEREF(__pyx_v_namespaces);
  __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2004; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._ElementTree.iterfind");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_root);
  __Pyx_DECREF(__pyx_v_start);
  __Pyx_DECREF(__pyx_v_path);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2006
 *         return root.iterfind(path, namespaces)
 * 
 *     def xpath(self, _path, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *               smart_strings=True, **_variables):
 *         u"""xpath(self, _path, namespaces=None, extensions=None, smart_strings=True, **_variables)
 */

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_13xpath(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_12_ElementTree_13xpath[] = "xpath(self, _path, namespaces=None, extensions=None, smart_strings=True, **_variables)\n\n        XPath evaluate in context of document.\n\n        ``namespaces`` is an optional dictionary with prefix to namespace URI\n        mappings, used by XPath.  ``extensions`` defines additional extension\n        functions.\n        \n        Returns a list (nodeset), or bool, float or string.\n\n        In case of a list result, return Element for element nodes,\n        string for text and attribute values.\n\n        Note: if you are going to apply multiple XPath expressions\n        against the same document, it is more efficient to use\n        XPathEvaluator directly.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_13xpath(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v__path = 0;
  PyObject *__pyx_v_namespaces = 0;
  PyObject *__pyx_v_extensions = 0;
  PyObject *__pyx_v_smart_strings = 0;
  PyObject *__pyx_v__variables = 0;
  PyObject *__pyx_v_evaluator;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s___path,&__pyx_n_s__namespaces,&__pyx_n_s__extensions,&__pyx_n_s__smart_strings,0};
  __Pyx_RefNannySetupContext("xpath");
  __pyx_v__variables = PyDict_New(); if (unlikely(!__pyx_v__variables)) return NULL;
  __Pyx_GOTREF(__pyx_v__variables);
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[4] = {0,0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    values[3] = __pyx_k_103;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s___path);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v__variables, values, PyTuple_GET_SIZE(__pyx_args), "xpath") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2006; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v__path = values[0];
    __pyx_v_namespaces = values[1];
    __pyx_v_extensions = values[2];
    __pyx_v_smart_strings = values[3];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v__path = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_namespaces = ((PyObject *)Py_None);
    __pyx_v_extensions = ((PyObject *)Py_None);
    __pyx_v_smart_strings = __pyx_k_103;
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("xpath", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2006; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v__variables);
  __Pyx_AddTraceback("lxml.etree._ElementTree.xpath");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_evaluator = Py_None; __Pyx_INCREF(Py_None);

  /* "src/lxml/lxml.etree.pyx":2025
 *         XPathEvaluator directly.
 *         """
 *         self._assertHasRoot()             # <<<<<<<<<<<<<<
 *         evaluator = XPathDocumentEvaluator(self, namespaces=namespaces,
 *                                            extensions=extensions,
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ElementTree *)((struct LxmlElementTree *)__pyx_v_self)->__pyx_vtab)->_assertHasRoot(((struct LxmlElementTree *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/lxml.etree.pyx":2026
 *         """
 *         self._assertHasRoot()
 *         evaluator = XPathDocumentEvaluator(self, namespaces=namespaces,             # <<<<<<<<<<<<<<
 *                                            extensions=extensions,
 *                                            smart_strings=smart_strings)
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2026; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2026; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__namespaces), __pyx_v_namespaces) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2026; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":2027
 *         self._assertHasRoot()
 *         evaluator = XPathDocumentEvaluator(self, namespaces=namespaces,
 *                                            extensions=extensions,             # <<<<<<<<<<<<<<
 *                                            smart_strings=smart_strings)
 *         return evaluator(_path, **_variables)
 */
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__extensions), __pyx_v_extensions) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2026; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":2028
 *         evaluator = XPathDocumentEvaluator(self, namespaces=namespaces,
 *                                            extensions=extensions,
 *                                            smart_strings=smart_strings)             # <<<<<<<<<<<<<<
 *         return evaluator(_path, **_variables)
 * 
 */
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__smart_strings), __pyx_v_smart_strings) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2026; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_XPathDocumentEvaluator)), ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2026; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_v_evaluator);
  __pyx_v_evaluator = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":2029
 *                                            extensions=extensions,
 *                                            smart_strings=smart_strings)
 *         return evaluator(_path, **_variables)             # <<<<<<<<<<<<<<
 * 
 *     def xslt(self, _xslt, extensions=None, access_control=None, **_kw):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2029; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(__pyx_v__path);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v__path);
  __Pyx_GIVEREF(__pyx_v__path);
  __pyx_t_2 = PyEval_CallObjectWithKeywords(__pyx_v_evaluator, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_v__variables)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2029; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ElementTree.xpath");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v__variables);
  __Pyx_DECREF(__pyx_v_evaluator);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2031
 *         return evaluator(_path, **_variables)
 * 
 *     def xslt(self, _xslt, extensions=None, access_control=None, **_kw):             # <<<<<<<<<<<<<<
 *         u"""xslt(self, _xslt, extensions=None, access_control=None, **_kw)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_14xslt(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_12_ElementTree_14xslt[] = "xslt(self, _xslt, extensions=None, access_control=None, **_kw)\n\n        Transform this document using other document.\n\n        xslt is a tree that should be XSLT\n        keyword parameters are XSLT transformation parameters.\n\n        Returns the transformed tree.\n\n        Note: if you are going to apply the same XSLT stylesheet against\n        multiple documents, it is more efficient to use the XSLT\n        class directly.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_14xslt(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v__xslt = 0;
  PyObject *__pyx_v_extensions = 0;
  PyObject *__pyx_v_access_control = 0;
  PyObject *__pyx_v__kw = 0;
  PyObject *__pyx_v_style;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s___xslt,&__pyx_n_s__extensions,&__pyx_n_s__access_control,0};
  __Pyx_RefNannySetupContext("xslt");
  __pyx_v__kw = PyDict_New(); if (unlikely(!__pyx_v__kw)) return NULL;
  __Pyx_GOTREF(__pyx_v__kw);
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s___xslt);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__extensions);
        if (value) { values[1] = value; kw_args--; }
      }
      case  2:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__access_control);
        if (value) { values[2] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v__kw, values, PyTuple_GET_SIZE(__pyx_args), "xslt") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2031; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v__xslt = values[0];
    __pyx_v_extensions = values[1];
    __pyx_v_access_control = values[2];
  } else {
    __pyx_v_extensions = ((PyObject *)Py_None);
    __pyx_v_access_control = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: __pyx_v_access_control = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: __pyx_v_extensions = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v__xslt = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("xslt", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2031; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v__kw);
  __Pyx_AddTraceback("lxml.etree._ElementTree.xslt");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_style = Py_None; __Pyx_INCREF(Py_None);

  /* "src/lxml/lxml.etree.pyx":2045
 *         class directly.
 *         """
 *         self._assertHasRoot()             # <<<<<<<<<<<<<<
 *         style = XSLT(_xslt, extensions=extensions,
 *                      access_control=access_control)
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ElementTree *)((struct LxmlElementTree *)__pyx_v_self)->__pyx_vtab)->_assertHasRoot(((struct LxmlElementTree *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2045; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/lxml.etree.pyx":2046
 *         """
 *         self._assertHasRoot()
 *         style = XSLT(_xslt, extensions=extensions,             # <<<<<<<<<<<<<<
 *                      access_control=access_control)
 *         return style(self, **_kw)
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2046; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v__xslt);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__xslt);
  __Pyx_GIVEREF(__pyx_v__xslt);
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2046; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__extensions), __pyx_v_extensions) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2046; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":2047
 *         self._assertHasRoot()
 *         style = XSLT(_xslt, extensions=extensions,
 *                      access_control=access_control)             # <<<<<<<<<<<<<<
 *         return style(self, **_kw)
 * 
 */
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__access_control), __pyx_v_access_control) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2046; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_XSLT)), ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2046; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_v_style);
  __pyx_v_style = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":2048
 *         style = XSLT(_xslt, extensions=extensions,
 *                      access_control=access_control)
 *         return style(self, **_kw)             # <<<<<<<<<<<<<<
 * 
 *     def relaxng(self, relaxng):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2048; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __pyx_t_2 = PyEval_CallObjectWithKeywords(__pyx_v_style, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_v__kw)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2048; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ElementTree.xslt");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v__kw);
  __Pyx_DECREF(__pyx_v_style);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2050
 *         return style(self, **_kw)
 * 
 *     def relaxng(self, relaxng):             # <<<<<<<<<<<<<<
 *         u"""relaxng(self, relaxng)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_15relaxng(PyObject *__pyx_v_self, PyObject *__pyx_v_relaxng); /*proto*/
static char __pyx_doc_4lxml_5etree_12_ElementTree_15relaxng[] = "relaxng(self, relaxng)\n\n        Validate this document using other document.\n\n        The relaxng argument is a tree that should contain a Relax NG schema.\n\n        Returns True or False, depending on whether validation\n        succeeded.\n\n        Note: if you are going to apply the same Relax NG schema against\n        multiple documents, it is more efficient to use the RelaxNG\n        class directly.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_15relaxng(PyObject *__pyx_v_self, PyObject *__pyx_v_relaxng) {
  struct __pyx_obj_4lxml_5etree_RelaxNG *__pyx_v_schema;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("relaxng");
  __pyx_v_schema = ((struct __pyx_obj_4lxml_5etree_RelaxNG *)Py_None); __Pyx_INCREF(Py_None);

  /* "src/lxml/lxml.etree.pyx":2064
 *         class directly.
 *         """
 *         self._assertHasRoot()             # <<<<<<<<<<<<<<
 *         schema = RelaxNG(relaxng)
 *         return schema.validate(self)
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ElementTree *)((struct LxmlElementTree *)__pyx_v_self)->__pyx_vtab)->_assertHasRoot(((struct LxmlElementTree *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/lxml.etree.pyx":2065
 *         """
 *         self._assertHasRoot()
 *         schema = RelaxNG(relaxng)             # <<<<<<<<<<<<<<
 *         return schema.validate(self)
 * 
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_relaxng);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_relaxng);
  __Pyx_GIVEREF(__pyx_v_relaxng);
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_RelaxNG)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_v_schema));
  __pyx_v_schema = ((struct __pyx_obj_4lxml_5etree_RelaxNG *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/lxml.etree.pyx":2066
 *         self._assertHasRoot()
 *         schema = RelaxNG(relaxng)
 *         return schema.validate(self)             # <<<<<<<<<<<<<<
 * 
 *     def xmlschema(self, xmlschema):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_schema), __pyx_n_s__validate); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2066; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2066; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2066; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ElementTree.relaxng");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_schema);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2068
 *         return schema.validate(self)
 * 
 *     def xmlschema(self, xmlschema):             # <<<<<<<<<<<<<<
 *         u"""xmlschema(self, xmlschema)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_16xmlschema(PyObject *__pyx_v_self, PyObject *__pyx_v_xmlschema); /*proto*/
static char __pyx_doc_4lxml_5etree_12_ElementTree_16xmlschema[] = "xmlschema(self, xmlschema)\n\n        Validate this document using other document.\n\n        The xmlschema argument is a tree that should contain an XML Schema.\n\n        Returns True or False, depending on whether validation\n        succeeded.\n\n        Note: If you are going to apply the same XML Schema against\n        multiple documents, it is more efficient to use the XMLSchema\n        class directly.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_16xmlschema(PyObject *__pyx_v_self, PyObject *__pyx_v_xmlschema) {
  struct __pyx_obj_4lxml_5etree_XMLSchema *__pyx_v_schema;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("xmlschema");
  __pyx_v_schema = ((struct __pyx_obj_4lxml_5etree_XMLSchema *)Py_None); __Pyx_INCREF(Py_None);

  /* "src/lxml/lxml.etree.pyx":2082
 *         class directly.
 *         """
 *         self._assertHasRoot()             # <<<<<<<<<<<<<<
 *         schema = XMLSchema(xmlschema)
 *         return schema.validate(self)
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ElementTree *)((struct LxmlElementTree *)__pyx_v_self)->__pyx_vtab)->_assertHasRoot(((struct LxmlElementTree *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/lxml.etree.pyx":2083
 *         """
 *         self._assertHasRoot()
 *         schema = XMLSchema(xmlschema)             # <<<<<<<<<<<<<<
 *         return schema.validate(self)
 * 
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_xmlschema);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_xmlschema);
  __Pyx_GIVEREF(__pyx_v_xmlschema);
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_XMLSchema)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_v_schema));
  __pyx_v_schema = ((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/lxml.etree.pyx":2084
 *         self._assertHasRoot()
 *         schema = XMLSchema(xmlschema)
 *         return schema.validate(self)             # <<<<<<<<<<<<<<
 * 
 *     def xinclude(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_schema), __pyx_n_s__validate); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ElementTree.xmlschema");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_schema);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2086
 *         return schema.validate(self)
 * 
 *     def xinclude(self):             # <<<<<<<<<<<<<<
 *         u"""xinclude(self)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_17xinclude(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_12_ElementTree_17xinclude[] = "xinclude(self)\n\n        Process the XInclude nodes in this document and include the\n        referenced XML fragments.\n\n        There is support for loading files through the file system, HTTP and\n        FTP.\n\n        Note that XInclude does not support custom resolvers in Python space\n        due to restrictions of libxml2 <= 2.6.29.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_17xinclude(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("xinclude");

  /* "src/lxml/lxml.etree.pyx":2098
 *         due to restrictions of libxml2 <= 2.6.29.
 *         """
 *         self._assertHasRoot()             # <<<<<<<<<<<<<<
 *         XInclude()(self._context_node)
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ElementTree *)((struct LxmlElementTree *)__pyx_v_self)->__pyx_vtab)->_assertHasRoot(((struct LxmlElementTree *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2098; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/lxml.etree.pyx":2099
 *         """
 *         self._assertHasRoot()
 *         XInclude()(self._context_node)             # <<<<<<<<<<<<<<
 * 
 *     def write_c14n(self, file, *, exclusive=False, with_comments=True,
 */
  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_XInclude)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(((PyObject *)((struct LxmlElementTree *)__pyx_v_self)->_context_node));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)((struct LxmlElementTree *)__pyx_v_self)->_context_node));
  __Pyx_GIVEREF(((PyObject *)((struct LxmlElementTree *)__pyx_v_self)->_context_node));
  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ElementTree.xinclude");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2101
 *         XInclude()(self._context_node)
 * 
 *     def write_c14n(self, file, *, exclusive=False, with_comments=True,             # <<<<<<<<<<<<<<
 *                    compression=0):
 *         u"""write_c14n(self, file, exclusive=False, with_comments=True,
 */

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_18write_c14n(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_12_ElementTree_18write_c14n[] = "write_c14n(self, file, exclusive=False, with_comments=True,\n                       compression=0)\n\n        C14N write of document. Always writes UTF-8.\n\n        The ``compression`` option enables GZip compression level 1-9.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_18write_c14n(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_file = 0;
  PyObject *__pyx_v_exclusive = 0;
  PyObject *__pyx_v_with_comments = 0;
  PyObject *__pyx_v_compression = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__file,&__pyx_n_s__exclusive,&__pyx_n_s__with_comments,&__pyx_n_s__compression,0};
  __Pyx_RefNannySetupContext("write_c14n");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[4] = {0,0,0,0};
    values[1] = __pyx_k_104;
    values[2] = __pyx_k_105;
    values[3] = ((PyObject *)__pyx_int_0);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__file);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
    }
    while (kw_args > 0) {
      PyObject* value;
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__exclusive);
      if (value) { values[1] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__with_comments);
      if (value) { values[2] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__compression);
      if (value) { values[3] = value; if (!(--kw_args)) break; }
      break;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "write_c14n") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2101; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_file = values[0];
    __pyx_v_exclusive = values[1];
    __pyx_v_with_comments = values[2];
    __pyx_v_compression = values[3];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_file = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_exclusive = __pyx_k_104;
    __pyx_v_with_comments = __pyx_k_105;
    __pyx_v_compression = ((PyObject *)__pyx_int_0);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("write_c14n", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2101; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._ElementTree.write_c14n");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF(__pyx_v_compression);

  /* "src/lxml/lxml.etree.pyx":2110
 *         The ``compression`` option enables GZip compression level 1-9.
 *         """
 *         self._assertHasRoot()             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._context_node)
 *         if compression is None or compression < 0:
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ElementTree *)((struct LxmlElementTree *)__pyx_v_self)->__pyx_vtab)->_assertHasRoot(((struct LxmlElementTree *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/lxml.etree.pyx":2111
 *         """
 *         self._assertHasRoot()
 *         _assertValidNode(self._context_node)             # <<<<<<<<<<<<<<
 *         if compression is None or compression < 0:
 *             compression = 0
 */
  __pyx_t_1 = ((PyObject *)((struct LxmlElementTree *)__pyx_v_self)->_context_node);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_t_1)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/lxml.etree.pyx":2112
 *         self._assertHasRoot()
 *         _assertValidNode(self._context_node)
 *         if compression is None or compression < 0:             # <<<<<<<<<<<<<<
 *             compression = 0
 *         _tofilelikeC14N(file, self._context_node, exclusive, with_comments,
 */
  __pyx_t_3 = (__pyx_v_compression == Py_None);
  if (!__pyx_t_3) {
    __pyx_t_1 = PyObject_RichCompare(__pyx_v_compression, __pyx_int_0, Py_LT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = __pyx_t_4;
  } else {
    __pyx_t_5 = __pyx_t_3;
  }
  if (__pyx_t_5) {

    /* "src/lxml/lxml.etree.pyx":2113
 *         _assertValidNode(self._context_node)
 *         if compression is None or compression < 0:
 *             compression = 0             # <<<<<<<<<<<<<<
 *         _tofilelikeC14N(file, self._context_node, exclusive, with_comments,
 *                         compression)
 */
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_DECREF(__pyx_v_compression);
    __pyx_v_compression = __pyx_int_0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "src/lxml/lxml.etree.pyx":2114
 *         if compression is None or compression < 0:
 *             compression = 0
 *         _tofilelikeC14N(file, self._context_node, exclusive, with_comments,             # <<<<<<<<<<<<<<
 *                         compression)
 * 
 */
  __pyx_t_1 = ((PyObject *)((struct LxmlElementTree *)__pyx_v_self)->_context_node);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_exclusive); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_with_comments); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":2115
 *             compression = 0
 *         _tofilelikeC14N(file, self._context_node, exclusive, with_comments,
 *                         compression)             # <<<<<<<<<<<<<<
 * 
 * cdef _ElementTree _elementTreeFactory(_Document doc, _Element context_node):
 */
  __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_v_compression); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = __pyx_f_4lxml_5etree__tofilelikeC14N(__pyx_v_file, ((struct LxmlElement *)__pyx_t_1), __pyx_t_5, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._ElementTree.write_c14n");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_compression);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2117
 *                         compression)
 * 
 * cdef _ElementTree _elementTreeFactory(_Document doc, _Element context_node):             # <<<<<<<<<<<<<<
 *     return _newElementTree(doc, context_node, _ElementTree)
 * 
 */

static  struct LxmlElementTree *__pyx_f_4lxml_5etree__elementTreeFactory(struct LxmlDocument *__pyx_v_doc, struct LxmlElement *__pyx_v_context_node) {
  struct LxmlElementTree *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("_elementTreeFactory");

  /* "src/lxml/lxml.etree.pyx":2118
 * 
 * cdef _ElementTree _elementTreeFactory(_Document doc, _Element context_node):
 *     return _newElementTree(doc, context_node, _ElementTree)             # <<<<<<<<<<<<<<
 * 
 * cdef _ElementTree _newElementTree(_Document doc, _Element context_node,
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__newElementTree(__pyx_v_doc, __pyx_v_context_node, ((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ElementTree)))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((struct LxmlElementTree *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = ((struct LxmlElementTree *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._elementTreeFactory");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2120
 *     return _newElementTree(doc, context_node, _ElementTree)
 * 
 * cdef _ElementTree _newElementTree(_Document doc, _Element context_node,             # <<<<<<<<<<<<<<
 *                                   object baseclass):
 *     cdef _ElementTree result
 */

static  struct LxmlElementTree *__pyx_f_4lxml_5etree__newElementTree(struct LxmlDocument *__pyx_v_doc, struct LxmlElement *__pyx_v_context_node, PyObject *__pyx_v_baseclass) {
  struct LxmlElementTree *__pyx_v_result;
  struct LxmlElementTree *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("_newElementTree");
  __Pyx_INCREF((PyObject *)__pyx_v_context_node);
  __pyx_v_result = ((struct LxmlElementTree *)Py_None); __Pyx_INCREF(Py_None);

  /* "src/lxml/lxml.etree.pyx":2123
 *                                   object baseclass):
 *     cdef _ElementTree result
 *     result = baseclass()             # <<<<<<<<<<<<<<
 *     if context_node is None and doc is not None:
 *         context_node = doc.getroot()
 */
  __pyx_t_1 = PyObject_Call(__pyx_v_baseclass, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__ElementTree))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_v_result));
  __pyx_v_result = ((struct LxmlElementTree *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/lxml.etree.pyx":2124
 *     cdef _ElementTree result
 *     result = baseclass()
 *     if context_node is None and doc is not None:             # <<<<<<<<<<<<<<
 *         context_node = doc.getroot()
 *     if context_node is None:
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_context_node) == Py_None);
  if (__pyx_t_2) {
    __pyx_t_3 = (((PyObject *)__pyx_v_doc) != Py_None);
    __pyx_t_4 = __pyx_t_3;
  } else {
    __pyx_t_4 = __pyx_t_2;
  }
  if (__pyx_t_4) {

    /* "src/lxml/lxml.etree.pyx":2125
 *     result = baseclass()
 *     if context_node is None and doc is not None:
 *         context_node = doc.getroot()             # <<<<<<<<<<<<<<
 *     if context_node is None:
 *         _assertValidDoc(doc)
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__Document *)__pyx_v_doc->__pyx_vtab)->getroot(__pyx_v_doc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_v_context_node));
    __pyx_v_context_node = ((struct LxmlElement *)__pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "src/lxml/lxml.etree.pyx":2126
 *     if context_node is None and doc is not None:
 *         context_node = doc.getroot()
 *     if context_node is None:             # <<<<<<<<<<<<<<
 *         _assertValidDoc(doc)
 *         result._doc = doc
 */
  __pyx_t_4 = (((PyObject *)__pyx_v_context_node) == Py_None);
  if (__pyx_t_4) {

    /* "src/lxml/lxml.etree.pyx":2127
 *         context_node = doc.getroot()
 *     if context_node is None:
 *         _assertValidDoc(doc)             # <<<<<<<<<<<<<<
 *         result._doc = doc
 *     else:
 */
    __pyx_t_5 = __pyx_f_4lxml_5etree__assertValidDoc(__pyx_v_doc); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "src/lxml/lxml.etree.pyx":2128
 *     if context_node is None:
 *         _assertValidDoc(doc)
 *         result._doc = doc             # <<<<<<<<<<<<<<
 *     else:
 *         _assertValidNode(context_node)
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_doc));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_doc));
    __Pyx_GOTREF(__pyx_v_result->_doc);
    __Pyx_DECREF(((PyObject *)__pyx_v_result->_doc));
    __pyx_v_result->_doc = __pyx_v_doc;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "src/lxml/lxml.etree.pyx":2130
 *         result._doc = doc
 *     else:
 *         _assertValidNode(context_node)             # <<<<<<<<<<<<<<
 *     result._context_node = context_node
 *     return result
 */
    __pyx_t_5 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_context_node); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L4:;

  /* "src/lxml/lxml.etree.pyx":2131
 *     else:
 *         _assertValidNode(context_node)
 *     result._context_node = context_node             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_context_node));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_context_node));
  __Pyx_GOTREF(__pyx_v_result->_context_node);
  __Pyx_DECREF(((PyObject *)__pyx_v_result->_context_node));
  __pyx_v_result->_context_node = __pyx_v_context_node;

  /* "src/lxml/lxml.etree.pyx":2132
 *         _assertValidNode(context_node)
 *     result._context_node = context_node
 *     return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  __pyx_r = ((struct LxmlElementTree *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._newElementTree");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_result);
  __Pyx_DECREF((PyObject *)__pyx_v_context_node);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2139
 *     """
 *     cdef _Element _element
 *     def __cinit__(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         _assertValidNode(element)
 *         self._element = element
 */

static int __pyx_pf_4lxml_5etree_7_Attrib___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_7_Attrib___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct LxmlElement *__pyx_v_element = 0;
  int __pyx_r;
  int __pyx_t_1;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__element,0};
  __Pyx_RefNannySetupContext("__cinit__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[1] = {0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__element);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2139; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_element = ((struct LxmlElement *)values[0]);
  } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_element = ((struct LxmlElement *)PyTuple_GET_ITEM(__pyx_args, 0));
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2139; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._Attrib.__cinit__");
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_element), __pyx_ptype_4lxml_5etree__Element, 0, "element", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":2140
 *     cdef _Element _element
 *     def __cinit__(self, _Element element not None):
 *         _assertValidNode(element)             # <<<<<<<<<<<<<<
 *         self._element = element
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":2141
 *     def __cinit__(self, _Element element not None):
 *         _assertValidNode(element)
 *         self._element = element             # <<<<<<<<<<<<<<
 * 
 *     # MANIPULATORS
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_element));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_element));
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self)->_element);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self)->_element));
  ((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self)->_element = __pyx_v_element;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._Attrib.__cinit__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2144
 * 
 *     # MANIPULATORS
 *     def __setitem__(self, key, value):             # <<<<<<<<<<<<<<
 *         _setAttributeValue(self._element, key, value)
 * 
 */

static int __pyx_pf_4lxml_5etree_7_Attrib_1__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_4lxml_5etree_7_Attrib_1__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("__setitem__");

  /* "src/lxml/lxml.etree.pyx":2145
 *     # MANIPULATORS
 *     def __setitem__(self, key, value):
 *         _setAttributeValue(self._element, key, value)             # <<<<<<<<<<<<<<
 * 
 *     def __delitem__(self, key):
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self)->_element);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__setAttributeValue(((struct LxmlElement *)__pyx_t_1), __pyx_v_key, __pyx_v_value); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._Attrib.__setitem__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2147
 *         _setAttributeValue(self._element, key, value)
 * 
 *     def __delitem__(self, key):             # <<<<<<<<<<<<<<
 *         _delAttribute(self._element, key)
 * 
 */

static int __pyx_pf_4lxml_5etree_7_Attrib_2__delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static int __pyx_pf_4lxml_5etree_7_Attrib_2__delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("__delitem__");

  /* "src/lxml/lxml.etree.pyx":2148
 * 
 *     def __delitem__(self, key):
 *         _delAttribute(self._element, key)             # <<<<<<<<<<<<<<
 * 
 *     def update(self, sequence_or_dict):
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self)->_element);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__delAttribute(((struct LxmlElement *)__pyx_t_1), __pyx_v_key); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._Attrib.__delitem__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2150
 *         _delAttribute(self._element, key)
 * 
 *     def update(self, sequence_or_dict):             # <<<<<<<<<<<<<<
 *         if isinstance(sequence_or_dict, dict):
 *             sequence_or_dict = sequence_or_dict.items()
 */

static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_3update(PyObject *__pyx_v_self, PyObject *__pyx_v_sequence_or_dict); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_3update(PyObject *__pyx_v_self, PyObject *__pyx_v_sequence_or_dict) {
  PyObject *__pyx_v_key;
  PyObject *__pyx_v_value;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  __Pyx_RefNannySetupContext("update");
  __Pyx_INCREF(__pyx_v_sequence_or_dict);
  __pyx_v_key = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_value = Py_None; __Pyx_INCREF(Py_None);

  /* "src/lxml/lxml.etree.pyx":2151
 * 
 *     def update(self, sequence_or_dict):
 *         if isinstance(sequence_or_dict, dict):             # <<<<<<<<<<<<<<
 *             sequence_or_dict = sequence_or_dict.items()
 *         for key, value in sequence_or_dict:
 */
  __pyx_t_1 = PyDict_Check(__pyx_v_sequence_or_dict); 
  if (__pyx_t_1) {

    /* "src/lxml/lxml.etree.pyx":2152
 *     def update(self, sequence_or_dict):
 *         if isinstance(sequence_or_dict, dict):
 *             sequence_or_dict = sequence_or_dict.items()             # <<<<<<<<<<<<<<
 *         for key, value in sequence_or_dict:
 *             _setAttributeValue(self._element, key, value)
 */
    __pyx_t_2 = PyObject_GetAttr(__pyx_v_sequence_or_dict, __pyx_n_s__items); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_v_sequence_or_dict);
    __pyx_v_sequence_or_dict = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "src/lxml/lxml.etree.pyx":2153
 *         if isinstance(sequence_or_dict, dict):
 *             sequence_or_dict = sequence_or_dict.items()
 *         for key, value in sequence_or_dict:             # <<<<<<<<<<<<<<
 *             _setAttributeValue(self._element, key, value)
 * 
 */
  if (PyList_CheckExact(__pyx_v_sequence_or_dict) || PyTuple_CheckExact(__pyx_v_sequence_or_dict)) {
    __pyx_t_4 = 0; __pyx_t_3 = __pyx_v_sequence_or_dict; __Pyx_INCREF(__pyx_t_3);
  } else {
    __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_sequence_or_dict); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
  }
  for (;;) {
    if (likely(PyList_CheckExact(__pyx_t_3))) {
      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
    } else if (likely(PyTuple_CheckExact(__pyx_t_3))) {
      if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
    } else {
      __pyx_t_2 = PyIter_Next(__pyx_t_3);
      if (!__pyx_t_2) {
        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    if (PyTuple_CheckExact(__pyx_t_2) && likely(PyTuple_GET_SIZE(__pyx_t_2) == 2)) {
      PyObject* tuple = __pyx_t_2;
      __pyx_t_5 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_5);
      __pyx_t_6 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_v_key);
      __pyx_v_key = __pyx_t_5;
      __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_v_value);
      __pyx_v_value = __pyx_t_6;
      __pyx_t_6 = 0;
    } else {
      __pyx_t_7 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_5 = __Pyx_UnpackItem(__pyx_t_7, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_UnpackItem(__pyx_t_7, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_EndUnpack(__pyx_t_7, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_v_key);
      __pyx_v_key = __pyx_t_5;
      __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_v_value);
      __pyx_v_value = __pyx_t_6;
      __pyx_t_6 = 0;
    }

    /* "src/lxml/lxml.etree.pyx":2154
 *             sequence_or_dict = sequence_or_dict.items()
 *         for key, value in sequence_or_dict:
 *             _setAttributeValue(self._element, key, value)             # <<<<<<<<<<<<<<
 * 
 *     def pop(self, key, *default):
 */
    __pyx_t_2 = ((PyObject *)((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self)->_element);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_8 = __pyx_f_4lxml_5etree__setAttributeValue(((struct LxmlElement *)__pyx_t_2), __pyx_v_key, __pyx_v_value); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree._Attrib.update");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_key);
  __Pyx_DECREF(__pyx_v_value);
  __Pyx_DECREF(__pyx_v_sequence_or_dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2156
 *             _setAttributeValue(self._element, key, value)
 * 
 *     def pop(self, key, *default):             # <<<<<<<<<<<<<<
 *         if python.PyTuple_GET_SIZE(default) > 1:
 *             raise TypeError, u"pop expected at most 2 arguments, got %d" % (
 */

static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_4pop(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_4pop(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_default = 0;
  PyObject *__pyx_v_result;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__key,0};
  __Pyx_RefNannySetupContext("pop");
  if (PyTuple_GET_SIZE(__pyx_args) > 1) {
    __pyx_v_default = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args)); __Pyx_GOTREF(__pyx_v_default);
    if (unlikely(!__pyx_v_default)) return NULL;
  } else {
    __pyx_v_default = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[1] = {0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      default:
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__key);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
    }
    if (unlikely(kw_args > 0)) {
      const Py_ssize_t used_pos_args = (PyTuple_GET_SIZE(__pyx_args) < 1) ? PyTuple_GET_SIZE(__pyx_args) : 1;
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "pop") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2156; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_key = values[0];
  } else if (PyTuple_GET_SIZE(__pyx_args) < 1) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_key = PyTuple_GET_ITEM(__pyx_args, 0);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pop", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2156; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_default);
  __Pyx_AddTraceback("lxml.etree._Attrib.pop");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_result = Py_None; __Pyx_INCREF(Py_None);

  /* "src/lxml/lxml.etree.pyx":2157
 * 
 *     def pop(self, key, *default):
 *         if python.PyTuple_GET_SIZE(default) > 1:             # <<<<<<<<<<<<<<
 *             raise TypeError, u"pop expected at most 2 arguments, got %d" % (
 *                 python.PyTuple_GET_SIZE(default)+1)
 */
  __pyx_t_1 = (PyTuple_GET_SIZE(((PyObject *)__pyx_v_default)) > 1);
  if (__pyx_t_1) {

    /* "src/lxml/lxml.etree.pyx":2159
 *         if python.PyTuple_GET_SIZE(default) > 1:
 *             raise TypeError, u"pop expected at most 2 arguments, got %d" % (
 *                 python.PyTuple_GET_SIZE(default)+1)             # <<<<<<<<<<<<<<
 *         result = _getAttributeValue(self._element, key, None)
 *         if result is None:
 */
    __pyx_t_2 = PyInt_FromSsize_t((PyTuple_GET_SIZE(((PyObject *)__pyx_v_default)) + 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_106), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_3), 0);
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "src/lxml/lxml.etree.pyx":2160
 *             raise TypeError, u"pop expected at most 2 arguments, got %d" % (
 *                 python.PyTuple_GET_SIZE(default)+1)
 *         result = _getAttributeValue(self._element, key, None)             # <<<<<<<<<<<<<<
 *         if result is None:
 *             if python.PyTuple_GET_SIZE(default) == 0:
 */
  __pyx_t_3 = ((PyObject *)((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self)->_element);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_2 = __pyx_f_4lxml_5etree__getAttributeValue(((struct LxmlElement *)__pyx_t_3), __pyx_v_key, Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_v_result);
  __pyx_v_result = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "src/lxml/lxml.etree.pyx":2161
 *                 python.PyTuple_GET_SIZE(default)+1)
 *         result = _getAttributeValue(self._element, key, None)
 *         if result is None:             # <<<<<<<<<<<<<<
 *             if python.PyTuple_GET_SIZE(default) == 0:
 *                 raise KeyError, key
 */
  __pyx_t_1 = (__pyx_v_result == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/lxml.etree.pyx":2162
 *         result = _getAttributeValue(self._element, key, None)
 *         if result is None:
 *             if python.PyTuple_GET_SIZE(default) == 0:             # <<<<<<<<<<<<<<
 *                 raise KeyError, key
 *             else:
 */
    __pyx_t_1 = (PyTuple_GET_SIZE(((PyObject *)__pyx_v_default)) == 0);
    if (__pyx_t_1) {

      /* "src/lxml/lxml.etree.pyx":2163
 *         if result is None:
 *             if python.PyTuple_GET_SIZE(default) == 0:
 *                 raise KeyError, key             # <<<<<<<<<<<<<<
 *             else:
 *                 result = python.PyTuple_GET_ITEM(default, 0)
 */
      __Pyx_Raise(__pyx_builtin_KeyError, __pyx_v_key, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L8;
    }
    /*else*/ {

      /* "src/lxml/lxml.etree.pyx":2165
 *                 raise KeyError, key
 *             else:
 *                 result = python.PyTuple_GET_ITEM(default, 0)             # <<<<<<<<<<<<<<
 *                 python.Py_INCREF(result)
 *         else:
 */
      __pyx_t_2 = PyTuple_GET_ITEM(((PyObject *)__pyx_v_default), 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_v_result);
      __pyx_v_result = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "src/lxml/lxml.etree.pyx":2166
 *             else:
 *                 result = python.PyTuple_GET_ITEM(default, 0)
 *                 python.Py_INCREF(result)             # <<<<<<<<<<<<<<
 *         else:
 *             _delAttribute(self._element, key)
 */
      Py_INCREF(__pyx_v_result);
    }
    __pyx_L8:;
    goto __pyx_L7;
  }
  /*else*/ {

    /* "src/lxml/lxml.etree.pyx":2168
 *                 python.Py_INCREF(result)
 *         else:
 *             _delAttribute(self._element, key)             # <<<<<<<<<<<<<<
 *         return result
 * 
 */
    __pyx_t_2 = ((PyObject *)((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self)->_element);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_4 = __pyx_f_4lxml_5etree__delAttribute(((struct LxmlElement *)__pyx_t_2), __pyx_v_key); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_L7:;

  /* "src/lxml/lxml.etree.pyx":2169
 *         else:
 *             _delAttribute(self._element, key)
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     def clear(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Attrib.pop");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_default);
  __Pyx_DECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2171
 *         return result
 * 
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         cdef xmlNode* c_node
 *         c_node = self._element._c_node
 */

static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_5clear(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_5clear(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  xmlNode *__pyx_v_c_node;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("clear");

  /* "src/lxml/lxml.etree.pyx":2173
 *     def clear(self):
 *         cdef xmlNode* c_node
 *         c_node = self._element._c_node             # <<<<<<<<<<<<<<
 *         while c_node.properties is not NULL:
 *             tree.xmlRemoveProp(c_node.properties)
 */
  __pyx_v_c_node = ((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self)->_element->_c_node;

  /* "src/lxml/lxml.etree.pyx":2174
 *         cdef xmlNode* c_node
 *         c_node = self._element._c_node
 *         while c_node.properties is not NULL:             # <<<<<<<<<<<<<<
 *             tree.xmlRemoveProp(c_node.properties)
 * 
 */
  while (1) {
    __pyx_t_1 = (__pyx_v_c_node->properties != NULL);
    if (!__pyx_t_1) break;

    /* "src/lxml/lxml.etree.pyx":2175
 *         c_node = self._element._c_node
 *         while c_node.properties is not NULL:
 *             tree.xmlRemoveProp(c_node.properties)             # <<<<<<<<<<<<<<
 * 
 *     # ACCESSORS
 */
    xmlRemoveProp(__pyx_v_c_node->properties);
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2178
 * 
 *     # ACCESSORS
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return repr(dict( _attributeIteratorFactory(self._element, 3) ))
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_6__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_6__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__repr__");

  /* "src/lxml/lxml.etree.pyx":2179
 *     # ACCESSORS
 *     def __repr__(self):
 *         return repr(dict( _attributeIteratorFactory(self._element, 3) ))             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, key):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self)->_element);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__attributeIteratorFactory(((struct LxmlElement *)__pyx_t_1), 3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyDict_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Repr(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Attrib.__repr__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2181
 *         return repr(dict( _attributeIteratorFactory(self._element, 3) ))
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         result = _getAttributeValue(self._element, key, None)
 *         if result is None:
 */

static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  PyObject *__pyx_v_result;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("__getitem__");
  __pyx_v_result = Py_None; __Pyx_INCREF(Py_None);

  /* "src/lxml/lxml.etree.pyx":2182
 * 
 *     def __getitem__(self, key):
 *         result = _getAttributeValue(self._element, key, None)             # <<<<<<<<<<<<<<
 *         if result is None:
 *             raise KeyError, key
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self)->_element);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__getAttributeValue(((struct LxmlElement *)__pyx_t_1), __pyx_v_key, Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_v_result);
  __pyx_v_result = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "src/lxml/lxml.etree.pyx":2183
 *     def __getitem__(self, key):
 *         result = _getAttributeValue(self._element, key, None)
 *         if result is None:             # <<<<<<<<<<<<<<
 *             raise KeyError, key
 *         else:
 */
  __pyx_t_3 = (__pyx_v_result == Py_None);
  if (__pyx_t_3) {

    /* "src/lxml/lxml.etree.pyx":2184
 *         result = _getAttributeValue(self._element, key, None)
 *         if result is None:
 *             raise KeyError, key             # <<<<<<<<<<<<<<
 *         else:
 *             return result
 */
    __Pyx_Raise(__pyx_builtin_KeyError, __pyx_v_key, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  /*else*/ {

    /* "src/lxml/lxml.etree.pyx":2186
 *             raise KeyError, key
 *         else:
 *             return result             # <<<<<<<<<<<<<<
 * 
 *     def __nonzero__(self):
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_result);
    __pyx_r = __pyx_v_result;
    goto __pyx_L0;
  }
  __pyx_L5:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Attrib.__getitem__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2188
 *             return result
 * 
 *     def __nonzero__(self):             # <<<<<<<<<<<<<<
 *         cdef xmlAttr* c_attr
 *         c_attr = self._element._c_node.properties
 */

static int __pyx_pf_4lxml_5etree_7_Attrib_8__nonzero__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pf_4lxml_5etree_7_Attrib_8__nonzero__(PyObject *__pyx_v_self) {
  xmlAttr *__pyx_v_c_attr;
  int __pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__nonzero__");

  /* "src/lxml/lxml.etree.pyx":2190
 *     def __nonzero__(self):
 *         cdef xmlAttr* c_attr
 *         c_attr = self._element._c_node.properties             # <<<<<<<<<<<<<<
 *         while c_attr is not NULL:
 *             if c_attr.type == tree.XML_ATTRIBUTE_NODE:
 */
  __pyx_v_c_attr = ((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self)->_element->_c_node->properties;

  /* "src/lxml/lxml.etree.pyx":2191
 *         cdef xmlAttr* c_attr
 *         c_attr = self._element._c_node.properties
 *         while c_attr is not NULL:             # <<<<<<<<<<<<<<
 *             if c_attr.type == tree.XML_ATTRIBUTE_NODE:
 *                 return 1
 */
  while (1) {
    __pyx_t_1 = (__pyx_v_c_attr != NULL);
    if (!__pyx_t_1) break;

    /* "src/lxml/lxml.etree.pyx":2192
 *         c_attr = self._element._c_node.properties
 *         while c_attr is not NULL:
 *             if c_attr.type == tree.XML_ATTRIBUTE_NODE:             # <<<<<<<<<<<<<<
 *                 return 1
 *             c_attr = c_attr.next
 */
    __pyx_t_1 = (__pyx_v_c_attr->type == XML_ATTRIBUTE_NODE);
    if (__pyx_t_1) {

      /* "src/lxml/lxml.etree.pyx":2193
 *         while c_attr is not NULL:
 *             if c_attr.type == tree.XML_ATTRIBUTE_NODE:
 *                 return 1             # <<<<<<<<<<<<<<
 *             c_attr = c_attr.next
 *         return 0
 */
      __pyx_r = 1;
      goto __pyx_L0;
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "src/lxml/lxml.etree.pyx":2194
 *             if c_attr.type == tree.XML_ATTRIBUTE_NODE:
 *                 return 1
 *             c_attr = c_attr.next             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
    __pyx_v_c_attr = __pyx_v_c_attr->next;
  }

  /* "src/lxml/lxml.etree.pyx":2195
 *                 return 1
 *             c_attr = c_attr.next
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2197
 *         return 0
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         cdef xmlAttr* c_attr
 *         cdef Py_ssize_t c
 */

static Py_ssize_t __pyx_pf_4lxml_5etree_7_Attrib_9__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pf_4lxml_5etree_7_Attrib_9__len__(PyObject *__pyx_v_self) {
  xmlAttr *__pyx_v_c_attr;
  Py_ssize_t __pyx_v_c;
  Py_ssize_t __pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__len__");

  /* "src/lxml/lxml.etree.pyx":2200
 *         cdef xmlAttr* c_attr
 *         cdef Py_ssize_t c
 *         c = 0             # <<<<<<<<<<<<<<
 *         c_attr = self._element._c_node.properties
 *         while c_attr is not NULL:
 */
  __pyx_v_c = 0;

  /* "src/lxml/lxml.etree.pyx":2201
 *         cdef Py_ssize_t c
 *         c = 0
 *         c_attr = self._element._c_node.properties             # <<<<<<<<<<<<<<
 *         while c_attr is not NULL:
 *             if c_attr.type == tree.XML_ATTRIBUTE_NODE:
 */
  __pyx_v_c_attr = ((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self)->_element->_c_node->properties;

  /* "src/lxml/lxml.etree.pyx":2202
 *         c = 0
 *         c_attr = self._element._c_node.properties
 *         while c_attr is not NULL:             # <<<<<<<<<<<<<<
 *             if c_attr.type == tree.XML_ATTRIBUTE_NODE:
 *                 c = c + 1
 */
  while (1) {
    __pyx_t_1 = (__pyx_v_c_attr != NULL);
    if (!__pyx_t_1) break;

    /* "src/lxml/lxml.etree.pyx":2203
 *         c_attr = self._element._c_node.properties
 *         while c_attr is not NULL:
 *             if c_attr.type == tree.XML_ATTRIBUTE_NODE:             # <<<<<<<<<<<<<<
 *                 c = c + 1
 *             c_attr = c_attr.next
 */
    __pyx_t_1 = (__pyx_v_c_attr->type == XML_ATTRIBUTE_NODE);
    if (__pyx_t_1) {

      /* "src/lxml/lxml.etree.pyx":2204
 *         while c_attr is not NULL:
 *             if c_attr.type == tree.XML_ATTRIBUTE_NODE:
 *                 c = c + 1             # <<<<<<<<<<<<<<
 *             c_attr = c_attr.next
 *         return c
 */
      __pyx_v_c = (__pyx_v_c + 1);
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "src/lxml/lxml.etree.pyx":2205
 *             if c_attr.type == tree.XML_ATTRIBUTE_NODE:
 *                 c = c + 1
 *             c_attr = c_attr.next             # <<<<<<<<<<<<<<
 *         return c
 * 
 */
    __pyx_v_c_attr = __pyx_v_c_attr->next;
  }

  /* "src/lxml/lxml.etree.pyx":2206
 *                 c = c + 1
 *             c_attr = c_attr.next
 *         return c             # <<<<<<<<<<<<<<
 * 
 *     def get(self, key, default=None):
 */
  __pyx_r = __pyx_v_c;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2208
 *         return c
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         return _getAttributeValue(self._element, key, default)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_10get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_10get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_default = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__key,&__pyx_n_s__default,0};
  __Pyx_RefNannySetupContext("get");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__key);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__default);
        if (value) { values[1] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "get") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2208; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_key = values[0];
    __pyx_v_default = values[1];
  } else {
    __pyx_v_default = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_default = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v_key = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2208; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._Attrib.get");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "src/lxml/lxml.etree.pyx":2209
 * 
 *     def get(self, key, default=None):
 *         return _getAttributeValue(self._element, key, default)             # <<<<<<<<<<<<<<
 * 
 *     def keys(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self)->_element);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__getAttributeValue(((struct LxmlElement *)__pyx_t_1), __pyx_v_key, __pyx_v_default); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Attrib.get");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2211
 *         return _getAttributeValue(self._element, key, default)
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         return _collectAttributes(self._element._c_node, 1)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_11keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_11keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("keys");

  /* "src/lxml/lxml.etree.pyx":2212
 * 
 *     def keys(self):
 *         return _collectAttributes(self._element._c_node, 1)             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__collectAttributes(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self)->_element->_c_node, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._Attrib.keys");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2214
 *         return _collectAttributes(self._element._c_node, 1)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return iter(_collectAttributes(self._element._c_node, 1))
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_12__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_12__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__iter__");

  /* "src/lxml/lxml.etree.pyx":2215
 * 
 *     def __iter__(self):
 *         return iter(_collectAttributes(self._element._c_node, 1))             # <<<<<<<<<<<<<<
 * 
 *     def iterkeys(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__collectAttributes(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self)->_element->_c_node, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Attrib.__iter__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2217
 *         return iter(_collectAttributes(self._element._c_node, 1))
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         return iter(_collectAttributes(self._element._c_node, 1))
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_13iterkeys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_13iterkeys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("iterkeys");

  /* "src/lxml/lxml.etree.pyx":2218
 * 
 *     def iterkeys(self):
 *         return iter(_collectAttributes(self._element._c_node, 1))             # <<<<<<<<<<<<<<
 * 
 *     def values(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__collectAttributes(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self)->_element->_c_node, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Attrib.iterkeys");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2220
 *         return iter(_collectAttributes(self._element._c_node, 1))
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         return _collectAttributes(self._element._c_node, 2)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_14values(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_14values(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("values");

  /* "src/lxml/lxml.etree.pyx":2221
 * 
 *     def values(self):
 *         return _collectAttributes(self._element._c_node, 2)             # <<<<<<<<<<<<<<
 * 
 *     def itervalues(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__collectAttributes(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self)->_element->_c_node, 2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._Attrib.values");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2223
 *         return _collectAttributes(self._element._c_node, 2)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         return iter(_collectAttributes(self._element._c_node, 2))
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_15itervalues(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_15itervalues(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("itervalues");

  /* "src/lxml/lxml.etree.pyx":2224
 * 
 *     def itervalues(self):
 *         return iter(_collectAttributes(self._element._c_node, 2))             # <<<<<<<<<<<<<<
 * 
 *     def items(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__collectAttributes(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self)->_element->_c_node, 2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Attrib.itervalues");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2226
 *         return iter(_collectAttributes(self._element._c_node, 2))
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         return _collectAttributes(self._element._c_node, 3)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_16items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_16items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("items");

  /* "src/lxml/lxml.etree.pyx":2227
 * 
 *     def items(self):
 *         return _collectAttributes(self._element._c_node, 3)             # <<<<<<<<<<<<<<
 * 
 *     def iteritems(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__collectAttributes(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self)->_element->_c_node, 3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._Attrib.items");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2229
 *         return _collectAttributes(self._element._c_node, 3)
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         return iter(_collectAttributes(self._element._c_node, 3))
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_17iteritems(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_17iteritems(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("iteritems");

  /* "src/lxml/lxml.etree.pyx":2230
 * 
 *     def iteritems(self):
 *         return iter(_collectAttributes(self._element._c_node, 3))             # <<<<<<<<<<<<<<
 * 
 *     def has_key(self, key):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__collectAttributes(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self)->_element->_c_node, 3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Attrib.iteritems");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2232
 *         return iter(_collectAttributes(self._element._c_node, 3))
 * 
 *     def has_key(self, key):             # <<<<<<<<<<<<<<
 *         if key in self:
 *             return True
 */

static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_18has_key(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_18has_key(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("has_key");

  /* "src/lxml/lxml.etree.pyx":2233
 * 
 *     def has_key(self, key):
 *         if key in self:             # <<<<<<<<<<<<<<
 *             return True
 *         else:
 */
  __pyx_t_1 = ((PySequence_Contains(__pyx_v_self, __pyx_v_key))); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "src/lxml/lxml.etree.pyx":2234
 *     def has_key(self, key):
 *         if key in self:
 *             return True             # <<<<<<<<<<<<<<
 *         else:
 *             return False
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "src/lxml/lxml.etree.pyx":2236
 *             return True
 *         else:
 *             return False             # <<<<<<<<<<<<<<
 * 
 *     def __contains__(self, key):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }
  __pyx_L5:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Attrib.has_key");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2238
 *             return False
 * 
 *     def __contains__(self, key):             # <<<<<<<<<<<<<<
 *         cdef xmlNode* c_node
 *         cdef char* c_href
 */

static int __pyx_pf_4lxml_5etree_7_Attrib_19__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static int __pyx_pf_4lxml_5etree_7_Attrib_19__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  xmlNode *__pyx_v_c_node;
  char *__pyx_v_c_href;
  PyObject *__pyx_v_ns;
  PyObject *__pyx_v_tag;
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  void *__pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("__contains__");
  __pyx_v_ns = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_tag = Py_None; __Pyx_INCREF(Py_None);

  /* "src/lxml/lxml.etree.pyx":2241
 *         cdef xmlNode* c_node
 *         cdef char* c_href
 *         ns, tag = _getNsTag(key)             # <<<<<<<<<<<<<<
 *         c_node = self._element._c_node
 *         c_href = NULL if ns is None else _cstr(ns)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__getNsTag(__pyx_v_key)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(__pyx_t_1 != Py_None) && likely(PyTuple_GET_SIZE(__pyx_t_1) == 2)) {
    PyObject* tuple = __pyx_t_1;
    __pyx_t_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_v_ns);
    __pyx_v_ns = __pyx_t_2;
    __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_v_tag);
    __pyx_v_tag = __pyx_t_3;
    __pyx_t_3 = 0;
  } else {
    __Pyx_UnpackTupleError(__pyx_t_1, 2);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "src/lxml/lxml.etree.pyx":2242
 *         cdef char* c_href
 *         ns, tag = _getNsTag(key)
 *         c_node = self._element._c_node             # <<<<<<<<<<<<<<
 *         c_href = NULL if ns is None else _cstr(ns)
 *         if tree.xmlHasNsProp(c_node, _cstr(tag), c_href):
 */
  __pyx_v_c_node = ((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self)->_element->_c_node;

  /* "src/lxml/lxml.etree.pyx":2243
 *         ns, tag = _getNsTag(key)
 *         c_node = self._element._c_node
 *         c_href = NULL if ns is None else _cstr(ns)             # <<<<<<<<<<<<<<
 *         if tree.xmlHasNsProp(c_node, _cstr(tag), c_href):
 *             return 1
 */
  __pyx_t_5 = (__pyx_v_ns == Py_None);
  if (__pyx_t_5) {
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_4 = PyBytes_AS_STRING(__pyx_v_ns);
  }
  __pyx_v_c_href = __pyx_t_4;

  /* "src/lxml/lxml.etree.pyx":2244
 *         c_node = self._element._c_node
 *         c_href = NULL if ns is None else _cstr(ns)
 *         if tree.xmlHasNsProp(c_node, _cstr(tag), c_href):             # <<<<<<<<<<<<<<
 *             return 1
 *         else:
 */
  __pyx_t_5 = (xmlHasNsProp(__pyx_v_c_node, PyBytes_AS_STRING(__pyx_v_tag), __pyx_v_c_href) != 0);
  if (__pyx_t_5) {

    /* "src/lxml/lxml.etree.pyx":2245
 *         c_href = NULL if ns is None else _cstr(ns)
 *         if tree.xmlHasNsProp(c_node, _cstr(tag), c_href):
 *             return 1             # <<<<<<<<<<<<<<
 *         else:
 *             return 0
 */
    __pyx_r = 1;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "src/lxml/lxml.etree.pyx":2247
 *             return 1
 *         else:
 *             return 0             # <<<<<<<<<<<<<<
 * 
 *     def __richcmp__(one, other, int op):
 */
    __pyx_r = 0;
    goto __pyx_L0;
  }
  __pyx_L5:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Attrib.__contains__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_ns);
  __Pyx_DECREF(__pyx_v_tag);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2249
 *             return 0
 * 
 *     def __richcmp__(one, other, int op):             # <<<<<<<<<<<<<<
 *         if not python.PyDict_Check(one):
 *             one = dict(one)
 */

static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_20__richcmp__(PyObject *__pyx_v_one, PyObject *__pyx_v_other, int __pyx_v_op); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_20__richcmp__(PyObject *__pyx_v_one, PyObject *__pyx_v_other, int __pyx_v_op) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__richcmp__");
  __Pyx_INCREF(__pyx_v_one);
  __Pyx_INCREF(__pyx_v_other);

  /* "src/lxml/lxml.etree.pyx":2250
 * 
 *     def __richcmp__(one, other, int op):
 *         if not python.PyDict_Check(one):             # <<<<<<<<<<<<<<
 *             one = dict(one)
 *         if not python.PyDict_Check(other):
 */
  __pyx_t_1 = (!PyDict_Check(__pyx_v_one));
  if (__pyx_t_1) {

    /* "src/lxml/lxml.etree.pyx":2251
 *     def __richcmp__(one, other, int op):
 *         if not python.PyDict_Check(one):
 *             one = dict(one)             # <<<<<<<<<<<<<<
 *         if not python.PyDict_Check(other):
 *             other = dict(other)
 */
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __Pyx_INCREF(__pyx_v_one);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_one);
    __Pyx_GIVEREF(__pyx_v_one);
    __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyDict_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_v_one);
    __pyx_v_one = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "src/lxml/lxml.etree.pyx":2252
 *         if not python.PyDict_Check(one):
 *             one = dict(one)
 *         if not python.PyDict_Check(other):             # <<<<<<<<<<<<<<
 *             other = dict(other)
 *         return python.PyObject_RichCompare(one, other, op)
 */
  __pyx_t_1 = (!PyDict_Check(__pyx_v_other));
  if (__pyx_t_1) {

    /* "src/lxml/lxml.etree.pyx":2253
 *             one = dict(one)
 *         if not python.PyDict_Check(other):
 *             other = dict(other)             # <<<<<<<<<<<<<<
 *         return python.PyObject_RichCompare(one, other, op)
 * 
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_INCREF(__pyx_v_other);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_other);
    __Pyx_GIVEREF(__pyx_v_other);
    __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyDict_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_v_other);
    __pyx_v_other = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "src/lxml/lxml.etree.pyx":2254
 *         if not python.PyDict_Check(other):
 *             other = dict(other)
 *         return python.PyObject_RichCompare(one, other, op)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyObject_RichCompare(__pyx_v_one, __pyx_v_other, __pyx_v_op); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Attrib.__richcmp__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_one);
  __Pyx_DECREF(__pyx_v_other);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2269
 *     cdef xmlAttr* _c_attr
 *     cdef int _keysvalues # 1 - keys, 2 - values, 3 - items (key, value)
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_15_AttribIterator___iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_15_AttribIterator___iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("__iter__");

  /* "src/lxml/lxml.etree.pyx":2270
 *     cdef int _keysvalues # 1 - keys, 2 - values, 3 - items (key, value)
 *     def __iter__(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __next__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self);
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2272
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         cdef xmlAttr* c_attr
 *         if self._node is None:
 */

static PyObject *__pyx_pf_4lxml_5etree_15_AttribIterator_1__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_15_AttribIterator_1__next__(PyObject *__pyx_v_self) {
  xmlAttr *__pyx_v_c_attr;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("__next__");

  /* "src/lxml/lxml.etree.pyx":2274
 *     def __next__(self):
 *         cdef xmlAttr* c_attr
 *         if self._node is None:             # <<<<<<<<<<<<<<
 *             raise StopIteration
 *         c_attr = self._c_attr
 */
  __pyx_t_1 = (((PyObject *)((struct __pyx_obj_4lxml_5etree__AttribIterator *)__pyx_v_self)->_node) == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/lxml.etree.pyx":2275
 *         cdef xmlAttr* c_attr
 *         if self._node is None:
 *             raise StopIteration             # <<<<<<<<<<<<<<
 *         c_attr = self._c_attr
 *         while c_attr is not NULL and c_attr.type != tree.XML_ATTRIBUTE_NODE:
 */
    __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "src/lxml/lxml.etree.pyx":2276
 *         if self._node is None:
 *             raise StopIteration
 *         c_attr = self._c_attr             # <<<<<<<<<<<<<<
 *         while c_attr is not NULL and c_attr.type != tree.XML_ATTRIBUTE_NODE:
 *             c_attr = c_attr.next
 */
  __pyx_v_c_attr = ((struct __pyx_obj_4lxml_5etree__AttribIterator *)__pyx_v_self)->_c_attr;

  /* "src/lxml/lxml.etree.pyx":2277
 *             raise StopIteration
 *         c_attr = self._c_attr
 *         while c_attr is not NULL and c_attr.type != tree.XML_ATTRIBUTE_NODE:             # <<<<<<<<<<<<<<
 *             c_attr = c_attr.next
 *         if c_attr is NULL:
 */
  while (1) {
    __pyx_t_1 = (__pyx_v_c_attr != NULL);
    if (__pyx_t_1) {
      __pyx_t_2 = (__pyx_v_c_attr->type != XML_ATTRIBUTE_NODE);
      __pyx_t_3 = __pyx_t_2;
    } else {
      __pyx_t_3 = __pyx_t_1;
    }
    if (!__pyx_t_3) break;

    /* "src/lxml/lxml.etree.pyx":2278
 *         c_attr = self._c_attr
 *         while c_attr is not NULL and c_attr.type != tree.XML_ATTRIBUTE_NODE:
 *             c_attr = c_attr.next             # <<<<<<<<<<<<<<
 *         if c_attr is NULL:
 *             self._node = None
 */
    __pyx_v_c_attr = __pyx_v_c_attr->next;
  }

  /* "src/lxml/lxml.etree.pyx":2279
 *         while c_attr is not NULL and c_attr.type != tree.XML_ATTRIBUTE_NODE:
 *             c_attr = c_attr.next
 *         if c_attr is NULL:             # <<<<<<<<<<<<<<
 *             self._node = None
 *             raise StopIteration
 */
  __pyx_t_3 = (__pyx_v_c_attr == NULL);
  if (__pyx_t_3) {

    /* "src/lxml/lxml.etree.pyx":2280
 *             c_attr = c_attr.next
 *         if c_attr is NULL:
 *             self._node = None             # <<<<<<<<<<<<<<
 *             raise StopIteration
 * 
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__AttribIterator *)__pyx_v_self)->_node);
    __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__AttribIterator *)__pyx_v_self)->_node));
    ((struct __pyx_obj_4lxml_5etree__AttribIterator *)__pyx_v_self)->_node = ((struct LxmlElement *)Py_None);

    /* "src/lxml/lxml.etree.pyx":2281
 *         if c_attr is NULL:
 *             self._node = None
 *             raise StopIteration             # <<<<<<<<<<<<<<
 * 
 *         self._c_attr = c_attr.next
 */
    __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L8;
  }
  __pyx_L8:;

  /* "src/lxml/lxml.etree.pyx":2283
 *             raise StopIteration
 * 
 *         self._c_attr = c_attr.next             # <<<<<<<<<<<<<<
 *         if self._keysvalues == 1:
 *             return _namespacedName(<xmlNode*>c_attr)
 */
  ((struct __pyx_obj_4lxml_5etree__AttribIterator *)__pyx_v_self)->_c_attr = __pyx_v_c_attr->next;

  /* "src/lxml/lxml.etree.pyx":2286
 *         if self._keysvalues == 1:
 *             return _namespacedName(<xmlNode*>c_attr)
 *         elif self._keysvalues == 2:             # <<<<<<<<<<<<<<
 *             return _attributeValue(self._node._c_node, c_attr)
 *         else:
 */
  switch (((struct __pyx_obj_4lxml_5etree__AttribIterator *)__pyx_v_self)->_keysvalues) {

    /* "src/lxml/lxml.etree.pyx":2284
 * 
 *         self._c_attr = c_attr.next
 *         if self._keysvalues == 1:             # <<<<<<<<<<<<<<
 *             return _namespacedName(<xmlNode*>c_attr)
 *         elif self._keysvalues == 2:
 */
    case 1:

    /* "src/lxml/lxml.etree.pyx":2285
 *         self._c_attr = c_attr.next
 *         if self._keysvalues == 1:
 *             return _namespacedName(<xmlNode*>c_attr)             # <<<<<<<<<<<<<<
 *         elif self._keysvalues == 2:
 *             return _attributeValue(self._node._c_node, c_attr)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __pyx_f_4lxml_5etree__namespacedName(((xmlNode *)__pyx_v_c_attr)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
    break;

    /* "src/lxml/lxml.etree.pyx":2286
 *         if self._keysvalues == 1:
 *             return _namespacedName(<xmlNode*>c_attr)
 *         elif self._keysvalues == 2:             # <<<<<<<<<<<<<<
 *             return _attributeValue(self._node._c_node, c_attr)
 *         else:
 */
    case 2:

    /* "src/lxml/lxml.etree.pyx":2287
 *             return _namespacedName(<xmlNode*>c_attr)
 *         elif self._keysvalues == 2:
 *             return _attributeValue(self._node._c_node, c_attr)             # <<<<<<<<<<<<<<
 *         else:
 *             return (_namespacedName(<xmlNode*>c_attr),
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __pyx_f_4lxml_5etree__attributeValue(((struct __pyx_obj_4lxml_5etree__AttribIterator *)__pyx_v_self)->_node->_c_node, __pyx_v_c_attr); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
    break;
    default:

    /* "src/lxml/lxml.etree.pyx":2289
 *             return _attributeValue(self._node._c_node, c_attr)
 *         else:
 *             return (_namespacedName(<xmlNode*>c_attr),             # <<<<<<<<<<<<<<
 *                     _attributeValue(self._node._c_node, c_attr))
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __pyx_f_4lxml_5etree__namespacedName(((xmlNode *)__pyx_v_c_attr)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);

    /* "src/lxml/lxml.etree.pyx":2290
 *         else:
 *             return (_namespacedName(<xmlNode*>c_attr),
 *                     _attributeValue(self._node._c_node, c_attr))             # <<<<<<<<<<<<<<
 * 
 * cdef object _attributeIteratorFactory(_Element element, int keysvalues):
 */
    __pyx_t_5 = __pyx_f_4lxml_5etree__attributeValue(((struct __pyx_obj_4lxml_5etree__AttribIterator *)__pyx_v_self)->_node->_c_node, __pyx_v_c_attr); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_r = ((PyObject *)__pyx_t_6);
    __pyx_t_6 = 0;
    goto __pyx_L0;
    break;
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._AttribIterator.__next__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2292
 *                     _attributeValue(self._node._c_node, c_attr))
 * 
 * cdef object _attributeIteratorFactory(_Element element, int keysvalues):             # <<<<<<<<<<<<<<
 *     cdef _AttribIterator attribs
 *     if element._c_node.properties is NULL:
 */

static  PyObject *__pyx_f_4lxml_5etree__attributeIteratorFactory(struct LxmlElement *__pyx_v_element, int __pyx_v_keysvalues) {
  struct __pyx_obj_4lxml_5etree__AttribIterator *__pyx_v_attribs;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_attributeIteratorFactory");
  __pyx_v_attribs = ((struct __pyx_obj_4lxml_5etree__AttribIterator *)Py_None); __Pyx_INCREF(Py_None);

  /* "src/lxml/lxml.etree.pyx":2294
 * cdef object _attributeIteratorFactory(_Element element, int keysvalues):
 *     cdef _AttribIterator attribs
 *     if element._c_node.properties is NULL:             # <<<<<<<<<<<<<<
 *         return ITER_EMPTY
 *     attribs = _AttribIterator()
 */
  __pyx_t_1 = (__pyx_v_element->_c_node->properties == NULL);
  if (__pyx_t_1) {

    /* "src/lxml/lxml.etree.pyx":2295
 *     cdef _AttribIterator attribs
 *     if element._c_node.properties is NULL:
 *         return ITER_EMPTY             # <<<<<<<<<<<<<<
 *     attribs = _AttribIterator()
 *     attribs._node = element
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_4lxml_5etree_ITER_EMPTY);
    __pyx_r = __pyx_v_4lxml_5etree_ITER_EMPTY;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "src/lxml/lxml.etree.pyx":2296
 *     if element._c_node.properties is NULL:
 *         return ITER_EMPTY
 *     attribs = _AttribIterator()             # <<<<<<<<<<<<<<
 *     attribs._node = element
 *     attribs._c_attr = element._c_node.properties
 */
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__AttribIterator)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_v_attribs));
  __pyx_v_attribs = ((struct __pyx_obj_4lxml_5etree__AttribIterator *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/lxml.etree.pyx":2297
 *         return ITER_EMPTY
 *     attribs = _AttribIterator()
 *     attribs._node = element             # <<<<<<<<<<<<<<
 *     attribs._c_attr = element._c_node.properties
 *     attribs._keysvalues = keysvalues
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_element));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_element));
  __Pyx_GOTREF(__pyx_v_attribs->_node);
  __Pyx_DECREF(((PyObject *)__pyx_v_attribs->_node));
  __pyx_v_attribs->_node = __pyx_v_element;

  /* "src/lxml/lxml.etree.pyx":2298
 *     attribs = _AttribIterator()
 *     attribs._node = element
 *     attribs._c_attr = element._c_node.properties             # <<<<<<<<<<<<<<
 *     attribs._keysvalues = keysvalues
 *     return attribs
 */
  __pyx_v_attribs->_c_attr = __pyx_v_element->_c_node->properties;

  /* "src/lxml/lxml.etree.pyx":2299
 *     attribs._node = element
 *     attribs._c_attr = element._c_node.properties
 *     attribs._keysvalues = keysvalues             # <<<<<<<<<<<<<<
 *     return attribs
 * 
 */
  __pyx_v_attribs->_keysvalues = __pyx_v_keysvalues;

  /* "src/lxml/lxml.etree.pyx":2300
 *     attribs._c_attr = element._c_node.properties
 *     attribs._keysvalues = keysvalues
 *     return attribs             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_attribs));
  __pyx_r = ((PyObject *)__pyx_v_attribs);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._attributeIteratorFactory");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_attribs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2309
 *     cdef char* _href
 *     cdef char* _name
 *     cdef _initTagMatch(self, tag):             # <<<<<<<<<<<<<<
 *         self._href = NULL
 *         self._name = NULL
 */

static  PyObject *__pyx_f_4lxml_5etree_18_ElementTagMatcher__initTagMatch(struct LxmlElementTagMatcher *__pyx_v_self, PyObject *__pyx_v_tag) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("_initTagMatch");

  /* "src/lxml/lxml.etree.pyx":2310
 *     cdef char* _name
 *     cdef _initTagMatch(self, tag):
 *         self._href = NULL             # <<<<<<<<<<<<<<
 *         self._name = NULL
 *         if tag is None:
 */
  __pyx_v_self->_href = NULL;

  /* "src/lxml/lxml.etree.pyx":2311
 *     cdef _initTagMatch(self, tag):
 *         self._href = NULL
 *         self._name = NULL             # <<<<<<<<<<<<<<
 *         if tag is None:
 *             self._node_type = 0
 */
  __pyx_v_self->_name = NULL;

  /* "src/lxml/lxml.etree.pyx":2312
 *         self._href = NULL
 *         self._name = NULL
 *         if tag is None:             # <<<<<<<<<<<<<<
 *             self._node_type = 0
 *         elif tag is Comment:
 */
  __pyx_t_1 = (__pyx_v_tag == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/lxml.etree.pyx":2313
 *         self._name = NULL
 *         if tag is None:
 *             self._node_type = 0             # <<<<<<<<<<<<<<
 *         elif tag is Comment:
 *             self._node_type = tree.XML_COMMENT_NODE
 */
    __pyx_v_self->_node_type = 0;
    goto __pyx_L3;
  }

  /* "src/lxml/lxml.etree.pyx":2314
 *         if tag is None:
 *             self._node_type = 0
 *         elif tag is Comment:             # <<<<<<<<<<<<<<
 *             self._node_type = tree.XML_COMMENT_NODE
 *         elif tag is ProcessingInstruction:
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__Comment); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = (__pyx_v_tag == __pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_1) {

    /* "src/lxml/lxml.etree.pyx":2315
 *             self._node_type = 0
 *         elif tag is Comment:
 *             self._node_type = tree.XML_COMMENT_NODE             # <<<<<<<<<<<<<<
 *         elif tag is ProcessingInstruction:
 *             self._node_type = tree.XML_PI_NODE
 */
    __pyx_v_self->_node_type = XML_COMMENT_NODE;
    goto __pyx_L3;
  }

  /* "src/lxml/lxml.etree.pyx":2316
 *         elif tag is Comment:
 *             self._node_type = tree.XML_COMMENT_NODE
 *         elif tag is ProcessingInstruction:             # <<<<<<<<<<<<<<
 *             self._node_type = tree.XML_PI_NODE
 *         elif tag is Entity:
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s_79); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = (__pyx_v_tag == __pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_1) {

    /* "src/lxml/lxml.etree.pyx":2317
 *             self._node_type = tree.XML_COMMENT_NODE
 *         elif tag is ProcessingInstruction:
 *             self._node_type = tree.XML_PI_NODE             # <<<<<<<<<<<<<<
 *         elif tag is Entity:
 *             self._node_type = tree.XML_ENTITY_REF_NODE
 */
    __pyx_v_self->_node_type = XML_PI_NODE;
    goto __pyx_L3;
  }

  /* "src/lxml/lxml.etree.pyx":2318
 *         elif tag is ProcessingInstruction:
 *             self._node_type = tree.XML_PI_NODE
 *         elif tag is Entity:             # <<<<<<<<<<<<<<
 *             self._node_type = tree.XML_ENTITY_REF_NODE
 *         elif tag is Element:
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__Entity); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = (__pyx_v_tag == __pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_1) {

    /* "src/lxml/lxml.etree.pyx":2319
 *             self._node_type = tree.XML_PI_NODE
 *         elif tag is Entity:
 *             self._node_type = tree.XML_ENTITY_REF_NODE             # <<<<<<<<<<<<<<
 *         elif tag is Element:
 *             self._node_type = tree.XML_ELEMENT_NODE
 */
    __pyx_v_self->_node_type = XML_ENTITY_REF_NODE;
    goto __pyx_L3;
  }

  /* "src/lxml/lxml.etree.pyx":2320
 *         elif tag is Entity:
 *             self._node_type = tree.XML_ENTITY_REF_NODE
 *         elif tag is Element:             # <<<<<<<<<<<<<<
 *             self._node_type = tree.XML_ELEMENT_NODE
 *         else:
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__Element); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = (__pyx_v_tag == __pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_1) {

    /* "src/lxml/lxml.etree.pyx":2321
 *             self._node_type = tree.XML_ENTITY_REF_NODE
 *         elif tag is Element:
 *             self._node_type = tree.XML_ELEMENT_NODE             # <<<<<<<<<<<<<<
 *         else:
 *             self._node_type = tree.XML_ELEMENT_NODE
 */
    __pyx_v_self->_node_type = XML_ELEMENT_NODE;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "src/lxml/lxml.etree.pyx":2323
 *             self._node_type = tree.XML_ELEMENT_NODE
 *         else:
 *             self._node_type = tree.XML_ELEMENT_NODE             # <<<<<<<<<<<<<<
 *             self._pystrings = _getNsTag(tag)
 *             if self._pystrings[0] is not None:
 */
    __pyx_v_self->_node_type = XML_ELEMENT_NODE;

    /* "src/lxml/lxml.etree.pyx":2324
 *         else:
 *             self._node_type = tree.XML_ELEMENT_NODE
 *             self._pystrings = _getNsTag(tag)             # <<<<<<<<<<<<<<
 *             if self._pystrings[0] is not None:
 *                 self._href = _cstr(self._pystrings[0])
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__getNsTag(__pyx_v_tag)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_GOTREF(__pyx_v_self->_pystrings);
    __Pyx_DECREF(__pyx_v_self->_pystrings);
    __pyx_v_self->_pystrings = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "src/lxml/lxml.etree.pyx":2325
 *             self._node_type = tree.XML_ELEMENT_NODE
 *             self._pystrings = _getNsTag(tag)
 *             if self._pystrings[0] is not None:             # <<<<<<<<<<<<<<
 *                 self._href = _cstr(self._pystrings[0])
 *             self._name = _cstr(self._pystrings[1])
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_self->_pystrings, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = (__pyx_t_2 != Py_None);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_1) {

      /* "src/lxml/lxml.etree.pyx":2326
 *             self._pystrings = _getNsTag(tag)
 *             if self._pystrings[0] is not None:
 *                 self._href = _cstr(self._pystrings[0])             # <<<<<<<<<<<<<<
 *             self._name = _cstr(self._pystrings[1])
 *             if self._name[0] == c'*' and self._name[1] == c'\0':
 */
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_self->_pystrings, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_v_self->_href = PyBytes_AS_STRING(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "src/lxml/lxml.etree.pyx":2327
 *             if self._pystrings[0] is not None:
 *                 self._href = _cstr(self._pystrings[0])
 *             self._name = _cstr(self._pystrings[1])             # <<<<<<<<<<<<<<
 *             if self._name[0] == c'*' and self._name[1] == c'\0':
 *                 self._name = NULL
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_self->_pystrings, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_self->_name = PyBytes_AS_STRING(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/lxml.etree.pyx":2328
 *                 self._href = _cstr(self._pystrings[0])
 *             self._name = _cstr(self._pystrings[1])
 *             if self._name[0] == c'*' and self._name[1] == c'\0':             # <<<<<<<<<<<<<<
 *                 self._name = NULL
 * 
 */
    __pyx_t_1 = ((__pyx_v_self->_name[0]) == '*');
    if (__pyx_t_1) {
      __pyx_t_3 = ((__pyx_v_self->_name[1]) == '\x00');
      __pyx_t_4 = __pyx_t_3;
    } else {
      __pyx_t_4 = __pyx_t_1;
    }
    if (__pyx_t_4) {

      /* "src/lxml/lxml.etree.pyx":2329
 *             self._name = _cstr(self._pystrings[1])
 *             if self._name[0] == c'*' and self._name[1] == c'\0':
 *                 self._name = NULL             # <<<<<<<<<<<<<<
 * 
 * cdef public class _ElementIterator(_ElementTagMatcher) [
 */
      __pyx_v_self->_name = NULL;
      goto __pyx_L5;
    }
    __pyx_L5:;
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ElementTagMatcher._initTagMatch");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2336
 *     cdef _Element _node
 *     cdef _node_to_node_function _next_element
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_16_ElementIterator___iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_16_ElementIterator___iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("__iter__");

  /* "src/lxml/lxml.etree.pyx":2337
 *     cdef _node_to_node_function _next_element
 *     def __iter__(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     cdef void _storeNext(self, _Element node):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self);
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2339
 *         return self
 * 
 *     cdef void _storeNext(self, _Element node):             # <<<<<<<<<<<<<<
 *         cdef xmlNode* c_node
 *         c_node = self._next_element(node._c_node)
 */

static  void __pyx_f_4lxml_5etree_16_ElementIterator__storeNext(struct LxmlElementIterator *__pyx_v_self, struct LxmlElement *__pyx_v_node) {
  xmlNode *__pyx_v_c_node;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("_storeNext");

  /* "src/lxml/lxml.etree.pyx":2341
 *     cdef void _storeNext(self, _Element node):
 *         cdef xmlNode* c_node
 *         c_node = self._next_element(node._c_node)             # <<<<<<<<<<<<<<
 *         while c_node is not NULL and \
 *                   self._node_type != 0 and \
 */
  __pyx_v_c_node = __pyx_v_self->_next_element(__pyx_v_node->_c_node);

  /* "src/lxml/lxml.etree.pyx":2342
 *         cdef xmlNode* c_node
 *         c_node = self._next_element(node._c_node)
 *         while c_node is not NULL and \             # <<<<<<<<<<<<<<
 *                   self._node_type != 0 and \
 *                   (self._node_type != c_node.type or
 */
  while (1) {
    __pyx_t_1 = (__pyx_v_c_node != NULL);
    if (__pyx_t_1) {

      /* "src/lxml/lxml.etree.pyx":2343
 *         c_node = self._next_element(node._c_node)
 *         while c_node is not NULL and \
 *                   self._node_type != 0 and \             # <<<<<<<<<<<<<<
 *                   (self._node_type != c_node.type or
 *                    not _tagMatches(c_node, self._href, self._name)):
 */
      __pyx_t_2 = (__pyx_v_self->__pyx_base._node_type != 0);
      if (__pyx_t_2) {

        /* "src/lxml/lxml.etree.pyx":2344
 *         while c_node is not NULL and \
 *                   self._node_type != 0 and \
 *                   (self._node_type != c_node.type or             # <<<<<<<<<<<<<<
 *                    not _tagMatches(c_node, self._href, self._name)):
 *             c_node = self._next_element(c_node)
 */
        __pyx_t_3 = (__pyx_v_self->__pyx_base._node_type != __pyx_v_c_node->type);
        if (!__pyx_t_3) {

          /* "src/lxml/lxml.etree.pyx":2345
 *                   self._node_type != 0 and \
 *                   (self._node_type != c_node.type or
 *                    not _tagMatches(c_node, self._href, self._name)):             # <<<<<<<<<<<<<<
 *             c_node = self._next_element(c_node)
 *         if c_node is NULL:
 */
          __pyx_t_4 = (!__pyx_f_4lxml_5etree__tagMatches(__pyx_v_c_node, __pyx_v_self->__pyx_base._href, __pyx_v_self->__pyx_base._name));
          __pyx_t_5 = __pyx_t_4;
        } else {
          __pyx_t_5 = __pyx_t_3;
        }
        __pyx_t_3 = __pyx_t_5;
      } else {
        __pyx_t_3 = __pyx_t_2;
      }
      __pyx_t_2 = __pyx_t_3;
    } else {
      __pyx_t_2 = __pyx_t_1;
    }
    if (!__pyx_t_2) break;

    /* "src/lxml/lxml.etree.pyx":2346
 *                   (self._node_type != c_node.type or
 *                    not _tagMatches(c_node, self._href, self._name)):
 *             c_node = self._next_element(c_node)             # <<<<<<<<<<<<<<
 *         if c_node is NULL:
 *             self._node = None
 */
    __pyx_v_c_node = __pyx_v_self->_next_element(__pyx_v_c_node);
  }

  /* "src/lxml/lxml.etree.pyx":2347
 *                    not _tagMatches(c_node, self._href, self._name)):
 *             c_node = self._next_element(c_node)
 *         if c_node is NULL:             # <<<<<<<<<<<<<<
 *             self._node = None
 *         else:
 */
  __pyx_t_2 = (__pyx_v_c_node == NULL);
  if (__pyx_t_2) {

    /* "src/lxml/lxml.etree.pyx":2348
 *             c_node = self._next_element(c_node)
 *         if c_node is NULL:
 *             self._node = None             # <<<<<<<<<<<<<<
 *         else:
 *             # Python ref:
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_self->_node);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->_node));
    __pyx_v_self->_node = ((struct LxmlElement *)Py_None);
    goto __pyx_L5;
  }
  /*else*/ {

    /* "src/lxml/lxml.etree.pyx":2351
 *         else:
 *             # Python ref:
 *             self._node = _elementFactory(node._doc, c_node)             # <<<<<<<<<<<<<<
 * 
 *     def __next__(self):
 */
    __pyx_t_6 = ((PyObject *)__pyx_v_node->_doc);
    __Pyx_INCREF(__pyx_t_6);
    __pyx_t_7 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_6), __pyx_v_c_node)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GIVEREF(__pyx_t_7);
    __Pyx_GOTREF(__pyx_v_self->_node);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->_node));
    __pyx_v_self->_node = ((struct LxmlElement *)__pyx_t_7);
    __pyx_t_7 = 0;
  }
  __pyx_L5:;

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_WriteUnraisable("lxml.etree._ElementIterator._storeNext");
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "src/lxml/lxml.etree.pyx":2353
 *             self._node = _elementFactory(node._doc, c_node)
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         cdef xmlNode* c_node
 *         cdef _Element current_node
 */

static PyObject *__pyx_pf_4lxml_5etree_16_ElementIterator_1__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_16_ElementIterator_1__next__(PyObject *__pyx_v_self) {
  struct LxmlElement *__pyx_v_current_node;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__next__");
  __pyx_v_current_node = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);

  /* "src/lxml/lxml.etree.pyx":2356
 *         cdef xmlNode* c_node
 *         cdef _Element current_node
 *         if self._node is None:             # <<<<<<<<<<<<<<
 *             raise StopIteration
 *         # Python ref:
 */
  __pyx_t_1 = (((PyObject *)((struct LxmlElementIterator *)__pyx_v_self)->_node) == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/lxml.etree.pyx":2357
 *         cdef _Element current_node
 *         if self._node is None:
 *             raise StopIteration             # <<<<<<<<<<<<<<
 *         # Python ref:
 *         current_node = self._node
 */
    __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "src/lxml/lxml.etree.pyx":2359
 *             raise StopIteration
 *         # Python ref:
 *         current_node = self._node             # <<<<<<<<<<<<<<
 *         self._storeNext(current_node)
 *         return current_node
 */
  __Pyx_INCREF(((PyObject *)((struct LxmlElementIterator *)__pyx_v_self)->_node));
  __Pyx_DECREF(((PyObject *)__pyx_v_current_node));
  __pyx_v_current_node = ((struct LxmlElementIterator *)__pyx_v_self)->_node;

  /* "src/lxml/lxml.etree.pyx":2360
 *         # Python ref:
 *         current_node = self._node
 *         self._storeNext(current_node)             # <<<<<<<<<<<<<<
 *         return current_node
 * 
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__ElementIterator *)((struct LxmlElementIterator *)__pyx_v_self)->__pyx_base.__pyx_vtab)->_storeNext(((struct LxmlElementIterator *)__pyx_v_self), __pyx_v_current_node);

  /* "src/lxml/lxml.etree.pyx":2361
 *         current_node = self._node
 *         self._storeNext(current_node)
 *         return current_node             # <<<<<<<<<<<<<<
 * 
 * cdef class ElementChildIterator(_ElementIterator):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_current_node));
  __pyx_r = ((PyObject *)__pyx_v_current_node);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._ElementIterator.__next__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_current_node);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2367
 *     Iterates over the children of an element.
 *     """
 *     def __cinit__(self, _Element node not None, tag=None, *, reversed=False):             # <<<<<<<<<<<<<<
 *         cdef xmlNode* c_node
 *         _assertValidNode(node)
 */

static int __pyx_pf_4lxml_5etree_20ElementChildIterator___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_20ElementChildIterator___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct LxmlElement *__pyx_v_node = 0;
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_reversed = 0;
  xmlNode *__pyx_v_c_node;
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__node,&__pyx_n_s__tag,&__pyx_n_s__reversed,0};
  __Pyx_RefNannySetupContext("__cinit__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = __pyx_k_107;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__node);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tag);
        if (value) { values[1] = value; kw_args--; }
      }
    }
    while (kw_args > 0) {
      PyObject* value;
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reversed);
      if (value) { values[2] = value; if (!(--kw_args)) break; }
      break;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2367; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_node = ((struct LxmlElement *)values[0]);
    __pyx_v_tag = values[1];
    __pyx_v_reversed = values[2];
  } else {
    __pyx_v_tag = ((PyObject *)Py_None);
    __pyx_v_reversed = __pyx_k_107;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_tag = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v_node = ((struct LxmlElement *)PyTuple_GET_ITEM(__pyx_args, 0));
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2367; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.ElementChildIterator.__cinit__");
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_node), __pyx_ptype_4lxml_5etree__Element, 0, "node", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":2369
 *     def __cinit__(self, _Element node not None, tag=None, *, reversed=False):
 *         cdef xmlNode* c_node
 *         _assertValidNode(node)             # <<<<<<<<<<<<<<
 *         self._initTagMatch(tag)
 *         if reversed:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":2370
 *         cdef xmlNode* c_node
 *         _assertValidNode(node)
 *         self._initTagMatch(tag)             # <<<<<<<<<<<<<<
 *         if reversed:
 *             c_node = _findChildBackwards(node._c_node, 0)
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree_ElementChildIterator *)((struct __pyx_obj_4lxml_5etree_ElementChildIterator *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._initTagMatch(((struct LxmlElementTagMatcher *)__pyx_v_self), __pyx_v_tag); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/lxml.etree.pyx":2371
 *         _assertValidNode(node)
 *         self._initTagMatch(tag)
 *         if reversed:             # <<<<<<<<<<<<<<
 *             c_node = _findChildBackwards(node._c_node, 0)
 *             self._next_element = _previousElement
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_reversed); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_3) {

    /* "src/lxml/lxml.etree.pyx":2372
 *         self._initTagMatch(tag)
 *         if reversed:
 *             c_node = _findChildBackwards(node._c_node, 0)             # <<<<<<<<<<<<<<
 *             self._next_element = _previousElement
 *         else:
 */
    __pyx_v_c_node = __pyx_f_4lxml_5etree__findChildBackwards(__pyx_v_node->_c_node, 0);

    /* "src/lxml/lxml.etree.pyx":2373
 *         if reversed:
 *             c_node = _findChildBackwards(node._c_node, 0)
 *             self._next_element = _previousElement             # <<<<<<<<<<<<<<
 *         else:
 *             c_node = _findChildForwards(node._c_node, 0)
 */
    ((struct __pyx_obj_4lxml_5etree_ElementChildIterator *)__pyx_v_self)->__pyx_base._next_element = __pyx_f_4lxml_5etree__previousElement;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "src/lxml/lxml.etree.pyx":2375
 *             self._next_element = _previousElement
 *         else:
 *             c_node = _findChildForwards(node._c_node, 0)             # <<<<<<<<<<<<<<
 *             self._next_element = _nextElement
 *         if tag is not None:
 */
    __pyx_v_c_node = __pyx_f_4lxml_5etree__findChildForwards(__pyx_v_node->_c_node, 0);

    /* "src/lxml/lxml.etree.pyx":2376
 *         else:
 *             c_node = _findChildForwards(node._c_node, 0)
 *             self._next_element = _nextElement             # <<<<<<<<<<<<<<
 *         if tag is not None:
 *             while c_node is not NULL and \
 */
    ((struct __pyx_obj_4lxml_5etree_ElementChildIterator *)__pyx_v_self)->__pyx_base._next_element = __pyx_f_4lxml_5etree__nextElement;
  }
  __pyx_L6:;

  /* "src/lxml/lxml.etree.pyx":2377
 *             c_node = _findChildForwards(node._c_node, 0)
 *             self._next_element = _nextElement
 *         if tag is not None:             # <<<<<<<<<<<<<<
 *             while c_node is not NULL and \
 *                       self._node_type != 0 and \
 */
  __pyx_t_3 = (__pyx_v_tag != Py_None);
  if (__pyx_t_3) {

    /* "src/lxml/lxml.etree.pyx":2378
 *             self._next_element = _nextElement
 *         if tag is not None:
 *             while c_node is not NULL and \             # <<<<<<<<<<<<<<
 *                       self._node_type != 0 and \
 *                       (self._node_type != c_node.type or
 */
    while (1) {
      __pyx_t_3 = (__pyx_v_c_node != NULL);
      if (__pyx_t_3) {

        /* "src/lxml/lxml.etree.pyx":2379
 *         if tag is not None:
 *             while c_node is not NULL and \
 *                       self._node_type != 0 and \             # <<<<<<<<<<<<<<
 *                       (self._node_type != c_node.type or
 *                        not _tagMatches(c_node, self._href, self._name)):
 */
        __pyx_t_4 = (((struct __pyx_obj_4lxml_5etree_ElementChildIterator *)__pyx_v_self)->__pyx_base.__pyx_base._node_type != 0);
        if (__pyx_t_4) {

          /* "src/lxml/lxml.etree.pyx":2380
 *             while c_node is not NULL and \
 *                       self._node_type != 0 and \
 *                       (self._node_type != c_node.type or             # <<<<<<<<<<<<<<
 *                        not _tagMatches(c_node, self._href, self._name)):
 *                 c_node = self._next_element(c_node)
 */
          __pyx_t_5 = (((struct __pyx_obj_4lxml_5etree_ElementChildIterator *)__pyx_v_self)->__pyx_base.__pyx_base._node_type != __pyx_v_c_node->type);
          if (!__pyx_t_5) {

            /* "src/lxml/lxml.etree.pyx":2381
 *                       self._node_type != 0 and \
 *                       (self._node_type != c_node.type or
 *                        not _tagMatches(c_node, self._href, self._name)):             # <<<<<<<<<<<<<<
 *                 c_node = self._next_element(c_node)
 *         if c_node is not NULL:
 */
            __pyx_t_6 = (!__pyx_f_4lxml_5etree__tagMatches(__pyx_v_c_node, ((struct __pyx_obj_4lxml_5etree_ElementChildIterator *)__pyx_v_self)->__pyx_base.__pyx_base._href, ((struct __pyx_obj_4lxml_5etree_ElementChildIterator *)__pyx_v_self)->__pyx_base.__pyx_base._name));
            __pyx_t_7 = __pyx_t_6;
          } else {
            __pyx_t_7 = __pyx_t_5;
          }
          __pyx_t_5 = __pyx_t_7;
        } else {
          __pyx_t_5 = __pyx_t_4;
        }
        __pyx_t_4 = __pyx_t_5;
      } else {
        __pyx_t_4 = __pyx_t_3;
      }
      if (!__pyx_t_4) break;

      /* "src/lxml/lxml.etree.pyx":2382
 *                       (self._node_type != c_node.type or
 *                        not _tagMatches(c_node, self._href, self._name)):
 *                 c_node = self._next_element(c_node)             # <<<<<<<<<<<<<<
 *         if c_node is not NULL:
 *             # store Python ref:
 */
      __pyx_v_c_node = ((struct __pyx_obj_4lxml_5etree_ElementChildIterator *)__pyx_v_self)->__pyx_base._next_element(__pyx_v_c_node);
    }
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "src/lxml/lxml.etree.pyx":2383
 *                        not _tagMatches(c_node, self._href, self._name)):
 *                 c_node = self._next_element(c_node)
 *         if c_node is not NULL:             # <<<<<<<<<<<<<<
 *             # store Python ref:
 *             self._node = _elementFactory(node._doc, c_node)
 */
  __pyx_t_4 = (__pyx_v_c_node != NULL);
  if (__pyx_t_4) {

    /* "src/lxml/lxml.etree.pyx":2385
 *         if c_node is not NULL:
 *             # store Python ref:
 *             self._node = _elementFactory(node._doc, c_node)             # <<<<<<<<<<<<<<
 * 
 * cdef class SiblingsIterator(_ElementIterator):
 */
    __pyx_t_2 = ((PyObject *)__pyx_v_node->_doc);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_8 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_2), __pyx_v_c_node)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GIVEREF(__pyx_t_8);
    __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree_ElementChildIterator *)__pyx_v_self)->__pyx_base._node);
    __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_ElementChildIterator *)__pyx_v_self)->__pyx_base._node));
    ((struct __pyx_obj_4lxml_5etree_ElementChildIterator *)__pyx_v_self)->__pyx_base._node = ((struct LxmlElement *)__pyx_t_8);
    __pyx_t_8 = 0;
    goto __pyx_L10;
  }
  __pyx_L10:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("lxml.etree.ElementChildIterator.__cinit__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2393
 *     You can pass the boolean keyword ``preceding`` to specify the direction.
 *     """
 *     def __cinit__(self, _Element node not None, tag=None, *, preceding=False):             # <<<<<<<<<<<<<<
 *         _assertValidNode(node)
 *         self._initTagMatch(tag)
 */

static int __pyx_pf_4lxml_5etree_16SiblingsIterator___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_16SiblingsIterator___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct LxmlElement *__pyx_v_node = 0;
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_preceding = 0;
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__node,&__pyx_n_s__tag,&__pyx_n_s__preceding,0};
  __Pyx_RefNannySetupContext("__cinit__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = __pyx_k_108;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__node);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tag);
        if (value) { values[1] = value; kw_args--; }
      }
    }
    while (kw_args > 0) {
      PyObject* value;
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__preceding);
      if (value) { values[2] = value; if (!(--kw_args)) break; }
      break;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2393; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_node = ((struct LxmlElement *)values[0]);
    __pyx_v_tag = values[1];
    __pyx_v_preceding = values[2];
  } else {
    __pyx_v_tag = ((PyObject *)Py_None);
    __pyx_v_preceding = __pyx_k_108;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_tag = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v_node = ((struct LxmlElement *)PyTuple_GET_ITEM(__pyx_args, 0));
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2393; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.SiblingsIterator.__cinit__");
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_node), __pyx_ptype_4lxml_5etree__Element, 0, "node", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2393; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":2394
 *     """
 *     def __cinit__(self, _Element node not None, tag=None, *, preceding=False):
 *         _assertValidNode(node)             # <<<<<<<<<<<<<<
 *         self._initTagMatch(tag)
 *         if preceding:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":2395
 *     def __cinit__(self, _Element node not None, tag=None, *, preceding=False):
 *         _assertValidNode(node)
 *         self._initTagMatch(tag)             # <<<<<<<<<<<<<<
 *         if preceding:
 *             self._next_element = _previousElement
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree_SiblingsIterator *)((struct __pyx_obj_4lxml_5etree_SiblingsIterator *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._initTagMatch(((struct LxmlElementTagMatcher *)__pyx_v_self), __pyx_v_tag); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/lxml.etree.pyx":2396
 *         _assertValidNode(node)
 *         self._initTagMatch(tag)
 *         if preceding:             # <<<<<<<<<<<<<<
 *             self._next_element = _previousElement
 *         else:
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_preceding); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_3) {

    /* "src/lxml/lxml.etree.pyx":2397
 *         self._initTagMatch(tag)
 *         if preceding:
 *             self._next_element = _previousElement             # <<<<<<<<<<<<<<
 *         else:
 *             self._next_element = _nextElement
 */
    ((struct __pyx_obj_4lxml_5etree_SiblingsIterator *)__pyx_v_self)->__pyx_base._next_element = __pyx_f_4lxml_5etree__previousElement;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "src/lxml/lxml.etree.pyx":2399
 *             self._next_element = _previousElement
 *         else:
 *             self._next_element = _nextElement             # <<<<<<<<<<<<<<
 *         self._storeNext(node)
 * 
 */
    ((struct __pyx_obj_4lxml_5etree_SiblingsIterator *)__pyx_v_self)->__pyx_base._next_element = __pyx_f_4lxml_5etree__nextElement;
  }
  __pyx_L6:;

  /* "src/lxml/lxml.etree.pyx":2400
 *         else:
 *             self._next_element = _nextElement
 *         self._storeNext(node)             # <<<<<<<<<<<<<<
 * 
 * cdef class AncestorsIterator(_ElementIterator):
 */
  ((struct __pyx_vtabstruct_4lxml_5etree_SiblingsIterator *)((struct __pyx_obj_4lxml_5etree_SiblingsIterator *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base._storeNext(((struct LxmlElementIterator *)__pyx_v_self), __pyx_v_node);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.SiblingsIterator.__cinit__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2406
 *     Iterates over the ancestors of an element (from parent to parent).
 *     """
 *     def __cinit__(self, _Element node not None, tag=None):             # <<<<<<<<<<<<<<
 *         _assertValidNode(node)
 *         self._initTagMatch(tag)
 */

static int __pyx_pf_4lxml_5etree_17AncestorsIterator___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_17AncestorsIterator___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct LxmlElement *__pyx_v_node = 0;
  PyObject *__pyx_v_tag = 0;
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__node,&__pyx_n_s__tag,0};
  __Pyx_RefNannySetupContext("__cinit__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__node);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tag);
        if (value) { values[1] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2406; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_node = ((struct LxmlElement *)values[0]);
    __pyx_v_tag = values[1];
  } else {
    __pyx_v_tag = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_tag = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v_node = ((struct LxmlElement *)PyTuple_GET_ITEM(__pyx_args, 0));
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2406; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.AncestorsIterator.__cinit__");
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_node), __pyx_ptype_4lxml_5etree__Element, 0, "node", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":2407
 *     """
 *     def __cinit__(self, _Element node not None, tag=None):
 *         _assertValidNode(node)             # <<<<<<<<<<<<<<
 *         self._initTagMatch(tag)
 *         self._next_element = _parentElement
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":2408
 *     def __cinit__(self, _Element node not None, tag=None):
 *         _assertValidNode(node)
 *         self._initTagMatch(tag)             # <<<<<<<<<<<<<<
 *         self._next_element = _parentElement
 *         self._storeNext(node)
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree_AncestorsIterator *)((struct __pyx_obj_4lxml_5etree_AncestorsIterator *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._initTagMatch(((struct LxmlElementTagMatcher *)__pyx_v_self), __pyx_v_tag); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/lxml.etree.pyx":2409
 *         _assertValidNode(node)
 *         self._initTagMatch(tag)
 *         self._next_element = _parentElement             # <<<<<<<<<<<<<<
 *         self._storeNext(node)
 * 
 */
  ((struct __pyx_obj_4lxml_5etree_AncestorsIterator *)__pyx_v_self)->__pyx_base._next_element = __pyx_f_4lxml_5etree__parentElement;

  /* "src/lxml/lxml.etree.pyx":2410
 *         self._initTagMatch(tag)
 *         self._next_element = _parentElement
 *         self._storeNext(node)             # <<<<<<<<<<<<<<
 * 
 * cdef class ElementDepthFirstIterator(_ElementTagMatcher):
 */
  ((struct __pyx_vtabstruct_4lxml_5etree_AncestorsIterator *)((struct __pyx_obj_4lxml_5etree_AncestorsIterator *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base._storeNext(((struct LxmlElementIterator *)__pyx_v_self), __pyx_v_node);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.AncestorsIterator.__cinit__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2436
 *     cdef _Element _next_node
 *     cdef _Element _top_node
 *     def __cinit__(self, _Element node not None, tag=None, *, inclusive=True):             # <<<<<<<<<<<<<<
 *         _assertValidNode(node)
 *         self._top_node  = node
 */

static int __pyx_pf_4lxml_5etree_25ElementDepthFirstIterator___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_25ElementDepthFirstIterator___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct LxmlElement *__pyx_v_node = 0;
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_inclusive = 0;
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__node,&__pyx_n_s__tag,&__pyx_n_s__inclusive,0};
  __Pyx_RefNannySetupContext("__cinit__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = __pyx_k_109;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__node);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tag);
        if (value) { values[1] = value; kw_args--; }
      }
    }
    while (kw_args > 0) {
      PyObject* value;
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__inclusive);
      if (value) { values[2] = value; if (!(--kw_args)) break; }
      break;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2436; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_node = ((struct LxmlElement *)values[0]);
    __pyx_v_tag = values[1];
    __pyx_v_inclusive = values[2];
  } else {
    __pyx_v_tag = ((PyObject *)Py_None);
    __pyx_v_inclusive = __pyx_k_109;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_tag = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v_node = ((struct LxmlElement *)PyTuple_GET_ITEM(__pyx_args, 0));
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2436; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.ElementDepthFirstIterator.__cinit__");
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_node), __pyx_ptype_4lxml_5etree__Element, 0, "node", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":2437
 *     cdef _Element _top_node
 *     def __cinit__(self, _Element node not None, tag=None, *, inclusive=True):
 *         _assertValidNode(node)             # <<<<<<<<<<<<<<
 *         self._top_node  = node
 *         self._next_node = node
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":2438
 *     def __cinit__(self, _Element node not None, tag=None, *, inclusive=True):
 *         _assertValidNode(node)
 *         self._top_node  = node             # <<<<<<<<<<<<<<
 *         self._next_node = node
 *         self._initTagMatch(tag)
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_node));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_node));
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *)__pyx_v_self)->_top_node);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *)__pyx_v_self)->_top_node));
  ((struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *)__pyx_v_self)->_top_node = __pyx_v_node;

  /* "src/lxml/lxml.etree.pyx":2439
 *         _assertValidNode(node)
 *         self._top_node  = node
 *         self._next_node = node             # <<<<<<<<<<<<<<
 *         self._initTagMatch(tag)
 *         if not inclusive or \
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_node));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_node));
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *)__pyx_v_self)->_next_node);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *)__pyx_v_self)->_next_node));
  ((struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *)__pyx_v_self)->_next_node = __pyx_v_node;

  /* "src/lxml/lxml.etree.pyx":2440
 *         self._top_node  = node
 *         self._next_node = node
 *         self._initTagMatch(tag)             # <<<<<<<<<<<<<<
 *         if not inclusive or \
 *                tag is not None and \
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree_ElementDepthFirstIterator *)((struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base._initTagMatch(((struct LxmlElementTagMatcher *)__pyx_v_self), __pyx_v_tag); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/lxml.etree.pyx":2441
 *         self._next_node = node
 *         self._initTagMatch(tag)
 *         if not inclusive or \             # <<<<<<<<<<<<<<
 *                tag is not None and \
 *                self._node_type != 0 and \
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_inclusive); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = (!__pyx_t_3);
  if (!__pyx_t_4) {

    /* "src/lxml/lxml.etree.pyx":2442
 *         self._initTagMatch(tag)
 *         if not inclusive or \
 *                tag is not None and \             # <<<<<<<<<<<<<<
 *                self._node_type != 0 and \
 *                (self._node_type != node._c_node.type or
 */
    __pyx_t_3 = (__pyx_v_tag != Py_None);
    if (__pyx_t_3) {

      /* "src/lxml/lxml.etree.pyx":2443
 *         if not inclusive or \
 *                tag is not None and \
 *                self._node_type != 0 and \             # <<<<<<<<<<<<<<
 *                (self._node_type != node._c_node.type or
 *                 not _tagMatches(node._c_node, self._href, self._name)):
 */
      __pyx_t_5 = (((struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *)__pyx_v_self)->__pyx_base._node_type != 0);
      if (__pyx_t_5) {

        /* "src/lxml/lxml.etree.pyx":2444
 *                tag is not None and \
 *                self._node_type != 0 and \
 *                (self._node_type != node._c_node.type or             # <<<<<<<<<<<<<<
 *                 not _tagMatches(node._c_node, self._href, self._name)):
 *             # this cannot raise StopIteration, self._next_node != None
 */
        __pyx_t_6 = (((struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *)__pyx_v_self)->__pyx_base._node_type != __pyx_v_node->_c_node->type);
        if (!__pyx_t_6) {

          /* "src/lxml/lxml.etree.pyx":2445
 *                self._node_type != 0 and \
 *                (self._node_type != node._c_node.type or
 *                 not _tagMatches(node._c_node, self._href, self._name)):             # <<<<<<<<<<<<<<
 *             # this cannot raise StopIteration, self._next_node != None
 *             self.__next__()
 */
          __pyx_t_7 = (!__pyx_f_4lxml_5etree__tagMatches(__pyx_v_node->_c_node, ((struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *)__pyx_v_self)->__pyx_base._href, ((struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *)__pyx_v_self)->__pyx_base._name));
          __pyx_t_8 = __pyx_t_7;
        } else {
          __pyx_t_8 = __pyx_t_6;
        }
        __pyx_t_6 = __pyx_t_8;
      } else {
        __pyx_t_6 = __pyx_t_5;
      }
      __pyx_t_5 = __pyx_t_6;
    } else {
      __pyx_t_5 = __pyx_t_3;
    }
    __pyx_t_3 = __pyx_t_5;
  } else {
    __pyx_t_3 = __pyx_t_4;
  }
  if (__pyx_t_3) {

    /* "src/lxml/lxml.etree.pyx":2447
 *                 not _tagMatches(node._c_node, self._href, self._name)):
 *             # this cannot raise StopIteration, self._next_node != None
 *             self.__next__()             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
    __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____next__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_9 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("lxml.etree.ElementDepthFirstIterator.__cinit__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2449
 *             self.__next__()
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_25ElementDepthFirstIterator_1__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_25ElementDepthFirstIterator_1__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("__iter__");

  /* "src/lxml/lxml.etree.pyx":2450
 * 
 *     def __iter__(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __next__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self);
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2452
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         cdef xmlNode* c_node
 *         cdef _Element current_node
 */

static PyObject *__pyx_pf_4lxml_5etree_25ElementDepthFirstIterator_2__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_25ElementDepthFirstIterator_2__next__(PyObject *__pyx_v_self) {
  xmlNode *__pyx_v_c_node;
  struct LxmlElement *__pyx_v_current_node;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__next__");
  __pyx_v_current_node = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);

  /* "src/lxml/lxml.etree.pyx":2455
 *         cdef xmlNode* c_node
 *         cdef _Element current_node
 *         if self._next_node is None:             # <<<<<<<<<<<<<<
 *             raise StopIteration
 *         current_node = self._next_node
 */
  __pyx_t_1 = (((PyObject *)((struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *)__pyx_v_self)->_next_node) == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/lxml.etree.pyx":2456
 *         cdef _Element current_node
 *         if self._next_node is None:
 *             raise StopIteration             # <<<<<<<<<<<<<<
 *         current_node = self._next_node
 *         c_node = self._next_node._c_node
 */
    __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "src/lxml/lxml.etree.pyx":2457
 *         if self._next_node is None:
 *             raise StopIteration
 *         current_node = self._next_node             # <<<<<<<<<<<<<<
 *         c_node = self._next_node._c_node
 *         if self._name is NULL and self._href is NULL:
 */
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *)__pyx_v_self)->_next_node));
  __Pyx_DECREF(((PyObject *)__pyx_v_current_node));
  __pyx_v_current_node = ((struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *)__pyx_v_self)->_next_node;

  /* "src/lxml/lxml.etree.pyx":2458
 *             raise StopIteration
 *         current_node = self._next_node
 *         c_node = self._next_node._c_node             # <<<<<<<<<<<<<<
 *         if self._name is NULL and self._href is NULL:
 *             c_node = self._nextNodeAnyTag(c_node)
 */
  __pyx_v_c_node = ((struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *)__pyx_v_self)->_next_node->_c_node;

  /* "src/lxml/lxml.etree.pyx":2459
 *         current_node = self._next_node
 *         c_node = self._next_node._c_node
 *         if self._name is NULL and self._href is NULL:             # <<<<<<<<<<<<<<
 *             c_node = self._nextNodeAnyTag(c_node)
 *         else:
 */
  __pyx_t_1 = (((struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *)__pyx_v_self)->__pyx_base._name == NULL);
  if (__pyx_t_1) {
    __pyx_t_2 = (((struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *)__pyx_v_self)->__pyx_base._href == NULL);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "src/lxml/lxml.etree.pyx":2460
 *         c_node = self._next_node._c_node
 *         if self._name is NULL and self._href is NULL:
 *             c_node = self._nextNodeAnyTag(c_node)             # <<<<<<<<<<<<<<
 *         else:
 *             c_node = self._nextNodeMatchTag(c_node)
 */
    __pyx_v_c_node = ((struct __pyx_vtabstruct_4lxml_5etree_ElementDepthFirstIterator *)((struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *)__pyx_v_self)->__pyx_base.__pyx_vtab)->_nextNodeAnyTag(((struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *)__pyx_v_self), __pyx_v_c_node);
    goto __pyx_L6;
  }
  /*else*/ {

    /* "src/lxml/lxml.etree.pyx":2462
 *             c_node = self._nextNodeAnyTag(c_node)
 *         else:
 *             c_node = self._nextNodeMatchTag(c_node)             # <<<<<<<<<<<<<<
 *         if c_node is NULL:
 *             self._next_node = None
 */
    __pyx_v_c_node = ((struct __pyx_vtabstruct_4lxml_5etree_ElementDepthFirstIterator *)((struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *)__pyx_v_self)->__pyx_base.__pyx_vtab)->_nextNodeMatchTag(((struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *)__pyx_v_self), __pyx_v_c_node);
  }
  __pyx_L6:;

  /* "src/lxml/lxml.etree.pyx":2463
 *         else:
 *             c_node = self._nextNodeMatchTag(c_node)
 *         if c_node is NULL:             # <<<<<<<<<<<<<<
 *             self._next_node = None
 *         else:
 */
  __pyx_t_3 = (__pyx_v_c_node == NULL);
  if (__pyx_t_3) {

    /* "src/lxml/lxml.etree.pyx":2464
 *             c_node = self._nextNodeMatchTag(c_node)
 *         if c_node is NULL:
 *             self._next_node = None             # <<<<<<<<<<<<<<
 *         else:
 *             self._next_node = _elementFactory(current_node._doc, c_node)
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *)__pyx_v_self)->_next_node);
    __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *)__pyx_v_self)->_next_node));
    ((struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *)__pyx_v_self)->_next_node = ((struct LxmlElement *)Py_None);
    goto __pyx_L7;
  }
  /*else*/ {

    /* "src/lxml/lxml.etree.pyx":2466
 *             self._next_node = None
 *         else:
 *             self._next_node = _elementFactory(current_node._doc, c_node)             # <<<<<<<<<<<<<<
 *         return current_node
 * 
 */
    __pyx_t_4 = ((PyObject *)__pyx_v_current_node->_doc);
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_5 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_4), __pyx_v_c_node)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GIVEREF(__pyx_t_5);
    __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *)__pyx_v_self)->_next_node);
    __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *)__pyx_v_self)->_next_node));
    ((struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *)__pyx_v_self)->_next_node = ((struct LxmlElement *)__pyx_t_5);
    __pyx_t_5 = 0;
  }
  __pyx_L7:;

  /* "src/lxml/lxml.etree.pyx":2467
 *         else:
 *             self._next_node = _elementFactory(current_node._doc, c_node)
 *         return current_node             # <<<<<<<<<<<<<<
 * 
 *     cdef xmlNode* _nextNodeAnyTag(self, xmlNode* c_node):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_current_node));
  __pyx_r = ((PyObject *)__pyx_v_current_node);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.ElementDepthFirstIterator.__next__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_current_node);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2469
 *         return current_node
 * 
 *     cdef xmlNode* _nextNodeAnyTag(self, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *         tree.BEGIN_FOR_EACH_ELEMENT_FROM(self._top_node._c_node, c_node, 0)
 *         if self._node_type == 0 or self._node_type == c_node.type:
 */

static  xmlNode *__pyx_f_4lxml_5etree_25ElementDepthFirstIterator__nextNodeAnyTag(struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *__pyx_v_self, xmlNode *__pyx_v_c_node) {
  xmlNode *__pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("_nextNodeAnyTag");

  /* "src/lxml/lxml.etree.pyx":2470
 * 
 *     cdef xmlNode* _nextNodeAnyTag(self, xmlNode* c_node):
 *         tree.BEGIN_FOR_EACH_ELEMENT_FROM(self._top_node._c_node, c_node, 0)             # <<<<<<<<<<<<<<
 *         if self._node_type == 0 or self._node_type == c_node.type:
 *             return c_node
 */
  BEGIN_FOR_EACH_ELEMENT_FROM(__pyx_v_self->_top_node->_c_node, __pyx_v_c_node, 0);

  /* "src/lxml/lxml.etree.pyx":2471
 *     cdef xmlNode* _nextNodeAnyTag(self, xmlNode* c_node):
 *         tree.BEGIN_FOR_EACH_ELEMENT_FROM(self._top_node._c_node, c_node, 0)
 *         if self._node_type == 0 or self._node_type == c_node.type:             # <<<<<<<<<<<<<<
 *             return c_node
 *         tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 */
  __pyx_t_1 = (__pyx_v_self->__pyx_base._node_type == 0);
  if (!__pyx_t_1) {
    __pyx_t_2 = (__pyx_v_self->__pyx_base._node_type == __pyx_v_c_node->type);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "src/lxml/lxml.etree.pyx":2472
 *         tree.BEGIN_FOR_EACH_ELEMENT_FROM(self._top_node._c_node, c_node, 0)
 *         if self._node_type == 0 or self._node_type == c_node.type:
 *             return c_node             # <<<<<<<<<<<<<<
 *         tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 *         return NULL
 */
    __pyx_r = __pyx_v_c_node;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "src/lxml/lxml.etree.pyx":2473
 *         if self._node_type == 0 or self._node_type == c_node.type:
 *             return c_node
 *         tree.END_FOR_EACH_ELEMENT_FROM(c_node)             # <<<<<<<<<<<<<<
 *         return NULL
 * 
 */
  END_FOR_EACH_ELEMENT_FROM(__pyx_v_c_node);

  /* "src/lxml/lxml.etree.pyx":2474
 *             return c_node
 *         tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 *         return NULL             # <<<<<<<<<<<<<<
 * 
 *     cdef xmlNode* _nextNodeMatchTag(self, xmlNode* c_node):
 */
  __pyx_r = NULL;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2476
 *         return NULL
 * 
 *     cdef xmlNode* _nextNodeMatchTag(self, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *         cdef char* c_name = NULL
 *         if self._name is not NULL:
 */

static  xmlNode *__pyx_f_4lxml_5etree_25ElementDepthFirstIterator__nextNodeMatchTag(struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *__pyx_v_self, xmlNode *__pyx_v_c_node) {
  char *__pyx_v_c_name;
  xmlNode *__pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("_nextNodeMatchTag");

  /* "src/lxml/lxml.etree.pyx":2477
 * 
 *     cdef xmlNode* _nextNodeMatchTag(self, xmlNode* c_node):
 *         cdef char* c_name = NULL             # <<<<<<<<<<<<<<
 *         if self._name is not NULL:
 *             c_name = tree.xmlDictExists(c_node.doc.dict, self._name, -1)
 */
  __pyx_v_c_name = NULL;

  /* "src/lxml/lxml.etree.pyx":2478
 *     cdef xmlNode* _nextNodeMatchTag(self, xmlNode* c_node):
 *         cdef char* c_name = NULL
 *         if self._name is not NULL:             # <<<<<<<<<<<<<<
 *             c_name = tree.xmlDictExists(c_node.doc.dict, self._name, -1)
 *             if c_name is NULL:
 */
  __pyx_t_1 = (__pyx_v_self->__pyx_base._name != NULL);
  if (__pyx_t_1) {

    /* "src/lxml/lxml.etree.pyx":2479
 *         cdef char* c_name = NULL
 *         if self._name is not NULL:
 *             c_name = tree.xmlDictExists(c_node.doc.dict, self._name, -1)             # <<<<<<<<<<<<<<
 *             if c_name is NULL:
 *                 # not found in dict => not in document at all
 */
    __pyx_v_c_name = xmlDictExists(__pyx_v_c_node->doc->dict, __pyx_v_self->__pyx_base._name, -1);

    /* "src/lxml/lxml.etree.pyx":2480
 *         if self._name is not NULL:
 *             c_name = tree.xmlDictExists(c_node.doc.dict, self._name, -1)
 *             if c_name is NULL:             # <<<<<<<<<<<<<<
 *                 # not found in dict => not in document at all
 *                 return NULL
 */
    __pyx_t_1 = (__pyx_v_c_name == NULL);
    if (__pyx_t_1) {

      /* "src/lxml/lxml.etree.pyx":2482
 *             if c_name is NULL:
 *                 # not found in dict => not in document at all
 *                 return NULL             # <<<<<<<<<<<<<<
 *         tree.BEGIN_FOR_EACH_ELEMENT_FROM(self._top_node._c_node, c_node, 0)
 *         if c_node.type == tree.XML_ELEMENT_NODE:
 */
      __pyx_r = NULL;
      goto __pyx_L0;
      goto __pyx_L4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "src/lxml/lxml.etree.pyx":2483
 *                 # not found in dict => not in document at all
 *                 return NULL
 *         tree.BEGIN_FOR_EACH_ELEMENT_FROM(self._top_node._c_node, c_node, 0)             # <<<<<<<<<<<<<<
 *         if c_node.type == tree.XML_ELEMENT_NODE:
 *             if (c_name is NULL or c_name is c_node.name) and \
 */
  BEGIN_FOR_EACH_ELEMENT_FROM(__pyx_v_self->_top_node->_c_node, __pyx_v_c_node, 0);

  /* "src/lxml/lxml.etree.pyx":2484
 *                 return NULL
 *         tree.BEGIN_FOR_EACH_ELEMENT_FROM(self._top_node._c_node, c_node, 0)
 *         if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *             if (c_name is NULL or c_name is c_node.name) and \
 *                     _tagMatches(c_node, self._href, self._name):
 */
  __pyx_t_1 = (__pyx_v_c_node->type == XML_ELEMENT_NODE);
  if (__pyx_t_1) {

    /* "src/lxml/lxml.etree.pyx":2485
 *         tree.BEGIN_FOR_EACH_ELEMENT_FROM(self._top_node._c_node, c_node, 0)
 *         if c_node.type == tree.XML_ELEMENT_NODE:
 *             if (c_name is NULL or c_name is c_node.name) and \             # <<<<<<<<<<<<<<
 *                     _tagMatches(c_node, self._href, self._name):
 *                 return c_node
 */
    __pyx_t_1 = (__pyx_v_c_name == NULL);
    if (!__pyx_t_1) {
      __pyx_t_2 = (__pyx_v_c_name == __pyx_v_c_node->name);
      __pyx_t_3 = __pyx_t_2;
    } else {
      __pyx_t_3 = __pyx_t_1;
    }
    if (__pyx_t_3) {

      /* "src/lxml/lxml.etree.pyx":2486
 *         if c_node.type == tree.XML_ELEMENT_NODE:
 *             if (c_name is NULL or c_name is c_node.name) and \
 *                     _tagMatches(c_node, self._href, self._name):             # <<<<<<<<<<<<<<
 *                 return c_node
 *         tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 */
      __pyx_t_1 = __pyx_f_4lxml_5etree__tagMatches(__pyx_v_c_node, __pyx_v_self->__pyx_base._href, __pyx_v_self->__pyx_base._name);
      __pyx_t_2 = __pyx_t_1;
    } else {
      __pyx_t_2 = __pyx_t_3;
    }
    if (__pyx_t_2) {

      /* "src/lxml/lxml.etree.pyx":2487
 *             if (c_name is NULL or c_name is c_node.name) and \
 *                     _tagMatches(c_node, self._href, self._name):
 *                 return c_node             # <<<<<<<<<<<<<<
 *         tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 *         return NULL
 */
      __pyx_r = __pyx_v_c_node;
      goto __pyx_L0;
      goto __pyx_L6;
    }
    __pyx_L6:;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "src/lxml/lxml.etree.pyx":2488
 *                     _tagMatches(c_node, self._href, self._name):
 *                 return c_node
 *         tree.END_FOR_EACH_ELEMENT_FROM(c_node)             # <<<<<<<<<<<<<<
 *         return NULL
 * 
 */
  END_FOR_EACH_ELEMENT_FROM(__pyx_v_c_node);

  /* "src/lxml/lxml.etree.pyx":2489
 *                 return c_node
 *         tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 *         return NULL             # <<<<<<<<<<<<<<
 * 
 * cdef class ElementTextIterator:
 */
  __pyx_r = NULL;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2503
 *     cdef object _nextEvent
 *     cdef _Element _start_element
 *     def __cinit__(self, _Element element not None, tag=None, *, with_tail=True):             # <<<<<<<<<<<<<<
 *         _assertValidNode(element)
 *         if with_tail:
 */

static int __pyx_pf_4lxml_5etree_19ElementTextIterator___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_19ElementTextIterator___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct LxmlElement *__pyx_v_element = 0;
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_with_tail = 0;
  PyObject *__pyx_v_events;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__element,&__pyx_n_s__tag,&__pyx_n_s__with_tail,0};
  __Pyx_RefNannySetupContext("__cinit__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = __pyx_k_110;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__element);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tag);
        if (value) { values[1] = value; kw_args--; }
      }
    }
    while (kw_args > 0) {
      PyObject* value;
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__with_tail);
      if (value) { values[2] = value; if (!(--kw_args)) break; }
      break;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2503; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_element = ((struct LxmlElement *)values[0]);
    __pyx_v_tag = values[1];
    __pyx_v_with_tail = values[2];
  } else {
    __pyx_v_tag = ((PyObject *)Py_None);
    __pyx_v_with_tail = __pyx_k_110;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_tag = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v_element = ((struct LxmlElement *)PyTuple_GET_ITEM(__pyx_args, 0));
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2503; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.ElementTextIterator.__cinit__");
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_events = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_element), __pyx_ptype_4lxml_5etree__Element, 0, "element", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":2504
 *     cdef _Element _start_element
 *     def __cinit__(self, _Element element not None, tag=None, *, with_tail=True):
 *         _assertValidNode(element)             # <<<<<<<<<<<<<<
 *         if with_tail:
 *             events = (u"start", u"end")
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":2505
 *     def __cinit__(self, _Element element not None, tag=None, *, with_tail=True):
 *         _assertValidNode(element)
 *         if with_tail:             # <<<<<<<<<<<<<<
 *             events = (u"start", u"end")
 *         else:
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_with_tail); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_2) {

    /* "src/lxml/lxml.etree.pyx":2506
 *         _assertValidNode(element)
 *         if with_tail:
 *             events = (u"start", u"end")             # <<<<<<<<<<<<<<
 *         else:
 *             events = (u"start",)
 */
    __Pyx_INCREF(((PyObject *)__pyx_k_tuple_111));
    __Pyx_DECREF(((PyObject *)__pyx_v_events));
    __pyx_v_events = __pyx_k_tuple_111;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "src/lxml/lxml.etree.pyx":2508
 *             events = (u"start", u"end")
 *         else:
 *             events = (u"start",)             # <<<<<<<<<<<<<<
 *         self._start_element = element
 *         self._nextEvent = iterwalk(element, events=events, tag=tag).__next__
 */
    __Pyx_INCREF(((PyObject *)__pyx_k_tuple_112));
    __Pyx_DECREF(((PyObject *)__pyx_v_events));
    __pyx_v_events = __pyx_k_tuple_112;
  }
  __pyx_L6:;

  /* "src/lxml/lxml.etree.pyx":2509
 *         else:
 *             events = (u"start",)
 *         self._start_element = element             # <<<<<<<<<<<<<<
 *         self._nextEvent = iterwalk(element, events=events, tag=tag).__next__
 * 
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_element));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_element));
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree_ElementTextIterator *)__pyx_v_self)->_start_element);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_ElementTextIterator *)__pyx_v_self)->_start_element));
  ((struct __pyx_obj_4lxml_5etree_ElementTextIterator *)__pyx_v_self)->_start_element = __pyx_v_element;

  /* "src/lxml/lxml.etree.pyx":2510
 *             events = (u"start",)
 *         self._start_element = element
 *         self._nextEvent = iterwalk(element, events=events, tag=tag).__next__             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(((PyObject *)__pyx_v_element));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_element));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_element));
  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__events), ((PyObject *)__pyx_v_events)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__tag), __pyx_v_tag) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_iterwalk)), ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s____next__); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree_ElementTextIterator *)__pyx_v_self)->_nextEvent);
  __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree_ElementTextIterator *)__pyx_v_self)->_nextEvent);
  ((struct __pyx_obj_4lxml_5etree_ElementTextIterator *)__pyx_v_self)->_nextEvent = __pyx_t_4;
  __pyx_t_4 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.ElementTextIterator.__cinit__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_events);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2512
 *         self._nextEvent = iterwalk(element, events=events, tag=tag).__next__
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_19ElementTextIterator_1__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_19ElementTextIterator_1__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("__iter__");

  /* "src/lxml/lxml.etree.pyx":2513
 * 
 *     def __iter__(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __next__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self);
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2515
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         cdef _Element element
 *         while result is None:
 */

static PyObject *__pyx_pf_4lxml_5etree_19ElementTextIterator_2__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_19ElementTextIterator_2__next__(PyObject *__pyx_v_self) {
  struct LxmlElement *__pyx_v_element;
  PyObject *__pyx_v_event;
  PyObject *__pyx_v_result;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__next__");
  __pyx_v_element = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_event = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_result = Py_None; __Pyx_INCREF(Py_None);

  /* "src/lxml/lxml.etree.pyx":2517
 *     def __next__(self):
 *         cdef _Element element
 *         while result is None:             # <<<<<<<<<<<<<<
 *             event, element = self._nextEvent() # raises StopIteration
 *             if event == u"start":
 */
  while (1) {
    __pyx_t_1 = (__pyx_v_result == Py_None);
    if (!__pyx_t_1) break;

    /* "src/lxml/lxml.etree.pyx":2518
 *         cdef _Element element
 *         while result is None:
 *             event, element = self._nextEvent() # raises StopIteration             # <<<<<<<<<<<<<<
 *             if event == u"start":
 *                 result = element.text
 */
    __pyx_t_2 = PyObject_Call(((struct __pyx_obj_4lxml_5etree_ElementTextIterator *)__pyx_v_self)->_nextEvent, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    if (PyTuple_CheckExact(__pyx_t_2) && likely(PyTuple_GET_SIZE(__pyx_t_2) == 2)) {
      PyObject* tuple = __pyx_t_2;
      __pyx_t_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_3);
      __pyx_t_4 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_4);
      if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_v_event);
      __pyx_v_event = __pyx_t_3;
      __pyx_t_3 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_v_element));
      __pyx_v_element = ((struct LxmlElement *)__pyx_t_4);
      __pyx_t_4 = 0;
    } else {
      __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_5, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_UnpackItem(__pyx_t_5, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (__Pyx_EndUnpack(__pyx_t_5, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_v_event);
      __pyx_v_event = __pyx_t_3;
      __pyx_t_3 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_v_element));
      __pyx_v_element = ((struct LxmlElement *)__pyx_t_4);
      __pyx_t_4 = 0;
    }

    /* "src/lxml/lxml.etree.pyx":2519
 *         while result is None:
 *             event, element = self._nextEvent() # raises StopIteration
 *             if event == u"start":             # <<<<<<<<<<<<<<
 *                 result = element.text
 *             elif element is not self._start_element:
 */
    __pyx_t_1 = __Pyx_PyUnicode_Equals(__pyx_v_event, ((PyObject *)__pyx_n_u__start), Py_EQ); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_1) {

      /* "src/lxml/lxml.etree.pyx":2520
 *             event, element = self._nextEvent() # raises StopIteration
 *             if event == u"start":
 *                 result = element.text             # <<<<<<<<<<<<<<
 *             elif element is not self._start_element:
 *                 result = element.tail
 */
      __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_element), __pyx_n_s__text); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2520; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_v_result);
      __pyx_v_result = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L7;
    }

    /* "src/lxml/lxml.etree.pyx":2521
 *             if event == u"start":
 *                 result = element.text
 *             elif element is not self._start_element:             # <<<<<<<<<<<<<<
 *                 result = element.tail
 *         return result
 */
    __pyx_t_1 = (__pyx_v_element != ((struct __pyx_obj_4lxml_5etree_ElementTextIterator *)__pyx_v_self)->_start_element);
    if (__pyx_t_1) {

      /* "src/lxml/lxml.etree.pyx":2522
 *                 result = element.text
 *             elif element is not self._start_element:
 *                 result = element.tail             # <<<<<<<<<<<<<<
 *         return result
 * 
 */
      __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_element), __pyx_n_s__tail); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_v_result);
      __pyx_v_result = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L7;
    }
    __pyx_L7:;
  }

  /* "src/lxml/lxml.etree.pyx":2523
 *             elif element is not self._start_element:
 *                 result = element.tail
 *         return result             # <<<<<<<<<<<<<<
 * 
 * cdef xmlNode* _createElement(xmlDoc* c_doc, object name_utf) except NULL:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.ElementTextIterator.__next__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_element);
  __Pyx_DECREF(__pyx_v_event);
  __Pyx_DECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2525
 *         return result
 * 
 * cdef xmlNode* _createElement(xmlDoc* c_doc, object name_utf) except NULL:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     c_node = tree.xmlNewDocNode(c_doc, NULL, _cstr(name_utf), NULL)
 */

static  xmlNode *__pyx_f_4lxml_5etree__createElement(xmlDoc *__pyx_v_c_doc, PyObject *__pyx_v_name_utf) {
  xmlNode *__pyx_v_c_node;
  xmlNode *__pyx_r;
  __Pyx_RefNannySetupContext("_createElement");

  /* "src/lxml/lxml.etree.pyx":2527
 * cdef xmlNode* _createElement(xmlDoc* c_doc, object name_utf) except NULL:
 *     cdef xmlNode* c_node
 *     c_node = tree.xmlNewDocNode(c_doc, NULL, _cstr(name_utf), NULL)             # <<<<<<<<<<<<<<
 *     return c_node
 * 
 */
  __pyx_v_c_node = xmlNewDocNode(__pyx_v_c_doc, NULL, PyBytes_AS_STRING(__pyx_v_name_utf), NULL);

  /* "src/lxml/lxml.etree.pyx":2528
 *     cdef xmlNode* c_node
 *     c_node = tree.xmlNewDocNode(c_doc, NULL, _cstr(name_utf), NULL)
 *     return c_node             # <<<<<<<<<<<<<<
 * 
 * cdef xmlNode* _createComment(xmlDoc* c_doc, char* text):
 */
  __pyx_r = __pyx_v_c_node;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2530
 *     return c_node
 * 
 * cdef xmlNode* _createComment(xmlDoc* c_doc, char* text):             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     c_node = tree.xmlNewDocComment(c_doc, text)
 */

static  xmlNode *__pyx_f_4lxml_5etree__createComment(xmlDoc *__pyx_v_c_doc, char *__pyx_v_text) {
  xmlNode *__pyx_v_c_node;
  xmlNode *__pyx_r;
  __Pyx_RefNannySetupContext("_createComment");

  /* "src/lxml/lxml.etree.pyx":2532
 * cdef xmlNode* _createComment(xmlDoc* c_doc, char* text):
 *     cdef xmlNode* c_node
 *     c_node = tree.xmlNewDocComment(c_doc, text)             # <<<<<<<<<<<<<<
 *     return c_node
 * 
 */
  __pyx_v_c_node = xmlNewDocComment(__pyx_v_c_doc, __pyx_v_text);

  /* "src/lxml/lxml.etree.pyx":2533
 *     cdef xmlNode* c_node
 *     c_node = tree.xmlNewDocComment(c_doc, text)
 *     return c_node             # <<<<<<<<<<<<<<
 * 
 * cdef xmlNode* _createPI(xmlDoc* c_doc, char* target, char* text):
 */
  __pyx_r = __pyx_v_c_node;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2535
 *     return c_node
 * 
 * cdef xmlNode* _createPI(xmlDoc* c_doc, char* target, char* text):             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     c_node = tree.xmlNewDocPI(c_doc, target, text)
 */

static  xmlNode *__pyx_f_4lxml_5etree__createPI(xmlDoc *__pyx_v_c_doc, char *__pyx_v_target, char *__pyx_v_text) {
  xmlNode *__pyx_v_c_node;
  xmlNode *__pyx_r;
  __Pyx_RefNannySetupContext("_createPI");

  /* "src/lxml/lxml.etree.pyx":2537
 * cdef xmlNode* _createPI(xmlDoc* c_doc, char* target, char* text):
 *     cdef xmlNode* c_node
 *     c_node = tree.xmlNewDocPI(c_doc, target, text)             # <<<<<<<<<<<<<<
 *     return c_node
 * 
 */
  __pyx_v_c_node = xmlNewDocPI(__pyx_v_c_doc, __pyx_v_target, __pyx_v_text);

  /* "src/lxml/lxml.etree.pyx":2538
 *     cdef xmlNode* c_node
 *     c_node = tree.xmlNewDocPI(c_doc, target, text)
 *     return c_node             # <<<<<<<<<<<<<<
 * 
 * cdef xmlNode* _createEntity(xmlDoc* c_doc, char* name):
 */
  __pyx_r = __pyx_v_c_node;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2540
 *     return c_node
 * 
 * cdef xmlNode* _createEntity(xmlDoc* c_doc, char* name):             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     c_node = tree.xmlNewReference(c_doc, name)
 */

static  xmlNode *__pyx_f_4lxml_5etree__createEntity(xmlDoc *__pyx_v_c_doc, char *__pyx_v_name) {
  xmlNode *__pyx_v_c_node;
  xmlNode *__pyx_r;
  __Pyx_RefNannySetupContext("_createEntity");

  /* "src/lxml/lxml.etree.pyx":2542
 * cdef xmlNode* _createEntity(xmlDoc* c_doc, char* name):
 *     cdef xmlNode* c_node
 *     c_node = tree.xmlNewReference(c_doc, name)             # <<<<<<<<<<<<<<
 *     return c_node
 * 
 */
  __pyx_v_c_node = xmlNewReference(__pyx_v_c_doc, __pyx_v_name);

  /* "src/lxml/lxml.etree.pyx":2543
 *     cdef xmlNode* c_node
 *     c_node = tree.xmlNewReference(c_doc, name)
 *     return c_node             # <<<<<<<<<<<<<<
 * 
 * # module-level API for ElementTree
 */
  __pyx_r = __pyx_v_c_node;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2547
 * # module-level API for ElementTree
 * 
 * def Element(_tag, attrib=None, nsmap=None, **_extra):             # <<<<<<<<<<<<<<
 *     u"""Element(_tag, attrib=None, nsmap=None, **_extra)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_3Element(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_3Element[] = "Element(_tag, attrib=None, nsmap=None, **_extra)\n\n    Element factory.  This function returns an object implementing the\n    Element interface.\n\n    Also look at the `_Element.makeelement()` and\n    `_BaseParser.makeelement()` methods, which provide a faster way to\n    create an Element within a specific document or parser context.\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_3Element = {__Pyx_NAMESTR("Element"), (PyCFunction)__pyx_pf_4lxml_5etree_3Element, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_3Element)};
static PyObject *__pyx_pf_4lxml_5etree_3Element(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v__tag = 0;
  PyObject *__pyx_v_attrib = 0;
  PyObject *__pyx_v_nsmap = 0;
  PyObject *__pyx_v__extra = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s___tag,&__pyx_n_s__attrib,&__pyx_n_s__nsmap,0};
  __Pyx_RefNannySetupContext("Element");
  __pyx_self = __pyx_self;
  __pyx_v__extra = PyDict_New(); if (unlikely(!__pyx_v__extra)) return NULL;
  __Pyx_GOTREF(__pyx_v__extra);
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s___tag);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__attrib);
        if (value) { values[1] = value; kw_args--; }
      }
      case  2:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nsmap);
        if (value) { values[2] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v__extra, values, PyTuple_GET_SIZE(__pyx_args), "Element") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2547; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v__tag = values[0];
    __pyx_v_attrib = values[1];
    __pyx_v_nsmap = values[2];
  } else {
    __pyx_v_attrib = ((PyObject *)Py_None);
    __pyx_v_nsmap = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: __pyx_v_nsmap = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: __pyx_v_attrib = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v__tag = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("Element", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2547; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v__extra);
  __Pyx_AddTraceback("lxml.etree.Element");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "src/lxml/lxml.etree.pyx":2557
 *     create an Element within a specific document or parser context.
 *     """
 *     return _makeElement(_tag, NULL, None, None, None, None,             # <<<<<<<<<<<<<<
 *                         attrib, nsmap, _extra)
 * 
 */
  __Pyx_XDECREF(__pyx_r);

  /* "src/lxml/lxml.etree.pyx":2558
 *     """
 *     return _makeElement(_tag, NULL, None, None, None, None,
 *                         attrib, nsmap, _extra)             # <<<<<<<<<<<<<<
 * 
 * def Comment(text=None):
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__makeElement(__pyx_v__tag, NULL, ((struct LxmlDocument *)Py_None), ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None), Py_None, Py_None, __pyx_v_attrib, __pyx_v_nsmap, ((PyObject *)__pyx_v__extra))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.Element");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v__extra);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2560
 *                         attrib, nsmap, _extra)
 * 
 * def Comment(text=None):             # <<<<<<<<<<<<<<
 *     u"""Comment(text=None)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_4Comment(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_4Comment[] = "Comment(text=None)\n\n    Comment element factory. This factory function creates a special element that will\n    be serialized as an XML comment.\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_4Comment = {__Pyx_NAMESTR("Comment"), (PyCFunction)__pyx_pf_4lxml_5etree_4Comment, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_4Comment)};
static PyObject *__pyx_pf_4lxml_5etree_4Comment(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_text = 0;
  struct LxmlDocument *__pyx_v_doc;
  xmlNode *__pyx_v_c_node;
  xmlDoc *__pyx_v_c_doc;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  xmlDoc *__pyx_t_3;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__text,0};
  __Pyx_RefNannySetupContext("Comment");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[1] = {0};
    values[0] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__text);
        if (value) { values[0] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "Comment") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2560; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_text = values[0];
  } else {
    __pyx_v_text = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: __pyx_v_text = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("Comment", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2560; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.Comment");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF(__pyx_v_text);
  __pyx_v_doc = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None);

  /* "src/lxml/lxml.etree.pyx":2569
 *     cdef xmlNode*  c_node
 *     cdef xmlDoc*   c_doc
 *     if text is None:             # <<<<<<<<<<<<<<
 *         text = b''
 *     else:
 */
  __pyx_t_1 = (__pyx_v_text == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/lxml.etree.pyx":2570
 *     cdef xmlDoc*   c_doc
 *     if text is None:
 *         text = b''             # <<<<<<<<<<<<<<
 *     else:
 *         text = _utf8(text)
 */
    __Pyx_INCREF(((PyObject *)__pyx_kp_b_25));
    __Pyx_DECREF(__pyx_v_text);
    __pyx_v_text = ((PyObject *)__pyx_kp_b_25);
    goto __pyx_L6;
  }
  /*else*/ {

    /* "src/lxml/lxml.etree.pyx":2572
 *         text = b''
 *     else:
 *         text = _utf8(text)             # <<<<<<<<<<<<<<
 *     c_doc = _newXMLDoc()
 *     doc = _documentFactory(c_doc, None)
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_v_text)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2572; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_v_text);
    __pyx_v_text = __pyx_t_2;
    __pyx_t_2 = 0;
  }
  __pyx_L6:;

  /* "src/lxml/lxml.etree.pyx":2573
 *     else:
 *         text = _utf8(text)
 *     c_doc = _newXMLDoc()             # <<<<<<<<<<<<<<
 *     doc = _documentFactory(c_doc, None)
 *     c_node = _createComment(c_doc, _cstr(text))
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree__newXMLDoc(); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_doc = __pyx_t_3;

  /* "src/lxml/lxml.etree.pyx":2574
 *         text = _utf8(text)
 *     c_doc = _newXMLDoc()
 *     doc = _documentFactory(c_doc, None)             # <<<<<<<<<<<<<<
 *     c_node = _createComment(c_doc, _cstr(text))
 *     tree.xmlAddChild(<xmlNode*>c_doc, c_node)
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_v_doc));
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "src/lxml/lxml.etree.pyx":2575
 *     c_doc = _newXMLDoc()
 *     doc = _documentFactory(c_doc, None)
 *     c_node = _createComment(c_doc, _cstr(text))             # <<<<<<<<<<<<<<
 *     tree.xmlAddChild(<xmlNode*>c_doc, c_node)
 *     return _elementFactory(doc, c_node)
 */
  __pyx_v_c_node = __pyx_f_4lxml_5etree__createComment(__pyx_v_c_doc, PyBytes_AS_STRING(__pyx_v_text));

  /* "src/lxml/lxml.etree.pyx":2576
 *     doc = _documentFactory(c_doc, None)
 *     c_node = _createComment(c_doc, _cstr(text))
 *     tree.xmlAddChild(<xmlNode*>c_doc, c_node)             # <<<<<<<<<<<<<<
 *     return _elementFactory(doc, c_node)
 * 
 */
  xmlAddChild(((xmlNode *)__pyx_v_c_doc), __pyx_v_c_node);

  /* "src/lxml/lxml.etree.pyx":2577
 *     c_node = _createComment(c_doc, _cstr(text))
 *     tree.xmlAddChild(<xmlNode*>c_doc, c_node)
 *     return _elementFactory(doc, c_node)             # <<<<<<<<<<<<<<
 * 
 * def ProcessingInstruction(target, text=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(__pyx_v_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.Comment");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_doc);
  __Pyx_DECREF(__pyx_v_text);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2579
 *     return _elementFactory(doc, c_node)
 * 
 * def ProcessingInstruction(target, text=None):             # <<<<<<<<<<<<<<
 *     u"""ProcessingInstruction(target, text=None)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_5ProcessingInstruction(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_5ProcessingInstruction[] = "ProcessingInstruction(target, text=None)\n\n    ProcessingInstruction element factory. This factory function creates a\n    special element that will be serialized as an XML processing instruction.\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_5ProcessingInstruction = {__Pyx_NAMESTR("ProcessingInstruction"), (PyCFunction)__pyx_pf_4lxml_5etree_5ProcessingInstruction, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_5ProcessingInstruction)};
static PyObject *__pyx_pf_4lxml_5etree_5ProcessingInstruction(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_target = 0;
  PyObject *__pyx_v_text = 0;
  struct LxmlDocument *__pyx_v_doc;
  xmlNode *__pyx_v_c_node;
  xmlDoc *__pyx_v_c_doc;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  xmlDoc *__pyx_t_3;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__target,&__pyx_n_s__text,0};
  __Pyx_RefNannySetupContext("ProcessingInstruction");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__target);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__text);
        if (value) { values[1] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "ProcessingInstruction") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2579; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_target = values[0];
    __pyx_v_text = values[1];
  } else {
    __pyx_v_text = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_text = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v_target = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ProcessingInstruction", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2579; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.ProcessingInstruction");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF(__pyx_v_target);
  __Pyx_INCREF(__pyx_v_text);
  __pyx_v_doc = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None);

  /* "src/lxml/lxml.etree.pyx":2588
 *     cdef xmlNode*  c_node
 *     cdef xmlDoc*   c_doc
 *     target = _utf8(target)             # <<<<<<<<<<<<<<
 *     if text is None:
 *         text = b''
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_v_target)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_v_target);
  __pyx_v_target = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "src/lxml/lxml.etree.pyx":2589
 *     cdef xmlDoc*   c_doc
 *     target = _utf8(target)
 *     if text is None:             # <<<<<<<<<<<<<<
 *         text = b''
 *     else:
 */
  __pyx_t_2 = (__pyx_v_text == Py_None);
  if (__pyx_t_2) {

    /* "src/lxml/lxml.etree.pyx":2590
 *     target = _utf8(target)
 *     if text is None:
 *         text = b''             # <<<<<<<<<<<<<<
 *     else:
 *         text = _utf8(text)
 */
    __Pyx_INCREF(((PyObject *)__pyx_kp_b_25));
    __Pyx_DECREF(__pyx_v_text);
    __pyx_v_text = ((PyObject *)__pyx_kp_b_25);
    goto __pyx_L6;
  }
  /*else*/ {

    /* "src/lxml/lxml.etree.pyx":2592
 *         text = b''
 *     else:
 *         text = _utf8(text)             # <<<<<<<<<<<<<<
 *     c_doc = _newXMLDoc()
 *     doc = _documentFactory(c_doc, None)
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_v_text)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_v_text);
    __pyx_v_text = __pyx_t_1;
    __pyx_t_1 = 0;
  }
  __pyx_L6:;

  /* "src/lxml/lxml.etree.pyx":2593
 *     else:
 *         text = _utf8(text)
 *     c_doc = _newXMLDoc()             # <<<<<<<<<<<<<<
 *     doc = _documentFactory(c_doc, None)
 *     c_node = _createPI(c_doc, _cstr(target), _cstr(text))
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree__newXMLDoc(); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_doc = __pyx_t_3;

  /* "src/lxml/lxml.etree.pyx":2594
 *         text = _utf8(text)
 *     c_doc = _newXMLDoc()
 *     doc = _documentFactory(c_doc, None)             # <<<<<<<<<<<<<<
 *     c_node = _createPI(c_doc, _cstr(target), _cstr(text))
 *     tree.xmlAddChild(<xmlNode*>c_doc, c_node)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_doc));
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/lxml.etree.pyx":2595
 *     c_doc = _newXMLDoc()
 *     doc = _documentFactory(c_doc, None)
 *     c_node = _createPI(c_doc, _cstr(target), _cstr(text))             # <<<<<<<<<<<<<<
 *     tree.xmlAddChild(<xmlNode*>c_doc, c_node)
 *     return _elementFactory(doc, c_node)
 */
  __pyx_v_c_node = __pyx_f_4lxml_5etree__createPI(__pyx_v_c_doc, PyBytes_AS_STRING(__pyx_v_target), PyBytes_AS_STRING(__pyx_v_text));

  /* "src/lxml/lxml.etree.pyx":2596
 *     doc = _documentFactory(c_doc, None)
 *     c_node = _createPI(c_doc, _cstr(target), _cstr(text))
 *     tree.xmlAddChild(<xmlNode*>c_doc, c_node)             # <<<<<<<<<<<<<<
 *     return _elementFactory(doc, c_node)
 * 
 */
  xmlAddChild(((xmlNode *)__pyx_v_c_doc), __pyx_v_c_node);

  /* "src/lxml/lxml.etree.pyx":2597
 *     c_node = _createPI(c_doc, _cstr(target), _cstr(text))
 *     tree.xmlAddChild(<xmlNode*>c_doc, c_node)
 *     return _elementFactory(doc, c_node)             # <<<<<<<<<<<<<<
 * 
 * PI = ProcessingInstruction
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(__pyx_v_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.ProcessingInstruction");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_doc);
  __Pyx_DECREF(__pyx_v_target);
  __Pyx_DECREF(__pyx_v_text);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2612
 *     """
 *     cdef object _utf8_data
 *     def __init__(self, data):             # <<<<<<<<<<<<<<
 *         self._utf8_data = _utf8(data)
 * 
 */

static int __pyx_pf_4lxml_5etree_5CDATA___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_5CDATA___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_data = 0;
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__data,0};
  __Pyx_RefNannySetupContext("__init__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[1] = {0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__data);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2612; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_data = values[0];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_data = PyTuple_GET_ITEM(__pyx_args, 0);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2612; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.CDATA.__init__");
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;

  /* "src/lxml/lxml.etree.pyx":2613
 *     cdef object _utf8_data
 *     def __init__(self, data):
 *         self._utf8_data = _utf8(data)             # <<<<<<<<<<<<<<
 * 
 * def Entity(name):
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_v_data)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree_CDATA *)__pyx_v_self)->_utf8_data);
  __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree_CDATA *)__pyx_v_self)->_utf8_data);
  ((struct __pyx_obj_4lxml_5etree_CDATA *)__pyx_v_self)->_utf8_data = __pyx_t_1;
  __pyx_t_1 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.CDATA.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2615
 *         self._utf8_data = _utf8(data)
 * 
 * def Entity(name):             # <<<<<<<<<<<<<<
 *     u"""Entity(name)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_6Entity(PyObject *__pyx_self, PyObject *__pyx_v_name); /*proto*/
static char __pyx_doc_4lxml_5etree_6Entity[] = "Entity(name)\n\n    Entity factory.  This factory function creates a special element\n    that will be serialized as an XML entity reference or character\n    reference.  Note, however, that entities will not be automatically\n    declared in the document.  A document that uses entity references\n    requires a DTD to define the entities.\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_6Entity = {__Pyx_NAMESTR("Entity"), (PyCFunction)__pyx_pf_4lxml_5etree_6Entity, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_6Entity)};
static PyObject *__pyx_pf_4lxml_5etree_6Entity(PyObject *__pyx_self, PyObject *__pyx_v_name) {
  struct LxmlDocument *__pyx_v_doc;
  xmlNode *__pyx_v_c_node;
  xmlDoc *__pyx_v_c_doc;
  char *__pyx_v_c_name;
  PyObject *__pyx_v_name_utf;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  xmlDoc *__pyx_t_3;
  __Pyx_RefNannySetupContext("Entity");
  __pyx_self = __pyx_self;
  __pyx_v_doc = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_name_utf = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);

  /* "src/lxml/lxml.etree.pyx":2628
 *     cdef xmlDoc*   c_doc
 *     cdef char* c_name
 *     name_utf = _utf8(name)             # <<<<<<<<<<<<<<
 *     c_name = _cstr(name_utf)
 *     if c_name[0] == c'#':
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_v_name)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_name_utf));
  __pyx_v_name_utf = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/lxml.etree.pyx":2629
 *     cdef char* c_name
 *     name_utf = _utf8(name)
 *     c_name = _cstr(name_utf)             # <<<<<<<<<<<<<<
 *     if c_name[0] == c'#':
 *         if not _characterReferenceIsValid(c_name + 1):
 */
  __pyx_v_c_name = PyBytes_AS_STRING(((PyObject *)__pyx_v_name_utf));

  /* "src/lxml/lxml.etree.pyx":2630
 *     name_utf = _utf8(name)
 *     c_name = _cstr(name_utf)
 *     if c_name[0] == c'#':             # <<<<<<<<<<<<<<
 *         if not _characterReferenceIsValid(c_name + 1):
 *             raise ValueError, u"Invalid character reference: '%s'" % name
 */
  __pyx_t_2 = ((__pyx_v_c_name[0]) == '#');
  if (__pyx_t_2) {

    /* "src/lxml/lxml.etree.pyx":2631
 *     c_name = _cstr(name_utf)
 *     if c_name[0] == c'#':
 *         if not _characterReferenceIsValid(c_name + 1):             # <<<<<<<<<<<<<<
 *             raise ValueError, u"Invalid character reference: '%s'" % name
 *     elif not _xmlNameIsValid(c_name):
 */
    __pyx_t_2 = (!__pyx_f_4lxml_5etree__characterReferenceIsValid((__pyx_v_c_name + 1)));
    if (__pyx_t_2) {

      /* "src/lxml/lxml.etree.pyx":2632
 *     if c_name[0] == c'#':
 *         if not _characterReferenceIsValid(c_name + 1):
 *             raise ValueError, u"Invalid character reference: '%s'" % name             # <<<<<<<<<<<<<<
 *     elif not _xmlNameIsValid(c_name):
 *         raise ValueError, u"Invalid entity reference: '%s'" % name
 */
      __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_113), __pyx_v_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_1), 0);
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L6;
    }
    __pyx_L6:;
    goto __pyx_L5;
  }

  /* "src/lxml/lxml.etree.pyx":2633
 *         if not _characterReferenceIsValid(c_name + 1):
 *             raise ValueError, u"Invalid character reference: '%s'" % name
 *     elif not _xmlNameIsValid(c_name):             # <<<<<<<<<<<<<<
 *         raise ValueError, u"Invalid entity reference: '%s'" % name
 *     c_doc = _newXMLDoc()
 */
  __pyx_t_2 = (!__pyx_f_4lxml_5etree__xmlNameIsValid(__pyx_v_c_name));
  if (__pyx_t_2) {

    /* "src/lxml/lxml.etree.pyx":2634
 *             raise ValueError, u"Invalid character reference: '%s'" % name
 *     elif not _xmlNameIsValid(c_name):
 *         raise ValueError, u"Invalid entity reference: '%s'" % name             # <<<<<<<<<<<<<<
 *     c_doc = _newXMLDoc()
 *     doc = _documentFactory(c_doc, None)
 */
    __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_114), __pyx_v_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_1), 0);
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "src/lxml/lxml.etree.pyx":2635
 *     elif not _xmlNameIsValid(c_name):
 *         raise ValueError, u"Invalid entity reference: '%s'" % name
 *     c_doc = _newXMLDoc()             # <<<<<<<<<<<<<<
 *     doc = _documentFactory(c_doc, None)
 *     c_node = _createEntity(c_doc, c_name)
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree__newXMLDoc(); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_doc = __pyx_t_3;

  /* "src/lxml/lxml.etree.pyx":2636
 *         raise ValueError, u"Invalid entity reference: '%s'" % name
 *     c_doc = _newXMLDoc()
 *     doc = _documentFactory(c_doc, None)             # <<<<<<<<<<<<<<
 *     c_node = _createEntity(c_doc, c_name)
 *     tree.xmlAddChild(<xmlNode*>c_doc, c_node)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_doc));
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "src/lxml/lxml.etree.pyx":2637
 *     c_doc = _newXMLDoc()
 *     doc = _documentFactory(c_doc, None)
 *     c_node = _createEntity(c_doc, c_name)             # <<<<<<<<<<<<<<
 *     tree.xmlAddChild(<xmlNode*>c_doc, c_node)
 *     return _elementFactory(doc, c_node)
 */
  __pyx_v_c_node = __pyx_f_4lxml_5etree__createEntity(__pyx_v_c_doc, __pyx_v_c_name);

  /* "src/lxml/lxml.etree.pyx":2638
 *     doc = _documentFactory(c_doc, None)
 *     c_node = _createEntity(c_doc, c_name)
 *     tree.xmlAddChild(<xmlNode*>c_doc, c_node)             # <<<<<<<<<<<<<<
 *     return _elementFactory(doc, c_node)
 * 
 */
  xmlAddChild(((xmlNode *)__pyx_v_c_doc), __pyx_v_c_node);

  /* "src/lxml/lxml.etree.pyx":2639
 *     c_node = _createEntity(c_doc, c_name)
 *     tree.xmlAddChild(<xmlNode*>c_doc, c_node)
 *     return _elementFactory(doc, c_node)             # <<<<<<<<<<<<<<
 * 
 * def SubElement(_Element _parent not None, _tag,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(__pyx_v_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2639; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.Entity");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_doc);
  __Pyx_DECREF(__pyx_v_name_utf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2641
 *     return _elementFactory(doc, c_node)
 * 
 * def SubElement(_Element _parent not None, _tag,             # <<<<<<<<<<<<<<
 *                attrib=None, nsmap=None, **_extra):
 *     u"""SubElement(_parent, _tag, attrib=None, nsmap=None, **_extra)
 */

static PyObject *__pyx_pf_4lxml_5etree_7SubElement(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_7SubElement[] = "SubElement(_parent, _tag, attrib=None, nsmap=None, **_extra)\n\n    Subelement factory.  This function creates an element instance, and\n    appends it to an existing element.\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_7SubElement = {__Pyx_NAMESTR("SubElement"), (PyCFunction)__pyx_pf_4lxml_5etree_7SubElement, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_7SubElement)};
static PyObject *__pyx_pf_4lxml_5etree_7SubElement(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct LxmlElement *__pyx_v__parent = 0;
  PyObject *__pyx_v__tag = 0;
  PyObject *__pyx_v_attrib = 0;
  PyObject *__pyx_v_nsmap = 0;
  PyObject *__pyx_v__extra = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s___parent,&__pyx_n_s___tag,&__pyx_n_s__attrib,&__pyx_n_s__nsmap,0};
  __Pyx_RefNannySetupContext("SubElement");
  __pyx_self = __pyx_self;
  __pyx_v__extra = PyDict_New(); if (unlikely(!__pyx_v__extra)) return NULL;
  __Pyx_GOTREF(__pyx_v__extra);
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[4] = {0,0,0,0};

    /* "src/lxml/lxml.etree.pyx":2642
 * 
 * def SubElement(_Element _parent not None, _tag,
 *                attrib=None, nsmap=None, **_extra):             # <<<<<<<<<<<<<<
 *     u"""SubElement(_parent, _tag, attrib=None, nsmap=None, **_extra)
 * 
 */
    values[2] = ((PyObject *)Py_None);
    values[3] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s___parent);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s___tag);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("SubElement", 0, 2, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2641; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__attrib);
        if (value) { values[2] = value; kw_args--; }
      }
      case  3:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nsmap);
        if (value) { values[3] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v__extra, values, PyTuple_GET_SIZE(__pyx_args), "SubElement") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2641; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v__parent = ((struct LxmlElement *)values[0]);
    __pyx_v__tag = values[1];
    __pyx_v_attrib = values[2];
    __pyx_v_nsmap = values[3];
  } else {
    __pyx_v_attrib = ((PyObject *)Py_None);
    __pyx_v_nsmap = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  4:
      __pyx_v_nsmap = PyTuple_GET_ITEM(__pyx_args, 3);
      case  3:
      __pyx_v_attrib = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2:
      __pyx_v__tag = PyTuple_GET_ITEM(__pyx_args, 1);
      __pyx_v__parent = ((struct LxmlElement *)PyTuple_GET_ITEM(__pyx_args, 0));
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("SubElement", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2641; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v__extra);
  __Pyx_AddTraceback("lxml.etree.SubElement");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v__parent), __pyx_ptype_4lxml_5etree__Element, 0, "_parent", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":2648
 *     appends it to an existing element.
 *     """
 *     return _makeSubElement(_parent, _tag, None, None, attrib, nsmap, _extra)             # <<<<<<<<<<<<<<
 * 
 * def ElementTree(_Element element=None, *, file=None, _BaseParser parser=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__makeSubElement(__pyx_v__parent, __pyx_v__tag, Py_None, Py_None, __pyx_v_attrib, __pyx_v_nsmap, ((PyObject *)__pyx_v__extra))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2648; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.SubElement");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v__extra);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2650
 *     return _makeSubElement(_parent, _tag, None, None, attrib, nsmap, _extra)
 * 
 * def ElementTree(_Element element=None, *, file=None, _BaseParser parser=None):             # <<<<<<<<<<<<<<
 *     u"""ElementTree(element=None, file=None, parser=None)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_8ElementTree(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_8ElementTree[] = "ElementTree(element=None, file=None, parser=None)\n\n    ElementTree wrapper class.\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_8ElementTree = {__Pyx_NAMESTR("ElementTree"), (PyCFunction)__pyx_pf_4lxml_5etree_8ElementTree, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8ElementTree)};
static PyObject *__pyx_pf_4lxml_5etree_8ElementTree(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct LxmlElement *__pyx_v_element = 0;
  PyObject *__pyx_v_file = 0;
  struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser = 0;
  xmlDoc *__pyx_v_c_doc;
  struct LxmlDocument *__pyx_v_doc;
  PyObject *__pyx_v_result_container;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  xmlDoc *__pyx_t_7;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__element,&__pyx_n_s__file,&__pyx_n_s__parser,0};
  __Pyx_RefNannySetupContext("ElementTree");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    values[0] = (PyObject *)((struct LxmlElement *)Py_None);
    values[1] = ((PyObject *)Py_None);
    values[2] = (PyObject *)((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__element);
        if (value) { values[0] = value; kw_args--; }
      }
    }
    while (kw_args > 0) {
      PyObject* value;
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__file);
      if (value) { values[1] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parser);
      if (value) { values[2] = value; if (!(--kw_args)) break; }
      break;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "ElementTree") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2650; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_element = ((struct LxmlElement *)values[0]);
    __pyx_v_file = values[1];
    __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)values[2]);
  } else {
    __pyx_v_element = ((struct LxmlElement *)Py_None);
    __pyx_v_file = ((PyObject *)Py_None);
    __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: __pyx_v_element = ((struct LxmlElement *)PyTuple_GET_ITEM(__pyx_args, 0));
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ElementTree", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2650; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.ElementTree");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_doc = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_result_container = Py_None; __Pyx_INCREF(Py_None);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_element), __pyx_ptype_4lxml_5etree__Element, 1, "element", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parser), __pyx_ptype_4lxml_5etree__BaseParser, 1, "parser", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":2662
 *     cdef _Document doc
 * 
 *     if element is not None:             # <<<<<<<<<<<<<<
 *         doc  = element._doc
 *     elif file is not None:
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_element) != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/lxml.etree.pyx":2663
 * 
 *     if element is not None:
 *         doc  = element._doc             # <<<<<<<<<<<<<<
 *     elif file is not None:
 *         try:
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_element->_doc));
    __Pyx_DECREF(((PyObject *)__pyx_v_doc));
    __pyx_v_doc = __pyx_v_element->_doc;
    goto __pyx_L6;
  }

  /* "src/lxml/lxml.etree.pyx":2664
 *     if element is not None:
 *         doc  = element._doc
 *     elif file is not None:             # <<<<<<<<<<<<<<
 *         try:
 *             doc = _parseDocument(file, parser, None)
 */
  __pyx_t_1 = (__pyx_v_file != Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/lxml.etree.pyx":2665
 *         doc  = element._doc
 *     elif file is not None:
 *         try:             # <<<<<<<<<<<<<<
 *             doc = _parseDocument(file, parser, None)
 *         except _TargetParserResult, result_container:
 */
    {
      PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
      __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
      __Pyx_XGOTREF(__pyx_save_exc_type);
      __Pyx_XGOTREF(__pyx_save_exc_value);
      __Pyx_XGOTREF(__pyx_save_exc_tb);
      /*try:*/ {

        /* "src/lxml/lxml.etree.pyx":2666
 *     elif file is not None:
 *         try:
 *             doc = _parseDocument(file, parser, None)             # <<<<<<<<<<<<<<
 *         except _TargetParserResult, result_container:
 *             return result_container.result
 */
        __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__parseDocument(__pyx_v_file, __pyx_v_parser, Py_None)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2666; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(((PyObject *)__pyx_v_doc));
        __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_2);
        __pyx_t_2 = 0;
      }
      __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
      __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
      __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
      goto __pyx_L14_try_end;
      __pyx_L7_error:;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "src/lxml/lxml.etree.pyx":2667
 *         try:
 *             doc = _parseDocument(file, parser, None)
 *         except _TargetParserResult, result_container:             # <<<<<<<<<<<<<<
 *             return result_container.result
 *     else:
 */
      __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s___TargetParserResult); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2667; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyErr_ExceptionMatches(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (__pyx_t_3) {
        __Pyx_AddTraceback("lxml.etree.ElementTree");
        if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_4, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2667; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_v_result_container);
        __pyx_v_result_container = __pyx_t_4;

        /* "src/lxml/lxml.etree.pyx":2668
 *             doc = _parseDocument(file, parser, None)
 *         except _TargetParserResult, result_container:
 *             return result_container.result             # <<<<<<<<<<<<<<
 *     else:
 *         c_doc = _newXMLDoc()
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_6 = PyObject_GetAttr(__pyx_v_result_container, __pyx_n_s__result); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2668; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_r = __pyx_t_6;
        __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        goto __pyx_L10_except_return;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        goto __pyx_L8_exception_handled;
      }
      __pyx_L9_except_error:;
      __Pyx_XGIVEREF(__pyx_save_exc_type);
      __Pyx_XGIVEREF(__pyx_save_exc_value);
      __Pyx_XGIVEREF(__pyx_save_exc_tb);
      __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
      goto __pyx_L1_error;
      __pyx_L10_except_return:;
      __Pyx_XGIVEREF(__pyx_save_exc_type);
      __Pyx_XGIVEREF(__pyx_save_exc_value);
      __Pyx_XGIVEREF(__pyx_save_exc_tb);
      __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
      goto __pyx_L0;
      __pyx_L8_exception_handled:;
      __Pyx_XGIVEREF(__pyx_save_exc_type);
      __Pyx_XGIVEREF(__pyx_save_exc_value);
      __Pyx_XGIVEREF(__pyx_save_exc_tb);
      __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
      __pyx_L14_try_end:;
    }
    goto __pyx_L6;
  }
  /*else*/ {

    /* "src/lxml/lxml.etree.pyx":2670
 *             return result_container.result
 *     else:
 *         c_doc = _newXMLDoc()             # <<<<<<<<<<<<<<
 *         doc = _documentFactory(c_doc, parser)
 * 
 */
    __pyx_t_7 = __pyx_f_4lxml_5etree__newXMLDoc(); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2670; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_c_doc = __pyx_t_7;

    /* "src/lxml/lxml.etree.pyx":2671
 *     else:
 *         c_doc = _newXMLDoc()
 *         doc = _documentFactory(c_doc, parser)             # <<<<<<<<<<<<<<
 * 
 *     return _elementTreeFactory(doc, element)
 */
    __pyx_t_5 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, __pyx_v_parser)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(((PyObject *)__pyx_v_doc));
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_5);
    __pyx_t_5 = 0;
  }
  __pyx_L6:;

  /* "src/lxml/lxml.etree.pyx":2673
 *         doc = _documentFactory(c_doc, parser)
 * 
 *     return _elementTreeFactory(doc, element)             # <<<<<<<<<<<<<<
 * 
 * def HTML(text, _BaseParser parser=None, *, base_url=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = ((PyObject *)__pyx_f_4lxml_5etree__elementTreeFactory(__pyx_v_doc, __pyx_v_element)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2673; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree.ElementTree");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_doc);
  __Pyx_DECREF(__pyx_v_result_container);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2675
 *     return _elementTreeFactory(doc, element)
 * 
 * def HTML(text, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     u"""HTML(text, parser=None, base_url=None)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_9HTML(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_9HTML[] = "HTML(text, parser=None, base_url=None)\n\n    Parses an HTML document from a string constant.  Returns the root\n    node (or the result returned by a parser target).  This function\n    can be used to embed \"HTML literals\" in Python code.\n\n    To override the parser with a different ``HTMLParser`` you can pass it to\n    the ``parser`` keyword argument.\n\n    The ``base_url`` keyword argument allows to set the original base URL of\n    the document to support relative Paths when looking up external entities\n    (DTD, XInclude, ...).\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_9HTML = {__Pyx_NAMESTR("HTML"), (PyCFunction)__pyx_pf_4lxml_5etree_9HTML, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_9HTML)};
static PyObject *__pyx_pf_4lxml_5etree_9HTML(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_text = 0;
  struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser = 0;
  PyObject *__pyx_v_base_url = 0;
  struct LxmlDocument *__pyx_v_doc;
  PyObject *__pyx_v_result_container;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__text,&__pyx_n_s__parser,&__pyx_n_s__base_url,0};
  __Pyx_RefNannySetupContext("HTML");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    values[1] = (PyObject *)((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None);
    values[2] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__text);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parser);
        if (value) { values[1] = value; kw_args--; }
      }
    }
    while (kw_args > 0) {
      PyObject* value;
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__base_url);
      if (value) { values[2] = value; if (!(--kw_args)) break; }
      break;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "HTML") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2675; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_text = values[0];
    __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)values[1]);
    __pyx_v_base_url = values[2];
  } else {
    __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None);
    __pyx_v_base_url = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)PyTuple_GET_ITEM(__pyx_args, 1));
      case  1: __pyx_v_text = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("HTML", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2675; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.HTML");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF((PyObject *)__pyx_v_parser);
  __pyx_v_doc = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_result_container = Py_None; __Pyx_INCREF(Py_None);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parser), __pyx_ptype_4lxml_5etree__BaseParser, 1, "parser", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2675; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":2690
 *     """
 *     cdef _Document doc
 *     if parser is None:             # <<<<<<<<<<<<<<
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *         if not isinstance(parser, HTMLParser):
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_parser) == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/lxml.etree.pyx":2691
 *     cdef _Document doc
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()             # <<<<<<<<<<<<<<
 *         if not isinstance(parser, HTMLParser):
 *             parser = __DEFAULT_HTML_PARSER
 */
    __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext *)__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT->__pyx_vtab)->getDefaultParser(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_v_parser));
    __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/lxml.etree.pyx":2692
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *         if not isinstance(parser, HTMLParser):             # <<<<<<<<<<<<<<
 *             parser = __DEFAULT_HTML_PARSER
 *     try:
 */
    __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_parser), ((PyObject*)__pyx_ptype_4lxml_5etree_HTMLParser)); 
    __pyx_t_3 = (!__pyx_t_1);
    if (__pyx_t_3) {

      /* "src/lxml/lxml.etree.pyx":2693
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *         if not isinstance(parser, HTMLParser):
 *             parser = __DEFAULT_HTML_PARSER             # <<<<<<<<<<<<<<
 *     try:
 *         doc = _parseMemoryDocument(text, base_url, parser)
 */
      __Pyx_INCREF(((PyObject *)__pyx_v_4lxml_5etree___DEFAULT_HTML_PARSER));
      __Pyx_DECREF(((PyObject *)__pyx_v_parser));
      __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_4lxml_5etree___DEFAULT_HTML_PARSER);
      goto __pyx_L7;
    }
    __pyx_L7:;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "src/lxml/lxml.etree.pyx":2694
 *         if not isinstance(parser, HTMLParser):
 *             parser = __DEFAULT_HTML_PARSER
 *     try:             # <<<<<<<<<<<<<<
 *         doc = _parseMemoryDocument(text, base_url, parser)
 *         return doc.getroot()
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "src/lxml/lxml.etree.pyx":2695
 *             parser = __DEFAULT_HTML_PARSER
 *     try:
 *         doc = _parseMemoryDocument(text, base_url, parser)             # <<<<<<<<<<<<<<
 *         return doc.getroot()
 *     except _TargetParserResult, result_container:
 */
      __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__parseMemoryDocument(__pyx_v_text, __pyx_v_base_url, __pyx_v_parser)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2695; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(((PyObject *)__pyx_v_doc));
      __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_2);
      __pyx_t_2 = 0;

      /* "src/lxml/lxml.etree.pyx":2696
 *     try:
 *         doc = _parseMemoryDocument(text, base_url, parser)
 *         return doc.getroot()             # <<<<<<<<<<<<<<
 *     except _TargetParserResult, result_container:
 *         return result_container.result
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__Document *)__pyx_v_doc->__pyx_vtab)->getroot(__pyx_v_doc); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2696; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L12_try_return;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L15_try_end;
    __pyx_L12_try_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;
    __pyx_L8_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/lxml.etree.pyx":2697
 *         doc = _parseMemoryDocument(text, base_url, parser)
 *         return doc.getroot()
 *     except _TargetParserResult, result_container:             # <<<<<<<<<<<<<<
 *         return result_container.result
 * 
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s___TargetParserResult); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2697; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PyErr_ExceptionMatches(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_4) {
      __Pyx_AddTraceback("lxml.etree.HTML");
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_5, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2697; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_v_result_container);
      __pyx_v_result_container = __pyx_t_5;

      /* "src/lxml/lxml.etree.pyx":2698
 *         return doc.getroot()
 *     except _TargetParserResult, result_container:
 *         return result_container.result             # <<<<<<<<<<<<<<
 * 
 * def XML(text, _BaseParser parser=None, *, base_url=None):
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_7 = PyObject_GetAttr(__pyx_v_result_container, __pyx_n_s__result); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2698; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_r = __pyx_t_7;
      __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L11_except_return;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L9_exception_handled;
    }
    __pyx_L10_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L11_except_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;
    __pyx_L9_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L15_try_end:;
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree.HTML");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_doc);
  __Pyx_DECREF(__pyx_v_result_container);
  __Pyx_DECREF((PyObject *)__pyx_v_parser);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2700
 *         return result_container.result
 * 
 * def XML(text, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     u"""XML(text, parser=None, base_url=None)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_10XML(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_10XML[] = "XML(text, parser=None, base_url=None)\n\n    Parses an XML document or fragment from a string constant.\n    Returns the root node (or the result returned by a parser target).\n    This function can be used to embed \"XML literals\" in Python code,\n    like in\n\n       >>> root = etree.XML(\"<root><test/></root>\")\n\n    To override the parser with a different ``XMLParser`` you can pass it to\n    the ``parser`` keyword argument.\n\n    The ``base_url`` keyword argument allows to set the original base URL of\n    the document to support relative Paths when looking up external entities\n    (DTD, XInclude, ...).\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_10XML = {__Pyx_NAMESTR("XML"), (PyCFunction)__pyx_pf_4lxml_5etree_10XML, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_10XML)};
static PyObject *__pyx_pf_4lxml_5etree_10XML(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_text = 0;
  struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser = 0;
  PyObject *__pyx_v_base_url = 0;
  struct LxmlDocument *__pyx_v_doc;
  PyObject *__pyx_v_result_container;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__text,&__pyx_n_s__parser,&__pyx_n_s__base_url,0};
  __Pyx_RefNannySetupContext("XML");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    values[1] = (PyObject *)((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None);
    values[2] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__text);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parser);
        if (value) { values[1] = value; kw_args--; }
      }
    }
    while (kw_args > 0) {
      PyObject* value;
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__base_url);
      if (value) { values[2] = value; if (!(--kw_args)) break; }
      break;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "XML") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2700; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_text = values[0];
    __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)values[1]);
    __pyx_v_base_url = values[2];
  } else {
    __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None);
    __pyx_v_base_url = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)PyTuple_GET_ITEM(__pyx_args, 1));
      case  1: __pyx_v_text = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("XML", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2700; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.XML");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF((PyObject *)__pyx_v_parser);
  __pyx_v_doc = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_result_container = Py_None; __Pyx_INCREF(Py_None);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parser), __pyx_ptype_4lxml_5etree__BaseParser, 1, "parser", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2700; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":2718
 *     """
 *     cdef _Document doc
 *     if parser is None:             # <<<<<<<<<<<<<<
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *         if not isinstance(parser, XMLParser):
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_parser) == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/lxml.etree.pyx":2719
 *     cdef _Document doc
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()             # <<<<<<<<<<<<<<
 *         if not isinstance(parser, XMLParser):
 *             parser = __DEFAULT_XML_PARSER
 */
    __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext *)__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT->__pyx_vtab)->getDefaultParser(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_v_parser));
    __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "src/lxml/lxml.etree.pyx":2720
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *         if not isinstance(parser, XMLParser):             # <<<<<<<<<<<<<<
 *             parser = __DEFAULT_XML_PARSER
 *     try:
 */
    __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_parser), ((PyObject*)__pyx_ptype_4lxml_5etree_XMLParser)); 
    __pyx_t_3 = (!__pyx_t_1);
    if (__pyx_t_3) {

      /* "src/lxml/lxml.etree.pyx":2721
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *         if not isinstance(parser, XMLParser):
 *             parser = __DEFAULT_XML_PARSER             # <<<<<<<<<<<<<<
 *     try:
 *         doc = _parseMemoryDocument(text, base_url, parser)
 */
      __Pyx_INCREF(((PyObject *)__pyx_v_4lxml_5etree___DEFAULT_XML_PARSER));
      __Pyx_DECREF(((PyObject *)__pyx_v_parser));
      __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_4lxml_5etree___DEFAULT_XML_PARSER);
      goto __pyx_L7;
    }
    __pyx_L7:;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "src/lxml/lxml.etree.pyx":2722
 *         if not isinstance(parser, XMLParser):
 *             parser = __DEFAULT_XML_PARSER
 *     try:             # <<<<<<<<<<<<<<
 *         doc = _parseMemoryDocument(text, base_url, parser)
 *         return doc.getroot()
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "src/lxml/lxml.etree.pyx":2723
 *             parser = __DEFAULT_XML_PARSER
 *     try:
 *         doc = _parseMemoryDocument(text, base_url, parser)             # <<<<<<<<<<<<<<
 *         return doc.getroot()
 *     except _TargetParserResult, result_container:
 */
      __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__parseMemoryDocument(__pyx_v_text, __pyx_v_base_url, __pyx_v_parser)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2723; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(((PyObject *)__pyx_v_doc));
      __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_2);
      __pyx_t_2 = 0;

      /* "src/lxml/lxml.etree.pyx":2724
 *     try:
 *         doc = _parseMemoryDocument(text, base_url, parser)
 *         return doc.getroot()             # <<<<<<<<<<<<<<
 *     except _TargetParserResult, result_container:
 *         return result_container.result
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__Document *)__pyx_v_doc->__pyx_vtab)->getroot(__pyx_v_doc); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2724; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L12_try_return;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L15_try_end;
    __pyx_L12_try_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;
    __pyx_L8_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "src/lxml/lxml.etree.pyx":2725
 *         doc = _parseMemoryDocument(text, base_url, parser)
 *         return doc.getroot()
 *     except _TargetParserResult, result_container:             # <<<<<<<<<<<<<<
 *         return result_container.result
 * 
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s___TargetParserResult); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2725; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PyErr_ExceptionMatches(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_4) {
      __Pyx_AddTraceback("lxml.etree.XML");
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_5, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2725; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_v_result_container);
      __pyx_v_result_container = __pyx_t_5;

      /* "src/lxml/lxml.etree.pyx":2726
 *         return doc.getroot()
 *     except _TargetParserResult, result_container:
 *         return result_container.result             # <<<<<<<<<<<<<<
 * 
 * def fromstring(text, _BaseParser parser=None, *, base_url=None):
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_7 = PyObject_GetAttr(__pyx_v_result_container, __pyx_n_s__result); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2726; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_r = __pyx_t_7;
      __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L11_except_return;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L9_exception_handled;
    }
    __pyx_L10_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L11_except_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;
    __pyx_L9_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L15_try_end:;
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree.XML");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_doc);
  __Pyx_DECREF(__pyx_v_result_container);
  __Pyx_DECREF((PyObject *)__pyx_v_parser);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2728
 *         return result_container.result
 * 
 * def fromstring(text, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     u"""fromstring(text, parser=None, base_url=None)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_11fromstring(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_11fromstring[] = "fromstring(text, parser=None, base_url=None)\n\n    Parses an XML document or fragment from a string.  Returns the\n    root node (or the result returned by a parser target).\n\n    To override the default parser with a different parser you can pass it to\n    the ``parser`` keyword argument.\n\n    The ``base_url`` keyword argument allows to set the original base URL of\n    the document to support relative Paths when looking up external entities\n    (DTD, XInclude, ...).\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_11fromstring = {__Pyx_NAMESTR("fromstring"), (PyCFunction)__pyx_pf_4lxml_5etree_11fromstring, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_11fromstring)};
static PyObject *__pyx_pf_4lxml_5etree_11fromstring(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_text = 0;
  struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser = 0;
  PyObject *__pyx_v_base_url = 0;
  struct LxmlDocument *__pyx_v_doc;
  PyObject *__pyx_v_result_container;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__text,&__pyx_n_s__parser,&__pyx_n_s__base_url,0};
  __Pyx_RefNannySetupContext("fromstring");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    values[1] = (PyObject *)((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None);
    values[2] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__text);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parser);
        if (value) { values[1] = value; kw_args--; }
      }
    }
    while (kw_args > 0) {
      PyObject* value;
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__base_url);
      if (value) { values[2] = value; if (!(--kw_args)) break; }
      break;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "fromstring") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2728; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_text = values[0];
    __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)values[1]);
    __pyx_v_base_url = values[2];
  } else {
    __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None);
    __pyx_v_base_url = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)PyTuple_GET_ITEM(__pyx_args, 1));
      case  1: __pyx_v_text = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("fromstring", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2728; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.fromstring");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_doc = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_result_container = Py_None; __Pyx_INCREF(Py_None);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parser), __pyx_ptype_4lxml_5etree__BaseParser, 1, "parser", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":2742
 *     """
 *     cdef _Document doc
 *     try:             # <<<<<<<<<<<<<<
 *         doc = _parseMemoryDocument(text, base_url, parser)
 *         return doc.getroot()
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "src/lxml/lxml.etree.pyx":2743
 *     cdef _Document doc
 *     try:
 *         doc = _parseMemoryDocument(text, base_url, parser)             # <<<<<<<<<<<<<<
 *         return doc.getroot()
 *     except _TargetParserResult, result_container:
 */
      __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__parseMemoryDocument(__pyx_v_text, __pyx_v_base_url, __pyx_v_parser)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2743; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(((PyObject *)__pyx_v_doc));
      __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "src/lxml/lxml.etree.pyx":2744
 *     try:
 *         doc = _parseMemoryDocument(text, base_url, parser)
 *         return doc.getroot()             # <<<<<<<<<<<<<<
 *     except _TargetParserResult, result_container:
 *         return result_container.result
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__Document *)__pyx_v_doc->__pyx_vtab)->getroot(__pyx_v_doc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2744; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L10_try_return;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L13_try_end;
    __pyx_L10_try_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;
    __pyx_L6_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "src/lxml/lxml.etree.pyx":2745
 *         doc = _parseMemoryDocument(text, base_url, parser)
 *         return doc.getroot()
 *     except _TargetParserResult, result_container:             # <<<<<<<<<<<<<<
 *         return result_container.result
 * 
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___TargetParserResult); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2745; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyErr_ExceptionMatches(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_2) {
      __Pyx_AddTraceback("lxml.etree.fromstring");
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2745; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_v_result_container);
      __pyx_v_result_container = __pyx_t_3;

      /* "src/lxml/lxml.etree.pyx":2746
 *         return doc.getroot()
 *     except _TargetParserResult, result_container:
 *         return result_container.result             # <<<<<<<<<<<<<<
 * 
 * def fromstringlist(strings, _BaseParser parser=None):
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_5 = PyObject_GetAttr(__pyx_v_result_container, __pyx_n_s__result); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2746; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L9_except_return;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L7_exception_handled;
    }
    __pyx_L8_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L9_except_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;
    __pyx_L7_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L13_try_end:;
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.fromstring");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_doc);
  __Pyx_DECREF(__pyx_v_result_container);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2748
 *         return result_container.result
 * 
 * def fromstringlist(strings, _BaseParser parser=None):             # <<<<<<<<<<<<<<
 *     u"""fromstringlist(strings, parser=None)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_12fromstringlist(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_12fromstringlist[] = "fromstringlist(strings, parser=None)\n\n    Parses an XML document from a sequence of strings.  Returns the\n    root node (or the result returned by a parser target).\n\n    To override the default parser with a different parser you can pass it to\n    the ``parser`` keyword argument.\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_12fromstringlist = {__Pyx_NAMESTR("fromstringlist"), (PyCFunction)__pyx_pf_4lxml_5etree_12fromstringlist, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_12fromstringlist)};
static PyObject *__pyx_pf_4lxml_5etree_12fromstringlist(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_strings = 0;
  struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser = 0;
  PyObject *__pyx_v_feed;
  PyObject *__pyx_v_data;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__strings,&__pyx_n_s__parser,0};
  __Pyx_RefNannySetupContext("fromstringlist");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    values[1] = (PyObject *)((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__strings);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parser);
        if (value) { values[1] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "fromstringlist") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2748; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_strings = values[0];
    __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)values[1]);
  } else {
    __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)PyTuple_GET_ITEM(__pyx_args, 1));
      case  1: __pyx_v_strings = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("fromstringlist", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2748; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.fromstringlist");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF((PyObject *)__pyx_v_parser);
  __pyx_v_feed = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_data = Py_None; __Pyx_INCREF(Py_None);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parser), __pyx_ptype_4lxml_5etree__BaseParser, 1, "parser", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":2758
 *     """
 *     cdef _Document doc
 *     if parser is None:             # <<<<<<<<<<<<<<
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     feed = parser.feed
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_parser) == Py_None);
  if (__pyx_t_1) {

    /* "src/lxml/lxml.etree.pyx":2759
 *     cdef _Document doc
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()             # <<<<<<<<<<<<<<
 *     feed = parser.feed
 *     for data in strings:
 */
    __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext *)__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT->__pyx_vtab)->getDefaultParser(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_v_parser));
    __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "src/lxml/lxml.etree.pyx":2760
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     feed = parser.feed             # <<<<<<<<<<<<<<
 *     for data in strings:
 *         feed(data)
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_parser), __pyx_n_s__feed); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_v_feed);
  __pyx_v_feed = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "src/lxml/lxml.etree.pyx":2761
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     feed = parser.feed
 *     for data in strings:             # <<<<<<<<<<<<<<
 *         feed(data)
 *     return parser.close()
 */
  if (PyList_CheckExact(__pyx_v_strings) || PyTuple_CheckExact(__pyx_v_strings)) {
    __pyx_t_3 = 0; __pyx_t_2 = __pyx_v_strings; __Pyx_INCREF(__pyx_t_2);
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_strings); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2761; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
  }
  for (;;) {
    if (likely(PyList_CheckExact(__pyx_t_2))) {
      if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++;
    } else if (likely(PyTuple_CheckExact(__pyx_t_2))) {
      if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++;
    } else {
      __pyx_t_4 = PyIter_Next(__pyx_t_2);
      if (!__pyx_t_4) {
        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2761; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_DECREF(__pyx_v_data);
    __pyx_v_data = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "src/lxml/lxml.etree.pyx":2762
 *     feed = parser.feed
 *     for data in strings:
 *         feed(data)             # <<<<<<<<<<<<<<
 *     return parser.close()
 * 
 */
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2762; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_INCREF(__pyx_v_data);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_data);
    __Pyx_GIVEREF(__pyx_v_data);
    __pyx_t_5 = PyObject_Call(__pyx_v_feed, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2762; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "src/lxml/lxml.etree.pyx":2763
 *     for data in strings:
 *         feed(data)
 *     return parser.close()             # <<<<<<<<<<<<<<
 * 
 * def iselement(element):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_parser), __pyx_n_s__close); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.fromstringlist");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_feed);
  __Pyx_DECREF(__pyx_v_data);
  __Pyx_DECREF((PyObject *)__pyx_v_parser);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2765
 *     return parser.close()
 * 
 * def iselement(element):             # <<<<<<<<<<<<<<
 *     u"""iselement(element)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_13iselement(PyObject *__pyx_self, PyObject *__pyx_v_element); /*proto*/
static char __pyx_doc_4lxml_5etree_13iselement[] = "iselement(element)\n\n    Checks if an object appears to be a valid element object.\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_13iselement = {__Pyx_NAMESTR("iselement"), (PyCFunction)__pyx_pf_4lxml_5etree_13iselement, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_13iselement)};
static PyObject *__pyx_pf_4lxml_5etree_13iselement(PyObject *__pyx_self, PyObject *__pyx_v_element) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("iselement");
  __pyx_self = __pyx_self;

  /* "src/lxml/lxml.etree.pyx":2770
 *     Checks if an object appears to be a valid element object.
 *     """
 *     return isinstance(element, _Element) and (<_Element>element)._c_node is not NULL             # <<<<<<<<<<<<<<
 * 
 * def dump(_Element elem not None, *, pretty_print=True, with_tail=True):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_element, ((PyObject*)__pyx_ptype_4lxml_5etree__Element)); 
  if (__pyx_t_1) {
    __pyx_t_2 = (((struct LxmlElement *)__pyx_v_element)->_c_node != NULL);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.iselement");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2772
 *     return isinstance(element, _Element) and (<_Element>element)._c_node is not NULL
 * 
 * def dump(_Element elem not None, *, pretty_print=True, with_tail=True):             # <<<<<<<<<<<<<<
 *     u"""dump(elem, pretty_print=True, with_tail=True)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_14dump(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_14dump[] = "dump(elem, pretty_print=True, with_tail=True)\n\n    Writes an element tree or element structure to sys.stdout. This function\n    should be used for debugging only.\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_14dump = {__Pyx_NAMESTR("dump"), (PyCFunction)__pyx_pf_4lxml_5etree_14dump, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_14dump)};
static PyObject *__pyx_pf_4lxml_5etree_14dump(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct LxmlElement *__pyx_v_elem = 0;
  PyObject *__pyx_v_pretty_print = 0;
  PyObject *__pyx_v_with_tail = 0;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__elem,&__pyx_n_s__pretty_print,&__pyx_n_s__with_tail,0};
  __Pyx_RefNannySetupContext("dump");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    values[1] = __pyx_k_115;
    values[2] = __pyx_k_116;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__elem);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
    }
    while (kw_args > 0) {
      PyObject* value;
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pretty_print);
      if (value) { values[1] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__with_tail);
      if (value) { values[2] = value; if (!(--kw_args)) break; }
      break;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "dump") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2772; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_elem = ((struct LxmlElement *)values[0]);
    __pyx_v_pretty_print = values[1];
    __pyx_v_with_tail = values[2];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_elem = ((struct LxmlElement *)PyTuple_GET_ITEM(__pyx_args, 0));
    __pyx_v_pretty_print = __pyx_k_115;
    __pyx_v_with_tail = __pyx_k_116;
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("dump", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2772; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.dump");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elem), __pyx_ptype_4lxml_5etree__Element, 0, "elem", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":2778
 *     should be used for debugging only.
 *     """
 *     _assertValidNode(elem)             # <<<<<<<<<<<<<<
 *     _dumpToFile(sys.stdout, elem._c_node, pretty_print, with_tail)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_elem); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":2779
 *     """
 *     _assertValidNode(elem)
 *     _dumpToFile(sys.stdout, elem._c_node, pretty_print, with_tail)             # <<<<<<<<<<<<<<
 * 
 * def tostring(element_or_tree, *, encoding=None, method=u"xml",
 */
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_4lxml_5etree_sys, __pyx_n_s__stdout); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_pretty_print); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_with_tail); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = __pyx_f_4lxml_5etree__dumpToFile(__pyx_t_2, __pyx_v_elem->_c_node, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.dump");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2781
 *     _dumpToFile(sys.stdout, elem._c_node, pretty_print, with_tail)
 * 
 * def tostring(element_or_tree, *, encoding=None, method=u"xml",             # <<<<<<<<<<<<<<
 *              xml_declaration=None, pretty_print=False, with_tail=True,
 *              standalone=None, doctype=None,
 */

static PyObject *__pyx_pf_4lxml_5etree_15tostring(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_15tostring[] = "tostring(element_or_tree, encoding=None, method=\"xml\",\n                 xml_declaration=None, pretty_print=False, with_tail=True,\n                 standalone=None, doctype=None,\n                 exclusive=False, with_comments=True)\n\n    Serialize an element to an encoded string representation of its XML\n    tree.\n\n    Defaults to ASCII encoding without XML declaration.  This\n    behaviour can be configured with the keyword arguments 'encoding'\n    (string) and 'xml_declaration' (bool).  Note that changing the\n    encoding to a non UTF-8 compatible encoding will enable a\n    declaration by default.\n\n    You can also serialise to a Unicode string without declaration by\n    passing the ``unicode`` function as encoding (or ``str`` in Py3),\n    or the name 'unicode'.  This changes the return value from a byte\n    string to an unencoded unicode string.\n\n    The keyword argument 'pretty_print' (bool) enables formatted XML.\n\n    The keyword argument 'method' selects the output method: 'xml',\n    'html', plain 'text' (text content without tags) or 'c14n'.\n    Default is 'xml'.\n\n    The ``exclusive`` and ``with_comments`` arguments are only used\n    with C14N output, where they request exclusive and uncommented\n    C14N serialisation respectively.\n\n    Passing a boolean value to the ``standalone`` option will output\n    an XML declaration with the corresponding ``standalone`` flag.\n\n    The ``doctype`` option allows passing in a plain string that will\n    be serialised before the XML tree.  Note that passing in non\n    well-formed content here will make the XML output non well-formed.\n\n    You can prevent the tail text of the element from being serialised\n    by passing the boolean ``with_tail`` option.  This has no impact\n    on the tail text of children, which will always be serialised.\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_15tostring = {__Pyx_NAMESTR("tostring"), (PyCFunction)__pyx_pf_4lxml_5etree_15tostring, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_15tostring)};
static PyObject *__pyx_pf_4lxml_5etree_15tostring(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_element_or_tree = 0;
  PyObject *__pyx_v_encoding = 0;
  PyObject *__pyx_v_method = 0;
  PyObject *__pyx_v_xml_declaration = 0;
  PyObject *__pyx_v_pretty_print = 0;
  PyObject *__pyx_v_with_tail = 0;
  PyObject *__pyx_v_standalone = 0;
  PyObject *__pyx_v_doctype = 0;
  PyObject *__pyx_v_exclusive = 0;
  PyObject *__pyx_v_with_comments = 0;
  int __pyx_v_write_declaration;
  int __pyx_v_is_standalone;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__element_or_tree,&__pyx_n_s__encoding,&__pyx_n_s__method,&__pyx_n_s__xml_declaration,&__pyx_n_s__pretty_print,&__pyx_n_s__with_tail,&__pyx_n_s__standalone,&__pyx_n_s__doctype,&__pyx_n_s__exclusive,&__pyx_n_s__with_comments,0};
  __Pyx_RefNannySetupContext("tostring");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)__pyx_n_u__xml);

    /* "src/lxml/lxml.etree.pyx":2782
 * 
 * def tostring(element_or_tree, *, encoding=None, method=u"xml",
 *              xml_declaration=None, pretty_print=False, with_tail=True,             # <<<<<<<<<<<<<<
 *              standalone=None, doctype=None,
 *              exclusive=False, with_comments=True):
 */
    values[3] = ((PyObject *)Py_None);
    values[4] = __pyx_k_117;
    values[5] = __pyx_k_118;

    /* "src/lxml/lxml.etree.pyx":2783
 * def tostring(element_or_tree, *, encoding=None, method=u"xml",
 *              xml_declaration=None, pretty_print=False, with_tail=True,
 *              standalone=None, doctype=None,             # <<<<<<<<<<<<<<
 *              exclusive=False, with_comments=True):
 *     u"""tostring(element_or_tree, encoding=None, method="xml",
 */
    values[6] = ((PyObject *)Py_None);
    values[7] = ((PyObject *)Py_None);
    values[8] = __pyx_k_119;
    values[9] = __pyx_k_120;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__element_or_tree);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
    }
    while (kw_args > 0) {
      PyObject* value;
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__encoding);
      if (value) { values[1] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__method);
      if (value) { values[2] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xml_declaration);
      if (value) { values[3] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pretty_print);
      if (value) { values[4] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__with_tail);
      if (value) { values[5] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__standalone);
      if (value) { values[6] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__doctype);
      if (value) { values[7] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__exclusive);
      if (value) { values[8] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__with_comments);
      if (value) { values[9] = value; if (!(--kw_args)) break; }
      break;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "tostring") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2781; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_element_or_tree = values[0];
    __pyx_v_encoding = values[1];
    __pyx_v_method = values[2];
    __pyx_v_xml_declaration = values[3];
    __pyx_v_pretty_print = values[4];
    __pyx_v_with_tail = values[5];
    __pyx_v_standalone = values[6];
    __pyx_v_doctype = values[7];
    __pyx_v_exclusive = values[8];
    __pyx_v_with_comments = values[9];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_element_or_tree = PyTuple_GET_ITEM(__pyx_args, 0);

    /* "src/lxml/lxml.etree.pyx":2781
 *     _dumpToFile(sys.stdout, elem._c_node, pretty_print, with_tail)
 * 
 * def tostring(element_or_tree, *, encoding=None, method=u"xml",             # <<<<<<<<<<<<<<
 *              xml_declaration=None, pretty_print=False, with_tail=True,
 *              standalone=None, doctype=None,
 */
    __pyx_v_encoding = ((PyObject *)Py_None);
    __pyx_v_method = ((PyObject *)__pyx_n_u__xml);

    /* "src/lxml/lxml.etree.pyx":2782
 * 
 * def tostring(element_or_tree, *, encoding=None, method=u"xml",
 *              xml_declaration=None, pretty_print=False, with_tail=True,             # <<<<<<<<<<<<<<
 *              standalone=None, doctype=None,
 *              exclusive=False, with_comments=True):
 */
    __pyx_v_xml_declaration = ((PyObject *)Py_None);
    __pyx_v_pretty_print = __pyx_k_117;
    __pyx_v_with_tail = __pyx_k_118;

    /* "src/lxml/lxml.etree.pyx":2783
 * def tostring(element_or_tree, *, encoding=None, method=u"xml",
 *              xml_declaration=None, pretty_print=False, with_tail=True,
 *              standalone=None, doctype=None,             # <<<<<<<<<<<<<<
 *              exclusive=False, with_comments=True):
 *     u"""tostring(element_or_tree, encoding=None, method="xml",
 */
    __pyx_v_standalone = ((PyObject *)Py_None);
    __pyx_v_doctype = ((PyObject *)Py_None);
    __pyx_v_exclusive = __pyx_k_119;
    __pyx_v_with_comments = __pyx_k_120;
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("tostring", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2781; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.tostring");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF(__pyx_v_encoding);

  /* "src/lxml/lxml.etree.pyx":2828
 *     cdef int is_standalone
 *     # C14N serialisation
 *     if method == 'c14n':             # <<<<<<<<<<<<<<
 *         if encoding is not None:
 *             raise ValueError("Cannot specify encoding with C14N")
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_method, ((PyObject *)__pyx_n_s__c14n), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "src/lxml/lxml.etree.pyx":2829
 *     # C14N serialisation
 *     if method == 'c14n':
 *         if encoding is not None:             # <<<<<<<<<<<<<<
 *             raise ValueError("Cannot specify encoding with C14N")
 *         if xml_declaration:
 */
    __pyx_t_2 = (__pyx_v_encoding != Py_None);
    if (__pyx_t_2) {

      /* "src/lxml/lxml.etree.pyx":2830
 *     if method == 'c14n':
 *         if encoding is not None:
 *             raise ValueError("Cannot specify encoding with C14N")             # <<<<<<<<<<<<<<
 *         if xml_declaration:
 *             raise ValueError("Cannot enable XML declaration in C14N")
 */
      __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_121), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_Raise(__pyx_t_1, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "src/lxml/lxml.etree.pyx":2831
 *         if encoding is not None:
 *             raise ValueError("Cannot specify encoding with C14N")
 *         if xml_declaration:             # <<<<<<<<<<<<<<
 *             raise ValueError("Cannot enable XML declaration in C14N")
 *         return _tostringC14N(element_or_tree, exclusive, with_comments)
 */
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_xml_declaration); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_2) {

      /* "src/lxml/lxml.etree.pyx":2832
 *             raise ValueError("Cannot specify encoding with C14N")
 *         if xml_declaration:
 *             raise ValueError("Cannot enable XML declaration in C14N")             # <<<<<<<<<<<<<<
 *         return _tostringC14N(element_or_tree, exclusive, with_comments)
 *     if not with_comments:
 */
      __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_122), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_Raise(__pyx_t_1, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "src/lxml/lxml.etree.pyx":2833
 *         if xml_declaration:
 *             raise ValueError("Cannot enable XML declaration in C14N")
 *         return _tostringC14N(element_or_tree, exclusive, with_comments)             # <<<<<<<<<<<<<<
 *     if not with_comments:
 *         raise ValueError("Can only discard comments in C14N serialisation")
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_exclusive); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_with_comments); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__tostringC14N(__pyx_v_element_or_tree, __pyx_t_2, __pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "src/lxml/lxml.etree.pyx":2834
 *             raise ValueError("Cannot enable XML declaration in C14N")
 *         return _tostringC14N(element_or_tree, exclusive, with_comments)
 *     if not with_comments:             # <<<<<<<<<<<<<<
 *         raise ValueError("Can only discard comments in C14N serialisation")
 *     if encoding is _unicode or (encoding is not None and encoding.upper() == 'UNICODE'):
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_with_comments); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = (!__pyx_t_3);
  if (__pyx_t_2) {

    /* "src/lxml/lxml.etree.pyx":2835
 *         return _tostringC14N(element_or_tree, exclusive, with_comments)
 *     if not with_comments:
 *         raise ValueError("Can only discard comments in C14N serialisation")             # <<<<<<<<<<<<<<
 *     if encoding is _unicode or (encoding is not None and encoding.upper() == 'UNICODE'):
 *         if xml_declaration:
 */
    __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_123), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L9;
  }
  __pyx_L9:;

  /* "src/lxml/lxml.etree.pyx":2836
 *     if not with_comments:
 *         raise ValueError("Can only discard comments in C14N serialisation")
 *     if encoding is _unicode or (encoding is not None and encoding.upper() == 'UNICODE'):             # <<<<<<<<<<<<<<
 *         if xml_declaration:
 *             raise ValueError, \
 */
  __pyx_t_2 = (__pyx_v_encoding == __pyx_v_4lxml_5etree__unicode);
  if (!__pyx_t_2) {
    __pyx_t_3 = (__pyx_v_encoding != Py_None);
    if (__pyx_t_3) {
      __pyx_t_1 = PyObject_GetAttr(__pyx_v_encoding, __pyx_n_s__upper); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, ((PyObject *)__pyx_n_s__UNICODE), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_6 = __pyx_t_5;
    } else {
      __pyx_t_6 = __pyx_t_3;
    }
    __pyx_t_3 = __pyx_t_6;
  } else {
    __pyx_t_3 = __pyx_t_2;
  }
  if (__pyx_t_3) {

    /* "src/lxml/lxml.etree.pyx":2837
 *         raise ValueError("Can only discard comments in C14N serialisation")
 *     if encoding is _unicode or (encoding is not None and encoding.upper() == 'UNICODE'):
 *         if xml_declaration:             # <<<<<<<<<<<<<<
 *             raise ValueError, \
 *                 u"Serialisation to unicode must not request an XML declaration"
 */
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_xml_declaration); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_3) {

      /* "src/lxml/lxml.etree.pyx":2838
 *     if encoding is _unicode or (encoding is not None and encoding.upper() == 'UNICODE'):
 *         if xml_declaration:
 *             raise ValueError, \             # <<<<<<<<<<<<<<
 *                 u"Serialisation to unicode must not request an XML declaration"
 *         write_declaration = 0
 */
      __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_u_124), 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L11;
    }
    __pyx_L11:;

    /* "src/lxml/lxml.etree.pyx":2840
 *             raise ValueError, \
 *                 u"Serialisation to unicode must not request an XML declaration"
 *         write_declaration = 0             # <<<<<<<<<<<<<<
 *         encoding = _unicode
 *     elif xml_declaration is None:
 */
    __pyx_v_write_declaration = 0;

    /* "src/lxml/lxml.etree.pyx":2841
 *                 u"Serialisation to unicode must not request an XML declaration"
 *         write_declaration = 0
 *         encoding = _unicode             # <<<<<<<<<<<<<<
 *     elif xml_declaration is None:
 *         # by default, write an XML declaration only for non-standard encodings
 */
    __Pyx_INCREF(__pyx_v_4lxml_5etree__unicode);
    __Pyx_DECREF(__pyx_v_encoding);
    __pyx_v_encoding = __pyx_v_4lxml_5etree__unicode;
    goto __pyx_L10;
  }

  /* "src/lxml/lxml.etree.pyx":2842
 *         write_declaration = 0
 *         encoding = _unicode
 *     elif xml_declaration is None:             # <<<<<<<<<<<<<<
 *         # by default, write an XML declaration only for non-standard encodings
 *         write_declaration = encoding is not None and encoding.upper() not in \
 */
  __pyx_t_3 = (__pyx_v_xml_declaration == Py_None);
  if (__pyx_t_3) {

    /* "src/lxml/lxml.etree.pyx":2844
 *     elif xml_declaration is None:
 *         # by default, write an XML declaration only for non-standard encodings
 *         write_declaration = encoding is not None and encoding.upper() not in \             # <<<<<<<<<<<<<<
 *                             (u'ASCII', u'UTF-8', u'UTF8', u'US-ASCII')
 *     else:
 */
    __pyx_t_3 = (__pyx_v_encoding != Py_None);
    if (__pyx_t_3) {
      __pyx_t_1 = PyObject_GetAttr(__pyx_v_encoding, __pyx_n_s__upper); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_2 = __Pyx_PyUnicode_Equals(__pyx_t_4, ((PyObject *)__pyx_n_u__ASCII), Py_NE); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_6 = __pyx_t_2;
      if (__pyx_t_6) {
        __pyx_t_2 = __Pyx_PyUnicode_Equals(__pyx_t_4, ((PyObject *)__pyx_kp_u_31), Py_NE); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_5 = __pyx_t_2;
        __pyx_t_2 = __pyx_t_5;
      } else {
        __pyx_t_2 = __pyx_t_6;
      }
      if (__pyx_t_2) {
        __pyx_t_6 = __Pyx_PyUnicode_Equals(__pyx_t_4, ((PyObject *)__pyx_n_u__UTF8), Py_NE); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_5 = __pyx_t_6;
        __pyx_t_6 = __pyx_t_5;
      } else {
        __pyx_t_6 = __pyx_t_2;
      }
      if (__pyx_t_6) {
        __pyx_t_2 = __Pyx_PyUnicode_Equals(__pyx_t_4, ((PyObject *)__pyx_kp_u_100), Py_NE); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_5 = __pyx_t_2;
        __pyx_t_2 = __pyx_t_5;
      } else {
        __pyx_t_2 = __pyx_t_6;
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __pyx_t_2;
      __pyx_t_2 = __pyx_t_6;
    } else {
      __pyx_t_2 = __pyx_t_3;
    }
    __pyx_v_write_declaration = __pyx_t_2;
    goto __pyx_L10;
  }
  /*else*/ {

    /* "src/lxml/lxml.etree.pyx":2847
 *                             (u'ASCII', u'UTF-8', u'UTF8', u'US-ASCII')
 *     else:
 *         write_declaration = xml_declaration             # <<<<<<<<<<<<<<
 *     if encoding is None:
 *         encoding = u'ASCII'
 */
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_xml_declaration); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_write_declaration = __pyx_t_2;
  }
  __pyx_L10:;

  /* "src/lxml/lxml.etree.pyx":2848
 *     else:
 *         write_declaration = xml_declaration
 *     if encoding is None:             # <<<<<<<<<<<<<<
 *         encoding = u'ASCII'
 *     if standalone is None:
 */
  __pyx_t_2 = (__pyx_v_encoding == Py_None);
  if (__pyx_t_2) {

    /* "src/lxml/lxml.etree.pyx":2849
 *         write_declaration = xml_declaration
 *     if encoding is None:
 *         encoding = u'ASCII'             # <<<<<<<<<<<<<<
 *     if standalone is None:
 *         is_standalone = -1
 */
    __Pyx_INCREF(((PyObject *)__pyx_n_u__ASCII));
    __Pyx_DECREF(__pyx_v_encoding);
    __pyx_v_encoding = ((PyObject *)__pyx_n_u__ASCII);
    goto __pyx_L12;
  }
  __pyx_L12:;

  /* "src/lxml/lxml.etree.pyx":2850
 *     if encoding is None:
 *         encoding = u'ASCII'
 *     if standalone is None:             # <<<<<<<<<<<<<<
 *         is_standalone = -1
 *     elif standalone:
 */
  __pyx_t_2 = (__pyx_v_standalone == Py_None);
  if (__pyx_t_2) {

    /* "src/lxml/lxml.etree.pyx":2851
 *         encoding = u'ASCII'
 *     if standalone is None:
 *         is_standalone = -1             # <<<<<<<<<<<<<<
 *     elif standalone:
 *         write_declaration = 1
 */
    __pyx_v_is_standalone = -1;
    goto __pyx_L13;
  }

  /* "src/lxml/lxml.etree.pyx":2852
 *     if standalone is None:
 *         is_standalone = -1
 *     elif standalone:             # <<<<<<<<<<<<<<
 *         write_declaration = 1
 *         is_standalone = 1
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_standalone); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_2) {

    /* "src/lxml/lxml.etree.pyx":2853
 *         is_standalone = -1
 *     elif standalone:
 *         write_declaration = 1             # <<<<<<<<<<<<<<
 *         is_standalone = 1
 *     else:
 */
    __pyx_v_write_declaration = 1;

    /* "src/lxml/lxml.etree.pyx":2854
 *     elif standalone:
 *         write_declaration = 1
 *         is_standalone = 1             # <<<<<<<<<<<<<<
 *     else:
 *         write_declaration = 1
 */
    __pyx_v_is_standalone = 1;
    goto __pyx_L13;
  }
  /*else*/ {

    /* "src/lxml/lxml.etree.pyx":2856
 *         is_standalone = 1
 *     else:
 *         write_declaration = 1             # <<<<<<<<<<<<<<
 *         is_standalone = 0
 * 
 */
    __pyx_v_write_declaration = 1;

    /* "src/lxml/lxml.etree.pyx":2857
 *     else:
 *         write_declaration = 1
 *         is_standalone = 0             # <<<<<<<<<<<<<<
 * 
 *     if isinstance(element_or_tree, _Element):
 */
    __pyx_v_is_standalone = 0;
  }
  __pyx_L13:;

  /* "src/lxml/lxml.etree.pyx":2859
 *         is_standalone = 0
 * 
 *     if isinstance(element_or_tree, _Element):             # <<<<<<<<<<<<<<
 *         return _tostring(<_Element>element_or_tree, encoding, doctype, method,
 *                          write_declaration, 0, pretty_print, with_tail,
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_element_or_tree, ((PyObject*)__pyx_ptype_4lxml_5etree__Element)); 
  if (__pyx_t_2) {

    /* "src/lxml/lxml.etree.pyx":2860
 * 
 *     if isinstance(element_or_tree, _Element):
 *         return _tostring(<_Element>element_or_tree, encoding, doctype, method,             # <<<<<<<<<<<<<<
 *                          write_declaration, 0, pretty_print, with_tail,
 *                          is_standalone)
 */
    __Pyx_XDECREF(__pyx_r);

    /* "src/lxml/lxml.etree.pyx":2861
 *     if isinstance(element_or_tree, _Element):
 *         return _tostring(<_Element>element_or_tree, encoding, doctype, method,
 *                          write_declaration, 0, pretty_print, with_tail,             # <<<<<<<<<<<<<<
 *                          is_standalone)
 *     elif isinstance(element_or_tree, _ElementTree):
 */
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_pretty_print); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_with_tail); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "src/lxml/lxml.etree.pyx":2862
 *         return _tostring(<_Element>element_or_tree, encoding, doctype, method,
 *                          write_declaration, 0, pretty_print, with_tail,
 *                          is_standalone)             # <<<<<<<<<<<<<<
 *     elif isinstance(element_or_tree, _ElementTree):
 *         return _tostring((<_ElementTree>element_or_tree)._context_node,
 */
    __pyx_t_4 = __pyx_f_4lxml_5etree__tostring(((struct LxmlElement *)__pyx_v_element_or_tree), __pyx_v_encoding, __pyx_v_doctype, __pyx_v_method, __pyx_v_write_declaration, 0, __pyx_t_2, __pyx_t_3, __pyx_v_is_standalone); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
    goto __pyx_L14;
  }

  /* "src/lxml/lxml.etree.pyx":2863
 *                          write_declaration, 0, pretty_print, with_tail,
 *                          is_standalone)
 *     elif isinstance(element_or_tree, _ElementTree):             # <<<<<<<<<<<<<<
 *         return _tostring((<_ElementTree>element_or_tree)._context_node,
 *                          encoding, doctype, method, write_declaration, 1,
 */
  __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_element_or_tree, ((PyObject*)__pyx_ptype_4lxml_5etree__ElementTree)); 
  if (__pyx_t_3) {

    /* "src/lxml/lxml.etree.pyx":2864
 *                          is_standalone)
 *     elif isinstance(element_or_tree, _ElementTree):
 *         return _tostring((<_ElementTree>element_or_tree)._context_node,             # <<<<<<<<<<<<<<
 *                          encoding, doctype, method, write_declaration, 1,
 *                          pretty_print, with_tail, is_standalone)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = ((PyObject *)((struct LxmlElementTree *)__pyx_v_element_or_tree)->_context_node);
    __Pyx_INCREF(__pyx_t_4);

    /* "src/lxml/lxml.etree.pyx":2866
 *         return _tostring((<_ElementTree>element_or_tree)._context_node,
 *                          encoding, doctype, method, write_declaration, 1,
 *                          pretty_print, with_tail, is_standalone)             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError, u"Type '%s' cannot be serialized." % \
 */
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_pretty_print); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_with_tail); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = __pyx_f_4lxml_5etree__tostring(((struct LxmlElement *)__pyx_t_4), __pyx_v_encoding, __pyx_v_doctype, __pyx_v_method, __pyx_v_write_declaration, 1, __pyx_t_3, __pyx_t_2, __pyx_v_is_standalone); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    goto __pyx_L14;
  }
  /*else*/ {

    /* "src/lxml/lxml.etree.pyx":2869
 *     else:
 *         raise TypeError, u"Type '%s' cannot be serialized." % \
 *             python._fqtypename(element_or_tree)             # <<<<<<<<<<<<<<
 * 
 * def tostringlist(element_or_tree, *args, **kwargs):
 */
    __pyx_t_1 = PyBytes_FromString(_fqtypename(__pyx_v_element_or_tree)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2869; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_125), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_4), 0);
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L14:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.tostring");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_encoding);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2871
 *             python._fqtypename(element_or_tree)
 * 
 * def tostringlist(element_or_tree, *args, **kwargs):             # <<<<<<<<<<<<<<
 *     u"""tostringlist(element_or_tree, *args, **kwargs)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_16tostringlist(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_16tostringlist[] = "tostringlist(element_or_tree, *args, **kwargs)\n\n    Serialize an element to an encoded string representation of its XML\n    tree, stored in a list of partial strings.\n\n    This is purely for ElementTree 1.3 compatibility.  The result is a\n    single string wrapped in a list.\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_16tostringlist = {__Pyx_NAMESTR("tostringlist"), (PyCFunction)__pyx_pf_4lxml_5etree_16tostringlist, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_16tostringlist)};
static PyObject *__pyx_pf_4lxml_5etree_16tostringlist(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_element_or_tree = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kwargs = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__element_or_tree,0};
  __Pyx_RefNannySetupContext("tostringlist");
  __pyx_self = __pyx_self;
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  if (PyTuple_GET_SIZE(__pyx_args) > 1) {
    __pyx_v_args = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args)); __Pyx_GOTREF(__pyx_v_args);

    if (unlikely(!__pyx_v_args)) {
      __Pyx_DECREF(__pyx_v_kwargs);
      return NULL;
    }
  } else {
    __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[1] = {0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      default:
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__element_or_tree);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
    }
    if (unlikely(kw_args > 0)) {
      const Py_ssize_t used_pos_args = (PyTuple_GET_SIZE(__pyx_args) < 1) ? PyTuple_GET_SIZE(__pyx_args) : 1;
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, used_pos_args, "tostringlist") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2871; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_element_or_tree = values[0];
  } else if (PyTuple_GET_SIZE(__pyx_args) < 1) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_element_or_tree = PyTuple_GET_ITEM(__pyx_args, 0);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("tostringlist", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2871; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_args);
  __Pyx_DECREF(__pyx_v_kwargs);
  __Pyx_AddTraceback("lxml.etree.tostringlist");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "src/lxml/lxml.etree.pyx":2880
 *     single string wrapped in a list.
 *     """
 *     return [tostring(element_or_tree, *args, **kwargs)]             # <<<<<<<<<<<<<<
 * 
 * def tounicode(element_or_tree, *, method=u"xml", pretty_print=False,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__tostring); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(__pyx_v_element_or_tree);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_element_or_tree);
  __Pyx_GIVEREF(__pyx_v_element_or_tree);
  __pyx_t_3 = PySequence_Tuple(((PyObject *)__pyx_v_args)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_v_kwargs)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_r = ((PyObject *)__pyx_t_4);
  __pyx_t_4 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.tostringlist");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_args);
  __Pyx_DECREF(__pyx_v_kwargs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2882
 *     return [tostring(element_or_tree, *args, **kwargs)]
 * 
 * def tounicode(element_or_tree, *, method=u"xml", pretty_print=False,             # <<<<<<<<<<<<<<
 *               with_tail=True, doctype=None):
 *     u"""tounicode(element_or_tree, method="xml", pretty_print=False,
 */

static PyObject *__pyx_pf_4lxml_5etree_17tounicode(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_17tounicode[] = "tounicode(element_or_tree, method=\"xml\", pretty_print=False,\n                  with_tail=True, doctype=None)\n\n    Serialize an element to the Python unicode representation of its XML\n    tree.\n\n    :deprecated: use ``tostring(el, encoding=unicode)`` instead.\n\n    Note that the result does not carry an XML encoding declaration and is\n    therefore not necessarily suited for serialization to byte streams without\n    further treatment.\n\n    The boolean keyword argument 'pretty_print' enables formatted XML.\n\n    The keyword argument 'method' selects the output method: 'xml',\n    'html' or plain 'text'.\n\n    You can prevent the tail text of the element from being serialised\n    by passing the boolean ``with_tail`` option.  This has no impact\n    on the tail text of children, which will always be serialised.\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_17tounicode = {__Pyx_NAMESTR("tounicode"), (PyCFunction)__pyx_pf_4lxml_5etree_17tounicode, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_17tounicode)};
static PyObject *__pyx_pf_4lxml_5etree_17tounicode(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_element_or_tree = 0;
  PyObject *__pyx_v_method = 0;
  PyObject *__pyx_v_pretty_print = 0;
  PyObject *__pyx_v_with_tail = 0;
  PyObject *__pyx_v_doctype = 0;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__element_or_tree,&__pyx_n_s__method,&__pyx_n_s__pretty_print,&__pyx_n_s__with_tail,&__pyx_n_s__doctype,0};
  __Pyx_RefNannySetupContext("tounicode");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[5] = {0,0,0,0,0};
    values[1] = ((PyObject *)__pyx_n_u__xml);
    values[2] = __pyx_k_126;
    values[3] = __pyx_k_127;

    /* "src/lxml/lxml.etree.pyx":2883
 * 
 * def tounicode(element_or_tree, *, method=u"xml", pretty_print=False,
 *               with_tail=True, doctype=None):             # <<<<<<<<<<<<<<
 *     u"""tounicode(element_or_tree, method="xml", pretty_print=False,
 *                   with_tail=True, doctype=None)
 */
    values[4] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__element_or_tree);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
    }
    while (kw_args > 0) {
      PyObject* value;
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__method);
      if (value) { values[1] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pretty_print);
      if (value) { values[2] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__with_tail);
      if (value) { values[3] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__doctype);
      if (value) { values[4] = value; if (!(--kw_args)) break; }
      break;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "tounicode") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2882; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_element_or_tree = values[0];
    __pyx_v_method = values[1];
    __pyx_v_pretty_print = values[2];
    __pyx_v_with_tail = values[3];
    __pyx_v_doctype = values[4];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_element_or_tree = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_method = ((PyObject *)__pyx_n_u__xml);
    __pyx_v_pretty_print = __pyx_k_126;
    __pyx_v_with_tail = __pyx_k_127;
    __pyx_v_doctype = ((PyObject *)Py_None);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("tounicode", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2882; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.tounicode");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "src/lxml/lxml.etree.pyx":2905
 *     on the tail text of children, which will always be serialised.
 *     """
 *     if isinstance(element_or_tree, _Element):             # <<<<<<<<<<<<<<
 *         return _tostring(<_Element>element_or_tree, _unicode, doctype, method,
 *                           0, 0, pretty_print, with_tail, -1)
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_element_or_tree, ((PyObject*)__pyx_ptype_4lxml_5etree__Element)); 
  if (__pyx_t_1) {

    /* "src/lxml/lxml.etree.pyx":2906
 *     """
 *     if isinstance(element_or_tree, _Element):
 *         return _tostring(<_Element>element_or_tree, _unicode, doctype, method,             # <<<<<<<<<<<<<<
 *                           0, 0, pretty_print, with_tail, -1)
 *     elif isinstance(element_or_tree, _ElementTree):
 */
    __Pyx_XDECREF(__pyx_r);

    /* "src/lxml/lxml.etree.pyx":2907
 *     if isinstance(element_or_tree, _Element):
 *         return _tostring(<_Element>element_or_tree, _unicode, doctype, method,
 *                           0, 0, pretty_print, with_tail, -1)             # <<<<<<<<<<<<<<
 *     elif isinstance(element_or_tree, _ElementTree):
 *         return _tostring((<_ElementTree>element_or_tree)._context_node,
 */
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_pretty_print); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_with_tail); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = __pyx_f_4lxml_5etree__tostring(((struct LxmlElement *)__pyx_v_element_or_tree), __pyx_v_4lxml_5etree__unicode, __pyx_v_doctype, __pyx_v_method, 0, 0, __pyx_t_1, __pyx_t_2, -1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2906; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
    goto __pyx_L6;
  }

  /* "src/lxml/lxml.etree.pyx":2908
 *         return _tostring(<_Element>element_or_tree, _unicode, doctype, method,
 *                           0, 0, pretty_print, with_tail, -1)
 *     elif isinstance(element_or_tree, _ElementTree):             # <<<<<<<<<<<<<<
 *         return _tostring((<_ElementTree>element_or_tree)._context_node,
 *                          _unicode, doctype, method, 0, 1, pretty_print,
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_element_or_tree, ((PyObject*)__pyx_ptype_4lxml_5etree__ElementTree)); 
  if (__pyx_t_2) {

    /* "src/lxml/lxml.etree.pyx":2909
 *                           0, 0, pretty_print, with_tail, -1)
 *     elif isinstance(element_or_tree, _ElementTree):
 *         return _tostring((<_ElementTree>element_or_tree)._context_node,             # <<<<<<<<<<<<<<
 *                          _unicode, doctype, method, 0, 1, pretty_print,
 *                          with_tail, -1)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = ((PyObject *)((struct LxmlElementTree *)__pyx_v_element_or_tree)->_context_node);
    __Pyx_INCREF(__pyx_t_3);

    /* "src/lxml/lxml.etree.pyx":2910
 *     elif isinstance(element_or_tree, _ElementTree):
 *         return _tostring((<_ElementTree>element_or_tree)._context_node,
 *                          _unicode, doctype, method, 0, 1, pretty_print,             # <<<<<<<<<<<<<<
 *                          with_tail, -1)
 *     else:
 */
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_pretty_print); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2910; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "src/lxml/lxml.etree.pyx":2911
 *         return _tostring((<_ElementTree>element_or_tree)._context_node,
 *                          _unicode, doctype, method, 0, 1, pretty_print,
 *                          with_tail, -1)             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError, u"Type '%s' cannot be serialized." % \
 */
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_with_tail); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __pyx_f_4lxml_5etree__tostring(((struct LxmlElement *)__pyx_t_3), __pyx_v_4lxml_5etree__unicode, __pyx_v_doctype, __pyx_v_method, 0, 1, __pyx_t_2, __pyx_t_1, -1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "src/lxml/lxml.etree.pyx":2914
 *     else:
 *         raise TypeError, u"Type '%s' cannot be serialized." % \
 *             type(element_or_tree)             # <<<<<<<<<<<<<<
 * 
 * def parse(source, _BaseParser parser=None, *, base_url=None):
 */
    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_125), ((PyObject *)Py_TYPE(__pyx_v_element_or_tree))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2913; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_4), 0);
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2913; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L6:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.tounicode");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2916
 *             type(element_or_tree)
 * 
 * def parse(source, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     u"""parse(source, parser=None, base_url=None)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_18parse(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_18parse[] = "parse(source, parser=None, base_url=None)\n\n    Return an ElementTree object loaded with source elements.  If no parser\n    is provided as second argument, the default parser is used.\n\n    The ``source`` can be any of the following:\n\n    - a file name/path\n    - a file object\n    - a file-like object\n    - a URL using the HTTP or FTP protocol\n\n    To parse from a string, use the ``fromstring()`` function instead.\n\n    Note that it is generally faster to parse from a file path or URL\n    than from an open file object or file-like object.  Transparent\n    decompression from gzip compressed sources is supported (unless\n    explicitly disabled in libxml2).\n\n    The ``base_url`` keyword allows setting a URL for the document\n    when parsing from a file-like object.  This is needed when looking\n    up external entities (DTD, XInclude, ...) with relative paths.\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_18parse = {__Pyx_NAMESTR("parse"), (PyCFunction)__pyx_pf_4lxml_5etree_18parse, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_18parse)};
static PyObject *__pyx_pf_4lxml_5etree_18parse(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_source = 0;
  struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser = 0;
  PyObject *__pyx_v_base_url = 0;
  struct LxmlDocument *__pyx_v_doc;
  PyObject *__pyx_v_result_container;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__source,&__pyx_n_s__parser,&__pyx_n_s__base_url,0};
  __Pyx_RefNannySetupContext("parse");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    values[1] = (PyObject *)((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None);
    values[2] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__source);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parser);
        if (value) { values[1] = value; kw_args--; }
      }
    }
    while (kw_args > 0) {
      PyObject* value;
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__base_url);
      if (value) { values[2] = value; if (!(--kw_args)) break; }
      break;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "parse") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2916; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_source = values[0];
    __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)values[1]);
    __pyx_v_base_url = values[2];
  } else {
    __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None);
    __pyx_v_base_url = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)PyTuple_GET_ITEM(__pyx_args, 1));
      case  1: __pyx_v_source = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("parse", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2916; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.parse");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_doc = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_result_container = Py_None; __Pyx_INCREF(Py_None);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parser), __pyx_ptype_4lxml_5etree__BaseParser, 1, "parser", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":2941
 *     """
 *     cdef _Document doc
 *     try:             # <<<<<<<<<<<<<<
 *         doc = _parseDocument(source, parser, base_url)
 *         return _elementTreeFactory(doc, None)
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "src/lxml/lxml.etree.pyx":2942
 *     cdef _Document doc
 *     try:
 *         doc = _parseDocument(source, parser, base_url)             # <<<<<<<<<<<<<<
 *         return _elementTreeFactory(doc, None)
 *     except _TargetParserResult, result_container:
 */
      __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__parseDocument(__pyx_v_source, __pyx_v_parser, __pyx_v_base_url)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2942; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(((PyObject *)__pyx_v_doc));
      __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "src/lxml/lxml.etree.pyx":2943
 *     try:
 *         doc = _parseDocument(source, parser, base_url)
 *         return _elementTreeFactory(doc, None)             # <<<<<<<<<<<<<<
 *     except _TargetParserResult, result_container:
 *         return result_container.result
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__elementTreeFactory(__pyx_v_doc, ((struct LxmlElement *)Py_None))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2943; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L10_try_return;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L13_try_end;
    __pyx_L10_try_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;
    __pyx_L6_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "src/lxml/lxml.etree.pyx":2944
 *         doc = _parseDocument(source, parser, base_url)
 *         return _elementTreeFactory(doc, None)
 *     except _TargetParserResult, result_container:             # <<<<<<<<<<<<<<
 *         return result_container.result
 * 
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___TargetParserResult); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2944; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyErr_ExceptionMatches(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_2) {
      __Pyx_AddTraceback("lxml.etree.parse");
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2944; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_v_result_container);
      __pyx_v_result_container = __pyx_t_3;

      /* "src/lxml/lxml.etree.pyx":2945
 *         return _elementTreeFactory(doc, None)
 *     except _TargetParserResult, result_container:
 *         return result_container.result             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_5 = PyObject_GetAttr(__pyx_v_result_container, __pyx_n_s__result); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2945; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L9_except_return;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L7_exception_handled;
    }
    __pyx_L8_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L9_except_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;
    __pyx_L7_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L13_try_end:;
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.parse");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_doc);
  __Pyx_DECREF(__pyx_v_result_container);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":9
 *     cdef _ReadOnlyProxy _source_proxy
 *     cdef list _dependent_proxies
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._c_node = NULL
 *         self._free_after_use = 0
 */

static int __pyx_pf_4lxml_5etree_14_ReadOnlyProxy___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_14_ReadOnlyProxy___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("__cinit__");
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":10
 *     cdef list _dependent_proxies
 *     def __cinit__(self):
 *         self._c_node = NULL             # <<<<<<<<<<<<<<
 *         self._free_after_use = 0
 * 
 */
  ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)->_c_node = NULL;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":11
 *     def __cinit__(self):
 *         self._c_node = NULL
 *         self._free_after_use = 0             # <<<<<<<<<<<<<<
 * 
 *     cdef int _assertNode(self) except -1:
 */
  ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)->_free_after_use = 0;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":13
 *         self._free_after_use = 0
 * 
 *     cdef int _assertNode(self) except -1:             # <<<<<<<<<<<<<<
 *         u"""This is our way of saying: this proxy is invalid!
 *         """
 */

static  int __pyx_f_4lxml_5etree_14_ReadOnlyProxy__assertNode(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("_assertNode");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":16
 *         u"""This is our way of saying: this proxy is invalid!
 *         """
 *         assert self._c_node is not NULL, u"Proxy invalidated!"             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!(__pyx_v_self->_c_node != NULL))) {
    PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_u_128));
    {__pyx_filename = __pyx_f[8]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":17
 *         """
 *         assert self._c_node is not NULL, u"Proxy invalidated!"
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cdef int _raise_unsupported_type(self):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy._assertNode");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":19
 *         return 0
 * 
 *     cdef int _raise_unsupported_type(self):             # <<<<<<<<<<<<<<
 *         raise TypeError("Unsupported node type: %d" % self._c_node.type)
 * 
 */

static  int __pyx_f_4lxml_5etree_14_ReadOnlyProxy__raise_unsupported_type(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self) {
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_raise_unsupported_type");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":20
 * 
 *     cdef int _raise_unsupported_type(self):
 *         raise TypeError("Unsupported node type: %d" % self._c_node.type)             # <<<<<<<<<<<<<<
 * 
 *     cdef void free_after_use(self):
 */
  __pyx_t_1 = PyInt_FromLong(__pyx_v_self->_c_node->type); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_129), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_2));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_Raise(__pyx_t_2, 0, 0);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  {__pyx_filename = __pyx_f[8]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_WriteUnraisable("lxml.etree._ReadOnlyProxy._raise_unsupported_type");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":22
 *         raise TypeError("Unsupported node type: %d" % self._c_node.type)
 * 
 *     cdef void free_after_use(self):             # <<<<<<<<<<<<<<
 *         u"""Should the xmlNode* be freed when releasing the proxy?
 *         """
 */

static  void __pyx_f_4lxml_5etree_14_ReadOnlyProxy_free_after_use(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self) {
  __Pyx_RefNannySetupContext("free_after_use");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":25
 *         u"""Should the xmlNode* be freed when releasing the proxy?
 *         """
 *         self._free_after_use = 1             # <<<<<<<<<<<<<<
 * 
 *     property tag:
 */
  __pyx_v_self->_free_after_use = 1;

  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":30
 *         u"""Element tag
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self._assertNode()
 *             if self._c_node.type == tree.XML_ELEMENT_NODE:
 */

static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_3tag___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_3tag___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__get__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":31
 *         """
 *         def __get__(self):
 *             self._assertNode()             # <<<<<<<<<<<<<<
 *             if self._c_node.type == tree.XML_ELEMENT_NODE:
 *                 return _namespacedName(self._c_node)
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)->__pyx_vtab)->_assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":32
 *         def __get__(self):
 *             self._assertNode()
 *             if self._c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *                 return _namespacedName(self._c_node)
 *             elif self._c_node.type == tree.XML_PI_NODE:
 */
  __pyx_t_2 = (((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)->_c_node->type == XML_ELEMENT_NODE);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":33
 *             self._assertNode()
 *             if self._c_node.type == tree.XML_ELEMENT_NODE:
 *                 return _namespacedName(self._c_node)             # <<<<<<<<<<<<<<
 *             elif self._c_node.type == tree.XML_PI_NODE:
 *                 return ProcessingInstruction
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __pyx_f_4lxml_5etree__namespacedName(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)->_c_node); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":34
 *             if self._c_node.type == tree.XML_ELEMENT_NODE:
 *                 return _namespacedName(self._c_node)
 *             elif self._c_node.type == tree.XML_PI_NODE:             # <<<<<<<<<<<<<<
 *                 return ProcessingInstruction
 *             elif self._c_node.type == tree.XML_COMMENT_NODE:
 */
  __pyx_t_2 = (((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)->_c_node->type == XML_PI_NODE);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":35
 *                 return _namespacedName(self._c_node)
 *             elif self._c_node.type == tree.XML_PI_NODE:
 *                 return ProcessingInstruction             # <<<<<<<<<<<<<<
 *             elif self._c_node.type == tree.XML_COMMENT_NODE:
 *                 return Comment
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s_79); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":36
 *             elif self._c_node.type == tree.XML_PI_NODE:
 *                 return ProcessingInstruction
 *             elif self._c_node.type == tree.XML_COMMENT_NODE:             # <<<<<<<<<<<<<<
 *                 return Comment
 *             elif self._c_node.type == tree.XML_ENTITY_REF_NODE:
 */
  __pyx_t_2 = (((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)->_c_node->type == XML_COMMENT_NODE);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":37
 *                 return ProcessingInstruction
 *             elif self._c_node.type == tree.XML_COMMENT_NODE:
 *                 return Comment             # <<<<<<<<<<<<<<
 *             elif self._c_node.type == tree.XML_ENTITY_REF_NODE:
 *                 return Entity
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__Comment); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":38
 *             elif self._c_node.type == tree.XML_COMMENT_NODE:
 *                 return Comment
 *             elif self._c_node.type == tree.XML_ENTITY_REF_NODE:             # <<<<<<<<<<<<<<
 *                 return Entity
 *             else:
 */
  __pyx_t_2 = (((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)->_c_node->type == XML_ENTITY_REF_NODE);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":39
 *                 return Comment
 *             elif self._c_node.type == tree.XML_ENTITY_REF_NODE:
 *                 return Entity             # <<<<<<<<<<<<<<
 *             else:
 *                 self._raise_unsupported_type()
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__Entity); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":41
 *                 return Entity
 *             else:
 *                 self._raise_unsupported_type()             # <<<<<<<<<<<<<<
 * 
 *     property text:
 */
    ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)->__pyx_vtab)->_raise_unsupported_type(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self));
  }
  __pyx_L5:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.tag.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":47
 *         the value None, if there was no text.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self._assertNode()
 *             if self._c_node.type == tree.XML_ELEMENT_NODE:
 */

static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_4text___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_4text___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  xmlElementType __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("__get__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":48
 *         """
 *         def __get__(self):
 *             self._assertNode()             # <<<<<<<<<<<<<<
 *             if self._c_node.type == tree.XML_ELEMENT_NODE:
 *                 return _collectText(self._c_node.children)
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)->__pyx_vtab)->_assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":49
 *         def __get__(self):
 *             self._assertNode()
 *             if self._c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *                 return _collectText(self._c_node.children)
 *             elif self._c_node.type in (tree.XML_PI_NODE,
 */
  __pyx_t_2 = (((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)->_c_node->type == XML_ELEMENT_NODE);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":50
 *             self._assertNode()
 *             if self._c_node.type == tree.XML_ELEMENT_NODE:
 *                 return _collectText(self._c_node.children)             # <<<<<<<<<<<<<<
 *             elif self._c_node.type in (tree.XML_PI_NODE,
 *                                        tree.XML_COMMENT_NODE):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __pyx_f_4lxml_5etree__collectText(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)->_c_node->children); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":51
 *             if self._c_node.type == tree.XML_ELEMENT_NODE:
 *                 return _collectText(self._c_node.children)
 *             elif self._c_node.type in (tree.XML_PI_NODE,             # <<<<<<<<<<<<<<
 *                                        tree.XML_COMMENT_NODE):
 *                 if self._c_node.content is NULL:
 */
  __pyx_t_4 = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)->_c_node->type;
  __pyx_t_2 = (__pyx_t_4 == XML_PI_NODE);
  if (!__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":52
 *                 return _collectText(self._c_node.children)
 *             elif self._c_node.type in (tree.XML_PI_NODE,
 *                                        tree.XML_COMMENT_NODE):             # <<<<<<<<<<<<<<
 *                 if self._c_node.content is NULL:
 *                     return ''
 */
    __pyx_t_5 = (__pyx_t_4 == XML_COMMENT_NODE);
    __pyx_t_6 = __pyx_t_5;
  } else {
    __pyx_t_6 = __pyx_t_2;
  }
  __pyx_t_2 = __pyx_t_6;
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":53
 *             elif self._c_node.type in (tree.XML_PI_NODE,
 *                                        tree.XML_COMMENT_NODE):
 *                 if self._c_node.content is NULL:             # <<<<<<<<<<<<<<
 *                     return ''
 *                 else:
 */
    __pyx_t_2 = (((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)->_c_node->content == NULL);
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":54
 *                                        tree.XML_COMMENT_NODE):
 *                 if self._c_node.content is NULL:
 *                     return ''             # <<<<<<<<<<<<<<
 *                 else:
 *                     return funicode(self._c_node.content)
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_kp_s_25));
      __pyx_r = ((PyObject *)__pyx_kp_s_25);
      goto __pyx_L0;
      goto __pyx_L6;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":56
 *                     return ''
 *                 else:
 *                     return funicode(self._c_node.content)             # <<<<<<<<<<<<<<
 *             elif self._c_node.type == tree.XML_ENTITY_REF_NODE:
 *                 return u'&%s;' % funicode(self._c_node.name)
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)->_c_node->content); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L0;
    }
    __pyx_L6:;
    goto __pyx_L5;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":57
 *                 else:
 *                     return funicode(self._c_node.content)
 *             elif self._c_node.type == tree.XML_ENTITY_REF_NODE:             # <<<<<<<<<<<<<<
 *                 return u'&%s;' % funicode(self._c_node.name)
 *             else:
 */
  __pyx_t_2 = (((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)->_c_node->type == XML_ENTITY_REF_NODE);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":58
 *                     return funicode(self._c_node.content)
 *             elif self._c_node.type == tree.XML_ENTITY_REF_NODE:
 *                 return u'&%s;' % funicode(self._c_node.name)             # <<<<<<<<<<<<<<
 *             else:
 *                 self._raise_unsupported_type()
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)->_c_node->name); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_85), __pyx_t_3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_7));
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = ((PyObject *)__pyx_t_7);
    __pyx_t_7 = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":60
 *                 return u'&%s;' % funicode(self._c_node.name)
 *             else:
 *                 self._raise_unsupported_type()             # <<<<<<<<<<<<<<
 * 
 *     property tail:
 */
    ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)->__pyx_vtab)->_raise_unsupported_type(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self));
  }
  __pyx_L5:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.text.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":67
 *         there was no text.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self._assertNode()
 *             return _collectText(self._c_node.next)
 */

static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_4tail___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_4tail___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__get__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":68
 *         """
 *         def __get__(self):
 *             self._assertNode()             # <<<<<<<<<<<<<<
 *             return _collectText(self._c_node.next)
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)->__pyx_vtab)->_assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":69
 *         def __get__(self):
 *             self._assertNode()
 *             return _collectText(self._c_node.next)             # <<<<<<<<<<<<<<
 * 
 *     property sourceline:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree__collectText(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)->_c_node->next); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.tail.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":74
 *         u"""Original line number as found by the parser or None if unknown.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef long line
 *             self._assertNode()
 */

static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_10sourceline___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_10sourceline___get__(PyObject *__pyx_v_self) {
  long __pyx_v_line;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__get__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":76
 *         def __get__(self):
 *             cdef long line
 *             self._assertNode()             # <<<<<<<<<<<<<<
 *             line = tree.xmlGetLineNo(self._c_node)
 *             if line > 0:
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)->__pyx_vtab)->_assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":77
 *             cdef long line
 *             self._assertNode()
 *             line = tree.xmlGetLineNo(self._c_node)             # <<<<<<<<<<<<<<
 *             if line > 0:
 *                 return line
 */
  __pyx_v_line = xmlGetLineNo(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)->_c_node);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":78
 *             self._assertNode()
 *             line = tree.xmlGetLineNo(self._c_node)
 *             if line > 0:             # <<<<<<<<<<<<<<
 *                 return line
 *             else:
 */
  __pyx_t_2 = (__pyx_v_line > 0);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":79
 *             line = tree.xmlGetLineNo(self._c_node)
 *             if line > 0:
 *                 return line             # <<<<<<<<<<<<<<
 *             else:
 *                 return None
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = PyInt_FromLong(__pyx_v_line); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":81
 *                 return line
 *             else:
 *                 return None             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }
  __pyx_L5:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.sourceline.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":83
 *                 return None
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         self._assertNode()
 *         if self._c_node.type == tree.XML_ELEMENT_NODE:
 */

static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_1__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_1__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_v_text;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__repr__");
  __pyx_v_text = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":84
 * 
 *     def __repr__(self):
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         if self._c_node.type == tree.XML_ELEMENT_NODE:
 *             return u"<Element %s at 0x%x>" % (self.tag, id(self))
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)->__pyx_vtab)->_assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":85
 *     def __repr__(self):
 *         self._assertNode()
 *         if self._c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *             return u"<Element %s at 0x%x>" % (self.tag, id(self))
 *         elif self._c_node.type == tree.XML_COMMENT_NODE:
 */
  __pyx_t_2 = (((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)->_c_node->type == XML_ELEMENT_NODE);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":86
 *         self._assertNode()
 *         if self._c_node.type == tree.XML_ELEMENT_NODE:
 *             return u"<Element %s at 0x%x>" % (self.tag, id(self))             # <<<<<<<<<<<<<<
 *         elif self._c_node.type == tree.XML_COMMENT_NODE:
 *             return u"<!--%s-->" % self.text
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__tag); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_INCREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    __pyx_t_5 = PyObject_Call(__pyx_builtin_id, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_3 = 0;
    __pyx_t_5 = 0;
    __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_69), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __pyx_r = ((PyObject *)__pyx_t_5);
    __pyx_t_5 = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":87
 *         if self._c_node.type == tree.XML_ELEMENT_NODE:
 *             return u"<Element %s at 0x%x>" % (self.tag, id(self))
 *         elif self._c_node.type == tree.XML_COMMENT_NODE:             # <<<<<<<<<<<<<<
 *             return u"<!--%s-->" % self.text
 *         elif self._c_node.type == tree.XML_ENTITY_NODE:
 */
  __pyx_t_2 = (((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)->_c_node->type == XML_COMMENT_NODE);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":88
 *             return u"<Element %s at 0x%x>" % (self.tag, id(self))
 *         elif self._c_node.type == tree.XML_COMMENT_NODE:
 *             return u"<!--%s-->" % self.text             # <<<<<<<<<<<<<<
 *         elif self._c_node.type == tree.XML_ENTITY_NODE:
 *             return u"&%s;" % funicode(self._c_node.name)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__text); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_78), __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_r = ((PyObject *)__pyx_t_4);
    __pyx_t_4 = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":89
 *         elif self._c_node.type == tree.XML_COMMENT_NODE:
 *             return u"<!--%s-->" % self.text
 *         elif self._c_node.type == tree.XML_ENTITY_NODE:             # <<<<<<<<<<<<<<
 *             return u"&%s;" % funicode(self._c_node.name)
 *         elif self._c_node.type == tree.XML_PI_NODE:
 */
  __pyx_t_2 = (((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)->_c_node->type == XML_ENTITY_NODE);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":90
 *             return u"<!--%s-->" % self.text
 *         elif self._c_node.type == tree.XML_ENTITY_NODE:
 *             return u"&%s;" % funicode(self._c_node.name)             # <<<<<<<<<<<<<<
 *         elif self._c_node.type == tree.XML_PI_NODE:
 *             text = self.text
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __pyx_f_4lxml_5etree_funicode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)->_c_node->name); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_85), __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = ((PyObject *)__pyx_t_5);
    __pyx_t_5 = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":91
 *         elif self._c_node.type == tree.XML_ENTITY_NODE:
 *             return u"&%s;" % funicode(self._c_node.name)
 *         elif self._c_node.type == tree.XML_PI_NODE:             # <<<<<<<<<<<<<<
 *             text = self.text
 *             if text:
 */
  __pyx_t_2 = (((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)->_c_node->type == XML_PI_NODE);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":92
 *             return u"&%s;" % funicode(self._c_node.name)
 *         elif self._c_node.type == tree.XML_PI_NODE:
 *             text = self.text             # <<<<<<<<<<<<<<
 *             if text:
 *                 return u"<?%s %s?>" % (self.target, text)
 */
    __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__text); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_v_text);
    __pyx_v_text = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":93
 *         elif self._c_node.type == tree.XML_PI_NODE:
 *             text = self.text
 *             if text:             # <<<<<<<<<<<<<<
 *                 return u"<?%s %s?>" % (self.target, text)
 *             else:
 */
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_text); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":94
 *             text = self.text
 *             if text:
 *                 return u"<?%s %s?>" % (self.target, text)             # <<<<<<<<<<<<<<
 *             else:
 *                 return u"<?%s?>" % self.target
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__target); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_v_text);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_text);
      __Pyx_GIVEREF(__pyx_v_text);
      __pyx_t_5 = 0;
      __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_80), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __pyx_r = ((PyObject *)__pyx_t_5);
      __pyx_t_5 = 0;
      goto __pyx_L0;
      goto __pyx_L6;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":96
 *                 return u"<?%s %s?>" % (self.target, text)
 *             else:
 *                 return u"<?%s?>" % self.target             # <<<<<<<<<<<<<<
 *         else:
 *             self._raise_unsupported_type()
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__target); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_81), __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_r = ((PyObject *)__pyx_t_4);
      __pyx_t_4 = 0;
      goto __pyx_L0;
    }
    __pyx_L6:;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":98
 *                 return u"<?%s?>" % self.target
 *         else:
 *             self._raise_unsupported_type()             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, x):
 */
    ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)->__pyx_vtab)->_raise_unsupported_type(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self));
  }
  __pyx_L5:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.__repr__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_text);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":100
 *             self._raise_unsupported_type()
 * 
 *     def __getitem__(self, x):             # <<<<<<<<<<<<<<
 *         u"""Returns the subelement at the given position or the requested
 *         slice.
 */

static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_2__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_4lxml_5etree_14_ReadOnlyProxy_2__getitem__[] = "Returns the subelement at the given position or the requested\n        slice.\n        ";
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_14_ReadOnlyProxy_2__getitem__;
static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_2__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  xmlNode *__pyx_v_c_node;
  Py_ssize_t __pyx_v_step;
  Py_ssize_t __pyx_v_slicelength;
  Py_ssize_t __pyx_v_c;
  Py_ssize_t __pyx_v_i;
  _node_to_node_function __pyx_v_next_element;
  PyObject *__pyx_v_result;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  __Pyx_RefNannySetupContext("__getitem__");
  __pyx_v_result = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":109
 *         cdef _node_to_node_function next_element
 *         cdef list result
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         if python.PySlice_Check(x):
 *             # slicing
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)->__pyx_vtab)->_assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":110
 *         cdef list result
 *         self._assertNode()
 *         if python.PySlice_Check(x):             # <<<<<<<<<<<<<<
 *             # slicing
 *             if _isFullSlice(<slice>x):
 */
  __pyx_t_2 = PySlice_Check(__pyx_v_x);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":112
 *         if python.PySlice_Check(x):
 *             # slicing
 *             if _isFullSlice(<slice>x):             # <<<<<<<<<<<<<<
 *                 return _collectChildren(self)
 *             _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree__isFullSlice(((PyObject*)__pyx_v_x));
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":113
 *             # slicing
 *             if _isFullSlice(<slice>x):
 *                 return _collectChildren(self)             # <<<<<<<<<<<<<<
 *             _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)
 *             if c_node is NULL:
 */
      __Pyx_XDECREF(__pyx_r);
      if (!(likely(((__pyx_v_self) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_self, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_3 = __pyx_f_4lxml_5etree__collectChildren(((struct LxmlElement *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L0;
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":114
 *             if _isFullSlice(<slice>x):
 *                 return _collectChildren(self)
 *             _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)             # <<<<<<<<<<<<<<
 *             if c_node is NULL:
 *                 return []
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree__findChildSlice(((PyObject*)__pyx_v_x), ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)->_c_node, (&__pyx_v_c_node), (&__pyx_v_step), (&__pyx_v_slicelength)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":115
 *                 return _collectChildren(self)
 *             _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)
 *             if c_node is NULL:             # <<<<<<<<<<<<<<
 *                 return []
 *             if step > 0:
 */
    __pyx_t_2 = (__pyx_v_c_node == NULL);
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":116
 *             _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)
 *             if c_node is NULL:
 *                 return []             # <<<<<<<<<<<<<<
 *             if step > 0:
 *                 next_element = _nextElement
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
      __pyx_r = ((PyObject *)__pyx_t_3);
      __pyx_t_3 = 0;
      goto __pyx_L0;
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":117
 *             if c_node is NULL:
 *                 return []
 *             if step > 0:             # <<<<<<<<<<<<<<
 *                 next_element = _nextElement
 *             else:
 */
    __pyx_t_2 = (__pyx_v_step > 0);
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":118
 *                 return []
 *             if step > 0:
 *                 next_element = _nextElement             # <<<<<<<<<<<<<<
 *             else:
 *                 step = -step
 */
      __pyx_v_next_element = __pyx_f_4lxml_5etree__nextElement;
      goto __pyx_L8;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":120
 *                 next_element = _nextElement
 *             else:
 *                 step = -step             # <<<<<<<<<<<<<<
 *                 next_element = _previousElement
 *             result = []
 */
      __pyx_v_step = (-__pyx_v_step);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":121
 *             else:
 *                 step = -step
 *                 next_element = _previousElement             # <<<<<<<<<<<<<<
 *             result = []
 *             c = 0
 */
      __pyx_v_next_element = __pyx_f_4lxml_5etree__previousElement;
    }
    __pyx_L8:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":122
 *                 step = -step
 *                 next_element = _previousElement
 *             result = []             # <<<<<<<<<<<<<<
 *             c = 0
 *             while c_node is not NULL and c < slicelength:
 */
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_DECREF(((PyObject *)__pyx_v_result));
    __pyx_v_result = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":123
 *                 next_element = _previousElement
 *             result = []
 *             c = 0             # <<<<<<<<<<<<<<
 *             while c_node is not NULL and c < slicelength:
 *                 result.append(_newReadOnlyProxy(self._source_proxy, c_node))
 */
    __pyx_v_c = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":124
 *             result = []
 *             c = 0
 *             while c_node is not NULL and c < slicelength:             # <<<<<<<<<<<<<<
 *                 result.append(_newReadOnlyProxy(self._source_proxy, c_node))
 *                 result.append(_elementFactory(self._doc, c_node))
 */
    while (1) {
      __pyx_t_2 = (__pyx_v_c_node != NULL);
      if (__pyx_t_2) {
        __pyx_t_4 = (__pyx_v_c < __pyx_v_slicelength);
        __pyx_t_5 = __pyx_t_4;
      } else {
        __pyx_t_5 = __pyx_t_2;
      }
      if (!__pyx_t_5) break;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":125
 *             c = 0
 *             while c_node is not NULL and c < slicelength:
 *                 result.append(_newReadOnlyProxy(self._source_proxy, c_node))             # <<<<<<<<<<<<<<
 *                 result.append(_elementFactory(self._doc, c_node))
 *                 c = c + 1
 */
      if (unlikely(__pyx_v_result == Py_None)) {
        PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
      }
      __pyx_t_3 = ((PyObject *)((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)->_source_proxy);
      __Pyx_INCREF(__pyx_t_3);
      __pyx_t_6 = ((PyObject *)__pyx_f_4lxml_5etree__newReadOnlyProxy(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_3), __pyx_v_c_node)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_1 = PyList_Append(__pyx_v_result, __pyx_t_6); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":126
 *             while c_node is not NULL and c < slicelength:
 *                 result.append(_newReadOnlyProxy(self._source_proxy, c_node))
 *                 result.append(_elementFactory(self._doc, c_node))             # <<<<<<<<<<<<<<
 *                 c = c + 1
 *                 for i from 0 <= i < step:
 */
      if (unlikely(__pyx_v_result == Py_None)) {
        PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
      }
      __pyx_t_6 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___doc); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_4lxml_5etree__Document))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_6), __pyx_v_c_node)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_1 = PyList_Append(__pyx_v_result, __pyx_t_3); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":127
 *                 result.append(_newReadOnlyProxy(self._source_proxy, c_node))
 *                 result.append(_elementFactory(self._doc, c_node))
 *                 c = c + 1             # <<<<<<<<<<<<<<
 *                 for i from 0 <= i < step:
 *                     c_node = next_element(c_node)
 */
      __pyx_v_c = (__pyx_v_c + 1);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":128
 *                 result.append(_elementFactory(self._doc, c_node))
 *                 c = c + 1
 *                 for i from 0 <= i < step:             # <<<<<<<<<<<<<<
 *                     c_node = next_element(c_node)
 *             return result
 */
      __pyx_t_7 = __pyx_v_step;
      for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_7; __pyx_v_i++) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":129
 *                 c = c + 1
 *                 for i from 0 <= i < step:
 *                     c_node = next_element(c_node)             # <<<<<<<<<<<<<<
 *             return result
 *         else:
 */
        __pyx_v_c_node = __pyx_v_next_element(__pyx_v_c_node);
      }
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":130
 *                 for i from 0 <= i < step:
 *                     c_node = next_element(c_node)
 *             return result             # <<<<<<<<<<<<<<
 *         else:
 *             # indexing
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_result));
    __pyx_r = ((PyObject *)__pyx_v_result);
    goto __pyx_L0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":133
 *         else:
 *             # indexing
 *             c_node = _findChild(self._c_node, x)             # <<<<<<<<<<<<<<
 *             if c_node is NULL:
 *                 raise IndexError, u"list index out of range"
 */
    __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_x); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_c_node = __pyx_f_4lxml_5etree__findChild(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)->_c_node, __pyx_t_7);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":134
 *             # indexing
 *             c_node = _findChild(self._c_node, x)
 *             if c_node is NULL:             # <<<<<<<<<<<<<<
 *                 raise IndexError, u"list index out of range"
 *             return _newReadOnlyProxy(self._source_proxy, c_node)
 */
    __pyx_t_5 = (__pyx_v_c_node == NULL);
    if (__pyx_t_5) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":135
 *             c_node = _findChild(self._c_node, x)
 *             if c_node is NULL:
 *                 raise IndexError, u"list index out of range"             # <<<<<<<<<<<<<<
 *             return _newReadOnlyProxy(self._source_proxy, c_node)
 * 
 */
      __Pyx_Raise(__pyx_builtin_IndexError, ((PyObject *)__pyx_kp_u_65), 0);
      {__pyx_filename = __pyx_f[8]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L13;
    }
    __pyx_L13:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":136
 *             if c_node is NULL:
 *                 raise IndexError, u"list index out of range"
 *             return _newReadOnlyProxy(self._source_proxy, c_node)             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = ((PyObject *)((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)->_source_proxy);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_6 = ((PyObject *)__pyx_f_4lxml_5etree__newReadOnlyProxy(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_3), __pyx_v_c_node)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L0;
  }
  __pyx_L5:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.__getitem__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":138
 *             return _newReadOnlyProxy(self._source_proxy, c_node)
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         u"""Returns the number of subelements.
 *         """
 */

static Py_ssize_t __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_3__len__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_4lxml_5etree_14_ReadOnlyProxy_3__len__[] = "Returns the number of subelements.\n        ";
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_14_ReadOnlyProxy_3__len__;
static Py_ssize_t __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_3__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_v_c;
  xmlNode *__pyx_v_c_node;
  Py_ssize_t __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("__len__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":143
 *         cdef Py_ssize_t c
 *         cdef xmlNode* c_node
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         c = 0
 *         c_node = self._c_node.children
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)->__pyx_vtab)->_assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":144
 *         cdef xmlNode* c_node
 *         self._assertNode()
 *         c = 0             # <<<<<<<<<<<<<<
 *         c_node = self._c_node.children
 *         while c_node is not NULL:
 */
  __pyx_v_c = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":145
 *         self._assertNode()
 *         c = 0
 *         c_node = self._c_node.children             # <<<<<<<<<<<<<<
 *         while c_node is not NULL:
 *             if tree._isElement(c_node):
 */
  __pyx_v_c_node = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)->_c_node->children;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":146
 *         c = 0
 *         c_node = self._c_node.children
 *         while c_node is not NULL:             # <<<<<<<<<<<<<<
 *             if tree._isElement(c_node):
 *                 c = c + 1
 */
  while (1) {
    __pyx_t_2 = (__pyx_v_c_node != NULL);
    if (!__pyx_t_2) break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":147
 *         c_node = self._c_node.children
 *         while c_node is not NULL:
 *             if tree._isElement(c_node):             # <<<<<<<<<<<<<<
 *                 c = c + 1
 *             c_node = c_node.next
 */
    __pyx_t_2 = _isElement(__pyx_v_c_node);
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":148
 *         while c_node is not NULL:
 *             if tree._isElement(c_node):
 *                 c = c + 1             # <<<<<<<<<<<<<<
 *             c_node = c_node.next
 *         return c
 */
      __pyx_v_c = (__pyx_v_c + 1);
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":149
 *             if tree._isElement(c_node):
 *                 c = c + 1
 *             c_node = c_node.next             # <<<<<<<<<<<<<<
 *         return c
 * 
 */
    __pyx_v_c_node = __pyx_v_c_node->next;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":150
 *                 c = c + 1
 *             c_node = c_node.next
 *         return c             # <<<<<<<<<<<<<<
 * 
 *     def __nonzero__(self):
 */
  __pyx_r = __pyx_v_c;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.__len__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":152
 *         return c
 * 
 *     def __nonzero__(self):             # <<<<<<<<<<<<<<
 *         cdef xmlNode* c_node
 *         self._assertNode()
 */

static int __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_4__nonzero__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_4__nonzero__(PyObject *__pyx_v_self) {
  xmlNode *__pyx_v_c_node;
  int __pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__nonzero__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":154
 *     def __nonzero__(self):
 *         cdef xmlNode* c_node
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         c_node = _findChildBackwards(self._c_node, 0)
 *         return c_node != NULL
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)->__pyx_vtab)->_assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":155
 *         cdef xmlNode* c_node
 *         self._assertNode()
 *         c_node = _findChildBackwards(self._c_node, 0)             # <<<<<<<<<<<<<<
 *         return c_node != NULL
 * 
 */
  __pyx_v_c_node = __pyx_f_4lxml_5etree__findChildBackwards(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)->_c_node, 0);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":156
 *         self._assertNode()
 *         c_node = _findChildBackwards(self._c_node, 0)
 *         return c_node != NULL             # <<<<<<<<<<<<<<
 * 
 *     def __deepcopy__(self, memo):
 */
  __pyx_r = (__pyx_v_c_node != NULL);
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.__nonzero__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":158
 *         return c_node != NULL
 * 
 *     def __deepcopy__(self, memo):             # <<<<<<<<<<<<<<
 *         u"__deepcopy__(self, memo)"
 *         return self.__copy__()
 */

static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_5__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo); /*proto*/
static char __pyx_doc_4lxml_5etree_14_ReadOnlyProxy_5__deepcopy__[] = "__deepcopy__(self, memo)";
static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_5__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__deepcopy__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":160
 *     def __deepcopy__(self, memo):
 *         u"__deepcopy__(self, memo)"
 *         return self.__copy__()             # <<<<<<<<<<<<<<
 * 
 *     cpdef __copy__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)->__pyx_vtab)->__copy__(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.__deepcopy__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":162
 *         return self.__copy__()
 * 
 *     cpdef __copy__(self):             # <<<<<<<<<<<<<<
 *         u"__copy__(self)"
 *         cdef xmlDoc* c_doc
 */

static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_6__copy__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static  PyObject *__pyx_f_4lxml_5etree_14_ReadOnlyProxy___copy__(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self, int __pyx_skip_dispatch) {
  xmlDoc *__pyx_v_c_doc;
  xmlNode *__pyx_v_c_node;
  struct LxmlDocument *__pyx_v_new_doc;
  PyObject *__pyx_v_root;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  xmlDoc *__pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("__copy__");
  __pyx_v_new_doc = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_root = Py_None; __Pyx_INCREF(Py_None);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s____copy__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_6__copy__)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":167
 *         cdef xmlNode* c_node
 *         cdef _Document new_doc
 *         if self._c_node is NULL:             # <<<<<<<<<<<<<<
 *             return self
 *         c_doc = _copyDocRoot(self._c_node.doc, self._c_node) # recursive
 */
  __pyx_t_3 = (__pyx_v_self->_c_node == NULL);
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":168
 *         cdef _Document new_doc
 *         if self._c_node is NULL:
 *             return self             # <<<<<<<<<<<<<<
 *         c_doc = _copyDocRoot(self._c_node.doc, self._c_node) # recursive
 *         new_doc = _documentFactory(c_doc, None)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __pyx_r = ((PyObject *)__pyx_v_self);
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":169
 *         if self._c_node is NULL:
 *             return self
 *         c_doc = _copyDocRoot(self._c_node.doc, self._c_node) # recursive             # <<<<<<<<<<<<<<
 *         new_doc = _documentFactory(c_doc, None)
 *         root = new_doc.getroot()
 */
  __pyx_t_4 = __pyx_f_4lxml_5etree__copyDocRoot(__pyx_v_self->_c_node->doc, __pyx_v_self->_c_node); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_doc = __pyx_t_4;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":170
 *             return self
 *         c_doc = _copyDocRoot(self._c_node.doc, self._c_node) # recursive
 *         new_doc = _documentFactory(c_doc, None)             # <<<<<<<<<<<<<<
 *         root = new_doc.getroot()
 *         if root is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_new_doc));
  __pyx_v_new_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":171
 *         c_doc = _copyDocRoot(self._c_node.doc, self._c_node) # recursive
 *         new_doc = _documentFactory(c_doc, None)
 *         root = new_doc.getroot()             # <<<<<<<<<<<<<<
 *         if root is not None:
 *             return root
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__Document *)__pyx_v_new_doc->__pyx_vtab)->getroot(__pyx_v_new_doc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_v_root);
  __pyx_v_root = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":172
 *         new_doc = _documentFactory(c_doc, None)
 *         root = new_doc.getroot()
 *         if root is not None:             # <<<<<<<<<<<<<<
 *             return root
 *         # Comment/PI
 */
  __pyx_t_3 = (__pyx_v_root != Py_None);
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":173
 *         root = new_doc.getroot()
 *         if root is not None:
 *             return root             # <<<<<<<<<<<<<<
 *         # Comment/PI
 *         c_node = c_doc.children
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_root);
    __pyx_r = __pyx_v_root;
    goto __pyx_L0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":175
 *             return root
 *         # Comment/PI
 *         c_node = c_doc.children             # <<<<<<<<<<<<<<
 *         while c_node is not NULL and c_node.type != self._c_node.type:
 *             c_node = c_node.next
 */
  __pyx_v_c_node = __pyx_v_c_doc->children;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":176
 *         # Comment/PI
 *         c_node = c_doc.children
 *         while c_node is not NULL and c_node.type != self._c_node.type:             # <<<<<<<<<<<<<<
 *             c_node = c_node.next
 *         if c_node is NULL:
 */
  while (1) {
    __pyx_t_3 = (__pyx_v_c_node != NULL);
    if (__pyx_t_3) {
      __pyx_t_5 = (__pyx_v_c_node->type != __pyx_v_self->_c_node->type);
      __pyx_t_6 = __pyx_t_5;
    } else {
      __pyx_t_6 = __pyx_t_3;
    }
    if (!__pyx_t_6) break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":177
 *         c_node = c_doc.children
 *         while c_node is not NULL and c_node.type != self._c_node.type:
 *             c_node = c_node.next             # <<<<<<<<<<<<<<
 *         if c_node is NULL:
 *             return None
 */
    __pyx_v_c_node = __pyx_v_c_node->next;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":178
 *         while c_node is not NULL and c_node.type != self._c_node.type:
 *             c_node = c_node.next
 *         if c_node is NULL:             # <<<<<<<<<<<<<<
 *             return None
 *         return _elementFactory(new_doc, c_node)
 */
  __pyx_t_6 = (__pyx_v_c_node == NULL);
  if (__pyx_t_6) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":179
 *             c_node = c_node.next
 *         if c_node is NULL:
 *             return None             # <<<<<<<<<<<<<<
 *         return _elementFactory(new_doc, c_node)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":180
 *         if c_node is NULL:
 *             return None
 *         return _elementFactory(new_doc, c_node)             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(__pyx_v_new_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.__copy__");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_new_doc);
  __Pyx_DECREF(__pyx_v_root);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":162
 *         return self.__copy__()
 * 
 *     cpdef __copy__(self):             # <<<<<<<<<<<<<<
 *         u"__copy__(self)"
 *         cdef xmlDoc* c_doc
 */

static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_6__copy__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_14_ReadOnlyProxy_6__copy__[] = "__copy__(self)";
static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_6__copy__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__copy__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)->__pyx_vtab)->__copy__(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.__copy__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":182
 *         return _elementFactory(new_doc, c_node)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return iter(self.getchildren())
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_7__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_7__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__iter__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":183
 * 
 *     def __iter__(self):
 *         return iter(self.getchildren())             # <<<<<<<<<<<<<<
 * 
 *     def iterchildren(self, tag=None, *, reversed=False):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)->__pyx_vtab)->getchildren(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.__iter__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":185
 *         return iter(self.getchildren())
 * 
 *     def iterchildren(self, tag=None, *, reversed=False):             # <<<<<<<<<<<<<<
 *         u"""iterchildren(self, tag=None, reversed=False)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_8iterchildren(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_14_ReadOnlyProxy_8iterchildren[] = "iterchildren(self, tag=None, reversed=False)\n\n        Iterate over the children of this element.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_8iterchildren(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_reversed = 0;
  PyObject *__pyx_v_children;
  PyObject *__pyx_v_el;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__tag,&__pyx_n_s__reversed,0};
  __Pyx_RefNannySetupContext("iterchildren");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = __pyx_k_131;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tag);
        if (value) { values[0] = value; kw_args--; }
      }
    }
    while (kw_args > 0) {
      PyObject* value;
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reversed);
      if (value) { values[1] = value; if (!(--kw_args)) break; }
      break;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "iterchildren") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_tag = values[0];
    __pyx_v_reversed = values[1];
  } else {
    __pyx_v_tag = ((PyObject *)Py_None);
    __pyx_v_reversed = __pyx_k_131;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: __pyx_v_tag = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("iterchildren", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.iterchildren");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_children = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_el = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":190
 *         Iterate over the children of this element.
 *         """
 *         children = self.getchildren()             # <<<<<<<<<<<<<<
 *         if tag is not None and tag != '*':
 *             children = [ el for el in children if el.tag == tag ]
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)->__pyx_vtab)->getchildren(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_v_children);
  __pyx_v_children = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":191
 *         """
 *         children = self.getchildren()
 *         if tag is not None and tag != '*':             # <<<<<<<<<<<<<<
 *             children = [ el for el in children if el.tag == tag ]
 *         if reversed:
 */
  __pyx_t_2 = (__pyx_v_tag != Py_None);
  if (__pyx_t_2) {
    __pyx_t_1 = PyObject_RichCompare(__pyx_v_tag, ((PyObject *)__pyx_kp_s_132), Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_4 = __pyx_t_3;
  } else {
    __pyx_t_4 = __pyx_t_2;
  }
  if (__pyx_t_4) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":192
 *         children = self.getchildren()
 *         if tag is not None and tag != '*':
 *             children = [ el for el in children if el.tag == tag ]             # <<<<<<<<<<<<<<
 *         if reversed:
 *             children = children[::-1]
 */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    if (PyList_CheckExact(__pyx_v_children) || PyTuple_CheckExact(__pyx_v_children)) {
      __pyx_t_5 = 0; __pyx_t_6 = __pyx_v_children; __Pyx_INCREF(__pyx_t_6);
    } else {
      __pyx_t_5 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_children); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
    }
    for (;;) {
      if (likely(PyList_CheckExact(__pyx_t_6))) {
        if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_6)) break;
        __pyx_t_7 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++;
      } else if (likely(PyTuple_CheckExact(__pyx_t_6))) {
        if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
        __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++;
      } else {
        __pyx_t_7 = PyIter_Next(__pyx_t_6);
        if (!__pyx_t_7) {
          if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          break;
        }
        __Pyx_GOTREF(__pyx_t_7);
      }
      __Pyx_DECREF(__pyx_v_el);
      __pyx_v_el = __pyx_t_7;
      __pyx_t_7 = 0;
      __pyx_t_7 = PyObject_GetAttr(__pyx_v_el, __pyx_n_s__tag); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = PyObject_RichCompare(__pyx_t_7, __pyx_v_tag, Py_EQ); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (__pyx_t_4) {
        if (unlikely(PyList_Append(__pyx_t_1, (PyObject*)__pyx_v_el))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L9;
      }
      __pyx_L9:;
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_INCREF(((PyObject *)__pyx_t_1));
    __Pyx_DECREF(__pyx_v_children);
    __pyx_v_children = ((PyObject *)__pyx_t_1);
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":193
 *         if tag is not None and tag != '*':
 *             children = [ el for el in children if el.tag == tag ]
 *         if reversed:             # <<<<<<<<<<<<<<
 *             children = children[::-1]
 *         return iter(children)
 */
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_reversed); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_4) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":194
 *             children = [ el for el in children if el.tag == tag ]
 *         if reversed:
 *             children = children[::-1]             # <<<<<<<<<<<<<<
 *         return iter(children)
 * 
 */
    __pyx_t_1 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = PyObject_GetItem(__pyx_v_children, __pyx_t_1); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_v_children);
    __pyx_v_children = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L10;
  }
  __pyx_L10:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":195
 *         if reversed:
 *             children = children[::-1]
 *         return iter(children)             # <<<<<<<<<<<<<<
 * 
 *     cpdef getchildren(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = PyObject_GetIter(__pyx_v_children); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.iterchildren");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_children);
  __Pyx_DECREF(__pyx_v_el);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":197
 *         return iter(children)
 * 
 *     cpdef getchildren(self):             # <<<<<<<<<<<<<<
 *         u"""Returns all subelements. The elements are returned in document
 *         order.
 */

static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_9getchildren(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static  PyObject *__pyx_f_4lxml_5etree_14_ReadOnlyProxy_getchildren(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self, int __pyx_skip_dispatch) {
  xmlNode *__pyx_v_c_node;
  PyObject *__pyx_v_result;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("getchildren");
  __pyx_v_result = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__getchildren); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_9getchildren)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":203
 *         cdef xmlNode* c_node
 *         cdef list result
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         result = []
 *         c_node = self._c_node.children
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self->__pyx_vtab)->_assertNode(__pyx_v_self); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":204
 *         cdef list result
 *         self._assertNode()
 *         result = []             # <<<<<<<<<<<<<<
 *         c_node = self._c_node.children
 *         while c_node is not NULL:
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_DECREF(((PyObject *)__pyx_v_result));
  __pyx_v_result = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":205
 *         self._assertNode()
 *         result = []
 *         c_node = self._c_node.children             # <<<<<<<<<<<<<<
 *         while c_node is not NULL:
 *             if tree._isElement(c_node):
 */
  __pyx_v_c_node = __pyx_v_self->_c_node->children;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":206
 *         result = []
 *         c_node = self._c_node.children
 *         while c_node is not NULL:             # <<<<<<<<<<<<<<
 *             if tree._isElement(c_node):
 *                 result.append(_newReadOnlyProxy(self._source_proxy, c_node))
 */
  while (1) {
    __pyx_t_4 = (__pyx_v_c_node != NULL);
    if (!__pyx_t_4) break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":207
 *         c_node = self._c_node.children
 *         while c_node is not NULL:
 *             if tree._isElement(c_node):             # <<<<<<<<<<<<<<
 *                 result.append(_newReadOnlyProxy(self._source_proxy, c_node))
 *             c_node = c_node.next
 */
    __pyx_t_4 = _isElement(__pyx_v_c_node);
    if (__pyx_t_4) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":208
 *         while c_node is not NULL:
 *             if tree._isElement(c_node):
 *                 result.append(_newReadOnlyProxy(self._source_proxy, c_node))             # <<<<<<<<<<<<<<
 *             c_node = c_node.next
 *         return result
 */
      if (unlikely(__pyx_v_result == Py_None)) {
        PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
      }
      __pyx_t_1 = ((PyObject *)__pyx_v_self->_source_proxy);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__newReadOnlyProxy(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_1), __pyx_v_c_node)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_3 = PyList_Append(__pyx_v_result, __pyx_t_2); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":209
 *             if tree._isElement(c_node):
 *                 result.append(_newReadOnlyProxy(self._source_proxy, c_node))
 *             c_node = c_node.next             # <<<<<<<<<<<<<<
 *         return result
 * 
 */
    __pyx_v_c_node = __pyx_v_c_node->next;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":210
 *                 result.append(_newReadOnlyProxy(self._source_proxy, c_node))
 *             c_node = c_node.next
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     def getparent(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.getchildren");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":197
 *         return iter(children)
 * 
 *     cpdef getchildren(self):             # <<<<<<<<<<<<<<
 *         u"""Returns all subelements. The elements are returned in document
 *         order.
 */

static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_9getchildren(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_14_ReadOnlyProxy_9getchildren[] = "Returns all subelements. The elements are returned in document\n        order.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_9getchildren(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getchildren");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)->__pyx_vtab)->getchildren(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.getchildren");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":212
 *         return result
 * 
 *     def getparent(self):             # <<<<<<<<<<<<<<
 *         u"""Returns the parent of this element or None for the root element.
 *         """
 */

static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_10getparent(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_14_ReadOnlyProxy_10getparent[] = "Returns the parent of this element or None for the root element.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_10getparent(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  xmlNode *__pyx_v_c_parent;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("getparent");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":216
 *         """
 *         cdef xmlNode* c_parent
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         c_parent = self._c_node.parent
 *         if c_parent is NULL or not tree._isElement(c_parent):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)->__pyx_vtab)->_assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":217
 *         cdef xmlNode* c_parent
 *         self._assertNode()
 *         c_parent = self._c_node.parent             # <<<<<<<<<<<<<<
 *         if c_parent is NULL or not tree._isElement(c_parent):
 *             return None
 */
  __pyx_v_c_parent = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)->_c_node->parent;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":218
 *         self._assertNode()
 *         c_parent = self._c_node.parent
 *         if c_parent is NULL or not tree._isElement(c_parent):             # <<<<<<<<<<<<<<
 *             return None
 *         else:
 */
  __pyx_t_2 = (__pyx_v_c_parent == NULL);
  if (!__pyx_t_2) {
    __pyx_t_3 = (!_isElement(__pyx_v_c_parent));
    __pyx_t_4 = __pyx_t_3;
  } else {
    __pyx_t_4 = __pyx_t_2;
  }
  if (__pyx_t_4) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":219
 *         c_parent = self._c_node.parent
 *         if c_parent is NULL or not tree._isElement(c_parent):
 *             return None             # <<<<<<<<<<<<<<
 *         else:
 *             return _newReadOnlyProxy(self._source_proxy, c_parent)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":221
 *             return None
 *         else:
 *             return _newReadOnlyProxy(self._source_proxy, c_parent)             # <<<<<<<<<<<<<<
 * 
 *     def getnext(self):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = ((PyObject *)((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)->_source_proxy);
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_6 = ((PyObject *)__pyx_f_4lxml_5etree__newReadOnlyProxy(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_5), __pyx_v_c_parent)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L0;
  }
  __pyx_L5:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.getparent");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":223
 *             return _newReadOnlyProxy(self._source_proxy, c_parent)
 * 
 *     def getnext(self):             # <<<<<<<<<<<<<<
 *         u"""Returns the following sibling of this element or None.
 *         """
 */

static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_11getnext(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_14_ReadOnlyProxy_11getnext[] = "Returns the following sibling of this element or None.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_11getnext(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  xmlNode *__pyx_v_c_node;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("getnext");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":227
 *         """
 *         cdef xmlNode* c_node
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         c_node = _nextElement(self._c_node)
 *         if c_node is not NULL:
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)->__pyx_vtab)->_assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":228
 *         cdef xmlNode* c_node
 *         self._assertNode()
 *         c_node = _nextElement(self._c_node)             # <<<<<<<<<<<<<<
 *         if c_node is not NULL:
 *             return _newReadOnlyProxy(self._source_proxy, c_node)
 */
  __pyx_v_c_node = __pyx_f_4lxml_5etree__nextElement(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)->_c_node);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":229
 *         self._assertNode()
 *         c_node = _nextElement(self._c_node)
 *         if c_node is not NULL:             # <<<<<<<<<<<<<<
 *             return _newReadOnlyProxy(self._source_proxy, c_node)
 *         return None
 */
  __pyx_t_2 = (__pyx_v_c_node != NULL);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":230
 *         c_node = _nextElement(self._c_node)
 *         if c_node is not NULL:
 *             return _newReadOnlyProxy(self._source_proxy, c_node)             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = ((PyObject *)((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)->_source_proxy);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__newReadOnlyProxy(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_3), __pyx_v_c_node)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":231
 *         if c_node is not NULL:
 *             return _newReadOnlyProxy(self._source_proxy, c_node)
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     def getprevious(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_None);
  __pyx_r = Py_None;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.getnext");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":233
 *         return None
 * 
 *     def getprevious(self):             # <<<<<<<<<<<<<<
 *         u"""Returns the preceding sibling of this element or None.
 *         """
 */

static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_12getprevious(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_14_ReadOnlyProxy_12getprevious[] = "Returns the preceding sibling of this element or None.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_12getprevious(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  xmlNode *__pyx_v_c_node;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("getprevious");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":237
 *         """
 *         cdef xmlNode* c_node
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         c_node = _previousElement(self._c_node)
 *         if c_node is not NULL:
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)->__pyx_vtab)->_assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":238
 *         cdef xmlNode* c_node
 *         self._assertNode()
 *         c_node = _previousElement(self._c_node)             # <<<<<<<<<<<<<<
 *         if c_node is not NULL:
 *             return _newReadOnlyProxy(self._source_proxy, c_node)
 */
  __pyx_v_c_node = __pyx_f_4lxml_5etree__previousElement(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)->_c_node);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":239
 *         self._assertNode()
 *         c_node = _previousElement(self._c_node)
 *         if c_node is not NULL:             # <<<<<<<<<<<<<<
 *             return _newReadOnlyProxy(self._source_proxy, c_node)
 *         return None
 */
  __pyx_t_2 = (__pyx_v_c_node != NULL);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":240
 *         c_node = _previousElement(self._c_node)
 *         if c_node is not NULL:
 *             return _newReadOnlyProxy(self._source_proxy, c_node)             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = ((PyObject *)((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)->_source_proxy);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__newReadOnlyProxy(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_3), __pyx_v_c_node)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":241
 *         if c_node is not NULL:
 *             return _newReadOnlyProxy(self._source_proxy, c_node)
 *         return None             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_None);
  __pyx_r = Py_None;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.getprevious");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":247
 *     u"A read-only proxy for processing instructions (for internal use only!)"
 *     property target:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self._assertNode()
 *             return funicode(self._c_node.name)
 */

static PyObject *__pyx_pf_4lxml_5etree_16_ReadOnlyPIProxy_6target___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_16_ReadOnlyPIProxy_6target___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__get__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":248
 *     property target:
 *         def __get__(self):
 *             self._assertNode()             # <<<<<<<<<<<<<<
 *             return funicode(self._c_node.name)
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyPIProxy *)((struct __pyx_obj_4lxml_5etree__ReadOnlyPIProxy *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base._assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":249
 *         def __get__(self):
 *             self._assertNode()
 *             return funicode(self._c_node.name)             # <<<<<<<<<<<<<<
 * 
 * cdef class _ReadOnlyEntityProxy(_ReadOnlyProxy):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(((struct __pyx_obj_4lxml_5etree__ReadOnlyPIProxy *)__pyx_v_self)->__pyx_base._c_node->name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyPIProxy.target.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":254
 *     u"A read-only proxy for entity references (for internal use only!)"
 *     property name:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return funicode(self._c_node.name)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_20_ReadOnlyEntityProxy_4name___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_20_ReadOnlyEntityProxy_4name___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":255
 *     property name:
 *         def __get__(self):
 *             return funicode(self._c_node.name)             # <<<<<<<<<<<<<<
 * 
 *         def __set__(self, value):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree_funicode(((struct __pyx_obj_4lxml_5etree__ReadOnlyEntityProxy *)__pyx_v_self)->__pyx_base._c_node->name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyEntityProxy.name.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":257
 *             return funicode(self._c_node.name)
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             value_utf = _utf8(value)
 *             assert u'&' not in value and u';' not in value, \
 */

static int __pyx_pf_4lxml_5etree_20_ReadOnlyEntityProxy_4name_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_4lxml_5etree_20_ReadOnlyEntityProxy_4name_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  PyObject *__pyx_v_value_utf;
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("__set__");
  __pyx_v_value_utf = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":258
 * 
 *         def __set__(self, value):
 *             value_utf = _utf8(value)             # <<<<<<<<<<<<<<
 *             assert u'&' not in value and u';' not in value, \
 *                 u"Invalid entity name '%s'" % value
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_v_value)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_value_utf));
  __pyx_v_value_utf = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":259
 *         def __set__(self, value):
 *             value_utf = _utf8(value)
 *             assert u'&' not in value and u';' not in value, \             # <<<<<<<<<<<<<<
 *                 u"Invalid entity name '%s'" % value
 *             tree.xmlNodeSetName(self._c_node, _cstr(value_utf))
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  __pyx_t_2 = (__Pyx_NegateNonNeg(PySequence_Contains(__pyx_v_value, ((PyObject *)__pyx_kp_u_82)))); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_2) {
    __pyx_t_3 = (__Pyx_NegateNonNeg(PySequence_Contains(__pyx_v_value, ((PyObject *)__pyx_kp_u_83)))); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __pyx_t_3;
  } else {
    __pyx_t_4 = __pyx_t_2;
  }
  if (unlikely(!__pyx_t_4)) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":260
 *             value_utf = _utf8(value)
 *             assert u'&' not in value and u';' not in value, \
 *                 u"Invalid entity name '%s'" % value             # <<<<<<<<<<<<<<
 *             tree.xmlNodeSetName(self._c_node, _cstr(value_utf))
 * 
 */
    __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_84), __pyx_v_value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_t_1));
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[8]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":261
 *             assert u'&' not in value and u';' not in value, \
 *                 u"Invalid entity name '%s'" % value
 *             tree.xmlNodeSetName(self._c_node, _cstr(value_utf))             # <<<<<<<<<<<<<<
 * 
 *     property text:
 */
  xmlNodeSetName(((struct __pyx_obj_4lxml_5etree__ReadOnlyEntityProxy *)__pyx_v_self)->__pyx_base._c_node, PyBytes_AS_STRING(((PyObject *)__pyx_v_value_utf)));

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyEntityProxy.name.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_value_utf);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":264
 * 
 *     property text:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return u'&%s;' % funicode(self._c_node.name)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_20_ReadOnlyEntityProxy_4text___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_20_ReadOnlyEntityProxy_4text___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__get__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":265
 *     property text:
 *         def __get__(self):
 *             return u'&%s;' % funicode(self._c_node.name)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree_funicode(((struct __pyx_obj_4lxml_5etree__ReadOnlyEntityProxy *)__pyx_v_self)->__pyx_base._c_node->name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_85), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = ((PyObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyEntityProxy.text.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":272
 * 
 *     property attrib:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self._assertNode()
 *             return dict(_collectAttributes(self._c_node, 3))
 */

static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_6attrib___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_6attrib___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__get__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":273
 *     property attrib:
 *         def __get__(self):
 *             self._assertNode()             # <<<<<<<<<<<<<<
 *             return dict(_collectAttributes(self._c_node, 3))
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyElementProxy *)((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base._assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":274
 *         def __get__(self):
 *             self._assertNode()
 *             return dict(_collectAttributes(self._c_node, 3))             # <<<<<<<<<<<<<<
 * 
 *     property prefix:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__collectAttributes(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)->__pyx_base._c_node, 3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyDict_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyElementProxy.attrib.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":279
 *         u"""Namespace prefix or None.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self._assertNode()
 *             if self._c_node.ns is not NULL:
 */

static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_6prefix___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_6prefix___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__get__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":280
 *         """
 *         def __get__(self):
 *             self._assertNode()             # <<<<<<<<<<<<<<
 *             if self._c_node.ns is not NULL:
 *                 if self._c_node.ns.prefix is not NULL:
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyElementProxy *)((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base._assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":281
 *         def __get__(self):
 *             self._assertNode()
 *             if self._c_node.ns is not NULL:             # <<<<<<<<<<<<<<
 *                 if self._c_node.ns.prefix is not NULL:
 *                     return funicode(self._c_node.ns.prefix)
 */
  __pyx_t_2 = (((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)->__pyx_base._c_node->ns != NULL);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":282
 *             self._assertNode()
 *             if self._c_node.ns is not NULL:
 *                 if self._c_node.ns.prefix is not NULL:             # <<<<<<<<<<<<<<
 *                     return funicode(self._c_node.ns.prefix)
 *             return None
 */
    __pyx_t_2 = (((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)->__pyx_base._c_node->ns->prefix != NULL);
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":283
 *             if self._c_node.ns is not NULL:
 *                 if self._c_node.ns.prefix is not NULL:
 *                     return funicode(self._c_node.ns.prefix)             # <<<<<<<<<<<<<<
 *             return None
 * 
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)->__pyx_base._c_node->ns->prefix); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L0;
      goto __pyx_L6;
    }
    __pyx_L6:;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":284
 *                 if self._c_node.ns.prefix is not NULL:
 *                     return funicode(self._c_node.ns.prefix)
 *             return None             # <<<<<<<<<<<<<<
 * 
 *     def get(self, key, default=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_None);
  __pyx_r = Py_None;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyElementProxy.prefix.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":286
 *             return None
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         u"""Gets an element attribute.
 *         """
 */

static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy_get[] = "Gets an element attribute.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_default = 0;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__key,&__pyx_n_s__default,0};
  __Pyx_RefNannySetupContext("get");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__key);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__default);
        if (value) { values[1] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "get") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_key = values[0];
    __pyx_v_default = values[1];
  } else {
    __pyx_v_default = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_default = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v_key = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._ReadOnlyElementProxy.get");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":289
 *         u"""Gets an element attribute.
 *         """
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         return _getNodeAttributeValue(self._c_node, key, default)
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyElementProxy *)((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base._assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":290
 *         """
 *         self._assertNode()
 *         return _getNodeAttributeValue(self._c_node, key, default)             # <<<<<<<<<<<<<<
 * 
 *     def keys(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree__getNodeAttributeValue(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)->__pyx_base._c_node, __pyx_v_key, __pyx_v_default); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyElementProxy.get");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":292
 *         return _getNodeAttributeValue(self._c_node, key, default)
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         u"""Gets a list of attribute names. The names are returned in an
 *         arbitrary order (just like for an ordinary Python dictionary).
 */

static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_1keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy_1keys[] = "Gets a list of attribute names. The names are returned in an\n        arbitrary order (just like for an ordinary Python dictionary).\n        ";
static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_1keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("keys");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":296
 *         arbitrary order (just like for an ordinary Python dictionary).
 *         """
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         return _collectAttributes(self._c_node, 1)
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyElementProxy *)((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base._assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":297
 *         """
 *         self._assertNode()
 *         return _collectAttributes(self._c_node, 1)             # <<<<<<<<<<<<<<
 * 
 *     def values(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__collectAttributes(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)->__pyx_base._c_node, 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyElementProxy.keys");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":299
 *         return _collectAttributes(self._c_node, 1)
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         u"""Gets element attributes, as a sequence. The attributes are returned
 *         in an arbitrary order.
 */

static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_2values(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy_2values[] = "Gets element attributes, as a sequence. The attributes are returned\n        in an arbitrary order.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_2values(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("values");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":303
 *         in an arbitrary order.
 *         """
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         return _collectAttributes(self._c_node, 2)
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyElementProxy *)((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base._assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":304
 *         """
 *         self._assertNode()
 *         return _collectAttributes(self._c_node, 2)             # <<<<<<<<<<<<<<
 * 
 *     def items(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__collectAttributes(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)->__pyx_base._c_node, 2)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyElementProxy.values");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":306
 *         return _collectAttributes(self._c_node, 2)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         u"""Gets element attributes, as a sequence. The attributes are returned
 *         in an arbitrary order.
 */

static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_3items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy_3items[] = "Gets element attributes, as a sequence. The attributes are returned\n        in an arbitrary order.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_3items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("items");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":310
 *         in an arbitrary order.
 *         """
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         return _collectAttributes(self._c_node, 3)
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyElementProxy *)((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base._assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":311
 *         """
 *         self._assertNode()
 *         return _collectAttributes(self._c_node, 3)             # <<<<<<<<<<<<<<
 * 
 * cdef extern from "etree_defs.h":
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__collectAttributes(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)->__pyx_base._c_node, 3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyElementProxy.items");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":317
 *     cdef _ReadOnlyProxy NEW_RO_PROXY "PY_NEW" (object t)
 * 
 * cdef _ReadOnlyProxy _newReadOnlyProxy(             # <<<<<<<<<<<<<<
 *     _ReadOnlyProxy source_proxy, xmlNode* c_node):
 *     cdef _ReadOnlyProxy el
 */

static  struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_f_4lxml_5etree__newReadOnlyProxy(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_source_proxy, xmlNode *__pyx_v_c_node) {
  struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_el;
  struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  xmlElementType __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("_newReadOnlyProxy");
  __pyx_v_el = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":320
 *     _ReadOnlyProxy source_proxy, xmlNode* c_node):
 *     cdef _ReadOnlyProxy el
 *     if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         el = NEW_RO_PROXY(_ReadOnlyElementProxy)
 *     elif c_node.type == tree.XML_PI_NODE:
 */
  __pyx_t_1 = (__pyx_v_c_node->type == XML_ELEMENT_NODE);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":321
 *     cdef _ReadOnlyProxy el
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         el = NEW_RO_PROXY(_ReadOnlyElementProxy)             # <<<<<<<<<<<<<<
 *     elif c_node.type == tree.XML_PI_NODE:
 *         el = NEW_RO_PROXY(_ReadOnlyPIProxy)
 */
    __pyx_t_2 = ((PyObject *)PY_NEW(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ReadOnlyElementProxy)))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_v_el));
    __pyx_v_el = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":322
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         el = NEW_RO_PROXY(_ReadOnlyElementProxy)
 *     elif c_node.type == tree.XML_PI_NODE:             # <<<<<<<<<<<<<<
 *         el = NEW_RO_PROXY(_ReadOnlyPIProxy)
 *     elif c_node.type in (tree.XML_COMMENT_NODE,
 */
  __pyx_t_1 = (__pyx_v_c_node->type == XML_PI_NODE);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":323
 *         el = NEW_RO_PROXY(_ReadOnlyElementProxy)
 *     elif c_node.type == tree.XML_PI_NODE:
 *         el = NEW_RO_PROXY(_ReadOnlyPIProxy)             # <<<<<<<<<<<<<<
 *     elif c_node.type in (tree.XML_COMMENT_NODE,
 *                          tree.XML_ENTITY_REF_NODE):
 */
    __pyx_t_2 = ((PyObject *)PY_NEW(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ReadOnlyPIProxy)))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_v_el));
    __pyx_v_el = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":324
 *     elif c_node.type == tree.XML_PI_NODE:
 *         el = NEW_RO_PROXY(_ReadOnlyPIProxy)
 *     elif c_node.type in (tree.XML_COMMENT_NODE,             # <<<<<<<<<<<<<<
 *                          tree.XML_ENTITY_REF_NODE):
 *         el = NEW_RO_PROXY(_ReadOnlyProxy)
 */
  __pyx_t_3 = __pyx_v_c_node->type;
  __pyx_t_1 = (__pyx_t_3 == XML_COMMENT_NODE);
  if (!__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":325
 *         el = NEW_RO_PROXY(_ReadOnlyPIProxy)
 *     elif c_node.type in (tree.XML_COMMENT_NODE,
 *                          tree.XML_ENTITY_REF_NODE):             # <<<<<<<<<<<<<<
 *         el = NEW_RO_PROXY(_ReadOnlyProxy)
 *     else:
 */
    __pyx_t_4 = (__pyx_t_3 == XML_ENTITY_REF_NODE);
    __pyx_t_5 = __pyx_t_4;
  } else {
    __pyx_t_5 = __pyx_t_1;
  }
  __pyx_t_1 = __pyx_t_5;
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":326
 *     elif c_node.type in (tree.XML_COMMENT_NODE,
 *                          tree.XML_ENTITY_REF_NODE):
 *         el = NEW_RO_PROXY(_ReadOnlyProxy)             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError("Unsupported element type: %d" % c_node.type)
 */
    __pyx_t_2 = ((PyObject *)PY_NEW(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ReadOnlyProxy)))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_v_el));
    __pyx_v_el = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":328
 *         el = NEW_RO_PROXY(_ReadOnlyProxy)
 *     else:
 *         raise TypeError("Unsupported element type: %d" % c_node.type)             # <<<<<<<<<<<<<<
 *     el._c_node = c_node
 *     _initReadOnlyProxy(el, source_proxy)
 */
    __pyx_t_2 = PyInt_FromLong(__pyx_v_c_node->type); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_133), __pyx_t_2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_6));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
    __pyx_t_6 = 0;
    __pyx_t_6 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_6, 0, 0);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    {__pyx_filename = __pyx_f[8]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":329
 *     else:
 *         raise TypeError("Unsupported element type: %d" % c_node.type)
 *     el._c_node = c_node             # <<<<<<<<<<<<<<
 *     _initReadOnlyProxy(el, source_proxy)
 *     return el
 */
  __pyx_v_el->_c_node = __pyx_v_c_node;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":330
 *         raise TypeError("Unsupported element type: %d" % c_node.type)
 *     el._c_node = c_node
 *     _initReadOnlyProxy(el, source_proxy)             # <<<<<<<<<<<<<<
 *     return el
 * 
 */
  __pyx_t_6 = __pyx_f_4lxml_5etree__initReadOnlyProxy(__pyx_v_el, __pyx_v_source_proxy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":331
 *     el._c_node = c_node
 *     _initReadOnlyProxy(el, source_proxy)
 *     return el             # <<<<<<<<<<<<<<
 * 
 * cdef inline _initReadOnlyProxy(_ReadOnlyProxy el,
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_el));
  __pyx_r = __pyx_v_el;
  goto __pyx_L0;

  __pyx_r = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._newReadOnlyProxy");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_el);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":333
 *     return el
 * 
 * cdef inline _initReadOnlyProxy(_ReadOnlyProxy el,             # <<<<<<<<<<<<<<
 *                                _ReadOnlyProxy source_proxy):
 *     if source_proxy is None:
 */

static CYTHON_INLINE PyObject *__pyx_f_4lxml_5etree__initReadOnlyProxy(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_el, struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_source_proxy) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("_initReadOnlyProxy");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":335
 * cdef inline _initReadOnlyProxy(_ReadOnlyProxy el,
 *                                _ReadOnlyProxy source_proxy):
 *     if source_proxy is None:             # <<<<<<<<<<<<<<
 *         el._source_proxy = el
 *         el._dependent_proxies = [el]
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_source_proxy) == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":336
 *                                _ReadOnlyProxy source_proxy):
 *     if source_proxy is None:
 *         el._source_proxy = el             # <<<<<<<<<<<<<<
 *         el._dependent_proxies = [el]
 *     else:
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_el));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_el));
    __Pyx_GOTREF(__pyx_v_el->_source_proxy);
    __Pyx_DECREF(((PyObject *)__pyx_v_el->_source_proxy));
    __pyx_v_el->_source_proxy = __pyx_v_el;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":337
 *     if source_proxy is None:
 *         el._source_proxy = el
 *         el._dependent_proxies = [el]             # <<<<<<<<<<<<<<
 *     else:
 *         el._source_proxy = source_proxy
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __Pyx_INCREF(((PyObject *)__pyx_v_el));
    PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_el));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_el));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
    __Pyx_GOTREF(__pyx_v_el->_dependent_proxies);
    __Pyx_DECREF(((PyObject *)__pyx_v_el->_dependent_proxies));
    __pyx_v_el->_dependent_proxies = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":339
 *         el._dependent_proxies = [el]
 *     else:
 *         el._source_proxy = source_proxy             # <<<<<<<<<<<<<<
 *         source_proxy._dependent_proxies.append(el)
 * 
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_source_proxy));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_source_proxy));
    __Pyx_GOTREF(__pyx_v_el->_source_proxy);
    __Pyx_DECREF(((PyObject *)__pyx_v_el->_source_proxy));
    __pyx_v_el->_source_proxy = __pyx_v_source_proxy;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":340
 *     else:
 *         el._source_proxy = source_proxy
 *         source_proxy._dependent_proxies.append(el)             # <<<<<<<<<<<<<<
 * 
 * cdef _freeReadOnlyProxies(_ReadOnlyProxy sourceProxy):
 */
    if (unlikely(__pyx_v_source_proxy->_dependent_proxies == Py_None)) {
      PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_3 = PyList_Append(__pyx_v_source_proxy->_dependent_proxies, ((PyObject *)__pyx_v_el)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._initReadOnlyProxy");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":342
 *         source_proxy._dependent_proxies.append(el)
 * 
 * cdef _freeReadOnlyProxies(_ReadOnlyProxy sourceProxy):             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     cdef _ReadOnlyProxy el
 */

static  PyObject *__pyx_f_4lxml_5etree__freeReadOnlyProxies(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_sourceProxy) {
  xmlNode *__pyx_v_c_node;
  struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_el;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("_freeReadOnlyProxies");
  __pyx_v_el = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":345
 *     cdef xmlNode* c_node
 *     cdef _ReadOnlyProxy el
 *     if sourceProxy is None:             # <<<<<<<<<<<<<<
 *         return
 *     if sourceProxy._dependent_proxies is None:
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_sourceProxy) == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":346
 *     cdef _ReadOnlyProxy el
 *     if sourceProxy is None:
 *         return             # <<<<<<<<<<<<<<
 *     if sourceProxy._dependent_proxies is None:
 *         return
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":347
 *     if sourceProxy is None:
 *         return
 *     if sourceProxy._dependent_proxies is None:             # <<<<<<<<<<<<<<
 *         return
 *     for el in sourceProxy._dependent_proxies:
 */
  __pyx_t_1 = (__pyx_v_sourceProxy->_dependent_proxies == ((PyObject*)Py_None));
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":348
 *         return
 *     if sourceProxy._dependent_proxies is None:
 *         return             # <<<<<<<<<<<<<<
 *     for el in sourceProxy._dependent_proxies:
 *         c_node = el._c_node
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":349
 *     if sourceProxy._dependent_proxies is None:
 *         return
 *     for el in sourceProxy._dependent_proxies:             # <<<<<<<<<<<<<<
 *         c_node = el._c_node
 *         el._c_node = NULL
 */
  if (unlikely(__pyx_v_sourceProxy->_dependent_proxies == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_2 = 0; __pyx_t_3 = ((PyObject *)__pyx_v_sourceProxy->_dependent_proxies); __Pyx_INCREF(__pyx_t_3);
  for (;;) {
    if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_3)) break;
    __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++;
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4lxml_5etree__ReadOnlyProxy))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_v_el));
    __pyx_v_el = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":350
 *         return
 *     for el in sourceProxy._dependent_proxies:
 *         c_node = el._c_node             # <<<<<<<<<<<<<<
 *         el._c_node = NULL
 *         if el._free_after_use:
 */
    __pyx_v_c_node = __pyx_v_el->_c_node;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":351
 *     for el in sourceProxy._dependent_proxies:
 *         c_node = el._c_node
 *         el._c_node = NULL             # <<<<<<<<<<<<<<
 *         if el._free_after_use:
 *             tree.xmlFreeNode(c_node)
 */
    __pyx_v_el->_c_node = NULL;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":352
 *         c_node = el._c_node
 *         el._c_node = NULL
 *         if el._free_after_use:             # <<<<<<<<<<<<<<
 *             tree.xmlFreeNode(c_node)
 *     del sourceProxy._dependent_proxies[:]
 */
    if (__pyx_v_el->_free_after_use) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":353
 *         el._c_node = NULL
 *         if el._free_after_use:
 *             tree.xmlFreeNode(c_node)             # <<<<<<<<<<<<<<
 *     del sourceProxy._dependent_proxies[:]
 * 
 */
      xmlFreeNode(__pyx_v_c_node);
      goto __pyx_L7;
    }
    __pyx_L7:;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":354
 *         if el._free_after_use:
 *             tree.xmlFreeNode(c_node)
 *     del sourceProxy._dependent_proxies[:]             # <<<<<<<<<<<<<<
 * 
 * # opaque wrapper around non-element nodes, e.g. the document node
 */
  if (__Pyx_PySequence_DelSlice(((PyObject *)__pyx_v_sourceProxy->_dependent_proxies), 0, PY_SSIZE_T_MAX) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._freeReadOnlyProxies");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_el);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":363
 * cdef class _OpaqueNodeWrapper:
 *     cdef tree.xmlNode* _c_node
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         raise TypeError, u"This type cannot be instatiated from Python"
 * 
 */

static int __pyx_pf_4lxml_5etree_18_OpaqueNodeWrapper___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_18_OpaqueNodeWrapper___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("__init__");
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":364
 *     cdef tree.xmlNode* _c_node
 *     def __init__(self):
 *         raise TypeError, u"This type cannot be instatiated from Python"             # <<<<<<<<<<<<<<
 * 
 * cdef class _OpaqueDocumentWrapper(_OpaqueNodeWrapper):
 */
  __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_u_134), 0);
  {__pyx_filename = __pyx_f[8]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._OpaqueNodeWrapper.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":367
 * 
 * cdef class _OpaqueDocumentWrapper(_OpaqueNodeWrapper):
 *     cdef int _assertNode(self) except -1:             # <<<<<<<<<<<<<<
 *         u"""This is our way of saying: this proxy is invalid!
 *         """
 */

static  int __pyx_f_4lxml_5etree_22_OpaqueDocumentWrapper__assertNode(struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("_assertNode");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":370
 *         u"""This is our way of saying: this proxy is invalid!
 *         """
 *         assert self._c_node is not NULL, u"Proxy invalidated!"             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!(__pyx_v_self->__pyx_base._c_node != NULL))) {
    PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_u_128));
    {__pyx_filename = __pyx_f[8]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":371
 *         """
 *         assert self._c_node is not NULL, u"Proxy invalidated!"
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cpdef append(self, other_element):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._OpaqueDocumentWrapper._assertNode");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":373
 *         return 0
 * 
 *     cpdef append(self, other_element):             # <<<<<<<<<<<<<<
 *         u"""Append a copy of an Element to the list of children.
 *         """
 */

static PyObject *__pyx_pf_4lxml_5etree_22_OpaqueDocumentWrapper_append(PyObject *__pyx_v_self, PyObject *__pyx_v_other_element); /*proto*/
static  PyObject *__pyx_f_4lxml_5etree_22_OpaqueDocumentWrapper_append(struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper *__pyx_v_self, PyObject *__pyx_v_other_element, int __pyx_skip_dispatch) {
  xmlNode *__pyx_v_c_next;
  xmlNode *__pyx_v_c_node;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  xmlNode *__pyx_t_5;
  int __pyx_t_6;
  xmlElementType __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  xmlNode *__pyx_t_10;
  __Pyx_RefNannySetupContext("append");
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__append); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_4lxml_5etree_22_OpaqueDocumentWrapper_append)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __Pyx_INCREF(__pyx_v_other_element);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_other_element);
      __Pyx_GIVEREF(__pyx_v_other_element);
      __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":378
 *         cdef xmlNode* c_next
 *         cdef xmlNode* c_node
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         c_node = _roNodeOf(other_element)
 *         if c_node.type == tree.XML_ELEMENT_NODE:
 */
  __pyx_t_4 = ((struct __pyx_vtabstruct_4lxml_5etree__OpaqueDocumentWrapper *)__pyx_v_self->__pyx_vtab)->_assertNode(__pyx_v_self); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":379
 *         cdef xmlNode* c_node
 *         self._assertNode()
 *         c_node = _roNodeOf(other_element)             # <<<<<<<<<<<<<<
 *         if c_node.type == tree.XML_ELEMENT_NODE:
 *             if tree.xmlDocGetRootElement(<tree.xmlDoc*>self._c_node) is not NULL:
 */
  __pyx_t_5 = __pyx_f_4lxml_5etree__roNodeOf(__pyx_v_other_element); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_node = __pyx_t_5;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":380
 *         self._assertNode()
 *         c_node = _roNodeOf(other_element)
 *         if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *             if tree.xmlDocGetRootElement(<tree.xmlDoc*>self._c_node) is not NULL:
 *                 raise ValueError, u"cannot append, document already has a root element"
 */
  __pyx_t_6 = (__pyx_v_c_node->type == XML_ELEMENT_NODE);
  if (__pyx_t_6) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":381
 *         c_node = _roNodeOf(other_element)
 *         if c_node.type == tree.XML_ELEMENT_NODE:
 *             if tree.xmlDocGetRootElement(<tree.xmlDoc*>self._c_node) is not NULL:             # <<<<<<<<<<<<<<
 *                 raise ValueError, u"cannot append, document already has a root element"
 *         elif c_node.type not in (tree.XML_PI_NODE, tree.XML_COMMENT_NODE):
 */
    __pyx_t_6 = (xmlDocGetRootElement(((xmlDoc *)__pyx_v_self->__pyx_base._c_node)) != NULL);
    if (__pyx_t_6) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":382
 *         if c_node.type == tree.XML_ELEMENT_NODE:
 *             if tree.xmlDocGetRootElement(<tree.xmlDoc*>self._c_node) is not NULL:
 *                 raise ValueError, u"cannot append, document already has a root element"             # <<<<<<<<<<<<<<
 *         elif c_node.type not in (tree.XML_PI_NODE, tree.XML_COMMENT_NODE):
 *             raise TypeError, u"unsupported element type for top-level node: %d" % c_node.type
 */
      __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_u_135), 0);
      {__pyx_filename = __pyx_f[8]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":383
 *             if tree.xmlDocGetRootElement(<tree.xmlDoc*>self._c_node) is not NULL:
 *                 raise ValueError, u"cannot append, document already has a root element"
 *         elif c_node.type not in (tree.XML_PI_NODE, tree.XML_COMMENT_NODE):             # <<<<<<<<<<<<<<
 *             raise TypeError, u"unsupported element type for top-level node: %d" % c_node.type
 *         c_node = _copyNodeToDoc(c_node, <tree.xmlDoc*>self._c_node)
 */
  __pyx_t_7 = __pyx_v_c_node->type;
  __pyx_t_6 = (__pyx_t_7 != XML_PI_NODE);
  if (__pyx_t_6) {
    __pyx_t_8 = (__pyx_t_7 != XML_COMMENT_NODE);
    __pyx_t_9 = __pyx_t_8;
  } else {
    __pyx_t_9 = __pyx_t_6;
  }
  __pyx_t_6 = __pyx_t_9;
  if (__pyx_t_6) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":384
 *                 raise ValueError, u"cannot append, document already has a root element"
 *         elif c_node.type not in (tree.XML_PI_NODE, tree.XML_COMMENT_NODE):
 *             raise TypeError, u"unsupported element type for top-level node: %d" % c_node.type             # <<<<<<<<<<<<<<
 *         c_node = _copyNodeToDoc(c_node, <tree.xmlDoc*>self._c_node)
 *         c_next = c_node.next
 */
    __pyx_t_1 = PyInt_FromLong(__pyx_v_c_node->type); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_136), __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_3), 0);
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[8]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":385
 *         elif c_node.type not in (tree.XML_PI_NODE, tree.XML_COMMENT_NODE):
 *             raise TypeError, u"unsupported element type for top-level node: %d" % c_node.type
 *         c_node = _copyNodeToDoc(c_node, <tree.xmlDoc*>self._c_node)             # <<<<<<<<<<<<<<
 *         c_next = c_node.next
 *         tree.xmlAddChild(self._c_node, c_node)
 */
  __pyx_t_10 = __pyx_f_4lxml_5etree__copyNodeToDoc(__pyx_v_c_node, ((xmlDoc *)__pyx_v_self->__pyx_base._c_node)); if (unlikely(__pyx_t_10 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_node = __pyx_t_10;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":386
 *             raise TypeError, u"unsupported element type for top-level node: %d" % c_node.type
 *         c_node = _copyNodeToDoc(c_node, <tree.xmlDoc*>self._c_node)
 *         c_next = c_node.next             # <<<<<<<<<<<<<<
 *         tree.xmlAddChild(self._c_node, c_node)
 *         _moveTail(c_next, c_node)
 */
  __pyx_v_c_next = __pyx_v_c_node->next;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":387
 *         c_node = _copyNodeToDoc(c_node, <tree.xmlDoc*>self._c_node)
 *         c_next = c_node.next
 *         tree.xmlAddChild(self._c_node, c_node)             # <<<<<<<<<<<<<<
 *         _moveTail(c_next, c_node)
 * 
 */
  xmlAddChild(__pyx_v_self->__pyx_base._c_node, __pyx_v_c_node);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":388
 *         c_next = c_node.next
 *         tree.xmlAddChild(self._c_node, c_node)
 *         _moveTail(c_next, c_node)             # <<<<<<<<<<<<<<
 * 
 *     def extend(self, elements):
 */
  __pyx_f_4lxml_5etree__moveTail(__pyx_v_c_next, __pyx_v_c_node);

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._OpaqueDocumentWrapper.append");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":373
 *         return 0
 * 
 *     cpdef append(self, other_element):             # <<<<<<<<<<<<<<
 *         u"""Append a copy of an Element to the list of children.
 *         """
 */

static PyObject *__pyx_pf_4lxml_5etree_22_OpaqueDocumentWrapper_append(PyObject *__pyx_v_self, PyObject *__pyx_v_other_element); /*proto*/
static char __pyx_doc_4lxml_5etree_22_OpaqueDocumentWrapper_append[] = "Append a copy of an Element to the list of children.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_22_OpaqueDocumentWrapper_append(PyObject *__pyx_v_self, PyObject *__pyx_v_other_element) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("append");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__OpaqueDocumentWrapper *)((struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper *)__pyx_v_self)->__pyx_vtab)->append(((struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper *)__pyx_v_self), __pyx_v_other_element, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._OpaqueDocumentWrapper.append");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":390
 *         _moveTail(c_next, c_node)
 * 
 *     def extend(self, elements):             # <<<<<<<<<<<<<<
 *         u"""Append a copy of all Elements from a sequence to the list of
 *         children.
 */

static PyObject *__pyx_pf_4lxml_5etree_22_OpaqueDocumentWrapper_1extend(PyObject *__pyx_v_self, PyObject *__pyx_v_elements); /*proto*/
static char __pyx_doc_4lxml_5etree_22_OpaqueDocumentWrapper_1extend[] = "Append a copy of all Elements from a sequence to the list of\n        children.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_22_OpaqueDocumentWrapper_1extend(PyObject *__pyx_v_self, PyObject *__pyx_v_elements) {
  PyObject *__pyx_v_element;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("extend");
  __pyx_v_element = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":394
 *         children.
 *         """
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         for element in elements:
 *             self.append(element)
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__OpaqueDocumentWrapper *)((struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper *)__pyx_v_self)->__pyx_vtab)->_assertNode(((struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":395
 *         """
 *         self._assertNode()
 *         for element in elements:             # <<<<<<<<<<<<<<
 *             self.append(element)
 * 
 */
  if (PyList_CheckExact(__pyx_v_elements) || PyTuple_CheckExact(__pyx_v_elements)) {
    __pyx_t_2 = 0; __pyx_t_3 = __pyx_v_elements; __Pyx_INCREF(__pyx_t_3);
  } else {
    __pyx_t_2 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_elements); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
  }
  for (;;) {
    if (likely(PyList_CheckExact(__pyx_t_3))) {
      if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_3)) break;
      __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++;
    } else if (likely(PyTuple_CheckExact(__pyx_t_3))) {
      if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
      __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++;
    } else {
      __pyx_t_4 = PyIter_Next(__pyx_t_3);
      if (!__pyx_t_4) {
        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_DECREF(__pyx_v_element);
    __pyx_v_element = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":396
 *         self._assertNode()
 *         for element in elements:
 *             self.append(element)             # <<<<<<<<<<<<<<
 * 
 * cdef extern from "etree_defs.h":
 */
    __pyx_t_4 = ((struct __pyx_vtabstruct_4lxml_5etree__OpaqueDocumentWrapper *)((struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper *)__pyx_v_self)->__pyx_vtab)->append(((struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper *)__pyx_v_self), __pyx_v_element, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._OpaqueDocumentWrapper.extend");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_element);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":402
 *     cdef _OpaqueNodeWrapper NEW_OPAQUE_NODE_PROXY "PY_NEW" (object t)
 * 
 * cdef _OpaqueNodeWrapper _newOpaqueAppendOnlyNodeWrapper(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     cdef _OpaqueNodeWrapper node
 *     if c_node.type in (tree.XML_DOCUMENT_NODE, tree.XML_HTML_DOCUMENT_NODE):
 */

static  struct __pyx_obj_4lxml_5etree__OpaqueNodeWrapper *__pyx_f_4lxml_5etree__newOpaqueAppendOnlyNodeWrapper(xmlNode *__pyx_v_c_node) {
  struct __pyx_obj_4lxml_5etree__OpaqueNodeWrapper *__pyx_v_node;
  struct __pyx_obj_4lxml_5etree__OpaqueNodeWrapper *__pyx_r = NULL;
  xmlElementType __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("_newOpaqueAppendOnlyNodeWrapper");
  __pyx_v_node = ((struct __pyx_obj_4lxml_5etree__OpaqueNodeWrapper *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":404
 * cdef _OpaqueNodeWrapper _newOpaqueAppendOnlyNodeWrapper(xmlNode* c_node):
 *     cdef _OpaqueNodeWrapper node
 *     if c_node.type in (tree.XML_DOCUMENT_NODE, tree.XML_HTML_DOCUMENT_NODE):             # <<<<<<<<<<<<<<
 *         node = NEW_OPAQUE_NODE_PROXY(_OpaqueDocumentWrapper)
 *     else:
 */
  __pyx_t_1 = __pyx_v_c_node->type;
  __pyx_t_2 = (__pyx_t_1 == XML_DOCUMENT_NODE);
  if (!__pyx_t_2) {
    __pyx_t_3 = (__pyx_t_1 == XML_HTML_DOCUMENT_NODE);
    __pyx_t_4 = __pyx_t_3;
  } else {
    __pyx_t_4 = __pyx_t_2;
  }
  __pyx_t_2 = __pyx_t_4;
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":405
 *     cdef _OpaqueNodeWrapper node
 *     if c_node.type in (tree.XML_DOCUMENT_NODE, tree.XML_HTML_DOCUMENT_NODE):
 *         node = NEW_OPAQUE_NODE_PROXY(_OpaqueDocumentWrapper)             # <<<<<<<<<<<<<<
 *     else:
 *         node = NEW_OPAQUE_NODE_PROXY(_OpaqueNodeWrapper)
 */
    __pyx_t_5 = ((PyObject *)PY_NEW(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__OpaqueDocumentWrapper)))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(((PyObject *)__pyx_v_node));
    __pyx_v_node = ((struct __pyx_obj_4lxml_5etree__OpaqueNodeWrapper *)__pyx_t_5);
    __pyx_t_5 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":407
 *         node = NEW_OPAQUE_NODE_PROXY(_OpaqueDocumentWrapper)
 *     else:
 *         node = NEW_OPAQUE_NODE_PROXY(_OpaqueNodeWrapper)             # <<<<<<<<<<<<<<
 *     node._c_node = c_node
 *     return node
 */
    __pyx_t_5 = ((PyObject *)PY_NEW(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__OpaqueNodeWrapper)))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(((PyObject *)__pyx_v_node));
    __pyx_v_node = ((struct __pyx_obj_4lxml_5etree__OpaqueNodeWrapper *)__pyx_t_5);
    __pyx_t_5 = 0;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":408
 *     else:
 *         node = NEW_OPAQUE_NODE_PROXY(_OpaqueNodeWrapper)
 *     node._c_node = c_node             # <<<<<<<<<<<<<<
 *     return node
 * 
 */
  __pyx_v_node->_c_node = __pyx_v_c_node;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":409
 *         node = NEW_OPAQUE_NODE_PROXY(_OpaqueNodeWrapper)
 *     node._c_node = c_node
 *     return node             # <<<<<<<<<<<<<<
 * 
 * # element proxies that allow restricted modification
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_node));
  __pyx_r = __pyx_v_node;
  goto __pyx_L0;

  __pyx_r = ((struct __pyx_obj_4lxml_5etree__OpaqueNodeWrapper *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._newOpaqueAppendOnlyNodeWrapper");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_node);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":417
 *     """
 *     property text:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self._assertNode()
 *             if self._c_node.content is NULL:
 */

static PyObject *__pyx_pf_4lxml_5etree_23_ModifyContentOnlyProxy_4text___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_23_ModifyContentOnlyProxy_4text___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__get__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":418
 *     property text:
 *         def __get__(self):
 *             self._assertNode()             # <<<<<<<<<<<<<<
 *             if self._c_node.content is NULL:
 *                 return ''
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ModifyContentOnlyProxy *)((struct __pyx_obj_4lxml_5etree__ModifyContentOnlyProxy *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base._assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":419
 *         def __get__(self):
 *             self._assertNode()
 *             if self._c_node.content is NULL:             # <<<<<<<<<<<<<<
 *                 return ''
 *             else:
 */
  __pyx_t_2 = (((struct __pyx_obj_4lxml_5etree__ModifyContentOnlyProxy *)__pyx_v_self)->__pyx_base._c_node->content == NULL);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":420
 *             self._assertNode()
 *             if self._c_node.content is NULL:
 *                 return ''             # <<<<<<<<<<<<<<
 *             else:
 *                 return funicode(self._c_node.content)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_25));
    __pyx_r = ((PyObject *)__pyx_kp_s_25);
    goto __pyx_L0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":422
 *                 return ''
 *             else:
 *                 return funicode(self._c_node.content)             # <<<<<<<<<<<<<<
 * 
 *         def __set__(self, value):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(((struct __pyx_obj_4lxml_5etree__ModifyContentOnlyProxy *)__pyx_v_self)->__pyx_base._c_node->content); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }
  __pyx_L5:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ModifyContentOnlyProxy.text.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":424
 *                 return funicode(self._c_node.content)
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             cdef tree.xmlDict* c_dict
 *             cdef char* c_text
 */

static int __pyx_pf_4lxml_5etree_23_ModifyContentOnlyProxy_4text_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_4lxml_5etree_23_ModifyContentOnlyProxy_4text_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  char *__pyx_v_c_text;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__set__");
  __Pyx_INCREF(__pyx_v_value);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":427
 *             cdef tree.xmlDict* c_dict
 *             cdef char* c_text
 *             self._assertNode()             # <<<<<<<<<<<<<<
 *             if value is None:
 *                 c_text = NULL
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ModifyContentOnlyProxy *)((struct __pyx_obj_4lxml_5etree__ModifyContentOnlyProxy *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base._assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":428
 *             cdef char* c_text
 *             self._assertNode()
 *             if value is None:             # <<<<<<<<<<<<<<
 *                 c_text = NULL
 *             else:
 */
  __pyx_t_2 = (__pyx_v_value == Py_None);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":429
 *             self._assertNode()
 *             if value is None:
 *                 c_text = NULL             # <<<<<<<<<<<<<<
 *             else:
 *                 value = _utf8(value)
 */
    __pyx_v_c_text = NULL;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":431
 *                 c_text = NULL
 *             else:
 *                 value = _utf8(value)             # <<<<<<<<<<<<<<
 *                 c_text = _cstr(value)
 *             tree.xmlNodeSetContent(self._c_node, c_text)
 */
    __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_v_value)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_v_value);
    __pyx_v_value = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":432
 *             else:
 *                 value = _utf8(value)
 *                 c_text = _cstr(value)             # <<<<<<<<<<<<<<
 *             tree.xmlNodeSetContent(self._c_node, c_text)
 * 
 */
    __pyx_v_c_text = PyBytes_AS_STRING(__pyx_v_value);
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":433
 *                 value = _utf8(value)
 *                 c_text = _cstr(value)
 *             tree.xmlNodeSetContent(self._c_node, c_text)             # <<<<<<<<<<<<<<
 * 
 * cdef class _ModifyContentOnlyPIProxy(_ModifyContentOnlyProxy):
 */
  xmlNodeSetContent(((struct __pyx_obj_4lxml_5etree__ModifyContentOnlyProxy *)__pyx_v_self)->__pyx_base._c_node, __pyx_v_c_text);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ModifyContentOnlyProxy.text.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_value);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":440
 *     """
 *     property target:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self._assertNode()
 *             return funicode(self._c_node.name)
 */

static PyObject *__pyx_pf_4lxml_5etree_25_ModifyContentOnlyPIProxy_6target___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_25_ModifyContentOnlyPIProxy_6target___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__get__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":441
 *     property target:
 *         def __get__(self):
 *             self._assertNode()             # <<<<<<<<<<<<<<
 *             return funicode(self._c_node.name)
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ModifyContentOnlyPIProxy *)((struct __pyx_obj_4lxml_5etree__ModifyContentOnlyPIProxy *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":442
 *         def __get__(self):
 *             self._assertNode()
 *             return funicode(self._c_node.name)             # <<<<<<<<<<<<<<
 * 
 *         def __set__(self, value):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(((struct __pyx_obj_4lxml_5etree__ModifyContentOnlyPIProxy *)__pyx_v_self)->__pyx_base.__pyx_base._c_node->name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ModifyContentOnlyPIProxy.target.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":444
 *             return funicode(self._c_node.name)
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self._assertNode()
 *             value = _utf8(value)
 */

static int __pyx_pf_4lxml_5etree_25_ModifyContentOnlyPIProxy_6target_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_4lxml_5etree_25_ModifyContentOnlyPIProxy_6target_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  char *__pyx_v_c_text;
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__set__");
  __Pyx_INCREF(__pyx_v_value);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":445
 * 
 *         def __set__(self, value):
 *             self._assertNode()             # <<<<<<<<<<<<<<
 *             value = _utf8(value)
 *             c_text = _cstr(value)
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ModifyContentOnlyPIProxy *)((struct __pyx_obj_4lxml_5etree__ModifyContentOnlyPIProxy *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":446
 *         def __set__(self, value):
 *             self._assertNode()
 *             value = _utf8(value)             # <<<<<<<<<<<<<<
 *             c_text = _cstr(value)
 *             tree.xmlNodeSetName(self._c_node, c_text)
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_v_value)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_v_value);
  __pyx_v_value = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":447
 *             self._assertNode()
 *             value = _utf8(value)
 *             c_text = _cstr(value)             # <<<<<<<<<<<<<<
 *             tree.xmlNodeSetName(self._c_node, c_text)
 * 
 */
  __pyx_v_c_text = PyBytes_AS_STRING(__pyx_v_value);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":448
 *             value = _utf8(value)
 *             c_text = _cstr(value)
 *             tree.xmlNodeSetName(self._c_node, c_text)             # <<<<<<<<<<<<<<
 * 
 * cdef class _ModifyContentOnlyEntityProxy(_ModifyContentOnlyProxy):
 */
  xmlNodeSetName(((struct __pyx_obj_4lxml_5etree__ModifyContentOnlyPIProxy *)__pyx_v_self)->__pyx_base.__pyx_base._c_node, __pyx_v_c_text);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ModifyContentOnlyPIProxy.target.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_value);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":453
 *     u"A read-only proxy for entity references (for internal use only!)"
 *     property name:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return funicode(self._c_node.name)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_29_ModifyContentOnlyEntityProxy_4name___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_29_ModifyContentOnlyEntityProxy_4name___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":454
 *     property name:
 *         def __get__(self):
 *             return funicode(self._c_node.name)             # <<<<<<<<<<<<<<
 * 
 *         def __set__(self, value):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree_funicode(((struct __pyx_obj_4lxml_5etree__ModifyContentOnlyEntityProxy *)__pyx_v_self)->__pyx_base.__pyx_base._c_node->name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ModifyContentOnlyEntityProxy.name.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":456
 *             return funicode(self._c_node.name)
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             value = _utf8(value)
 *             assert u'&' not in value and u';' not in value, \
 */

static int __pyx_pf_4lxml_5etree_29_ModifyContentOnlyEntityProxy_4name_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_4lxml_5etree_29_ModifyContentOnlyEntityProxy_4name_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  char *__pyx_v_c_text;
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("__set__");
  __Pyx_INCREF(__pyx_v_value);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":457
 * 
 *         def __set__(self, value):
 *             value = _utf8(value)             # <<<<<<<<<<<<<<
 *             assert u'&' not in value and u';' not in value, \
 *                 u"Invalid entity name '%s'" % value
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_v_value)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_v_value);
  __pyx_v_value = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":458
 *         def __set__(self, value):
 *             value = _utf8(value)
 *             assert u'&' not in value and u';' not in value, \             # <<<<<<<<<<<<<<
 *                 u"Invalid entity name '%s'" % value
 *             c_text = _cstr(value)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  __pyx_t_2 = (__Pyx_NegateNonNeg(PySequence_Contains(__pyx_v_value, ((PyObject *)__pyx_kp_u_82)))); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_2) {
    __pyx_t_3 = (__Pyx_NegateNonNeg(PySequence_Contains(__pyx_v_value, ((PyObject *)__pyx_kp_u_83)))); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __pyx_t_3;
  } else {
    __pyx_t_4 = __pyx_t_2;
  }
  if (unlikely(!__pyx_t_4)) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":459
 *             value = _utf8(value)
 *             assert u'&' not in value and u';' not in value, \
 *                 u"Invalid entity name '%s'" % value             # <<<<<<<<<<<<<<
 *             c_text = _cstr(value)
 *             tree.xmlNodeSetName(self._c_node, c_text)
 */
    __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_84), __pyx_v_value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_t_1));
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[8]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":460
 *             assert u'&' not in value and u';' not in value, \
 *                 u"Invalid entity name '%s'" % value
 *             c_text = _cstr(value)             # <<<<<<<<<<<<<<
 *             tree.xmlNodeSetName(self._c_node, c_text)
 * 
 */
  __pyx_v_c_text = PyBytes_AS_STRING(__pyx_v_value);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":461
 *                 u"Invalid entity name '%s'" % value
 *             c_text = _cstr(value)
 *             tree.xmlNodeSetName(self._c_node, c_text)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  xmlNodeSetName(((struct __pyx_obj_4lxml_5etree__ModifyContentOnlyEntityProxy *)__pyx_v_self)->__pyx_base.__pyx_base._c_node, __pyx_v_c_text);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ModifyContentOnlyEntityProxy.name.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_value);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":468
 *     text content (i.e. everything that adds to the subtree).
 *     """
 *     cpdef append(self, other_element):             # <<<<<<<<<<<<<<
 *         u"""Append a copy of an Element to the list of children.
 *         """
 */

static PyObject *__pyx_pf_4lxml_5etree_23_AppendOnlyElementProxy_append(PyObject *__pyx_v_self, PyObject *__pyx_v_other_element); /*proto*/
static  PyObject *__pyx_f_4lxml_5etree_23_AppendOnlyElementProxy_append(struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *__pyx_v_self, PyObject *__pyx_v_other_element, int __pyx_skip_dispatch) {
  xmlNode *__pyx_v_c_next;
  xmlNode *__pyx_v_c_node;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  xmlNode *__pyx_t_5;
  xmlNode *__pyx_t_6;
  __Pyx_RefNannySetupContext("append");
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__append); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_4lxml_5etree_23_AppendOnlyElementProxy_append)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __Pyx_INCREF(__pyx_v_other_element);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_other_element);
      __Pyx_GIVEREF(__pyx_v_other_element);
      __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":473
 *         cdef xmlNode* c_next
 *         cdef xmlNode* c_node
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         c_node = _roNodeOf(other_element)
 *         c_node = _copyNodeToDoc(c_node, self._c_node.doc)
 */
  __pyx_t_4 = ((struct __pyx_vtabstruct_4lxml_5etree__AppendOnlyElementProxy *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":474
 *         cdef xmlNode* c_node
 *         self._assertNode()
 *         c_node = _roNodeOf(other_element)             # <<<<<<<<<<<<<<
 *         c_node = _copyNodeToDoc(c_node, self._c_node.doc)
 *         c_next = c_node.next
 */
  __pyx_t_5 = __pyx_f_4lxml_5etree__roNodeOf(__pyx_v_other_element); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_node = __pyx_t_5;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":475
 *         self._assertNode()
 *         c_node = _roNodeOf(other_element)
 *         c_node = _copyNodeToDoc(c_node, self._c_node.doc)             # <<<<<<<<<<<<<<
 *         c_next = c_node.next
 *         tree.xmlAddChild(self._c_node, c_node)
 */
  __pyx_t_6 = __pyx_f_4lxml_5etree__copyNodeToDoc(__pyx_v_c_node, __pyx_v_self->__pyx_base.__pyx_base._c_node->doc); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_node = __pyx_t_6;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":476
 *         c_node = _roNodeOf(other_element)
 *         c_node = _copyNodeToDoc(c_node, self._c_node.doc)
 *         c_next = c_node.next             # <<<<<<<<<<<<<<
 *         tree.xmlAddChild(self._c_node, c_node)
 *         _moveTail(c_next, c_node)
 */
  __pyx_v_c_next = __pyx_v_c_node->next;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":477
 *         c_node = _copyNodeToDoc(c_node, self._c_node.doc)
 *         c_next = c_node.next
 *         tree.xmlAddChild(self._c_node, c_node)             # <<<<<<<<<<<<<<
 *         _moveTail(c_next, c_node)
 * 
 */
  xmlAddChild(__pyx_v_self->__pyx_base.__pyx_base._c_node, __pyx_v_c_node);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":478
 *         c_next = c_node.next
 *         tree.xmlAddChild(self._c_node, c_node)
 *         _moveTail(c_next, c_node)             # <<<<<<<<<<<<<<
 * 
 *     def extend(self, elements):
 */
  __pyx_f_4lxml_5etree__moveTail(__pyx_v_c_next, __pyx_v_c_node);

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._AppendOnlyElementProxy.append");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":468
 *     text content (i.e. everything that adds to the subtree).
 *     """
 *     cpdef append(self, other_element):             # <<<<<<<<<<<<<<
 *         u"""Append a copy of an Element to the list of children.
 *         """
 */

static PyObject *__pyx_pf_4lxml_5etree_23_AppendOnlyElementProxy_append(PyObject *__pyx_v_self, PyObject *__pyx_v_other_element); /*proto*/
static char __pyx_doc_4lxml_5etree_23_AppendOnlyElementProxy_append[] = "Append a copy of an Element to the list of children.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_23_AppendOnlyElementProxy_append(PyObject *__pyx_v_self, PyObject *__pyx_v_other_element) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("append");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__AppendOnlyElementProxy *)((struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_vtab)->append(((struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *)__pyx_v_self), __pyx_v_other_element, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._AppendOnlyElementProxy.append");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":480
 *         _moveTail(c_next, c_node)
 * 
 *     def extend(self, elements):             # <<<<<<<<<<<<<<
 *         u"""Append a copy of all Elements from a sequence to the list of
 *         children.
 */

static PyObject *__pyx_pf_4lxml_5etree_23_AppendOnlyElementProxy_1extend(PyObject *__pyx_v_self, PyObject *__pyx_v_elements); /*proto*/
static char __pyx_doc_4lxml_5etree_23_AppendOnlyElementProxy_1extend[] = "Append a copy of all Elements from a sequence to the list of\n        children.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_23_AppendOnlyElementProxy_1extend(PyObject *__pyx_v_self, PyObject *__pyx_v_elements) {
  PyObject *__pyx_v_element;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("extend");
  __pyx_v_element = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":484
 *         children.
 *         """
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         for element in elements:
 *             self.append(element)
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__AppendOnlyElementProxy *)((struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":485
 *         """
 *         self._assertNode()
 *         for element in elements:             # <<<<<<<<<<<<<<
 *             self.append(element)
 * 
 */
  if (PyList_CheckExact(__pyx_v_elements) || PyTuple_CheckExact(__pyx_v_elements)) {
    __pyx_t_2 = 0; __pyx_t_3 = __pyx_v_elements; __Pyx_INCREF(__pyx_t_3);
  } else {
    __pyx_t_2 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_elements); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
  }
  for (;;) {
    if (likely(PyList_CheckExact(__pyx_t_3))) {
      if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_3)) break;
      __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++;
    } else if (likely(PyTuple_CheckExact(__pyx_t_3))) {
      if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
      __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++;
    } else {
      __pyx_t_4 = PyIter_Next(__pyx_t_3);
      if (!__pyx_t_4) {
        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_DECREF(__pyx_v_element);
    __pyx_v_element = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":486
 *         self._assertNode()
 *         for element in elements:
 *             self.append(element)             # <<<<<<<<<<<<<<
 * 
 *     property text:
 */
    __pyx_t_4 = ((struct __pyx_vtabstruct_4lxml_5etree__AppendOnlyElementProxy *)((struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_vtab)->append(((struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *)__pyx_v_self), __pyx_v_element, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._AppendOnlyElementProxy.extend");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_element);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":492
 *         value None, if there was no text.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self._assertNode()
 *             return _collectText(self._c_node.children)
 */

static PyObject *__pyx_pf_4lxml_5etree_23_AppendOnlyElementProxy_4text___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_23_AppendOnlyElementProxy_4text___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__get__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":493
 *         """
 *         def __get__(self):
 *             self._assertNode()             # <<<<<<<<<<<<<<
 *             return _collectText(self._c_node.children)
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__AppendOnlyElementProxy *)((struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":494
 *         def __get__(self):
 *             self._assertNode()
 *             return _collectText(self._c_node.children)             # <<<<<<<<<<<<<<
 * 
 *         def __set__(self, value):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree__collectText(((struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *)__pyx_v_self)->__pyx_base.__pyx_base._c_node->children); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._AppendOnlyElementProxy.text.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":496
 *             return _collectText(self._c_node.children)
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self._assertNode()
 *             if isinstance(value, QName):
 */

static int __pyx_pf_4lxml_5etree_23_AppendOnlyElementProxy_4text_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_4lxml_5etree_23_AppendOnlyElementProxy_4text_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("__set__");
  __Pyx_INCREF(__pyx_v_value);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":497
 * 
 *         def __set__(self, value):
 *             self._assertNode()             # <<<<<<<<<<<<<<
 *             if isinstance(value, QName):
 *                 value = python.PyUnicode_FromEncodedObject(
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__AppendOnlyElementProxy *)((struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":498
 *         def __set__(self, value):
 *             self._assertNode()
 *             if isinstance(value, QName):             # <<<<<<<<<<<<<<
 *                 value = python.PyUnicode_FromEncodedObject(
 *                     _resolveQNameText(self, value), 'UTF-8', 'strict')
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_value, ((PyObject*)__pyx_ptype_4lxml_5etree_QName)); 
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":500
 *             if isinstance(value, QName):
 *                 value = python.PyUnicode_FromEncodedObject(
 *                     _resolveQNameText(self, value), 'UTF-8', 'strict')             # <<<<<<<<<<<<<<
 *             _setNodeText(self._c_node, value)
 * 
 */
    if (!(likely(((__pyx_v_self) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_self, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__resolveQNameText(((struct LxmlElement *)__pyx_v_self), __pyx_v_value)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = ((PyObject *)PyUnicode_FromEncodedObject(__pyx_t_3, __pyx_k_31, __pyx_k__strict)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_v_value);
    __pyx_v_value = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":501
 *                 value = python.PyUnicode_FromEncodedObject(
 *                     _resolveQNameText(self, value), 'UTF-8', 'strict')
 *             _setNodeText(self._c_node, value)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__setNodeText(((struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *)__pyx_v_self)->__pyx_base.__pyx_base._c_node, __pyx_v_value); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._AppendOnlyElementProxy.text.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_value);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":504
 * 
 * 
 * cdef _ReadOnlyProxy _newAppendOnlyProxy(             # <<<<<<<<<<<<<<
 *     _ReadOnlyProxy source_proxy, xmlNode* c_node):
 *     cdef _ReadOnlyProxy el
 */

static  struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_f_4lxml_5etree__newAppendOnlyProxy(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_source_proxy, xmlNode *__pyx_v_c_node) {
  struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_el;
  struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("_newAppendOnlyProxy");
  __pyx_v_el = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":507
 *     _ReadOnlyProxy source_proxy, xmlNode* c_node):
 *     cdef _ReadOnlyProxy el
 *     if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         el = NEW_RO_PROXY(_AppendOnlyElementProxy)
 *     elif c_node.type == tree.XML_PI_NODE:
 */
  __pyx_t_1 = (__pyx_v_c_node->type == XML_ELEMENT_NODE);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":508
 *     cdef _ReadOnlyProxy el
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         el = NEW_RO_PROXY(_AppendOnlyElementProxy)             # <<<<<<<<<<<<<<
 *     elif c_node.type == tree.XML_PI_NODE:
 *         el = NEW_RO_PROXY(_ModifyContentOnlyPIProxy)
 */
    __pyx_t_2 = ((PyObject *)PY_NEW(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__AppendOnlyElementProxy)))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_v_el));
    __pyx_v_el = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":509
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         el = NEW_RO_PROXY(_AppendOnlyElementProxy)
 *     elif c_node.type == tree.XML_PI_NODE:             # <<<<<<<<<<<<<<
 *         el = NEW_RO_PROXY(_ModifyContentOnlyPIProxy)
 *     elif c_node.type == tree.XML_COMMENT_NODE:
 */
  __pyx_t_1 = (__pyx_v_c_node->type == XML_PI_NODE);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":510
 *         el = NEW_RO_PROXY(_AppendOnlyElementProxy)
 *     elif c_node.type == tree.XML_PI_NODE:
 *         el = NEW_RO_PROXY(_ModifyContentOnlyPIProxy)             # <<<<<<<<<<<<<<
 *     elif c_node.type == tree.XML_COMMENT_NODE:
 *         el = NEW_RO_PROXY(_ModifyContentOnlyProxy)
 */
    __pyx_t_2 = ((PyObject *)PY_NEW(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ModifyContentOnlyPIProxy)))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_v_el));
    __pyx_v_el = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":511
 *     elif c_node.type == tree.XML_PI_NODE:
 *         el = NEW_RO_PROXY(_ModifyContentOnlyPIProxy)
 *     elif c_node.type == tree.XML_COMMENT_NODE:             # <<<<<<<<<<<<<<
 *         el = NEW_RO_PROXY(_ModifyContentOnlyProxy)
 *     else:
 */
  __pyx_t_1 = (__pyx_v_c_node->type == XML_COMMENT_NODE);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":512
 *         el = NEW_RO_PROXY(_ModifyContentOnlyPIProxy)
 *     elif c_node.type == tree.XML_COMMENT_NODE:
 *         el = NEW_RO_PROXY(_ModifyContentOnlyProxy)             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError("Unsupported element type: %d" % c_node.type)
 */
    __pyx_t_2 = ((PyObject *)PY_NEW(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ModifyContentOnlyProxy)))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_v_el));
    __pyx_v_el = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":514
 *         el = NEW_RO_PROXY(_ModifyContentOnlyProxy)
 *     else:
 *         raise TypeError("Unsupported element type: %d" % c_node.type)             # <<<<<<<<<<<<<<
 *     el._c_node = c_node
 *     _initReadOnlyProxy(el, source_proxy)
 */
    __pyx_t_2 = PyInt_FromLong(__pyx_v_c_node->type); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_133), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
    __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[8]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":515
 *     else:
 *         raise TypeError("Unsupported element type: %d" % c_node.type)
 *     el._c_node = c_node             # <<<<<<<<<<<<<<
 *     _initReadOnlyProxy(el, source_proxy)
 *     return el
 */
  __pyx_v_el->_c_node = __pyx_v_c_node;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":516
 *         raise TypeError("Unsupported element type: %d" % c_node.type)
 *     el._c_node = c_node
 *     _initReadOnlyProxy(el, source_proxy)             # <<<<<<<<<<<<<<
 *     return el
 * 
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree__initReadOnlyProxy(__pyx_v_el, __pyx_v_source_proxy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":517
 *     el._c_node = c_node
 *     _initReadOnlyProxy(el, source_proxy)
 *     return el             # <<<<<<<<<<<<<<
 * 
 * cdef xmlNode* _roNodeOf(element) except NULL:
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_el));
  __pyx_r = __pyx_v_el;
  goto __pyx_L0;

  __pyx_r = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._newAppendOnlyProxy");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_el);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":519
 *     return el
 * 
 * cdef xmlNode* _roNodeOf(element) except NULL:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     if isinstance(element, _Element):
 */

static  xmlNode *__pyx_f_4lxml_5etree__roNodeOf(PyObject *__pyx_v_element) {
  xmlNode *__pyx_v_c_node;
  xmlNode *__pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_roNodeOf");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":521
 * cdef xmlNode* _roNodeOf(element) except NULL:
 *     cdef xmlNode* c_node
 *     if isinstance(element, _Element):             # <<<<<<<<<<<<<<
 *         c_node = (<_Element>element)._c_node
 *     elif isinstance(element, _ReadOnlyProxy):
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_element, ((PyObject*)__pyx_ptype_4lxml_5etree__Element)); 
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":522
 *     cdef xmlNode* c_node
 *     if isinstance(element, _Element):
 *         c_node = (<_Element>element)._c_node             # <<<<<<<<<<<<<<
 *     elif isinstance(element, _ReadOnlyProxy):
 *         c_node = (<_ReadOnlyProxy>element)._c_node
 */
    __pyx_v_c_node = ((struct LxmlElement *)__pyx_v_element)->_c_node;
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":523
 *     if isinstance(element, _Element):
 *         c_node = (<_Element>element)._c_node
 *     elif isinstance(element, _ReadOnlyProxy):             # <<<<<<<<<<<<<<
 *         c_node = (<_ReadOnlyProxy>element)._c_node
 *     elif isinstance(element, _OpaqueNodeWrapper):
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_element, ((PyObject*)__pyx_ptype_4lxml_5etree__ReadOnlyProxy)); 
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":524
 *         c_node = (<_Element>element)._c_node
 *     elif isinstance(element, _ReadOnlyProxy):
 *         c_node = (<_ReadOnlyProxy>element)._c_node             # <<<<<<<<<<<<<<
 *     elif isinstance(element, _OpaqueNodeWrapper):
 *         c_node = (<_OpaqueNodeWrapper>element)._c_node
 */
    __pyx_v_c_node = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_element)->_c_node;
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":525
 *     elif isinstance(element, _ReadOnlyProxy):
 *         c_node = (<_ReadOnlyProxy>element)._c_node
 *     elif isinstance(element, _OpaqueNodeWrapper):             # <<<<<<<<<<<<<<
 *         c_node = (<_OpaqueNodeWrapper>element)._c_node
 *     else:
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_element, ((PyObject*)__pyx_ptype_4lxml_5etree__OpaqueNodeWrapper)); 
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":526
 *         c_node = (<_ReadOnlyProxy>element)._c_node
 *     elif isinstance(element, _OpaqueNodeWrapper):
 *         c_node = (<_OpaqueNodeWrapper>element)._c_node             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError, u"invalid argument type %s" % type(element)
 */
    __pyx_v_c_node = ((struct __pyx_obj_4lxml_5etree__OpaqueNodeWrapper *)__pyx_v_element)->_c_node;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":528
 *         c_node = (<_OpaqueNodeWrapper>element)._c_node
 *     else:
 *         raise TypeError, u"invalid argument type %s" % type(element)             # <<<<<<<<<<<<<<
 * 
 *     if c_node is NULL:
 */
    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_137), ((PyObject *)Py_TYPE(__pyx_v_element))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_2), 0);
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[8]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":530
 *         raise TypeError, u"invalid argument type %s" % type(element)
 * 
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         raise TypeError, u"invalid element"
 *     return c_node
 */
  __pyx_t_1 = (__pyx_v_c_node == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":531
 * 
 *     if c_node is NULL:
 *         raise TypeError, u"invalid element"             # <<<<<<<<<<<<<<
 *     return c_node
 * 
 */
    __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_u_138), 0);
    {__pyx_filename = __pyx_f[8]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":532
 *     if c_node is NULL:
 *         raise TypeError, u"invalid element"
 *     return c_node             # <<<<<<<<<<<<<<
 * 
 * cdef xmlNode* _nonRoNodeOf(element) except NULL:
 */
  __pyx_r = __pyx_v_c_node;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._roNodeOf");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":534
 *     return c_node
 * 
 * cdef xmlNode* _nonRoNodeOf(element) except NULL:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     if isinstance(element, _Element):
 */

static  xmlNode *__pyx_f_4lxml_5etree__nonRoNodeOf(PyObject *__pyx_v_element) {
  xmlNode *__pyx_v_c_node;
  xmlNode *__pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_nonRoNodeOf");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":536
 * cdef xmlNode* _nonRoNodeOf(element) except NULL:
 *     cdef xmlNode* c_node
 *     if isinstance(element, _Element):             # <<<<<<<<<<<<<<
 *         c_node = (<_Element>element)._c_node
 *     elif isinstance(element, _AppendOnlyElementProxy):
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_element, ((PyObject*)__pyx_ptype_4lxml_5etree__Element)); 
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":537
 *     cdef xmlNode* c_node
 *     if isinstance(element, _Element):
 *         c_node = (<_Element>element)._c_node             # <<<<<<<<<<<<<<
 *     elif isinstance(element, _AppendOnlyElementProxy):
 *         c_node = (<_AppendOnlyElementProxy>element)._c_node
 */
    __pyx_v_c_node = ((struct LxmlElement *)__pyx_v_element)->_c_node;
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":538
 *     if isinstance(element, _Element):
 *         c_node = (<_Element>element)._c_node
 *     elif isinstance(element, _AppendOnlyElementProxy):             # <<<<<<<<<<<<<<
 *         c_node = (<_AppendOnlyElementProxy>element)._c_node
 *     elif isinstance(element, _OpaqueNodeWrapper):
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_element, ((PyObject*)__pyx_ptype_4lxml_5etree__AppendOnlyElementProxy)); 
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":539
 *         c_node = (<_Element>element)._c_node
 *     elif isinstance(element, _AppendOnlyElementProxy):
 *         c_node = (<_AppendOnlyElementProxy>element)._c_node             # <<<<<<<<<<<<<<
 *     elif isinstance(element, _OpaqueNodeWrapper):
 *         c_node = (<_OpaqueNodeWrapper>element)._c_node
 */
    __pyx_v_c_node = ((struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *)__pyx_v_element)->__pyx_base.__pyx_base._c_node;
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":540
 *     elif isinstance(element, _AppendOnlyElementProxy):
 *         c_node = (<_AppendOnlyElementProxy>element)._c_node
 *     elif isinstance(element, _OpaqueNodeWrapper):             # <<<<<<<<<<<<<<
 *         c_node = (<_OpaqueNodeWrapper>element)._c_node
 *     else:
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_element, ((PyObject*)__pyx_ptype_4lxml_5etree__OpaqueNodeWrapper)); 
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":541
 *         c_node = (<_AppendOnlyElementProxy>element)._c_node
 *     elif isinstance(element, _OpaqueNodeWrapper):
 *         c_node = (<_OpaqueNodeWrapper>element)._c_node             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError, u"invalid argument type %s" % type(element)
 */
    __pyx_v_c_node = ((struct __pyx_obj_4lxml_5etree__OpaqueNodeWrapper *)__pyx_v_element)->_c_node;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":543
 *         c_node = (<_OpaqueNodeWrapper>element)._c_node
 *     else:
 *         raise TypeError, u"invalid argument type %s" % type(element)             # <<<<<<<<<<<<<<
 * 
 *     if c_node is NULL:
 */
    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_137), ((PyObject *)Py_TYPE(__pyx_v_element))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_2), 0);
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[8]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":545
 *         raise TypeError, u"invalid argument type %s" % type(element)
 * 
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         raise TypeError, u"invalid element"
 *     return c_node
 */
  __pyx_t_1 = (__pyx_v_c_node == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":546
 * 
 *     if c_node is NULL:
 *         raise TypeError, u"invalid element"             # <<<<<<<<<<<<<<
 *     return c_node
 */
    __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_u_138), 0);
    {__pyx_filename = __pyx_f[8]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":547
 *     if c_node is NULL:
 *         raise TypeError, u"invalid element"
 *     return c_node             # <<<<<<<<<<<<<<
 */
  __pyx_r = __pyx_v_c_node;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._nonRoNodeOf");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":42
 *     hierarchies that implement a common namespace.
 *     """
 *     def __init__(self, *children, attrib=None, nsmap=None, **_extra):             # <<<<<<<<<<<<<<
 *         u"""ElementBase(*children, attrib=None, nsmap=None, **_extra)
 *         """
 */

static int __pyx_pf_4lxml_5etree_11ElementBase___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_11ElementBase___init__[] = "ElementBase(*children, attrib=None, nsmap=None, **_extra)\n        ";
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_11ElementBase___init__;
static int __pyx_pf_4lxml_5etree_11ElementBase___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_attrib = 0;
  PyObject *__pyx_v_nsmap = 0;
  PyObject *__pyx_v_children = 0;
  PyObject *__pyx_v__extra = 0;
  int __pyx_v_is_html;
  struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser;
  struct LxmlElement *__pyx_v_last_child;
  PyObject *__pyx_v__getattr;
  PyObject *__pyx_v_namespace;
  PyObject *__pyx_v_ns;
  PyObject *__pyx_v_tag;
  PyObject *__pyx_v_child;
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__attrib,&__pyx_n_s__nsmap,0};
  __Pyx_RefNannySetupContext("__init__");
  __pyx_v__extra = PyDict_New(); if (unlikely(!__pyx_v__extra)) return -1;
  __Pyx_GOTREF(__pyx_v__extra);
  if (PyTuple_GET_SIZE(__pyx_args) > 0) {
    __pyx_v_children = PyTuple_GetSlice(__pyx_args, 0, PyTuple_GET_SIZE(__pyx_args)); __Pyx_GOTREF(__pyx_v_children);

    if (unlikely(!__pyx_v_children)) {
      __Pyx_DECREF(__pyx_v__extra);
      return -1;
    }
  } else {
    __pyx_v_children = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      default:
      case  0: break;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v__extra, values, 0, "__init__") < 0)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_attrib = values[0];
    __pyx_v_nsmap = values[1];
  } else if (PyTuple_GET_SIZE(__pyx_args) < 0) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_attrib = ((PyObject *)Py_None);
    __pyx_v_nsmap = ((PyObject *)Py_None);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 0, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_children);
  __Pyx_DECREF(__pyx_v__extra);
  __Pyx_AddTraceback("lxml.etree.ElementBase.__init__");
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_last_child = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v__getattr = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_namespace = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_ns = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_tag = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_child = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":45
 *         u"""ElementBase(*children, attrib=None, nsmap=None, **_extra)
 *         """
 *         cdef bint is_html = 0             # <<<<<<<<<<<<<<
 *         cdef _BaseParser parser
 *         cdef _Element last_child
 */
  __pyx_v_is_html = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":49
 *         cdef _Element last_child
 *         # don't use normal attribute access as it might be overridden
 *         _getattr = object.__getattribute__             # <<<<<<<<<<<<<<
 *         try:
 *             namespace = _utf8(_getattr(self, 'NAMESPACE'))
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_builtin_object, __pyx_n_s____getattribute__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_v__getattr);
  __pyx_v__getattr = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":50
 *         # don't use normal attribute access as it might be overridden
 *         _getattr = object.__getattribute__
 *         try:             # <<<<<<<<<<<<<<
 *             namespace = _utf8(_getattr(self, 'NAMESPACE'))
 *         except AttributeError:
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":51
 *         _getattr = object.__getattribute__
 *         try:
 *             namespace = _utf8(_getattr(self, 'NAMESPACE'))             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             namespace = None
 */
      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      __Pyx_INCREF(__pyx_v_self);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self);
      __Pyx_GIVEREF(__pyx_v_self);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__NAMESPACE));
      PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_n_s__NAMESPACE));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__NAMESPACE));
      __pyx_t_2 = PyObject_Call(__pyx_v__getattr, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
      __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_v_namespace);
      __pyx_v_namespace = __pyx_t_1;
      __pyx_t_1 = 0;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L13_try_end;
    __pyx_L6_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":52
 *         try:
 *             namespace = _utf8(_getattr(self, 'NAMESPACE'))
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             namespace = None
 *         try:
 */
    __pyx_t_3 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
    if (__pyx_t_3) {
      __Pyx_AddTraceback("lxml.etree.ElementBase.__init__");
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_4);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":53
 *             namespace = _utf8(_getattr(self, 'NAMESPACE'))
 *         except AttributeError:
 *             namespace = None             # <<<<<<<<<<<<<<
 *         try:
 *             ns, tag = _getNsTag(_getattr(self, 'TAG'))
 */
      __Pyx_INCREF(Py_None);
      __Pyx_DECREF(__pyx_v_namespace);
      __pyx_v_namespace = Py_None;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L7_exception_handled;
    }
    __pyx_L8_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L7_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L13_try_end:;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":54
 *         except AttributeError:
 *             namespace = None
 *         try:             # <<<<<<<<<<<<<<
 *             ns, tag = _getNsTag(_getattr(self, 'TAG'))
 *             if ns is not None:
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":55
 *             namespace = None
 *         try:
 *             ns, tag = _getNsTag(_getattr(self, 'TAG'))             # <<<<<<<<<<<<<<
 *             if ns is not None:
 *                 namespace = ns
 */
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      __Pyx_INCREF(__pyx_v_self);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_self);
      __Pyx_GIVEREF(__pyx_v_self);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__TAG));
      PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_n_s__TAG));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__TAG));
      __pyx_t_2 = PyObject_Call(__pyx_v__getattr, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__getNsTag(__pyx_t_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (likely(__pyx_t_4 != Py_None) && likely(PyTuple_GET_SIZE(__pyx_t_4) == 2)) {
        PyObject* tuple = __pyx_t_4;
        __pyx_t_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_2);
        __pyx_t_1 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_v_ns);
        __pyx_v_ns = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_v_tag);
        __pyx_v_tag = __pyx_t_1;
        __pyx_t_1 = 0;
      } else {
        __Pyx_UnpackTupleError(__pyx_t_4, 2);
        {__pyx_filename = __pyx_f[9]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
      }

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":56
 *         try:
 *             ns, tag = _getNsTag(_getattr(self, 'TAG'))
 *             if ns is not None:             # <<<<<<<<<<<<<<
 *                 namespace = ns
 *         except AttributeError:
 */
      __pyx_t_5 = (__pyx_v_ns != Py_None);
      if (__pyx_t_5) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":57
 *             ns, tag = _getNsTag(_getattr(self, 'TAG'))
 *             if ns is not None:
 *                 namespace = ns             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             tag = _utf8(_getattr(_getattr(self, '__class__'), '__name__'))
 */
        __Pyx_INCREF(__pyx_v_ns);
        __Pyx_DECREF(__pyx_v_namespace);
        __pyx_v_namespace = __pyx_v_ns;
        goto __pyx_L24;
      }
      __pyx_L24:;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L23_try_end;
    __pyx_L16_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":58
 *             if ns is not None:
 *                 namespace = ns
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             tag = _utf8(_getattr(_getattr(self, '__class__'), '__name__'))
 *             if b'.' in tag:
 */
    __pyx_t_3 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
    if (__pyx_t_3) {
      __Pyx_AddTraceback("lxml.etree.ElementBase.__init__");
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_1, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_2);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":59
 *                 namespace = ns
 *         except AttributeError:
 *             tag = _utf8(_getattr(_getattr(self, '__class__'), '__name__'))             # <<<<<<<<<<<<<<
 *             if b'.' in tag:
 *                 tag = tag.split(b'.')[-1]
 */
      __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
      __Pyx_INCREF(__pyx_v_self);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_self);
      __Pyx_GIVEREF(__pyx_v_self);
      __Pyx_INCREF(((PyObject *)__pyx_n_s____class__));
      PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_n_s____class__));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s____class__));
      __pyx_t_7 = PyObject_Call(__pyx_v__getattr, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
      __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_7);
      __Pyx_INCREF(((PyObject *)__pyx_n_s____name__));
      PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_n_s____name__));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s____name__));
      __pyx_t_7 = 0;
      __pyx_t_7 = PyObject_Call(__pyx_v__getattr, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
      __pyx_t_6 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_t_7)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_v_tag);
      __pyx_v_tag = __pyx_t_6;
      __pyx_t_6 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":60
 *         except AttributeError:
 *             tag = _utf8(_getattr(_getattr(self, '__class__'), '__name__'))
 *             if b'.' in tag:             # <<<<<<<<<<<<<<
 *                 tag = tag.split(b'.')[-1]
 *         try:
 */
      __pyx_t_5 = ((PySequence_Contains(__pyx_v_tag, ((PyObject *)__pyx_kp_b_5)))); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
      if (__pyx_t_5) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":61
 *             tag = _utf8(_getattr(_getattr(self, '__class__'), '__name__'))
 *             if b'.' in tag:
 *                 tag = tag.split(b'.')[-1]             # <<<<<<<<<<<<<<
 *         try:
 *             parser = _getattr(self, 'PARSER')
 */
        __pyx_t_6 = PyObject_GetAttr(__pyx_v_tag, __pyx_n_s__split); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_139), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_7, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_v_tag);
        __pyx_v_tag = __pyx_t_6;
        __pyx_t_6 = 0;
        goto __pyx_L27;
      }
      __pyx_L27:;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L17_exception_handled;
    }
    __pyx_L18_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L17_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L23_try_end:;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":62
 *             if b'.' in tag:
 *                 tag = tag.split(b'.')[-1]
 *         try:             # <<<<<<<<<<<<<<
 *             parser = _getattr(self, 'PARSER')
 *         except AttributeError:
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":63
 *                 tag = tag.split(b'.')[-1]
 *         try:
 *             parser = _getattr(self, 'PARSER')             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             parser = None
 */
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L28_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __Pyx_INCREF(__pyx_v_self);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self);
      __Pyx_GIVEREF(__pyx_v_self);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__PARSER));
      PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__PARSER));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PARSER));
      __pyx_t_1 = PyObject_Call(__pyx_v__getattr, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L28_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__BaseParser))))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L28_error;}
      __Pyx_DECREF(((PyObject *)__pyx_v_parser));
      __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_1);
      __pyx_t_1 = 0;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L35_try_end;
    __pyx_L28_error:;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":64
 *         try:
 *             parser = _getattr(self, 'PARSER')
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             parser = None
 *             for child in children:
 */
    __pyx_t_3 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
    if (__pyx_t_3) {
      __Pyx_AddTraceback("lxml.etree.ElementBase.__init__");
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L30_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_4);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":65
 *             parser = _getattr(self, 'PARSER')
 *         except AttributeError:
 *             parser = None             # <<<<<<<<<<<<<<
 *             for child in children:
 *                 if isinstance(child, _Element):
 */
      __Pyx_INCREF(Py_None);
      __Pyx_DECREF(((PyObject *)__pyx_v_parser));
      __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":66
 *         except AttributeError:
 *             parser = None
 *             for child in children:             # <<<<<<<<<<<<<<
 *                 if isinstance(child, _Element):
 *                     parser = (<_Element>child)._doc._parser
 */
      if (unlikely(__pyx_v_children == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L30_except_error;} 
      }
      __pyx_t_8 = 0; __pyx_t_6 = ((PyObject *)__pyx_v_children); __Pyx_INCREF(__pyx_t_6);
      for (;;) {
        if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
        __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_8); __Pyx_INCREF(__pyx_t_7); __pyx_t_8++;
        __Pyx_DECREF(__pyx_v_child);
        __pyx_v_child = __pyx_t_7;
        __pyx_t_7 = 0;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":67
 *             parser = None
 *             for child in children:
 *                 if isinstance(child, _Element):             # <<<<<<<<<<<<<<
 *                     parser = (<_Element>child)._doc._parser
 *                     break
 */
        __pyx_t_5 = __Pyx_TypeCheck(__pyx_v_child, ((PyObject*)__pyx_ptype_4lxml_5etree__Element)); 
        if (__pyx_t_5) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":68
 *             for child in children:
 *                 if isinstance(child, _Element):
 *                     parser = (<_Element>child)._doc._parser             # <<<<<<<<<<<<<<
 *                     break
 *         if isinstance(parser, HTMLParser):
 */
          __Pyx_INCREF(((PyObject *)((struct LxmlElement *)__pyx_v_child)->_doc->_parser));
          __Pyx_DECREF(((PyObject *)__pyx_v_parser));
          __pyx_v_parser = ((struct LxmlElement *)__pyx_v_child)->_doc->_parser;

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":69
 *                 if isinstance(child, _Element):
 *                     parser = (<_Element>child)._doc._parser
 *                     break             # <<<<<<<<<<<<<<
 *         if isinstance(parser, HTMLParser):
 *             is_html = 1
 */
          goto __pyx_L39_break;
          goto __pyx_L40;
        }
        __pyx_L40:;
      }
      __pyx_L39_break:;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L29_exception_handled;
    }
    __pyx_L30_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L29_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L35_try_end:;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":70
 *                     parser = (<_Element>child)._doc._parser
 *                     break
 *         if isinstance(parser, HTMLParser):             # <<<<<<<<<<<<<<
 *             is_html = 1
 *         if namespace is None:
 */
  __pyx_t_5 = __Pyx_TypeCheck(((PyObject *)__pyx_v_parser), ((PyObject*)__pyx_ptype_4lxml_5etree_HTMLParser)); 
  if (__pyx_t_5) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":71
 *                     break
 *         if isinstance(parser, HTMLParser):
 *             is_html = 1             # <<<<<<<<<<<<<<
 *         if namespace is None:
 *             try:
 */
    __pyx_v_is_html = 1;
    goto __pyx_L41;
  }
  __pyx_L41:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":72
 *         if isinstance(parser, HTMLParser):
 *             is_html = 1
 *         if namespace is None:             # <<<<<<<<<<<<<<
 *             try:
 *                 is_html = _getattr(self, 'HTML')
 */
  __pyx_t_5 = (__pyx_v_namespace == Py_None);
  if (__pyx_t_5) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":73
 *             is_html = 1
 *         if namespace is None:
 *             try:             # <<<<<<<<<<<<<<
 *                 is_html = _getattr(self, 'HTML')
 *             except AttributeError:
 */
    {
      PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
      __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
      __Pyx_XGOTREF(__pyx_save_exc_type);
      __Pyx_XGOTREF(__pyx_save_exc_value);
      __Pyx_XGOTREF(__pyx_save_exc_tb);
      /*try:*/ {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":74
 *         if namespace is None:
 *             try:
 *                 is_html = _getattr(self, 'HTML')             # <<<<<<<<<<<<<<
 *             except AttributeError:
 *                 pass
 */
        __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L43_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_4));
        __Pyx_INCREF(__pyx_v_self);
        PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_self);
        __Pyx_GIVEREF(__pyx_v_self);
        __Pyx_INCREF(((PyObject *)__pyx_n_s__HTML));
        PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_n_s__HTML));
        __Pyx_GIVEREF(((PyObject *)__pyx_n_s__HTML));
        __pyx_t_2 = PyObject_Call(__pyx_v__getattr, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L43_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
        __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L43_error;}
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_v_is_html = __pyx_t_5;
      }
      __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
      __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
      __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
      goto __pyx_L50_try_end;
      __pyx_L43_error:;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":75
 *             try:
 *                 is_html = _getattr(self, 'HTML')
 *             except AttributeError:             # <<<<<<<<<<<<<<
 *                 pass
 *         _initNewElement(self, is_html, tag, namespace, parser,
 */
      __pyx_t_3 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
      if (__pyx_t_3) {
        PyErr_Restore(0,0,0);
        goto __pyx_L44_exception_handled;
      }
      __Pyx_XGIVEREF(__pyx_save_exc_type);
      __Pyx_XGIVEREF(__pyx_save_exc_value);
      __Pyx_XGIVEREF(__pyx_save_exc_tb);
      __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
      goto __pyx_L1_error;
      __pyx_L44_exception_handled:;
      __Pyx_XGIVEREF(__pyx_save_exc_type);
      __Pyx_XGIVEREF(__pyx_save_exc_value);
      __Pyx_XGIVEREF(__pyx_save_exc_tb);
      __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
      __pyx_L50_try_end:;
    }
    goto __pyx_L42;
  }
  __pyx_L42:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":78
 *                 pass
 *         _initNewElement(self, is_html, tag, namespace, parser,
 *                         attrib, nsmap, _extra)             # <<<<<<<<<<<<<<
 *         last_child = None
 *         for child in children:
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree__initNewElement(((struct LxmlElement *)__pyx_v_self), __pyx_v_is_html, __pyx_v_tag, __pyx_v_namespace, __pyx_v_parser, __pyx_v_attrib, __pyx_v_nsmap, ((PyObject *)__pyx_v__extra)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":79
 *         _initNewElement(self, is_html, tag, namespace, parser,
 *                         attrib, nsmap, _extra)
 *         last_child = None             # <<<<<<<<<<<<<<
 *         for child in children:
 *             if _isString(child):
 */
  __Pyx_INCREF(Py_None);
  __Pyx_DECREF(((PyObject *)__pyx_v_last_child));
  __pyx_v_last_child = ((struct LxmlElement *)Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":80
 *                         attrib, nsmap, _extra)
 *         last_child = None
 *         for child in children:             # <<<<<<<<<<<<<<
 *             if _isString(child):
 *                 if last_child is None:
 */
  if (unlikely(__pyx_v_children == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_8 = 0; __pyx_t_2 = ((PyObject *)__pyx_v_children); __Pyx_INCREF(__pyx_t_2);
  for (;;) {
    if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
    __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++;
    __Pyx_DECREF(__pyx_v_child);
    __pyx_v_child = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":81
 *         last_child = None
 *         for child in children:
 *             if _isString(child):             # <<<<<<<<<<<<<<
 *                 if last_child is None:
 *                     if _hasText(self._c_node):
 */
    __pyx_t_5 = _isString(__pyx_v_child);
    if (__pyx_t_5) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":82
 *         for child in children:
 *             if _isString(child):
 *                 if last_child is None:             # <<<<<<<<<<<<<<
 *                     if _hasText(self._c_node):
 *                         self.text += child
 */
      __pyx_t_5 = (((PyObject *)__pyx_v_last_child) == Py_None);
      if (__pyx_t_5) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":83
 *             if _isString(child):
 *                 if last_child is None:
 *                     if _hasText(self._c_node):             # <<<<<<<<<<<<<<
 *                         self.text += child
 *                     else:
 */
        __pyx_t_5 = __pyx_f_4lxml_5etree__hasText(((struct LxmlElementBase *)__pyx_v_self)->__pyx_base._c_node);
        if (__pyx_t_5) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":84
 *                 if last_child is None:
 *                     if _hasText(self._c_node):
 *                         self.text += child             # <<<<<<<<<<<<<<
 *                     else:
 *                         self.text = child
 */
          __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__text); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_t_4, __pyx_v_child); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__text, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          goto __pyx_L55;
        }
        /*else*/ {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":86
 *                         self.text += child
 *                     else:
 *                         self.text = child             # <<<<<<<<<<<<<<
 *                 else:
 *                     if _hasTail(last_child._c_node):
 */
          if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__text, __pyx_v_child) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_L55:;
        goto __pyx_L54;
      }
      /*else*/ {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":88
 *                         self.text = child
 *                 else:
 *                     if _hasTail(last_child._c_node):             # <<<<<<<<<<<<<<
 *                         last_child.tail += child
 *                     else:
 */
        __pyx_t_5 = __pyx_f_4lxml_5etree__hasTail(__pyx_v_last_child->_c_node);
        if (__pyx_t_5) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":89
 *                 else:
 *                     if _hasTail(last_child._c_node):
 *                         last_child.tail += child             # <<<<<<<<<<<<<<
 *                     else:
 *                         last_child.tail = child
 */
          __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_last_child), __pyx_n_s__tail); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_t_1, __pyx_v_child); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          if (PyObject_SetAttr(((PyObject *)__pyx_v_last_child), __pyx_n_s__tail, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          goto __pyx_L56;
        }
        /*else*/ {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":91
 *                         last_child.tail += child
 *                     else:
 *                         last_child.tail = child             # <<<<<<<<<<<<<<
 *             elif isinstance(child, _Element):
 *                 last_child = child
 */
          if (PyObject_SetAttr(((PyObject *)__pyx_v_last_child), __pyx_n_s__tail, __pyx_v_child) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_L56:;
      }
      __pyx_L54:;
      goto __pyx_L53;
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":92
 *                     else:
 *                         last_child.tail = child
 *             elif isinstance(child, _Element):             # <<<<<<<<<<<<<<
 *                 last_child = child
 *                 _appendChild(self, last_child)
 */
    __pyx_t_5 = __Pyx_TypeCheck(__pyx_v_child, ((PyObject*)__pyx_ptype_4lxml_5etree__Element)); 
    if (__pyx_t_5) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":93
 *                         last_child.tail = child
 *             elif isinstance(child, _Element):
 *                 last_child = child             # <<<<<<<<<<<<<<
 *                 _appendChild(self, last_child)
 *             elif isinstance(child, type) and issubclass(child, ElementBase):
 */
      if (!(likely(((__pyx_v_child) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_child, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_INCREF(__pyx_v_child);
      __Pyx_DECREF(((PyObject *)__pyx_v_last_child));
      __pyx_v_last_child = ((struct LxmlElement *)__pyx_v_child);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":94
 *             elif isinstance(child, _Element):
 *                 last_child = child
 *                 _appendChild(self, last_child)             # <<<<<<<<<<<<<<
 *             elif isinstance(child, type) and issubclass(child, ElementBase):
 *                 last_child = child()
 */
      __pyx_t_3 = __pyx_f_4lxml_5etree__appendChild(((struct LxmlElement *)__pyx_v_self), __pyx_v_last_child); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L53;
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":95
 *                 last_child = child
 *                 _appendChild(self, last_child)
 *             elif isinstance(child, type) and issubclass(child, ElementBase):             # <<<<<<<<<<<<<<
 *                 last_child = child()
 *                 _appendChild(self, last_child)
 */
    __pyx_t_5 = __Pyx_TypeCheck(__pyx_v_child, ((PyObject*)(&PyType_Type))); 
    if (__pyx_t_5) {
      __pyx_t_9 = PyObject_IsSubclass(__pyx_v_child, ((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_ElementBase))); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_10 = __pyx_t_9;
    } else {
      __pyx_t_10 = __pyx_t_5;
    }
    if (__pyx_t_10) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":96
 *                 _appendChild(self, last_child)
 *             elif isinstance(child, type) and issubclass(child, ElementBase):
 *                 last_child = child()             # <<<<<<<<<<<<<<
 *                 _appendChild(self, last_child)
 *             else:
 */
      __pyx_t_4 = PyObject_Call(__pyx_v_child, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_v_last_child));
      __pyx_v_last_child = ((struct LxmlElement *)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":97
 *             elif isinstance(child, type) and issubclass(child, ElementBase):
 *                 last_child = child()
 *                 _appendChild(self, last_child)             # <<<<<<<<<<<<<<
 *             else:
 *                 raise TypeError, "Invalid child type: %r" % type(child)
 */
      __pyx_t_3 = __pyx_f_4lxml_5etree__appendChild(((struct LxmlElement *)__pyx_v_self), __pyx_v_last_child); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L53;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":99
 *                 _appendChild(self, last_child)
 *             else:
 *                 raise TypeError, "Invalid child type: %r" % type(child)             # <<<<<<<<<<<<<<
 * 
 * cdef class CommentBase(_Comment):
 */
      __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_140), ((PyObject *)Py_TYPE(__pyx_v_child))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_4), 0);
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      {__pyx_filename = __pyx_f[9]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_L53:;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree.ElementBase.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_children);
  __Pyx_DECREF(__pyx_v__extra);
  __Pyx_DECREF((PyObject *)__pyx_v_parser);
  __Pyx_DECREF((PyObject *)__pyx_v_last_child);
  __Pyx_DECREF(__pyx_v__getattr);
  __Pyx_DECREF(__pyx_v_namespace);
  __Pyx_DECREF(__pyx_v_ns);
  __Pyx_DECREF(__pyx_v_tag);
  __Pyx_DECREF(__pyx_v_child);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":113
 *     called after object creation.
 *     """
 *     def __init__(self, text):             # <<<<<<<<<<<<<<
 *         # copied from Comment() factory
 *         cdef _Document doc
 */

static int __pyx_pf_4lxml_5etree_11CommentBase___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_11CommentBase___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_text = 0;
  struct LxmlDocument *__pyx_v_doc;
  xmlDoc *__pyx_v_c_doc;
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  xmlDoc *__pyx_t_3;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__text,0};
  __Pyx_RefNannySetupContext("__init__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[1] = {0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__text);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_text = values[0];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_text = PyTuple_GET_ITEM(__pyx_args, 0);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.CommentBase.__init__");
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF(__pyx_v_text);
  __pyx_v_doc = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":117
 *         cdef _Document doc
 *         cdef xmlDoc*   c_doc
 *         if text is None:             # <<<<<<<<<<<<<<
 *             text = b''
 *         else:
 */
  __pyx_t_1 = (__pyx_v_text == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":118
 *         cdef xmlDoc*   c_doc
 *         if text is None:
 *             text = b''             # <<<<<<<<<<<<<<
 *         else:
 *             text = _utf8(text)
 */
    __Pyx_INCREF(((PyObject *)__pyx_kp_b_25));
    __Pyx_DECREF(__pyx_v_text);
    __pyx_v_text = ((PyObject *)__pyx_kp_b_25);
    goto __pyx_L6;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":120
 *             text = b''
 *         else:
 *             text = _utf8(text)             # <<<<<<<<<<<<<<
 *         c_doc = _newXMLDoc()
 *         doc = _documentFactory(c_doc, None)
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_v_text)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_v_text);
    __pyx_v_text = __pyx_t_2;
    __pyx_t_2 = 0;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":121
 *         else:
 *             text = _utf8(text)
 *         c_doc = _newXMLDoc()             # <<<<<<<<<<<<<<
 *         doc = _documentFactory(c_doc, None)
 *         self._c_node = _createComment(c_doc, _cstr(text))
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree__newXMLDoc(); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_doc = __pyx_t_3;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":122
 *             text = _utf8(text)
 *         c_doc = _newXMLDoc()
 *         doc = _documentFactory(c_doc, None)             # <<<<<<<<<<<<<<
 *         self._c_node = _createComment(c_doc, _cstr(text))
 *         tree.xmlAddChild(<xmlNode*>c_doc, self._c_node)
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_v_doc));
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":123
 *         c_doc = _newXMLDoc()
 *         doc = _documentFactory(c_doc, None)
 *         self._c_node = _createComment(c_doc, _cstr(text))             # <<<<<<<<<<<<<<
 *         tree.xmlAddChild(<xmlNode*>c_doc, self._c_node)
 * 
 */
  ((struct __pyx_obj_4lxml_5etree_CommentBase *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base._c_node = __pyx_f_4lxml_5etree__createComment(__pyx_v_c_doc, PyBytes_AS_STRING(__pyx_v_text));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":124
 *         doc = _documentFactory(c_doc, None)
 *         self._c_node = _createComment(c_doc, _cstr(text))
 *         tree.xmlAddChild(<xmlNode*>c_doc, self._c_node)             # <<<<<<<<<<<<<<
 * 
 * cdef class PIBase(_ProcessingInstruction):
 */
  xmlAddChild(((xmlNode *)__pyx_v_c_doc), ((struct __pyx_obj_4lxml_5etree_CommentBase *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base._c_node);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.CommentBase.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_doc);
  __Pyx_DECREF(__pyx_v_text);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":139
 *     called after object creation.
 *     """
 *     def __init__(self, target, text=None):             # <<<<<<<<<<<<<<
 *         # copied from PI() factory
 *         cdef _Document doc
 */

static int __pyx_pf_4lxml_5etree_6PIBase___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_6PIBase___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_target = 0;
  PyObject *__pyx_v_text = 0;
  struct LxmlDocument *__pyx_v_doc;
  xmlDoc *__pyx_v_c_doc;
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  xmlDoc *__pyx_t_3;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__target,&__pyx_n_s__text,0};
  __Pyx_RefNannySetupContext("__init__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__target);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__text);
        if (value) { values[1] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_target = values[0];
    __pyx_v_text = values[1];
  } else {
    __pyx_v_text = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_text = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v_target = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.PIBase.__init__");
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF(__pyx_v_target);
  __Pyx_INCREF(__pyx_v_text);
  __pyx_v_doc = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":143
 *         cdef _Document doc
 *         cdef xmlDoc*   c_doc
 *         target = _utf8(target)             # <<<<<<<<<<<<<<
 *         if text is None:
 *             text = b''
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_v_target)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_v_target);
  __pyx_v_target = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":144
 *         cdef xmlDoc*   c_doc
 *         target = _utf8(target)
 *         if text is None:             # <<<<<<<<<<<<<<
 *             text = b''
 *         else:
 */
  __pyx_t_2 = (__pyx_v_text == Py_None);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":145
 *         target = _utf8(target)
 *         if text is None:
 *             text = b''             # <<<<<<<<<<<<<<
 *         else:
 *             text = _utf8(text)
 */
    __Pyx_INCREF(((PyObject *)__pyx_kp_b_25));
    __Pyx_DECREF(__pyx_v_text);
    __pyx_v_text = ((PyObject *)__pyx_kp_b_25);
    goto __pyx_L6;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":147
 *             text = b''
 *         else:
 *             text = _utf8(text)             # <<<<<<<<<<<<<<
 *         c_doc = _newXMLDoc()
 *         doc = _documentFactory(c_doc, None)
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_v_text)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_v_text);
    __pyx_v_text = __pyx_t_1;
    __pyx_t_1 = 0;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":148
 *         else:
 *             text = _utf8(text)
 *         c_doc = _newXMLDoc()             # <<<<<<<<<<<<<<
 *         doc = _documentFactory(c_doc, None)
 *         self._c_node = _createPI(c_doc, _cstr(target), _cstr(text))
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree__newXMLDoc(); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_doc = __pyx_t_3;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":149
 *             text = _utf8(text)
 *         c_doc = _newXMLDoc()
 *         doc = _documentFactory(c_doc, None)             # <<<<<<<<<<<<<<
 *         self._c_node = _createPI(c_doc, _cstr(target), _cstr(text))
 *         tree.xmlAddChild(<xmlNode*>c_doc, self._c_node)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_doc));
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":150
 *         c_doc = _newXMLDoc()
 *         doc = _documentFactory(c_doc, None)
 *         self._c_node = _createPI(c_doc, _cstr(target), _cstr(text))             # <<<<<<<<<<<<<<
 *         tree.xmlAddChild(<xmlNode*>c_doc, self._c_node)
 * 
 */
  ((struct __pyx_obj_4lxml_5etree_PIBase *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base._c_node = __pyx_f_4lxml_5etree__createPI(__pyx_v_c_doc, PyBytes_AS_STRING(__pyx_v_target), PyBytes_AS_STRING(__pyx_v_text));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":151
 *         doc = _documentFactory(c_doc, None)
 *         self._c_node = _createPI(c_doc, _cstr(target), _cstr(text))
 *         tree.xmlAddChild(<xmlNode*>c_doc, self._c_node)             # <<<<<<<<<<<<<<
 * 
 * cdef class EntityBase(_Entity):
 */
  xmlAddChild(((xmlNode *)__pyx_v_c_doc), ((struct __pyx_obj_4lxml_5etree_PIBase *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base._c_node);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.PIBase.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_doc);
  __Pyx_DECREF(__pyx_v_target);
  __Pyx_DECREF(__pyx_v_text);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":165
 *     called after object creation.
 *     """
 *     def __init__(self, name):             # <<<<<<<<<<<<<<
 *         cdef _Document doc
 *         cdef xmlDoc*   c_doc
 */

static int __pyx_pf_4lxml_5etree_10EntityBase___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_10EntityBase___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  struct LxmlDocument *__pyx_v_doc;
  xmlDoc *__pyx_v_c_doc;
  char *__pyx_v_c_name;
  PyObject *__pyx_v_name_utf;
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  xmlDoc *__pyx_t_3;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__name,0};
  __Pyx_RefNannySetupContext("__init__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[1] = {0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__name);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_name = values[0];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_name = PyTuple_GET_ITEM(__pyx_args, 0);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.EntityBase.__init__");
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_doc = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_name_utf = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":169
 *         cdef xmlDoc*   c_doc
 *         cdef char* c_name
 *         name_utf = _utf8(name)             # <<<<<<<<<<<<<<
 *         c_name = _cstr(name_utf)
 *         if c_name[0] == c'#':
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_v_name)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_name_utf));
  __pyx_v_name_utf = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":170
 *         cdef char* c_name
 *         name_utf = _utf8(name)
 *         c_name = _cstr(name_utf)             # <<<<<<<<<<<<<<
 *         if c_name[0] == c'#':
 *             if not _characterReferenceIsValid(c_name + 1):
 */
  __pyx_v_c_name = PyBytes_AS_STRING(((PyObject *)__pyx_v_name_utf));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":171
 *         name_utf = _utf8(name)
 *         c_name = _cstr(name_utf)
 *         if c_name[0] == c'#':             # <<<<<<<<<<<<<<
 *             if not _characterReferenceIsValid(c_name + 1):
 *                 raise ValueError, u"Invalid character reference: '%s'" % name
 */
  __pyx_t_2 = ((__pyx_v_c_name[0]) == '#');
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":172
 *         c_name = _cstr(name_utf)
 *         if c_name[0] == c'#':
 *             if not _characterReferenceIsValid(c_name + 1):             # <<<<<<<<<<<<<<
 *                 raise ValueError, u"Invalid character reference: '%s'" % name
 *         elif not _xmlNameIsValid(c_name):
 */
    __pyx_t_2 = (!__pyx_f_4lxml_5etree__characterReferenceIsValid((__pyx_v_c_name + 1)));
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":173
 *         if c_name[0] == c'#':
 *             if not _characterReferenceIsValid(c_name + 1):
 *                 raise ValueError, u"Invalid character reference: '%s'" % name             # <<<<<<<<<<<<<<
 *         elif not _xmlNameIsValid(c_name):
 *             raise ValueError, u"Invalid entity reference: '%s'" % name
 */
      __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_113), __pyx_v_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_1), 0);
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
      {__pyx_filename = __pyx_f[9]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L7;
    }
    __pyx_L7:;
    goto __pyx_L6;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":174
 *             if not _characterReferenceIsValid(c_name + 1):
 *                 raise ValueError, u"Invalid character reference: '%s'" % name
 *         elif not _xmlNameIsValid(c_name):             # <<<<<<<<<<<<<<
 *             raise ValueError, u"Invalid entity reference: '%s'" % name
 *         c_doc = _newXMLDoc()
 */
  __pyx_t_2 = (!__pyx_f_4lxml_5etree__xmlNameIsValid(__pyx_v_c_name));
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":175
 *                 raise ValueError, u"Invalid character reference: '%s'" % name
 *         elif not _xmlNameIsValid(c_name):
 *             raise ValueError, u"Invalid entity reference: '%s'" % name             # <<<<<<<<<<<<<<
 *         c_doc = _newXMLDoc()
 *         doc = _documentFactory(c_doc, None)
 */
    __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_114), __pyx_v_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_1), 0);
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[9]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":176
 *         elif not _xmlNameIsValid(c_name):
 *             raise ValueError, u"Invalid entity reference: '%s'" % name
 *         c_doc = _newXMLDoc()             # <<<<<<<<<<<<<<
 *         doc = _documentFactory(c_doc, None)
 *         self._c_node = _createEntity(c_doc, c_name)
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree__newXMLDoc(); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_doc = __pyx_t_3;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":177
 *             raise ValueError, u"Invalid entity reference: '%s'" % name
 *         c_doc = _newXMLDoc()
 *         doc = _documentFactory(c_doc, None)             # <<<<<<<<<<<<<<
 *         self._c_node = _createEntity(c_doc, c_name)
 *         tree.xmlAddChild(<xmlNode*>c_doc, self._c_node)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_doc));
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":178
 *         c_doc = _newXMLDoc()
 *         doc = _documentFactory(c_doc, None)
 *         self._c_node = _createEntity(c_doc, c_name)             # <<<<<<<<<<<<<<
 *         tree.xmlAddChild(<xmlNode*>c_doc, self._c_node)
 * 
 */
  ((struct __pyx_obj_4lxml_5etree_EntityBase *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base._c_node = __pyx_f_4lxml_5etree__createEntity(__pyx_v_c_doc, __pyx_v_c_name);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":179
 *         doc = _documentFactory(c_doc, None)
 *         self._c_node = _createEntity(c_doc, c_name)
 *         tree.xmlAddChild(<xmlNode*>c_doc, self._c_node)             # <<<<<<<<<<<<<<
 * 
 * ################################################################################
 */
  xmlAddChild(((xmlNode *)__pyx_v_c_doc), ((struct __pyx_obj_4lxml_5etree_EntityBase *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base._c_node);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.EntityBase.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_doc);
  __Pyx_DECREF(__pyx_v_name_utf);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":193
 *     """
 *     cdef _element_class_lookup_function _lookup_function
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._lookup_function = NULL # use default lookup
 * 
 */

static int __pyx_pf_4lxml_5etree_18ElementClassLookup___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_18ElementClassLookup___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("__cinit__");
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":194
 *     cdef _element_class_lookup_function _lookup_function
 *     def __cinit__(self):
 *         self._lookup_function = NULL # use default lookup             # <<<<<<<<<<<<<<
 * 
 * cdef public class FallbackElementClassLookup(ElementClassLookup) \
 */
  ((struct LxmlElementClassLookup *)__pyx_v_self)->_lookup_function = NULL;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":205
 *     cdef readonly ElementClassLookup fallback
 *     cdef _element_class_lookup_function _fallback_function
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         # fall back to default lookup
 *         self._fallback_function = _lookupDefaultElementClass
 */

static int __pyx_pf_4lxml_5etree_26FallbackElementClassLookup___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_26FallbackElementClassLookup___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("__cinit__");
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":207
 *     def __cinit__(self):
 *         # fall back to default lookup
 *         self._fallback_function = _lookupDefaultElementClass             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, ElementClassLookup fallback=None):
 */
  ((struct LxmlFallbackElementClassLookup *)__pyx_v_self)->_fallback_function = __pyx_f_4lxml_5etree__lookupDefaultElementClass;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":209
 *         self._fallback_function = _lookupDefaultElementClass
 * 
 *     def __init__(self, ElementClassLookup fallback=None):             # <<<<<<<<<<<<<<
 *         if fallback is not None:
 *             self._setFallback(fallback)
 */

static int __pyx_pf_4lxml_5etree_26FallbackElementClassLookup_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_26FallbackElementClassLookup_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct LxmlElementClassLookup *__pyx_v_fallback = 0;
  int __pyx_r;
  int __pyx_t_1;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fallback,0};
  __Pyx_RefNannySetupContext("__init__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[1] = {0};
    values[0] = (PyObject *)((struct LxmlElementClassLookup *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fallback);
        if (value) { values[0] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_fallback = ((struct LxmlElementClassLookup *)values[0]);
  } else {
    __pyx_v_fallback = ((struct LxmlElementClassLookup *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: __pyx_v_fallback = ((struct LxmlElementClassLookup *)PyTuple_GET_ITEM(__pyx_args, 0));
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.FallbackElementClassLookup.__init__");
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fallback), __pyx_ptype_4lxml_5etree_ElementClassLookup, 1, "fallback", 0))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":210
 * 
 *     def __init__(self, ElementClassLookup fallback=None):
 *         if fallback is not None:             # <<<<<<<<<<<<<<
 *             self._setFallback(fallback)
 *         else:
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_fallback) != Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":211
 *     def __init__(self, ElementClassLookup fallback=None):
 *         if fallback is not None:
 *             self._setFallback(fallback)             # <<<<<<<<<<<<<<
 *         else:
 *             self._fallback_function = _lookupDefaultElementClass
 */
    ((struct __pyx_vtabstruct_4lxml_5etree_FallbackElementClassLookup *)((struct LxmlFallbackElementClassLookup *)__pyx_v_self)->__pyx_vtab)->_setFallback(((struct LxmlFallbackElementClassLookup *)__pyx_v_self), __pyx_v_fallback);
    goto __pyx_L6;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":213
 *             self._setFallback(fallback)
 *         else:
 *             self._fallback_function = _lookupDefaultElementClass             # <<<<<<<<<<<<<<
 * 
 *     cdef void _setFallback(self, ElementClassLookup lookup):
 */
    ((struct LxmlFallbackElementClassLookup *)__pyx_v_self)->_fallback_function = __pyx_f_4lxml_5etree__lookupDefaultElementClass;
  }
  __pyx_L6:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.FallbackElementClassLookup.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":215
 *             self._fallback_function = _lookupDefaultElementClass
 * 
 *     cdef void _setFallback(self, ElementClassLookup lookup):             # <<<<<<<<<<<<<<
 *         u"""Sets the fallback scheme for this lookup method.
 *         """
 */

static  void __pyx_f_4lxml_5etree_26FallbackElementClassLookup__setFallback(struct LxmlFallbackElementClassLookup *__pyx_v_self, struct LxmlElementClassLookup *__pyx_v_lookup) {
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_setFallback");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":218
 *         u"""Sets the fallback scheme for this lookup method.
 *         """
 *         self.fallback = lookup             # <<<<<<<<<<<<<<
 *         self._fallback_function = lookup._lookup_function
 *         if self._fallback_function is NULL:
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_lookup));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_lookup));
  __Pyx_GOTREF(__pyx_v_self->fallback);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->fallback));
  __pyx_v_self->fallback = __pyx_v_lookup;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":219
 *         """
 *         self.fallback = lookup
 *         self._fallback_function = lookup._lookup_function             # <<<<<<<<<<<<<<
 *         if self._fallback_function is NULL:
 *             self._fallback_function = _lookupDefaultElementClass
 */
  __pyx_v_self->_fallback_function = __pyx_v_lookup->_lookup_function;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":220
 *         self.fallback = lookup
 *         self._fallback_function = lookup._lookup_function
 *         if self._fallback_function is NULL:             # <<<<<<<<<<<<<<
 *             self._fallback_function = _lookupDefaultElementClass
 * 
 */
  __pyx_t_1 = (__pyx_v_self->_fallback_function == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":221
 *         self._fallback_function = lookup._lookup_function
 *         if self._fallback_function is NULL:
 *             self._fallback_function = _lookupDefaultElementClass             # <<<<<<<<<<<<<<
 * 
 *     def set_fallback(self, ElementClassLookup lookup not None):
 */
    __pyx_v_self->_fallback_function = __pyx_f_4lxml_5etree__lookupDefaultElementClass;
    goto __pyx_L3;
  }
  __pyx_L3:;

  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":223
 *             self._fallback_function = _lookupDefaultElementClass
 * 
 *     def set_fallback(self, ElementClassLookup lookup not None):             # <<<<<<<<<<<<<<
 *         u"""set_fallback(self, lookup)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_26FallbackElementClassLookup_2set_fallback(PyObject *__pyx_v_self, PyObject *__pyx_v_lookup); /*proto*/
static char __pyx_doc_4lxml_5etree_26FallbackElementClassLookup_2set_fallback[] = "set_fallback(self, lookup)\n\n        Sets the fallback scheme for this lookup method.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_26FallbackElementClassLookup_2set_fallback(PyObject *__pyx_v_self, PyObject *__pyx_v_lookup) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("set_fallback");
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lookup), __pyx_ptype_4lxml_5etree_ElementClassLookup, 0, "lookup", 0))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":228
 *         Sets the fallback scheme for this lookup method.
 *         """
 *         self._setFallback(lookup)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object _callLookupFallback(FallbackElementClassLookup lookup,
 */
  ((struct __pyx_vtabstruct_4lxml_5etree_FallbackElementClassLookup *)((struct LxmlFallbackElementClassLookup *)__pyx_v_self)->__pyx_vtab)->_setFallback(((struct LxmlFallbackElementClassLookup *)__pyx_v_self), ((struct LxmlElementClassLookup *)__pyx_v_lookup));

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.FallbackElementClassLookup.set_fallback");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":203
 *     Superclass of Element class lookups with additional fallback.
 *     """
 *     cdef readonly ElementClassLookup fallback             # <<<<<<<<<<<<<<
 *     cdef _element_class_lookup_function _fallback_function
 *     def __cinit__(self):
 */

static PyObject *__pyx_pf_4lxml_5etree_26FallbackElementClassLookup_8fallback___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_26FallbackElementClassLookup_8fallback___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct LxmlFallbackElementClassLookup *)__pyx_v_self)->fallback));
  __pyx_r = ((PyObject *)((struct LxmlFallbackElementClassLookup *)__pyx_v_self)->fallback);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":230
 *         self._setFallback(lookup)
 * 
 * cdef inline object _callLookupFallback(FallbackElementClassLookup lookup,             # <<<<<<<<<<<<<<
 *                                        _Document doc, xmlNode* c_node):
 *     return lookup._fallback_function(lookup.fallback, doc, c_node)
 */

static CYTHON_INLINE PyObject *__pyx_f_4lxml_5etree__callLookupFallback(struct LxmlFallbackElementClassLookup *__pyx_v_lookup, struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_callLookupFallback");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":232
 * cdef inline object _callLookupFallback(FallbackElementClassLookup lookup,
 *                                        _Document doc, xmlNode* c_node):
 *     return lookup._fallback_function(lookup.fallback, doc, c_node)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_v_lookup->fallback);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_v_lookup->_fallback_function(__pyx_t_1, __pyx_v_doc, __pyx_v_c_node); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._callLookupFallback");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":250
 *     cdef readonly object pi_class
 *     cdef readonly object entity_class
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._lookup_function = _lookupDefaultElementClass
 * 
 */

static int __pyx_pf_4lxml_5etree_25ElementDefaultClassLookup___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_25ElementDefaultClassLookup___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("__cinit__");
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":251
 *     cdef readonly object entity_class
 *     def __cinit__(self):
 *         self._lookup_function = _lookupDefaultElementClass             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, element=None, comment=None, pi=None, entity=None):
 */
  ((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_self)->__pyx_base._lookup_function = __pyx_f_4lxml_5etree__lookupDefaultElementClass;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":253
 *         self._lookup_function = _lookupDefaultElementClass
 * 
 *     def __init__(self, element=None, comment=None, pi=None, entity=None):             # <<<<<<<<<<<<<<
 *         if element is None:
 *             self.element_class = _Element
 */

static int __pyx_pf_4lxml_5etree_25ElementDefaultClassLookup_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_25ElementDefaultClassLookup_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_element = 0;
  PyObject *__pyx_v_comment = 0;
  PyObject *__pyx_v_pi = 0;
  PyObject *__pyx_v_entity = 0;
  int __pyx_r;
  int __pyx_t_1;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__element,&__pyx_n_s__comment,&__pyx_n_s__pi,&__pyx_n_s__entity,0};
  __Pyx_RefNannySetupContext("__init__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[4] = {0,0,0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    values[3] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__element);
        if (value) { values[0] = value; kw_args--; }
      }
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__comment);
        if (value) { values[1] = value; kw_args--; }
      }
      case  2:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pi);
        if (value) { values[2] = value; kw_args--; }
      }
      case  3:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__entity);
        if (value) { values[3] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_element = values[0];
    __pyx_v_comment = values[1];
    __pyx_v_pi = values[2];
    __pyx_v_entity = values[3];
  } else {
    __pyx_v_element = ((PyObject *)Py_None);
    __pyx_v_comment = ((PyObject *)Py_None);
    __pyx_v_pi = ((PyObject *)Py_None);
    __pyx_v_entity = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  4: __pyx_v_entity = PyTuple_GET_ITEM(__pyx_args, 3);
      case  3: __pyx_v_pi = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: __pyx_v_comment = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v_element = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.ElementDefaultClassLookup.__init__");
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":254
 * 
 *     def __init__(self, element=None, comment=None, pi=None, entity=None):
 *         if element is None:             # <<<<<<<<<<<<<<
 *             self.element_class = _Element
 *         elif issubclass(element, ElementBase):
 */
  __pyx_t_1 = (__pyx_v_element == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":255
 *     def __init__(self, element=None, comment=None, pi=None, entity=None):
 *         if element is None:
 *             self.element_class = _Element             # <<<<<<<<<<<<<<
 *         elif issubclass(element, ElementBase):
 *             self.element_class = element
 */
    __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Element)));
    __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Element)));
    __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_self)->element_class);
    __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_self)->element_class);
    ((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_self)->element_class = ((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Element));
    goto __pyx_L6;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":256
 *         if element is None:
 *             self.element_class = _Element
 *         elif issubclass(element, ElementBase):             # <<<<<<<<<<<<<<
 *             self.element_class = element
 *         else:
 */
  __pyx_t_1 = PyObject_IsSubclass(__pyx_v_element, ((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_ElementBase))); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":257
 *             self.element_class = _Element
 *         elif issubclass(element, ElementBase):
 *             self.element_class = element             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError, u"element class must be subclass of ElementBase"
 */
    __Pyx_INCREF(__pyx_v_element);
    __Pyx_GIVEREF(__pyx_v_element);
    __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_self)->element_class);
    __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_self)->element_class);
    ((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_self)->element_class = __pyx_v_element;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":259
 *             self.element_class = element
 *         else:
 *             raise TypeError, u"element class must be subclass of ElementBase"             # <<<<<<<<<<<<<<
 * 
 *         if comment is None:
 */
    __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_u_141), 0);
    {__pyx_filename = __pyx_f[9]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":261
 *             raise TypeError, u"element class must be subclass of ElementBase"
 * 
 *         if comment is None:             # <<<<<<<<<<<<<<
 *             self.comment_class = _Comment
 *         elif issubclass(comment, CommentBase):
 */
  __pyx_t_1 = (__pyx_v_comment == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":262
 * 
 *         if comment is None:
 *             self.comment_class = _Comment             # <<<<<<<<<<<<<<
 *         elif issubclass(comment, CommentBase):
 *             self.comment_class = comment
 */
    __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Comment)));
    __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Comment)));
    __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_self)->comment_class);
    __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_self)->comment_class);
    ((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_self)->comment_class = ((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Comment));
    goto __pyx_L7;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":263
 *         if comment is None:
 *             self.comment_class = _Comment
 *         elif issubclass(comment, CommentBase):             # <<<<<<<<<<<<<<
 *             self.comment_class = comment
 *         else:
 */
  __pyx_t_1 = PyObject_IsSubclass(__pyx_v_comment, ((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_CommentBase))); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":264
 *             self.comment_class = _Comment
 *         elif issubclass(comment, CommentBase):
 *             self.comment_class = comment             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError, u"comment class must be subclass of CommentBase"
 */
    __Pyx_INCREF(__pyx_v_comment);
    __Pyx_GIVEREF(__pyx_v_comment);
    __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_self)->comment_class);
    __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_self)->comment_class);
    ((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_self)->comment_class = __pyx_v_comment;
    goto __pyx_L7;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":266
 *             self.comment_class = comment
 *         else:
 *             raise TypeError, u"comment class must be subclass of CommentBase"             # <<<<<<<<<<<<<<
 * 
 *         if entity is None:
 */
    __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_u_142), 0);
    {__pyx_filename = __pyx_f[9]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L7:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":268
 *             raise TypeError, u"comment class must be subclass of CommentBase"
 * 
 *         if entity is None:             # <<<<<<<<<<<<<<
 *             self.entity_class = _Entity
 *         elif issubclass(entity, EntityBase):
 */
  __pyx_t_1 = (__pyx_v_entity == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":269
 * 
 *         if entity is None:
 *             self.entity_class = _Entity             # <<<<<<<<<<<<<<
 *         elif issubclass(entity, EntityBase):
 *             self.entity_class = entity
 */
    __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Entity)));
    __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Entity)));
    __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_self)->entity_class);
    __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_self)->entity_class);
    ((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_self)->entity_class = ((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Entity));
    goto __pyx_L8;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":270
 *         if entity is None:
 *             self.entity_class = _Entity
 *         elif issubclass(entity, EntityBase):             # <<<<<<<<<<<<<<
 *             self.entity_class = entity
 *         else:
 */
  __pyx_t_1 = PyObject_IsSubclass(__pyx_v_entity, ((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_EntityBase))); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":271
 *             self.entity_class = _Entity
 *         elif issubclass(entity, EntityBase):
 *             self.entity_class = entity             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError, u"Entity class must be subclass of EntityBase"
 */
    __Pyx_INCREF(__pyx_v_entity);
    __Pyx_GIVEREF(__pyx_v_entity);
    __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_self)->entity_class);
    __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_self)->entity_class);
    ((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_self)->entity_class = __pyx_v_entity;
    goto __pyx_L8;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":273
 *             self.entity_class = entity
 *         else:
 *             raise TypeError, u"Entity class must be subclass of EntityBase"             # <<<<<<<<<<<<<<
 * 
 *         if pi is None:
 */
    __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_u_143), 0);
    {__pyx_filename = __pyx_f[9]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L8:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":275
 *             raise TypeError, u"Entity class must be subclass of EntityBase"
 * 
 *         if pi is None:             # <<<<<<<<<<<<<<
 *             self.pi_class = None # special case, see below
 *         elif issubclass(pi, PIBase):
 */
  __pyx_t_1 = (__pyx_v_pi == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":276
 * 
 *         if pi is None:
 *             self.pi_class = None # special case, see below             # <<<<<<<<<<<<<<
 *         elif issubclass(pi, PIBase):
 *             self.pi_class = pi
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_self)->pi_class);
    __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_self)->pi_class);
    ((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_self)->pi_class = Py_None;
    goto __pyx_L9;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":277
 *         if pi is None:
 *             self.pi_class = None # special case, see below
 *         elif issubclass(pi, PIBase):             # <<<<<<<<<<<<<<
 *             self.pi_class = pi
 *         else:
 */
  __pyx_t_1 = PyObject_IsSubclass(__pyx_v_pi, ((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_PIBase))); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":278
 *             self.pi_class = None # special case, see below
 *         elif issubclass(pi, PIBase):
 *             self.pi_class = pi             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError, u"PI class must be subclass of PIBase"
 */
    __Pyx_INCREF(__pyx_v_pi);
    __Pyx_GIVEREF(__pyx_v_pi);
    __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_self)->pi_class);
    __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_self)->pi_class);
    ((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_self)->pi_class = __pyx_v_pi;
    goto __pyx_L9;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":280
 *             self.pi_class = pi
 *         else:
 *             raise TypeError, u"PI class must be subclass of PIBase"             # <<<<<<<<<<<<<<
 * 
 * cdef object _lookupDefaultElementClass(state, _Document _doc, xmlNode* c_node):
 */
    __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_u_144), 0);
    {__pyx_filename = __pyx_f[9]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L9:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.ElementDefaultClassLookup.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":246
 *     accept the respective Element classes.
 *     """
 *     cdef readonly object element_class             # <<<<<<<<<<<<<<
 *     cdef readonly object comment_class
 *     cdef readonly object pi_class
 */

static PyObject *__pyx_pf_4lxml_5etree_25ElementDefaultClassLookup_13element_class___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_25ElementDefaultClassLookup_13element_class___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_self)->element_class);
  __pyx_r = ((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_self)->element_class;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":247
 *     """
 *     cdef readonly object element_class
 *     cdef readonly object comment_class             # <<<<<<<<<<<<<<
 *     cdef readonly object pi_class
 *     cdef readonly object entity_class
 */

static PyObject *__pyx_pf_4lxml_5etree_25ElementDefaultClassLookup_13comment_class___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_25ElementDefaultClassLookup_13comment_class___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_self)->comment_class);
  __pyx_r = ((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_self)->comment_class;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":248
 *     cdef readonly object element_class
 *     cdef readonly object comment_class
 *     cdef readonly object pi_class             # <<<<<<<<<<<<<<
 *     cdef readonly object entity_class
 *     def __cinit__(self):
 */

static PyObject *__pyx_pf_4lxml_5etree_25ElementDefaultClassLookup_8pi_class___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_25ElementDefaultClassLookup_8pi_class___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_self)->pi_class);
  __pyx_r = ((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_self)->pi_class;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":249
 *     cdef readonly object comment_class
 *     cdef readonly object pi_class
 *     cdef readonly object entity_class             # <<<<<<<<<<<<<<
 *     def __cinit__(self):
 *         self._lookup_function = _lookupDefaultElementClass
 */

static PyObject *__pyx_pf_4lxml_5etree_25ElementDefaultClassLookup_12entity_class___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_25ElementDefaultClassLookup_12entity_class___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_self)->entity_class);
  __pyx_r = ((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_self)->entity_class;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":282
 *             raise TypeError, u"PI class must be subclass of PIBase"
 * 
 * cdef object _lookupDefaultElementClass(state, _Document _doc, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     u"Trivial class lookup function that always returns the default class."
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 */

static  PyObject *__pyx_f_4lxml_5etree__lookupDefaultElementClass(PyObject *__pyx_v_state, struct LxmlDocument *__pyx_v__doc, xmlNode *__pyx_v_c_node) {
  PyObject *__pyx_v_cls;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("_lookupDefaultElementClass");
  __pyx_v_cls = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":284
 * cdef object _lookupDefaultElementClass(state, _Document _doc, xmlNode* c_node):
 *     u"Trivial class lookup function that always returns the default class."
 *     if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         if state is not None:
 *             return (<ElementDefaultClassLookup>state).element_class
 */
  __pyx_t_1 = (__pyx_v_c_node->type == XML_ELEMENT_NODE);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":285
 *     u"Trivial class lookup function that always returns the default class."
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         if state is not None:             # <<<<<<<<<<<<<<
 *             return (<ElementDefaultClassLookup>state).element_class
 *         else:
 */
    __pyx_t_1 = (__pyx_v_state != Py_None);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":286
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         if state is not None:
 *             return (<ElementDefaultClassLookup>state).element_class             # <<<<<<<<<<<<<<
 *         else:
 *             return _Element
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_state)->element_class);
      __pyx_r = ((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_state)->element_class;
      goto __pyx_L0;
      goto __pyx_L4;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":288
 *             return (<ElementDefaultClassLookup>state).element_class
 *         else:
 *             return _Element             # <<<<<<<<<<<<<<
 *     elif c_node.type == tree.XML_COMMENT_NODE:
 *         if state is not None:
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Element)));
      __pyx_r = ((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Element));
      goto __pyx_L0;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":289
 *         else:
 *             return _Element
 *     elif c_node.type == tree.XML_COMMENT_NODE:             # <<<<<<<<<<<<<<
 *         if state is not None:
 *             return (<ElementDefaultClassLookup>state).comment_class
 */
  __pyx_t_1 = (__pyx_v_c_node->type == XML_COMMENT_NODE);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":290
 *             return _Element
 *     elif c_node.type == tree.XML_COMMENT_NODE:
 *         if state is not None:             # <<<<<<<<<<<<<<
 *             return (<ElementDefaultClassLookup>state).comment_class
 *         else:
 */
    __pyx_t_1 = (__pyx_v_state != Py_None);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":291
 *     elif c_node.type == tree.XML_COMMENT_NODE:
 *         if state is not None:
 *             return (<ElementDefaultClassLookup>state).comment_class             # <<<<<<<<<<<<<<
 *         else:
 *             return _Comment
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_state)->comment_class);
      __pyx_r = ((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_state)->comment_class;
      goto __pyx_L0;
      goto __pyx_L5;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":293
 *             return (<ElementDefaultClassLookup>state).comment_class
 *         else:
 *             return _Comment             # <<<<<<<<<<<<<<
 *     elif c_node.type == tree.XML_ENTITY_REF_NODE:
 *         if state is not None:
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Comment)));
      __pyx_r = ((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Comment));
      goto __pyx_L0;
    }
    __pyx_L5:;
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":294
 *         else:
 *             return _Comment
 *     elif c_node.type == tree.XML_ENTITY_REF_NODE:             # <<<<<<<<<<<<<<
 *         if state is not None:
 *             return (<ElementDefaultClassLookup>state).entity_class
 */
  __pyx_t_1 = (__pyx_v_c_node->type == XML_ENTITY_REF_NODE);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":295
 *             return _Comment
 *     elif c_node.type == tree.XML_ENTITY_REF_NODE:
 *         if state is not None:             # <<<<<<<<<<<<<<
 *             return (<ElementDefaultClassLookup>state).entity_class
 *         else:
 */
    __pyx_t_1 = (__pyx_v_state != Py_None);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":296
 *     elif c_node.type == tree.XML_ENTITY_REF_NODE:
 *         if state is not None:
 *             return (<ElementDefaultClassLookup>state).entity_class             # <<<<<<<<<<<<<<
 *         else:
 *             return _Entity
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_state)->entity_class);
      __pyx_r = ((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_state)->entity_class;
      goto __pyx_L0;
      goto __pyx_L6;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":298
 *             return (<ElementDefaultClassLookup>state).entity_class
 *         else:
 *             return _Entity             # <<<<<<<<<<<<<<
 *     elif c_node.type == tree.XML_PI_NODE:
 *         if state is not None:
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Entity)));
      __pyx_r = ((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Entity));
      goto __pyx_L0;
    }
    __pyx_L6:;
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":299
 *         else:
 *             return _Entity
 *     elif c_node.type == tree.XML_PI_NODE:             # <<<<<<<<<<<<<<
 *         if state is not None:
 *             cls = (<ElementDefaultClassLookup>state).pi_class
 */
  __pyx_t_1 = (__pyx_v_c_node->type == XML_PI_NODE);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":300
 *             return _Entity
 *     elif c_node.type == tree.XML_PI_NODE:
 *         if state is not None:             # <<<<<<<<<<<<<<
 *             cls = (<ElementDefaultClassLookup>state).pi_class
 *         if cls is None:
 */
    __pyx_t_1 = (__pyx_v_state != Py_None);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":301
 *     elif c_node.type == tree.XML_PI_NODE:
 *         if state is not None:
 *             cls = (<ElementDefaultClassLookup>state).pi_class             # <<<<<<<<<<<<<<
 *         if cls is None:
 *             # special case XSLT-PI
 */
      __Pyx_INCREF(((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_state)->pi_class);
      __Pyx_DECREF(__pyx_v_cls);
      __pyx_v_cls = ((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_state)->pi_class;
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":302
 *         if state is not None:
 *             cls = (<ElementDefaultClassLookup>state).pi_class
 *         if cls is None:             # <<<<<<<<<<<<<<
 *             # special case XSLT-PI
 *             if c_node.name is not NULL and c_node.content is not NULL:
 */
    __pyx_t_1 = (__pyx_v_cls == Py_None);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":304
 *         if cls is None:
 *             # special case XSLT-PI
 *             if c_node.name is not NULL and c_node.content is not NULL:             # <<<<<<<<<<<<<<
 *                 if cstd.strcmp(c_node.name, "xml-stylesheet") == 0:
 *                     if cstd.strstr(c_node.content, "text/xsl") is not NULL or \
 */
      __pyx_t_1 = (__pyx_v_c_node->name != NULL);
      if (__pyx_t_1) {
        __pyx_t_2 = (__pyx_v_c_node->content != NULL);
        __pyx_t_3 = __pyx_t_2;
      } else {
        __pyx_t_3 = __pyx_t_1;
      }
      if (__pyx_t_3) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":305
 *             # special case XSLT-PI
 *             if c_node.name is not NULL and c_node.content is not NULL:
 *                 if cstd.strcmp(c_node.name, "xml-stylesheet") == 0:             # <<<<<<<<<<<<<<
 *                     if cstd.strstr(c_node.content, "text/xsl") is not NULL or \
 *                            cstd.strstr(c_node.content, "text/xml") is not NULL:
 */
        __pyx_t_3 = (strcmp(__pyx_v_c_node->name, __pyx_k_145) == 0);
        if (__pyx_t_3) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":306
 *             if c_node.name is not NULL and c_node.content is not NULL:
 *                 if cstd.strcmp(c_node.name, "xml-stylesheet") == 0:
 *                     if cstd.strstr(c_node.content, "text/xsl") is not NULL or \             # <<<<<<<<<<<<<<
 *                            cstd.strstr(c_node.content, "text/xml") is not NULL:
 *                         return _XSLTProcessingInstruction
 */
          __pyx_t_3 = (strstr(__pyx_v_c_node->content, __pyx_k_146) != NULL);
          if (!__pyx_t_3) {

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":307
 *                 if cstd.strcmp(c_node.name, "xml-stylesheet") == 0:
 *                     if cstd.strstr(c_node.content, "text/xsl") is not NULL or \
 *                            cstd.strstr(c_node.content, "text/xml") is not NULL:             # <<<<<<<<<<<<<<
 *                         return _XSLTProcessingInstruction
 *             return _ProcessingInstruction
 */
            __pyx_t_1 = (strstr(__pyx_v_c_node->content, __pyx_k_147) != NULL);
            __pyx_t_2 = __pyx_t_1;
          } else {
            __pyx_t_2 = __pyx_t_3;
          }
          if (__pyx_t_2) {

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":308
 *                     if cstd.strstr(c_node.content, "text/xsl") is not NULL or \
 *                            cstd.strstr(c_node.content, "text/xml") is not NULL:
 *                         return _XSLTProcessingInstruction             # <<<<<<<<<<<<<<
 *             return _ProcessingInstruction
 *         else:
 */
            __Pyx_XDECREF(__pyx_r);
            __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__XSLTProcessingInstruction)));
            __pyx_r = ((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__XSLTProcessingInstruction));
            goto __pyx_L0;
            goto __pyx_L11;
          }
          __pyx_L11:;
          goto __pyx_L10;
        }
        __pyx_L10:;
        goto __pyx_L9;
      }
      __pyx_L9:;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":309
 *                            cstd.strstr(c_node.content, "text/xml") is not NULL:
 *                         return _XSLTProcessingInstruction
 *             return _ProcessingInstruction             # <<<<<<<<<<<<<<
 *         else:
 *             return cls
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ProcessingInstruction)));
      __pyx_r = ((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ProcessingInstruction));
      goto __pyx_L0;
      goto __pyx_L8;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":311
 *             return _ProcessingInstruction
 *         else:
 *             return cls             # <<<<<<<<<<<<<<
 *     else:
 *         assert 0, u"Unknown node type: %s" % c_node.type
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_cls);
      __pyx_r = __pyx_v_cls;
      goto __pyx_L0;
    }
    __pyx_L8:;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":313
 *             return cls
 *     else:
 *         assert 0, u"Unknown node type: %s" % c_node.type             # <<<<<<<<<<<<<<
 * 
 * 
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!0)) {
      __pyx_t_4 = PyInt_FromLong(__pyx_v_c_node->type); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_148), __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_t_5));
      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
      {__pyx_filename = __pyx_f[9]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #endif
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._lookupDefaultElementClass");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_cls);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":336
 *     cdef char* _c_ns
 *     cdef char* _c_name
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._lookup_function = _attribute_class_lookup
 * 
 */

static int __pyx_pf_4lxml_5etree_32AttributeBasedElementClassLookup___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_32AttributeBasedElementClassLookup___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("__cinit__");
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":337
 *     cdef char* _c_name
 *     def __cinit__(self):
 *         self._lookup_function = _attribute_class_lookup             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, attribute_name, class_mapping,
 */
  ((struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *)__pyx_v_self)->__pyx_base.__pyx_base._lookup_function = __pyx_f_4lxml_5etree__attribute_class_lookup;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":339
 *         self._lookup_function = _attribute_class_lookup
 * 
 *     def __init__(self, attribute_name, class_mapping,             # <<<<<<<<<<<<<<
 *                  ElementClassLookup fallback=None):
 *         self._pytag = _getNsTag(attribute_name)
 */

static int __pyx_pf_4lxml_5etree_32AttributeBasedElementClassLookup_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_32AttributeBasedElementClassLookup_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_attribute_name = 0;
  PyObject *__pyx_v_class_mapping = 0;
  struct LxmlElementClassLookup *__pyx_v_fallback = 0;
  PyObject *__pyx_v_ns;
  PyObject *__pyx_v_name;
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__attribute_name,&__pyx_n_s__class_mapping,&__pyx_n_s__fallback,0};
  __Pyx_RefNannySetupContext("__init__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":340
 * 
 *     def __init__(self, attribute_name, class_mapping,
 *                  ElementClassLookup fallback=None):             # <<<<<<<<<<<<<<
 *         self._pytag = _getNsTag(attribute_name)
 *         ns, name = self._pytag
 */
    values[2] = (PyObject *)((struct LxmlElementClassLookup *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__attribute_name);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__class_mapping);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 3, 1); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fallback);
        if (value) { values[2] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_attribute_name = values[0];
    __pyx_v_class_mapping = values[1];
    __pyx_v_fallback = ((struct LxmlElementClassLookup *)values[2]);
  } else {
    __pyx_v_fallback = ((struct LxmlElementClassLookup *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3:
      __pyx_v_fallback = ((struct LxmlElementClassLookup *)PyTuple_GET_ITEM(__pyx_args, 2));
      case  2:
      __pyx_v_class_mapping = PyTuple_GET_ITEM(__pyx_args, 1);
      __pyx_v_attribute_name = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.AttributeBasedElementClassLookup.__init__");
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_ns = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_name = Py_None; __Pyx_INCREF(Py_None);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fallback), __pyx_ptype_4lxml_5etree_ElementClassLookup, 1, "fallback", 0))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":341
 *     def __init__(self, attribute_name, class_mapping,
 *                  ElementClassLookup fallback=None):
 *         self._pytag = _getNsTag(attribute_name)             # <<<<<<<<<<<<<<
 *         ns, name = self._pytag
 *         if ns is None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__getNsTag(__pyx_v_attribute_name)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *)__pyx_v_self)->_pytag);
  __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *)__pyx_v_self)->_pytag);
  ((struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *)__pyx_v_self)->_pytag = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":342
 *                  ElementClassLookup fallback=None):
 *         self._pytag = _getNsTag(attribute_name)
 *         ns, name = self._pytag             # <<<<<<<<<<<<<<
 *         if ns is None:
 *             self._c_ns = NULL
 */
  if (PyTuple_CheckExact(((struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *)__pyx_v_self)->_pytag) && likely(PyTuple_GET_SIZE(((struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *)__pyx_v_self)->_pytag) == 2)) {
    PyObject* tuple = ((struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *)__pyx_v_self)->_pytag;
    __pyx_t_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_1);
    __pyx_t_2 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_v_ns);
    __pyx_v_ns = __pyx_t_1;
    __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_v_name);
    __pyx_v_name = __pyx_t_2;
    __pyx_t_2 = 0;
  } else {
    __pyx_t_3 = PyObject_GetIter(((struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *)__pyx_v_self)->_pytag); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_3, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_3, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_EndUnpack(__pyx_t_3, 2) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_v_ns);
    __pyx_v_ns = __pyx_t_1;
    __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_v_name);
    __pyx_v_name = __pyx_t_2;
    __pyx_t_2 = 0;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":343
 *         self._pytag = _getNsTag(attribute_name)
 *         ns, name = self._pytag
 *         if ns is None:             # <<<<<<<<<<<<<<
 *             self._c_ns = NULL
 *         else:
 */
  __pyx_t_4 = (__pyx_v_ns == Py_None);
  if (__pyx_t_4) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":344
 *         ns, name = self._pytag
 *         if ns is None:
 *             self._c_ns = NULL             # <<<<<<<<<<<<<<
 *         else:
 *             self._c_ns = _cstr(ns)
 */
    ((struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *)__pyx_v_self)->_c_ns = NULL;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":346
 *             self._c_ns = NULL
 *         else:
 *             self._c_ns = _cstr(ns)             # <<<<<<<<<<<<<<
 *         self._c_name = _cstr(name)
 *         self._class_mapping = dict(class_mapping)
 */
    ((struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *)__pyx_v_self)->_c_ns = PyBytes_AS_STRING(__pyx_v_ns);
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":347
 *         else:
 *             self._c_ns = _cstr(ns)
 *         self._c_name = _cstr(name)             # <<<<<<<<<<<<<<
 *         self._class_mapping = dict(class_mapping)
 * 
 */
  ((struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *)__pyx_v_self)->_c_name = PyBytes_AS_STRING(__pyx_v_name);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":348
 *             self._c_ns = _cstr(ns)
 *         self._c_name = _cstr(name)
 *         self._class_mapping = dict(class_mapping)             # <<<<<<<<<<<<<<
 * 
 *         FallbackElementClassLookup.__init__(self, fallback)
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(__pyx_v_class_mapping);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_class_mapping);
  __Pyx_GIVEREF(__pyx_v_class_mapping);
  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyDict_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *)__pyx_v_self)->_class_mapping);
  __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *)__pyx_v_self)->_class_mapping);
  ((struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *)__pyx_v_self)->_class_mapping = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":350
 *         self._class_mapping = dict(class_mapping)
 * 
 *         FallbackElementClassLookup.__init__(self, fallback)             # <<<<<<<<<<<<<<
 * 
 * cdef object _attribute_class_lookup(state, _Document doc, xmlNode* c_node):
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_FallbackElementClassLookup)), __pyx_n_s____init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __Pyx_INCREF(((PyObject *)__pyx_v_fallback));
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_fallback));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_fallback));
  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.AttributeBasedElementClassLookup.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_ns);
  __Pyx_DECREF(__pyx_v_name);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":352
 *         FallbackElementClassLookup.__init__(self, fallback)
 * 
 * cdef object _attribute_class_lookup(state, _Document doc, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     cdef AttributeBasedElementClassLookup lookup
 *     cdef python.PyObject* dict_result
 */

static  PyObject *__pyx_f_4lxml_5etree__attribute_class_lookup(PyObject *__pyx_v_state, struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node) {
  struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *__pyx_v_lookup;
  PyObject *__pyx_v_dict_result;
  PyObject *__pyx_v_value;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_attribute_class_lookup");
  __pyx_v_lookup = ((struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_value = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":356
 *     cdef python.PyObject* dict_result
 * 
 *     lookup = <AttributeBasedElementClassLookup>state             # <<<<<<<<<<<<<<
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         value = _attributeValueFromNsName(
 */
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *)__pyx_v_state)));
  __Pyx_DECREF(((PyObject *)__pyx_v_lookup));
  __pyx_v_lookup = ((struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *)__pyx_v_state);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":357
 * 
 *     lookup = <AttributeBasedElementClassLookup>state
 *     if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         value = _attributeValueFromNsName(
 *             c_node, lookup._c_ns, lookup._c_name)
 */
  __pyx_t_1 = (__pyx_v_c_node->type == XML_ELEMENT_NODE);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":359
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         value = _attributeValueFromNsName(
 *             c_node, lookup._c_ns, lookup._c_name)             # <<<<<<<<<<<<<<
 *         dict_result = python.PyDict_GetItem(lookup._class_mapping, value)
 *         if dict_result is not NULL:
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree__attributeValueFromNsName(__pyx_v_c_node, __pyx_v_lookup->_c_ns, __pyx_v_lookup->_c_name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_v_value);
    __pyx_v_value = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":360
 *         value = _attributeValueFromNsName(
 *             c_node, lookup._c_ns, lookup._c_name)
 *         dict_result = python.PyDict_GetItem(lookup._class_mapping, value)             # <<<<<<<<<<<<<<
 *         if dict_result is not NULL:
 *             return <object>dict_result
 */
    __pyx_t_2 = __pyx_v_lookup->_class_mapping;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v_dict_result = PyDict_GetItem(__pyx_t_2, __pyx_v_value);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":361
 *             c_node, lookup._c_ns, lookup._c_name)
 *         dict_result = python.PyDict_GetItem(lookup._class_mapping, value)
 *         if dict_result is not NULL:             # <<<<<<<<<<<<<<
 *             return <object>dict_result
 *     return _callLookupFallback(lookup, doc, c_node)
 */
    __pyx_t_1 = (__pyx_v_dict_result != NULL);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":362
 *         dict_result = python.PyDict_GetItem(lookup._class_mapping, value)
 *         if dict_result is not NULL:
 *             return <object>dict_result             # <<<<<<<<<<<<<<
 *     return _callLookupFallback(lookup, doc, c_node)
 * 
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_dict_result));
      __pyx_r = ((PyObject *)__pyx_v_dict_result);
      goto __pyx_L0;
      goto __pyx_L4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":363
 *         if dict_result is not NULL:
 *             return <object>dict_result
 *     return _callLookupFallback(lookup, doc, c_node)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree__callLookupFallback(((struct LxmlFallbackElementClassLookup *)__pyx_v_lookup), __pyx_v_doc, __pyx_v_c_node); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._attribute_class_lookup");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_lookup);
  __Pyx_DECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":373
 *     Element class lookup based on the XML parser.
 *     """
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._lookup_function = _parser_class_lookup
 * 
 */

static int __pyx_pf_4lxml_5etree_29ParserBasedElementClassLookup___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_29ParserBasedElementClassLookup___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("__cinit__");
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":374
 *     """
 *     def __cinit__(self):
 *         self._lookup_function = _parser_class_lookup             # <<<<<<<<<<<<<<
 * 
 * cdef object _parser_class_lookup(state, _Document doc, xmlNode* c_node):
 */
  ((struct __pyx_obj_4lxml_5etree_ParserBasedElementClassLookup *)__pyx_v_self)->__pyx_base.__pyx_base._lookup_function = __pyx_f_4lxml_5etree__parser_class_lookup;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":376
 *         self._lookup_function = _parser_class_lookup
 * 
 * cdef object _parser_class_lookup(state, _Document doc, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     if doc._parser._class_lookup is not None:
 *         return doc._parser._class_lookup._lookup_function(
 */

static  PyObject *__pyx_f_4lxml_5etree__parser_class_lookup(PyObject *__pyx_v_state, struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("_parser_class_lookup");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":377
 * 
 * cdef object _parser_class_lookup(state, _Document doc, xmlNode* c_node):
 *     if doc._parser._class_lookup is not None:             # <<<<<<<<<<<<<<
 *         return doc._parser._class_lookup._lookup_function(
 *             doc._parser._class_lookup, doc, c_node)
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_doc->_parser->_class_lookup) != Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":378
 * cdef object _parser_class_lookup(state, _Document doc, xmlNode* c_node):
 *     if doc._parser._class_lookup is not None:
 *         return doc._parser._class_lookup._lookup_function(             # <<<<<<<<<<<<<<
 *             doc._parser._class_lookup, doc, c_node)
 *     return _callLookupFallback(<FallbackElementClassLookup>state, doc, c_node)
 */
    __Pyx_XDECREF(__pyx_r);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":379
 *     if doc._parser._class_lookup is not None:
 *         return doc._parser._class_lookup._lookup_function(
 *             doc._parser._class_lookup, doc, c_node)             # <<<<<<<<<<<<<<
 *     return _callLookupFallback(<FallbackElementClassLookup>state, doc, c_node)
 * 
 */
    __pyx_t_2 = ((PyObject *)__pyx_v_doc->_parser->_class_lookup);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = __pyx_v_doc->_parser->_class_lookup->_lookup_function(__pyx_t_2, __pyx_v_doc, __pyx_v_c_node); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":380
 *         return doc._parser._class_lookup._lookup_function(
 *             doc._parser._class_lookup, doc, c_node)
 *     return _callLookupFallback(<FallbackElementClassLookup>state, doc, c_node)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __pyx_f_4lxml_5etree__callLookupFallback(((struct LxmlFallbackElementClassLookup *)__pyx_v_state), __pyx_v_doc, __pyx_v_c_node); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._parser_class_lookup");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":402
 *     If you return None from this method, the fallback will be called.
 *     """
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._lookup_function = _custom_class_lookup
 * 
 */

static int __pyx_pf_4lxml_5etree_24CustomElementClassLookup___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_24CustomElementClassLookup___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("__cinit__");
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":403
 *     """
 *     def __cinit__(self):
 *         self._lookup_function = _custom_class_lookup             # <<<<<<<<<<<<<<
 * 
 *     def lookup(self, type, doc, namespace, name):
 */
  ((struct __pyx_obj_4lxml_5etree_CustomElementClassLookup *)__pyx_v_self)->__pyx_base.__pyx_base._lookup_function = __pyx_f_4lxml_5etree__custom_class_lookup;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":405
 *         self._lookup_function = _custom_class_lookup
 * 
 *     def lookup(self, type, doc, namespace, name):             # <<<<<<<<<<<<<<
 *         u"lookup(self, type, doc, namespace, name)"
 *         return None
 */

static PyObject *__pyx_pf_4lxml_5etree_24CustomElementClassLookup_1lookup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_24CustomElementClassLookup_1lookup[] = "lookup(self, type, doc, namespace, name)";
static PyObject *__pyx_pf_4lxml_5etree_24CustomElementClassLookup_1lookup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_type = 0;
  PyObject *__pyx_v_doc = 0;
  PyObject *__pyx_v_namespace = 0;
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_r = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__type,&__pyx_n_s__doc,&__pyx_n_s__namespace,&__pyx_n_s__name,0};
  __Pyx_RefNannySetupContext("lookup");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[4] = {0,0,0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__type);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__doc);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("lookup", 1, 4, 4, 1); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__namespace);
      if (likely(values[2])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("lookup", 1, 4, 4, 2); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  3:
      values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__name);
      if (likely(values[3])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("lookup", 1, 4, 4, 3); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "lookup") < 0)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_type = values[0];
    __pyx_v_doc = values[1];
    __pyx_v_namespace = values[2];
    __pyx_v_name = values[3];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_type = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_doc = PyTuple_GET_ITEM(__pyx_args, 1);
    __pyx_v_namespace = PyTuple_GET_ITEM(__pyx_args, 2);
    __pyx_v_name = PyTuple_GET_ITEM(__pyx_args, 3);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lookup", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.CustomElementClassLookup.lookup");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":407
 *     def lookup(self, type, doc, namespace, name):
 *         u"lookup(self, type, doc, namespace, name)"
 *         return None             # <<<<<<<<<<<<<<
 * 
 * cdef object _custom_class_lookup(state, _Document doc, xmlNode* c_node):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_None);
  __pyx_r = Py_None;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":409
 *         return None
 * 
 * cdef object _custom_class_lookup(state, _Document doc, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     cdef CustomElementClassLookup lookup
 *     cdef char* c_str
 */

static  PyObject *__pyx_f_4lxml_5etree__custom_class_lookup(PyObject *__pyx_v_state, struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node) {
  struct __pyx_obj_4lxml_5etree_CustomElementClassLookup *__pyx_v_lookup;
  char *__pyx_v_c_str;
  PyObject *__pyx_v_element_type;
  PyObject *__pyx_v_name;
  PyObject *__pyx_v_ns;
  PyObject *__pyx_v_cls;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("_custom_class_lookup");
  __pyx_v_lookup = ((struct __pyx_obj_4lxml_5etree_CustomElementClassLookup *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_element_type = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_name = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_ns = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_cls = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":413
 *     cdef char* c_str
 * 
 *     lookup = <CustomElementClassLookup>state             # <<<<<<<<<<<<<<
 * 
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 */
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_CustomElementClassLookup *)__pyx_v_state)));
  __Pyx_DECREF(((PyObject *)__pyx_v_lookup));
  __pyx_v_lookup = ((struct __pyx_obj_4lxml_5etree_CustomElementClassLookup *)__pyx_v_state);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":415
 *     lookup = <CustomElementClassLookup>state
 * 
 *     if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         element_type = u"element"
 *     elif c_node.type == tree.XML_COMMENT_NODE:
 */
  __pyx_t_1 = (__pyx_v_c_node->type == XML_ELEMENT_NODE);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":416
 * 
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         element_type = u"element"             # <<<<<<<<<<<<<<
 *     elif c_node.type == tree.XML_COMMENT_NODE:
 *         element_type = u"comment"
 */
    __Pyx_INCREF(((PyObject *)__pyx_n_u__element));
    __Pyx_DECREF(((PyObject *)__pyx_v_element_type));
    __pyx_v_element_type = __pyx_n_u__element;
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":417
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         element_type = u"element"
 *     elif c_node.type == tree.XML_COMMENT_NODE:             # <<<<<<<<<<<<<<
 *         element_type = u"comment"
 *     elif c_node.type == tree.XML_PI_NODE:
 */
  __pyx_t_1 = (__pyx_v_c_node->type == XML_COMMENT_NODE);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":418
 *         element_type = u"element"
 *     elif c_node.type == tree.XML_COMMENT_NODE:
 *         element_type = u"comment"             # <<<<<<<<<<<<<<
 *     elif c_node.type == tree.XML_PI_NODE:
 *         element_type = u"PI"
 */
    __Pyx_INCREF(((PyObject *)__pyx_n_u__comment));
    __Pyx_DECREF(((PyObject *)__pyx_v_element_type));
    __pyx_v_element_type = __pyx_n_u__comment;
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":419
 *     elif c_node.type == tree.XML_COMMENT_NODE:
 *         element_type = u"comment"
 *     elif c_node.type == tree.XML_PI_NODE:             # <<<<<<<<<<<<<<
 *         element_type = u"PI"
 *     elif c_node.type == tree.XML_ENTITY_REF_NODE:
 */
  __pyx_t_1 = (__pyx_v_c_node->type == XML_PI_NODE);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":420
 *         element_type = u"comment"
 *     elif c_node.type == tree.XML_PI_NODE:
 *         element_type = u"PI"             # <<<<<<<<<<<<<<
 *     elif c_node.type == tree.XML_ENTITY_REF_NODE:
 *         element_type = u"entity"
 */
    __Pyx_INCREF(((PyObject *)__pyx_n_u__PI));
    __Pyx_DECREF(((PyObject *)__pyx_v_element_type));
    __pyx_v_element_type = __pyx_n_u__PI;
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":421
 *     elif c_node.type == tree.XML_PI_NODE:
 *         element_type = u"PI"
 *     elif c_node.type == tree.XML_ENTITY_REF_NODE:             # <<<<<<<<<<<<<<
 *         element_type = u"entity"
 *     else:
 */
  __pyx_t_1 = (__pyx_v_c_node->type == XML_ENTITY_REF_NODE);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":422
 *         element_type = u"PI"
 *     elif c_node.type == tree.XML_ENTITY_REF_NODE:
 *         element_type = u"entity"             # <<<<<<<<<<<<<<
 *     else:
 *         element_type = u"element"
 */
    __Pyx_INCREF(((PyObject *)__pyx_n_u__entity));
    __Pyx_DECREF(((PyObject *)__pyx_v_element_type));
    __pyx_v_element_type = __pyx_n_u__entity;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":424
 *         element_type = u"entity"
 *     else:
 *         element_type = u"element"             # <<<<<<<<<<<<<<
 *     if c_node.name is NULL:
 *         name = None
 */
    __Pyx_INCREF(((PyObject *)__pyx_n_u__element));
    __Pyx_DECREF(((PyObject *)__pyx_v_element_type));
    __pyx_v_element_type = __pyx_n_u__element;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":425
 *     else:
 *         element_type = u"element"
 *     if c_node.name is NULL:             # <<<<<<<<<<<<<<
 *         name = None
 *     else:
 */
  __pyx_t_1 = (__pyx_v_c_node->name == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":426
 *         element_type = u"element"
 *     if c_node.name is NULL:
 *         name = None             # <<<<<<<<<<<<<<
 *     else:
 *         name = funicode(c_node.name)
 */
    __Pyx_INCREF(Py_None);
    __Pyx_DECREF(__pyx_v_name);
    __pyx_v_name = Py_None;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":428
 *         name = None
 *     else:
 *         name = funicode(c_node.name)             # <<<<<<<<<<<<<<
 *     c_str = tree._getNs(c_node)
 *     if c_str is NULL:
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_node->name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_v_name);
    __pyx_v_name = __pyx_t_2;
    __pyx_t_2 = 0;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":429
 *     else:
 *         name = funicode(c_node.name)
 *     c_str = tree._getNs(c_node)             # <<<<<<<<<<<<<<
 *     if c_str is NULL:
 *         ns = None
 */
  __pyx_v_c_str = _getNs(__pyx_v_c_node);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":430
 *         name = funicode(c_node.name)
 *     c_str = tree._getNs(c_node)
 *     if c_str is NULL:             # <<<<<<<<<<<<<<
 *         ns = None
 *     else:
 */
  __pyx_t_1 = (__pyx_v_c_str == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":431
 *     c_str = tree._getNs(c_node)
 *     if c_str is NULL:
 *         ns = None             # <<<<<<<<<<<<<<
 *     else:
 *         ns = funicode(c_str)
 */
    __Pyx_INCREF(Py_None);
    __Pyx_DECREF(__pyx_v_ns);
    __pyx_v_ns = Py_None;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":433
 *         ns = None
 *     else:
 *         ns = funicode(c_str)             # <<<<<<<<<<<<<<
 * 
 *     cls = lookup.lookup(element_type, doc, ns, name)
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_str); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_v_ns);
    __pyx_v_ns = __pyx_t_2;
    __pyx_t_2 = 0;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":435
 *         ns = funicode(c_str)
 * 
 *     cls = lookup.lookup(element_type, doc, ns, name)             # <<<<<<<<<<<<<<
 *     if cls is not None:
 *         return cls
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_lookup), __pyx_n_s__lookup); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(((PyObject *)__pyx_v_element_type));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_element_type));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_element_type));
  __Pyx_INCREF(((PyObject *)__pyx_v_doc));
  PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_doc));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_doc));
  __Pyx_INCREF(__pyx_v_ns);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_ns);
  __Pyx_GIVEREF(__pyx_v_ns);
  __Pyx_INCREF(__pyx_v_name);
  PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_v_name);
  __Pyx_GIVEREF(__pyx_v_name);
  __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_v_cls);
  __pyx_v_cls = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":436
 * 
 *     cls = lookup.lookup(element_type, doc, ns, name)
 *     if cls is not None:             # <<<<<<<<<<<<<<
 *         return cls
 *     return _callLookupFallback(lookup, doc, c_node)
 */
  __pyx_t_1 = (__pyx_v_cls != Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":437
 *     cls = lookup.lookup(element_type, doc, ns, name)
 *     if cls is not None:
 *         return cls             # <<<<<<<<<<<<<<
 *     return _callLookupFallback(lookup, doc, c_node)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_cls);
    __pyx_r = __pyx_v_cls;
    goto __pyx_L0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":438
 *     if cls is not None:
 *         return cls
 *     return _callLookupFallback(lookup, doc, c_node)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __pyx_f_4lxml_5etree__callLookupFallback(((struct LxmlFallbackElementClassLookup *)__pyx_v_lookup), __pyx_v_doc, __pyx_v_c_node); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._custom_class_lookup");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_lookup);
  __Pyx_DECREF(__pyx_v_element_type);
  __Pyx_DECREF(__pyx_v_name);
  __Pyx_DECREF(__pyx_v_ns);
  __Pyx_DECREF(__pyx_v_cls);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":487
 *     See http://codespeak.net/lxml/element_classes.html
 *     """
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._lookup_function = _python_class_lookup
 * 
 */

static int __pyx_pf_4lxml_5etree_24PythonElementClassLookup___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_24PythonElementClassLookup___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("__cinit__");
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":488
 *     """
 *     def __cinit__(self):
 *         self._lookup_function = _python_class_lookup             # <<<<<<<<<<<<<<
 * 
 *     def lookup(self, doc, element):
 */
  ((struct __pyx_obj_4lxml_5etree_PythonElementClassLookup *)__pyx_v_self)->__pyx_base.__pyx_base._lookup_function = __pyx_f_4lxml_5etree__python_class_lookup;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":490
 *         self._lookup_function = _python_class_lookup
 * 
 *     def lookup(self, doc, element):             # <<<<<<<<<<<<<<
 *         u"""lookup(self, doc, element)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_24PythonElementClassLookup_1lookup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_24PythonElementClassLookup_1lookup[] = "lookup(self, doc, element)\n\n        Override this method to implement your own lookup scheme.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_24PythonElementClassLookup_1lookup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_doc = 0;
  PyObject *__pyx_v_element = 0;
  PyObject *__pyx_r = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__doc,&__pyx_n_s__element,0};
  __Pyx_RefNannySetupContext("lookup");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__doc);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__element);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("lookup", 1, 2, 2, 1); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "lookup") < 0)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_doc = values[0];
    __pyx_v_element = values[1];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_doc = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_element = PyTuple_GET_ITEM(__pyx_args, 1);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lookup", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.PythonElementClassLookup.lookup");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":495
 *         Override this method to implement your own lookup scheme.
 *         """
 *         return None             # <<<<<<<<<<<<<<
 * 
 * cdef object _python_class_lookup(state, _Document doc, tree.xmlNode* c_node):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_None);
  __pyx_r = Py_None;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":497
 *         return None
 * 
 * cdef object _python_class_lookup(state, _Document doc, tree.xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     cdef PythonElementClassLookup lookup
 *     cdef _ReadOnlyElementProxy proxy
 */

static  PyObject *__pyx_f_4lxml_5etree__python_class_lookup(PyObject *__pyx_v_state, struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node) {
  struct __pyx_obj_4lxml_5etree_PythonElementClassLookup *__pyx_v_lookup;
  struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *__pyx_v_proxy;
  PyObject *__pyx_v_cls;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("_python_class_lookup");
  __pyx_v_lookup = ((struct __pyx_obj_4lxml_5etree_PythonElementClassLookup *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_proxy = ((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_cls = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":500
 *     cdef PythonElementClassLookup lookup
 *     cdef _ReadOnlyElementProxy proxy
 *     lookup = <PythonElementClassLookup>state             # <<<<<<<<<<<<<<
 * 
 *     proxy = _newReadOnlyProxy(None, c_node)
 */
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_PythonElementClassLookup *)__pyx_v_state)));
  __Pyx_DECREF(((PyObject *)__pyx_v_lookup));
  __pyx_v_lookup = ((struct __pyx_obj_4lxml_5etree_PythonElementClassLookup *)__pyx_v_state);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":502
 *     lookup = <PythonElementClassLookup>state
 * 
 *     proxy = _newReadOnlyProxy(None, c_node)             # <<<<<<<<<<<<<<
 *     cls = lookup.lookup(doc, proxy)
 *     _freeReadOnlyProxies(proxy)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__newReadOnlyProxy(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)Py_None), __pyx_v_c_node)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__ReadOnlyElementProxy))))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_v_proxy));
  __pyx_v_proxy = ((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":503
 * 
 *     proxy = _newReadOnlyProxy(None, c_node)
 *     cls = lookup.lookup(doc, proxy)             # <<<<<<<<<<<<<<
 *     _freeReadOnlyProxies(proxy)
 * 
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_lookup), __pyx_n_s__lookup); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(((PyObject *)__pyx_v_doc));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_doc));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_doc));
  __Pyx_INCREF(((PyObject *)__pyx_v_proxy));
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_proxy));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_proxy));
  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_v_cls);
  __pyx_v_cls = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":504
 *     proxy = _newReadOnlyProxy(None, c_node)
 *     cls = lookup.lookup(doc, proxy)
 *     _freeReadOnlyProxies(proxy)             # <<<<<<<<<<<<<<
 * 
 *     if cls is not None:
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree__freeReadOnlyProxies(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_proxy)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":506
 *     _freeReadOnlyProxies(proxy)
 * 
 *     if cls is not None:             # <<<<<<<<<<<<<<
 *         return cls
 *     return _callLookupFallback(lookup, doc, c_node)
 */
  __pyx_t_4 = (__pyx_v_cls != Py_None);
  if (__pyx_t_4) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":507
 * 
 *     if cls is not None:
 *         return cls             # <<<<<<<<<<<<<<
 *     return _callLookupFallback(lookup, doc, c_node)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_cls);
    __pyx_r = __pyx_v_cls;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":508
 *     if cls is not None:
 *         return cls
 *     return _callLookupFallback(lookup, doc, c_node)             # <<<<<<<<<<<<<<
 * 
 * ################################################################################
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __pyx_f_4lxml_5etree__callLookupFallback(((struct LxmlFallbackElementClassLookup *)__pyx_v_lookup), __pyx_v_doc, __pyx_v_c_node); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._python_class_lookup");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_lookup);
  __Pyx_DECREF((PyObject *)__pyx_v_proxy);
  __Pyx_DECREF(__pyx_v_cls);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":516
 * cdef object ELEMENT_CLASS_LOOKUP_STATE
 * 
 * cdef void _setElementClassLookupFunction(             # <<<<<<<<<<<<<<
 *     _element_class_lookup_function function, object state):
 *     global LOOKUP_ELEMENT_CLASS, ELEMENT_CLASS_LOOKUP_STATE
 */

static  void __pyx_f_4lxml_5etree__setElementClassLookupFunction(_element_class_lookup_function __pyx_v_function, PyObject *__pyx_v_state) {
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_setElementClassLookupFunction");
  __Pyx_INCREF(__pyx_v_state);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":519
 *     _element_class_lookup_function function, object state):
 *     global LOOKUP_ELEMENT_CLASS, ELEMENT_CLASS_LOOKUP_STATE
 *     if function is NULL:             # <<<<<<<<<<<<<<
 *         state    = DEFAULT_ELEMENT_CLASS_LOOKUP
 *         function = DEFAULT_ELEMENT_CLASS_LOOKUP._lookup_function
 */
  __pyx_t_1 = (__pyx_v_function == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":520
 *     global LOOKUP_ELEMENT_CLASS, ELEMENT_CLASS_LOOKUP_STATE
 *     if function is NULL:
 *         state    = DEFAULT_ELEMENT_CLASS_LOOKUP             # <<<<<<<<<<<<<<
 *         function = DEFAULT_ELEMENT_CLASS_LOOKUP._lookup_function
 * 
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_4lxml_5etree_DEFAULT_ELEMENT_CLASS_LOOKUP));
    __Pyx_DECREF(__pyx_v_state);
    __pyx_v_state = ((PyObject *)__pyx_v_4lxml_5etree_DEFAULT_ELEMENT_CLASS_LOOKUP);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":521
 *     if function is NULL:
 *         state    = DEFAULT_ELEMENT_CLASS_LOOKUP
 *         function = DEFAULT_ELEMENT_CLASS_LOOKUP._lookup_function             # <<<<<<<<<<<<<<
 * 
 *     ELEMENT_CLASS_LOOKUP_STATE = state
 */
    __pyx_v_function = __pyx_v_4lxml_5etree_DEFAULT_ELEMENT_CLASS_LOOKUP->__pyx_base.__pyx_base._lookup_function;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":523
 *         function = DEFAULT_ELEMENT_CLASS_LOOKUP._lookup_function
 * 
 *     ELEMENT_CLASS_LOOKUP_STATE = state             # <<<<<<<<<<<<<<
 *     LOOKUP_ELEMENT_CLASS = function
 * 
 */
  __Pyx_INCREF(__pyx_v_state);
  __Pyx_GOTREF(__pyx_v_4lxml_5etree_ELEMENT_CLASS_LOOKUP_STATE);
  __Pyx_DECREF(__pyx_v_4lxml_5etree_ELEMENT_CLASS_LOOKUP_STATE);
  __Pyx_GIVEREF(__pyx_v_state);
  __pyx_v_4lxml_5etree_ELEMENT_CLASS_LOOKUP_STATE = __pyx_v_state;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":524
 * 
 *     ELEMENT_CLASS_LOOKUP_STATE = state
 *     LOOKUP_ELEMENT_CLASS = function             # <<<<<<<<<<<<<<
 * 
 * def set_element_class_lookup(ElementClassLookup lookup = None):
 */
  __pyx_v_4lxml_5etree_LOOKUP_ELEMENT_CLASS = __pyx_v_function;

  __Pyx_DECREF(__pyx_v_state);
  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":526
 *     LOOKUP_ELEMENT_CLASS = function
 * 
 * def set_element_class_lookup(ElementClassLookup lookup = None):             # <<<<<<<<<<<<<<
 *     u"""set_element_class_lookup(lookup = None)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_19set_element_class_lookup(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_19set_element_class_lookup[] = "set_element_class_lookup(lookup = None)\n\n    Set the global default element class lookup method.\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_19set_element_class_lookup = {__Pyx_NAMESTR("set_element_class_lookup"), (PyCFunction)__pyx_pf_4lxml_5etree_19set_element_class_lookup, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_19set_element_class_lookup)};
static PyObject *__pyx_pf_4lxml_5etree_19set_element_class_lookup(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct LxmlElementClassLookup *__pyx_v_lookup = 0;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__lookup,0};
  __Pyx_RefNannySetupContext("set_element_class_lookup");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[1] = {0};
    values[0] = (PyObject *)((struct LxmlElementClassLookup *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__lookup);
        if (value) { values[0] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "set_element_class_lookup") < 0)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_lookup = ((struct LxmlElementClassLookup *)values[0]);
  } else {
    __pyx_v_lookup = ((struct LxmlElementClassLookup *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: __pyx_v_lookup = ((struct LxmlElementClassLookup *)PyTuple_GET_ITEM(__pyx_args, 0));
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_element_class_lookup", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.set_element_class_lookup");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lookup), __pyx_ptype_4lxml_5etree_ElementClassLookup, 1, "lookup", 0))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":531
 *     Set the global default element class lookup method.
 *     """
 *     if lookup is None or lookup._lookup_function is NULL:             # <<<<<<<<<<<<<<
 *         _setElementClassLookupFunction(NULL, None)
 *     else:
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_lookup) == Py_None);
  if (!__pyx_t_1) {
    __pyx_t_2 = (__pyx_v_lookup->_lookup_function == NULL);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":532
 *     """
 *     if lookup is None or lookup._lookup_function is NULL:
 *         _setElementClassLookupFunction(NULL, None)             # <<<<<<<<<<<<<<
 *     else:
 *         _setElementClassLookupFunction(lookup._lookup_function, lookup)
 */
    __pyx_f_4lxml_5etree__setElementClassLookupFunction(NULL, Py_None);
    goto __pyx_L6;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":534
 *         _setElementClassLookupFunction(NULL, None)
 *     else:
 *         _setElementClassLookupFunction(lookup._lookup_function, lookup)             # <<<<<<<<<<<<<<
 * 
 * # default setup: parser delegation
 */
    __pyx_f_4lxml_5etree__setElementClassLookupFunction(__pyx_v_lookup->_lookup_function, ((PyObject *)__pyx_v_lookup));
  }
  __pyx_L6:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.set_element_class_lookup");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":20
 *     cdef dict _entries
 *     cdef char* _c_ns_uri_utf
 *     def __cinit__(self, ns_uri):             # <<<<<<<<<<<<<<
 *         self._ns_uri = ns_uri
 *         if ns_uri is None:
 */

static int __pyx_pf_4lxml_5etree_18_NamespaceRegistry___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_18_NamespaceRegistry___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_ns_uri = 0;
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__ns_uri,0};
  __Pyx_RefNannySetupContext("__cinit__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[1] = {0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ns_uri);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_ns_uri = values[0];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_ns_uri = PyTuple_GET_ITEM(__pyx_args, 0);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[10]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._NamespaceRegistry.__cinit__");
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":21
 *     cdef char* _c_ns_uri_utf
 *     def __cinit__(self, ns_uri):
 *         self._ns_uri = ns_uri             # <<<<<<<<<<<<<<
 *         if ns_uri is None:
 *             self._ns_uri_utf = None
 */
  __Pyx_INCREF(__pyx_v_ns_uri);
  __Pyx_GIVEREF(__pyx_v_ns_uri);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_v_self)->_ns_uri);
  __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_v_self)->_ns_uri);
  ((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_v_self)->_ns_uri = __pyx_v_ns_uri;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":22
 *     def __cinit__(self, ns_uri):
 *         self._ns_uri = ns_uri
 *         if ns_uri is None:             # <<<<<<<<<<<<<<
 *             self._ns_uri_utf = None
 *             self._c_ns_uri_utf = NULL
 */
  __pyx_t_1 = (__pyx_v_ns_uri == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":23
 *         self._ns_uri = ns_uri
 *         if ns_uri is None:
 *             self._ns_uri_utf = None             # <<<<<<<<<<<<<<
 *             self._c_ns_uri_utf = NULL
 *         else:
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_v_self)->_ns_uri_utf);
    __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_v_self)->_ns_uri_utf);
    ((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_v_self)->_ns_uri_utf = Py_None;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":24
 *         if ns_uri is None:
 *             self._ns_uri_utf = None
 *             self._c_ns_uri_utf = NULL             # <<<<<<<<<<<<<<
 *         else:
 *             self._ns_uri_utf = _utf8(ns_uri)
 */
    ((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_v_self)->_c_ns_uri_utf = NULL;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":26
 *             self._c_ns_uri_utf = NULL
 *         else:
 *             self._ns_uri_utf = _utf8(ns_uri)             # <<<<<<<<<<<<<<
 *             self._c_ns_uri_utf = _cstr(self._ns_uri_utf)
 *         self._entries = {}
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_v_ns_uri)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_v_self)->_ns_uri_utf);
    __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_v_self)->_ns_uri_utf);
    ((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_v_self)->_ns_uri_utf = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":27
 *         else:
 *             self._ns_uri_utf = _utf8(ns_uri)
 *             self._c_ns_uri_utf = _cstr(self._ns_uri_utf)             # <<<<<<<<<<<<<<
 *         self._entries = {}
 * 
 */
    __pyx_t_2 = ((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_v_self)->_ns_uri_utf;
    __Pyx_INCREF(__pyx_t_2);
    ((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_v_self)->_c_ns_uri_utf = PyBytes_AS_STRING(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":28
 *             self._ns_uri_utf = _utf8(ns_uri)
 *             self._c_ns_uri_utf = _cstr(self._ns_uri_utf)
 *         self._entries = {}             # <<<<<<<<<<<<<<
 * 
 *     def update(self, class_dict_iterable):
 */
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_v_self)->_entries);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_v_self)->_entries));
  ((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_v_self)->_entries = __pyx_t_2;
  __pyx_t_2 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._NamespaceRegistry.__cinit__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":30
 *         self._entries = {}
 * 
 *     def update(self, class_dict_iterable):             # <<<<<<<<<<<<<<
 *         u"""update(self, class_dict_iterable)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_18_NamespaceRegistry_1update(PyObject *__pyx_v_self, PyObject *__pyx_v_class_dict_iterable); /*proto*/
static char __pyx_doc_4lxml_5etree_18_NamespaceRegistry_1update[] = "update(self, class_dict_iterable)\n\n        Forgivingly update the registry.\n\n        If registered values do not match the required type for this\n        registry, or if their name starts with '_', they will be\n        silently discarded. This allows registrations at the module or\n        class level using vars(), globals() etc.";
static PyObject *__pyx_pf_4lxml_5etree_18_NamespaceRegistry_1update(PyObject *__pyx_v_self, PyObject *__pyx_v_class_dict_iterable) {
  PyObject *__pyx_v_name;
  PyObject *__pyx_v_item;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_t_9;
  __Pyx_RefNannySetupContext("update");
  __Pyx_INCREF(__pyx_v_class_dict_iterable);
  __pyx_v_name = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_item = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":39
 *         silently discarded. This allows registrations at the module or
 *         class level using vars(), globals() etc."""
 *         if hasattr(class_dict_iterable, u'items'):             # <<<<<<<<<<<<<<
 *             class_dict_iterable = class_dict_iterable.items()
 *         for name, item in class_dict_iterable:
 */
  __pyx_t_1 = PyObject_HasAttr(__pyx_v_class_dict_iterable, ((PyObject *)__pyx_n_u__items)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":40
 *         class level using vars(), globals() etc."""
 *         if hasattr(class_dict_iterable, u'items'):
 *             class_dict_iterable = class_dict_iterable.items()             # <<<<<<<<<<<<<<
 *         for name, item in class_dict_iterable:
 *             if (name is None or name[:1] != u'_') and callable(item):
 */
    __pyx_t_2 = PyObject_GetAttr(__pyx_v_class_dict_iterable, __pyx_n_s__items); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_v_class_dict_iterable);
    __pyx_v_class_dict_iterable = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":41
 *         if hasattr(class_dict_iterable, u'items'):
 *             class_dict_iterable = class_dict_iterable.items()
 *         for name, item in class_dict_iterable:             # <<<<<<<<<<<<<<
 *             if (name is None or name[:1] != u'_') and callable(item):
 *                 self[name] = item
 */
  if (PyList_CheckExact(__pyx_v_class_dict_iterable) || PyTuple_CheckExact(__pyx_v_class_dict_iterable)) {
    __pyx_t_4 = 0; __pyx_t_3 = __pyx_v_class_dict_iterable; __Pyx_INCREF(__pyx_t_3);
  } else {
    __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_class_dict_iterable); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
  }
  for (;;) {
    if (likely(PyList_CheckExact(__pyx_t_3))) {
      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
    } else if (likely(PyTuple_CheckExact(__pyx_t_3))) {
      if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
    } else {
      __pyx_t_2 = PyIter_Next(__pyx_t_3);
      if (!__pyx_t_2) {
        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    if (PyTuple_CheckExact(__pyx_t_2) && likely(PyTuple_GET_SIZE(__pyx_t_2) == 2)) {
      PyObject* tuple = __pyx_t_2;
      __pyx_t_5 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_5);
      __pyx_t_6 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_v_name);
      __pyx_v_name = __pyx_t_5;
      __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_v_item);
      __pyx_v_item = __pyx_t_6;
      __pyx_t_6 = 0;
    } else {
      __pyx_t_7 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_5 = __Pyx_UnpackItem(__pyx_t_7, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_UnpackItem(__pyx_t_7, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_EndUnpack(__pyx_t_7, 2) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_v_name);
      __pyx_v_name = __pyx_t_5;
      __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_v_item);
      __pyx_v_item = __pyx_t_6;
      __pyx_t_6 = 0;
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":42
 *             class_dict_iterable = class_dict_iterable.items()
 *         for name, item in class_dict_iterable:
 *             if (name is None or name[:1] != u'_') and callable(item):             # <<<<<<<<<<<<<<
 *                 self[name] = item
 * 
 */
    __pyx_t_1 = (__pyx_v_name == Py_None);
    if (!__pyx_t_1) {
      __pyx_t_2 = __Pyx_PySequence_GetSlice(__pyx_v_name, 0, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_8 = __Pyx_PyUnicode_Equals(__pyx_t_2, ((PyObject *)__pyx_n_u___), Py_NE); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_9 = __pyx_t_8;
    } else {
      __pyx_t_9 = __pyx_t_1;
    }
    if (__pyx_t_9) {
      __pyx_t_1 = PyCallable_Check(__pyx_v_item);
    } else {
      __pyx_t_1 = __pyx_t_9;
    }
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":43
 *         for name, item in class_dict_iterable:
 *             if (name is None or name[:1] != u'_') and callable(item):
 *                 self[name] = item             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, name):
 */
      if (PyObject_SetItem(__pyx_v_self, __pyx_v_name, __pyx_v_item) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L8;
    }
    __pyx_L8:;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree._NamespaceRegistry.update");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_name);
  __Pyx_DECREF(__pyx_v_item);
  __Pyx_DECREF(__pyx_v_class_dict_iterable);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":45
 *                 self[name] = item
 * 
 *     def __getitem__(self, name):             # <<<<<<<<<<<<<<
 *         if name is not None:
 *             name = _utf8(name)
 */

static PyObject *__pyx_pf_4lxml_5etree_18_NamespaceRegistry_2__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_name); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_18_NamespaceRegistry_2__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_name) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__getitem__");
  __Pyx_INCREF(__pyx_v_name);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":46
 * 
 *     def __getitem__(self, name):
 *         if name is not None:             # <<<<<<<<<<<<<<
 *             name = _utf8(name)
 *         return self._get(name)
 */
  __pyx_t_1 = (__pyx_v_name != Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":47
 *     def __getitem__(self, name):
 *         if name is not None:
 *             name = _utf8(name)             # <<<<<<<<<<<<<<
 *         return self._get(name)
 * 
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_v_name)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_v_name);
    __pyx_v_name = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":48
 *         if name is not None:
 *             name = _utf8(name)
 *         return self._get(name)             # <<<<<<<<<<<<<<
 * 
 *     def __delitem__(self, name):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__NamespaceRegistry *)((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_v_self)->__pyx_vtab)->_get(((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_v_self), __pyx_v_name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._NamespaceRegistry.__getitem__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":50
 *         return self._get(name)
 * 
 *     def __delitem__(self, name):             # <<<<<<<<<<<<<<
 *         if name is not None:
 *             name = _utf8(name)
 */

static int __pyx_pf_4lxml_5etree_18_NamespaceRegistry_3__delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_name); /*proto*/
static int __pyx_pf_4lxml_5etree_18_NamespaceRegistry_3__delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_name) {
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__delitem__");
  __Pyx_INCREF(__pyx_v_name);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":51
 * 
 *     def __delitem__(self, name):
 *         if name is not None:             # <<<<<<<<<<<<<<
 *             name = _utf8(name)
 *         del self._entries[name]
 */
  __pyx_t_1 = (__pyx_v_name != Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":52
 *     def __delitem__(self, name):
 *         if name is not None:
 *             name = _utf8(name)             # <<<<<<<<<<<<<<
 *         del self._entries[name]
 * 
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_v_name)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_v_name);
    __pyx_v_name = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":53
 *         if name is not None:
 *             name = _utf8(name)
 *         del self._entries[name]             # <<<<<<<<<<<<<<
 * 
 *     cdef object _get(self, object name):
 */
  if (PyDict_DelItem(((PyObject *)((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_v_self)->_entries), __pyx_v_name) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._NamespaceRegistry.__delitem__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_name);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":55
 *         del self._entries[name]
 * 
 *     cdef object _get(self, object name):             # <<<<<<<<<<<<<<
 *         cdef python.PyObject* dict_result
 *         dict_result = python.PyDict_GetItem(self._entries, name)
 */

static  PyObject *__pyx_f_4lxml_5etree_18_NamespaceRegistry__get(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *__pyx_v_self, PyObject *__pyx_v_name) {
  PyObject *__pyx_v_dict_result;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("_get");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":57
 *     cdef object _get(self, object name):
 *         cdef python.PyObject* dict_result
 *         dict_result = python.PyDict_GetItem(self._entries, name)             # <<<<<<<<<<<<<<
 *         if dict_result is NULL:
 *             raise KeyError, u"Name not registered."
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_entries);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_dict_result = PyDict_GetItem(__pyx_t_1, __pyx_v_name);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":58
 *         cdef python.PyObject* dict_result
 *         dict_result = python.PyDict_GetItem(self._entries, name)
 *         if dict_result is NULL:             # <<<<<<<<<<<<<<
 *             raise KeyError, u"Name not registered."
 *         return <object>dict_result
 */
  __pyx_t_2 = (__pyx_v_dict_result == NULL);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":59
 *         dict_result = python.PyDict_GetItem(self._entries, name)
 *         if dict_result is NULL:
 *             raise KeyError, u"Name not registered."             # <<<<<<<<<<<<<<
 *         return <object>dict_result
 * 
 */
    __Pyx_Raise(__pyx_builtin_KeyError, ((PyObject *)__pyx_kp_u_149), 0);
    {__pyx_filename = __pyx_f[10]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":60
 *         if dict_result is NULL:
 *             raise KeyError, u"Name not registered."
 *         return <object>dict_result             # <<<<<<<<<<<<<<
 * 
 *     cdef object _getForString(self, char* name):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_dict_result));
  __pyx_r = ((PyObject *)__pyx_v_dict_result);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._NamespaceRegistry._get");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":62
 *         return <object>dict_result
 * 
 *     cdef object _getForString(self, char* name):             # <<<<<<<<<<<<<<
 *         cdef python.PyObject* dict_result
 *         dict_result = python.PyDict_GetItem(self._entries, name)
 */

static  PyObject *__pyx_f_4lxml_5etree_18_NamespaceRegistry__getForString(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *__pyx_v_self, char *__pyx_v_name) {
  PyObject *__pyx_v_dict_result;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("_getForString");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":64
 *     cdef object _getForString(self, char* name):
 *         cdef python.PyObject* dict_result
 *         dict_result = python.PyDict_GetItem(self._entries, name)             # <<<<<<<<<<<<<<
 *         if dict_result is NULL:
 *             raise KeyError, u"Name not registered."
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_entries);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = PyBytes_FromString(__pyx_v_name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __pyx_v_dict_result = PyDict_GetItem(__pyx_t_1, ((PyObject *)__pyx_t_2));
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":65
 *         cdef python.PyObject* dict_result
 *         dict_result = python.PyDict_GetItem(self._entries, name)
 *         if dict_result is NULL:             # <<<<<<<<<<<<<<
 *             raise KeyError, u"Name not registered."
 *         return <object>dict_result
 */
  __pyx_t_3 = (__pyx_v_dict_result == NULL);
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":66
 *         dict_result = python.PyDict_GetItem(self._entries, name)
 *         if dict_result is NULL:
 *             raise KeyError, u"Name not registered."             # <<<<<<<<<<<<<<
 *         return <object>dict_result
 * 
 */
    __Pyx_Raise(__pyx_builtin_KeyError, ((PyObject *)__pyx_kp_u_149), 0);
    {__pyx_filename = __pyx_f[10]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":67
 *         if dict_result is NULL:
 *             raise KeyError, u"Name not registered."
 *         return <object>dict_result             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_dict_result));
  __pyx_r = ((PyObject *)__pyx_v_dict_result);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._NamespaceRegistry._getForString");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":69
 *         return <object>dict_result
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return iter(self._entries)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_18_NamespaceRegistry_4__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_18_NamespaceRegistry_4__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__iter__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":70
 * 
 *     def __iter__(self):
 *         return iter(self._entries)             # <<<<<<<<<<<<<<
 * 
 *     def items(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_v_self)->_entries);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._NamespaceRegistry.__iter__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":72
 *         return iter(self._entries)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         return list(self._entries.items())
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_18_NamespaceRegistry_5items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_18_NamespaceRegistry_5items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("items");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":73
 * 
 *     def items(self):
 *         return list(self._entries.items())             # <<<<<<<<<<<<<<
 * 
 *     def iteritems(self):
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_v_self)->_entries == Py_None)) {
    PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'items'"); {__pyx_filename = __pyx_f[10]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_1 = PyDict_Items(((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_v_self)->_entries); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._NamespaceRegistry.items");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":75
 *         return list(self._entries.items())
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         return iter(self._entries.items())
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_18_NamespaceRegistry_6iteritems(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_18_NamespaceRegistry_6iteritems(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("iteritems");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":76
 * 
 *     def iteritems(self):
 *         return iter(self._entries.items())             # <<<<<<<<<<<<<<
 * 
 *     def clear(self):
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_v_self)->_entries == Py_None)) {
    PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'items'"); {__pyx_filename = __pyx_f[10]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_1 = PyDict_Items(((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_v_self)->_entries); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._NamespaceRegistry.iteritems");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":78
 *         return iter(self._entries.items())
 * 
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         python.PyDict_Clear(self._entries)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_18_NamespaceRegistry_7clear(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_18_NamespaceRegistry_7clear(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("clear");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":79
 * 
 *     def clear(self):
 *         python.PyDict_Clear(self._entries)             # <<<<<<<<<<<<<<
 * 
 * cdef class _ClassNamespaceRegistry(_NamespaceRegistry):
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_v_self)->_entries);
  __Pyx_INCREF(__pyx_t_1);
  PyDict_Clear(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":83
 * cdef class _ClassNamespaceRegistry(_NamespaceRegistry):
 *     u"Dictionary-like registry for namespace implementation classes"
 *     def __setitem__(self, name, item):             # <<<<<<<<<<<<<<
 *         if not python.PyType_Check(item) or not issubclass(item, ElementBase):
 *             raise NamespaceRegistryError, \
 */

static int __pyx_pf_4lxml_5etree_23_ClassNamespaceRegistry___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_item); /*proto*/
static int __pyx_pf_4lxml_5etree_23_ClassNamespaceRegistry___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_item) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("__setitem__");
  __Pyx_INCREF(__pyx_v_name);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":84
 *     u"Dictionary-like registry for namespace implementation classes"
 *     def __setitem__(self, name, item):
 *         if not python.PyType_Check(item) or not issubclass(item, ElementBase):             # <<<<<<<<<<<<<<
 *             raise NamespaceRegistryError, \
 *                 u"Registered element classes must be subtypes of ElementBase"
 */
  __pyx_t_1 = (!PyType_Check(__pyx_v_item));
  if (!__pyx_t_1) {
    __pyx_t_2 = PyObject_IsSubclass(__pyx_v_item, ((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_ElementBase))); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = (!__pyx_t_2);
    __pyx_t_2 = __pyx_t_3;
  } else {
    __pyx_t_2 = __pyx_t_1;
  }
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":85
 *     def __setitem__(self, name, item):
 *         if not python.PyType_Check(item) or not issubclass(item, ElementBase):
 *             raise NamespaceRegistryError, \             # <<<<<<<<<<<<<<
 *                 u"Registered element classes must be subtypes of ElementBase"
 *         if name is not None:
 */
    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s_150); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_Raise(__pyx_t_4, ((PyObject *)__pyx_kp_u_151), 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[10]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":87
 *             raise NamespaceRegistryError, \
 *                 u"Registered element classes must be subtypes of ElementBase"
 *         if name is not None:             # <<<<<<<<<<<<<<
 *             name = _utf8(name)
 *         self._entries[name] = item
 */
  __pyx_t_2 = (__pyx_v_name != Py_None);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":88
 *                 u"Registered element classes must be subtypes of ElementBase"
 *         if name is not None:
 *             name = _utf8(name)             # <<<<<<<<<<<<<<
 *         self._entries[name] = item
 * 
 */
    __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_v_name)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_v_name);
    __pyx_v_name = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":89
 *         if name is not None:
 *             name = _utf8(name)
 *         self._entries[name] = item             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  if (PyDict_SetItem(((PyObject *)((struct __pyx_obj_4lxml_5etree__ClassNamespaceRegistry *)__pyx_v_self)->__pyx_base._entries), __pyx_v_name, __pyx_v_item) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._ClassNamespaceRegistry.__setitem__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_name);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":91
 *         self._entries[name] = item
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return u"Namespace(%r)" % self._ns_uri
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_23_ClassNamespaceRegistry_1__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_23_ClassNamespaceRegistry_1__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__repr__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":92
 * 
 *     def __repr__(self):
 *         return u"Namespace(%r)" % self._ns_uri             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_152), ((struct __pyx_obj_4lxml_5etree__ClassNamespaceRegistry *)__pyx_v_self)->__pyx_base._ns_uri); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_r = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ClassNamespaceRegistry.__repr__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":102
 *     """
 *     cdef dict _namespace_registries
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._namespace_registries = {}
 * 
 */

static int __pyx_pf_4lxml_5etree_27ElementNamespaceClassLookup___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_27ElementNamespaceClassLookup___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__cinit__");
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":103
 *     cdef dict _namespace_registries
 *     def __cinit__(self):
 *         self._namespace_registries = {}             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, ElementClassLookup fallback=None):
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *)__pyx_v_self)->_namespace_registries);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *)__pyx_v_self)->_namespace_registries));
  ((struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *)__pyx_v_self)->_namespace_registries = __pyx_t_1;
  __pyx_t_1 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.ElementNamespaceClassLookup.__cinit__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":105
 *         self._namespace_registries = {}
 * 
 *     def __init__(self, ElementClassLookup fallback=None):             # <<<<<<<<<<<<<<
 *         FallbackElementClassLookup.__init__(self, fallback)
 *         self._lookup_function = _find_nselement_class
 */

static int __pyx_pf_4lxml_5etree_27ElementNamespaceClassLookup_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_27ElementNamespaceClassLookup_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct LxmlElementClassLookup *__pyx_v_fallback = 0;
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fallback,0};
  __Pyx_RefNannySetupContext("__init__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[1] = {0};
    values[0] = (PyObject *)((struct LxmlElementClassLookup *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fallback);
        if (value) { values[0] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_fallback = ((struct LxmlElementClassLookup *)values[0]);
  } else {
    __pyx_v_fallback = ((struct LxmlElementClassLookup *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: __pyx_v_fallback = ((struct LxmlElementClassLookup *)PyTuple_GET_ITEM(__pyx_args, 0));
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[10]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.ElementNamespaceClassLookup.__init__");
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fallback), __pyx_ptype_4lxml_5etree_ElementClassLookup, 1, "fallback", 0))) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":106
 * 
 *     def __init__(self, ElementClassLookup fallback=None):
 *         FallbackElementClassLookup.__init__(self, fallback)             # <<<<<<<<<<<<<<
 *         self._lookup_function = _find_nselement_class
 * 
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_FallbackElementClassLookup)), __pyx_n_s____init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __Pyx_INCREF(((PyObject *)__pyx_v_fallback));
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_fallback));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_fallback));
  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":107
 *     def __init__(self, ElementClassLookup fallback=None):
 *         FallbackElementClassLookup.__init__(self, fallback)
 *         self._lookup_function = _find_nselement_class             # <<<<<<<<<<<<<<
 * 
 *     def get_namespace(self, ns_uri):
 */
  ((struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *)__pyx_v_self)->__pyx_base.__pyx_base._lookup_function = __pyx_f_4lxml_5etree__find_nselement_class;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.ElementNamespaceClassLookup.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":109
 *         self._lookup_function = _find_nselement_class
 * 
 *     def get_namespace(self, ns_uri):             # <<<<<<<<<<<<<<
 *         u"""get_namespace(self, ns_uri)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_27ElementNamespaceClassLookup_2get_namespace(PyObject *__pyx_v_self, PyObject *__pyx_v_ns_uri); /*proto*/
static char __pyx_doc_4lxml_5etree_27ElementNamespaceClassLookup_2get_namespace[] = "get_namespace(self, ns_uri)\n\n        Retrieve the namespace object associated with the given URI.\n\n        Creates a new one if it does not yet exist.";
static PyObject *__pyx_pf_4lxml_5etree_27ElementNamespaceClassLookup_2get_namespace(PyObject *__pyx_v_self, PyObject *__pyx_v_ns_uri) {
  PyObject *__pyx_v_ns_utf;
  struct __pyx_obj_4lxml_5etree__ClassNamespaceRegistry *__pyx_v_registry;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("get_namespace");
  __pyx_v_ns_utf = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_registry = ((struct __pyx_obj_4lxml_5etree__ClassNamespaceRegistry *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":115
 * 
 *         Creates a new one if it does not yet exist."""
 *         if ns_uri:             # <<<<<<<<<<<<<<
 *             ns_utf = _utf8(ns_uri)
 *         else:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_ns_uri); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":116
 *         Creates a new one if it does not yet exist."""
 *         if ns_uri:
 *             ns_utf = _utf8(ns_uri)             # <<<<<<<<<<<<<<
 *         else:
 *             ns_utf = None
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_v_ns_uri)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_v_ns_utf);
    __pyx_v_ns_utf = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":118
 *             ns_utf = _utf8(ns_uri)
 *         else:
 *             ns_utf = None             # <<<<<<<<<<<<<<
 *         try:
 *             return self._namespace_registries[ns_utf]
 */
    __Pyx_INCREF(Py_None);
    __Pyx_DECREF(__pyx_v_ns_utf);
    __pyx_v_ns_utf = Py_None;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":119
 *         else:
 *             ns_utf = None
 *         try:             # <<<<<<<<<<<<<<
 *             return self._namespace_registries[ns_utf]
 *         except KeyError:
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":120
 *             ns_utf = None
 *         try:
 *             return self._namespace_registries[ns_utf]             # <<<<<<<<<<<<<<
 *         except KeyError:
 *             registry = self._namespace_registries[ns_utf] = \
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = __Pyx_PyDict_GetItem(((PyObject *)((struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *)__pyx_v_self)->_namespace_registries), __pyx_v_ns_utf); if (!__pyx_t_2) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L10_try_return;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L13_try_end;
    __pyx_L10_try_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;
    __pyx_L6_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":121
 *         try:
 *             return self._namespace_registries[ns_utf]
 *         except KeyError:             # <<<<<<<<<<<<<<
 *             registry = self._namespace_registries[ns_utf] = \
 *                        _ClassNamespaceRegistry(ns_uri)
 */
    __pyx_t_3 = PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_3) {
      __Pyx_AddTraceback("lxml.etree.ElementNamespaceClassLookup.get_namespace");
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_4, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_5);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":123
 *         except KeyError:
 *             registry = self._namespace_registries[ns_utf] = \
 *                        _ClassNamespaceRegistry(ns_uri)             # <<<<<<<<<<<<<<
 *             return registry
 * 
 */
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
      __Pyx_INCREF(__pyx_v_ns_uri);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_ns_uri);
      __Pyx_GIVEREF(__pyx_v_ns_uri);
      __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ClassNamespaceRegistry)), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_DECREF(((PyObject *)__pyx_v_registry));
      __pyx_v_registry = ((struct __pyx_obj_4lxml_5etree__ClassNamespaceRegistry *)__pyx_t_7);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":122
 *             return self._namespace_registries[ns_utf]
 *         except KeyError:
 *             registry = self._namespace_registries[ns_utf] = \             # <<<<<<<<<<<<<<
 *                        _ClassNamespaceRegistry(ns_uri)
 *             return registry
 */
      if (PyDict_SetItem(((PyObject *)((struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *)__pyx_v_self)->_namespace_registries), __pyx_v_ns_utf, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":124
 *             registry = self._namespace_registries[ns_utf] = \
 *                        _ClassNamespaceRegistry(ns_uri)
 *             return registry             # <<<<<<<<<<<<<<
 * 
 * cdef object _find_nselement_class(state, _Document doc, xmlNode* c_node):
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_registry));
      __pyx_r = ((PyObject *)__pyx_v_registry);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L9_except_return;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L7_exception_handled;
    }
    __pyx_L8_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L9_except_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;
    __pyx_L7_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L13_try_end:;
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree.ElementNamespaceClassLookup.get_namespace");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_ns_utf);
  __Pyx_DECREF((PyObject *)__pyx_v_registry);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":126
 *             return registry
 * 
 * cdef object _find_nselement_class(state, _Document doc, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     cdef python.PyObject* dict_result
 *     cdef ElementNamespaceClassLookup lookup
 */

static  PyObject *__pyx_f_4lxml_5etree__find_nselement_class(PyObject *__pyx_v_state, struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node) {
  PyObject *__pyx_v_dict_result;
  struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *__pyx_v_lookup;
  struct __pyx_obj_4lxml_5etree__NamespaceRegistry *__pyx_v_registry;
  char *__pyx_v_c_namespace_utf;
  PyObject *__pyx_v_classes;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("_find_nselement_class");
  __pyx_v_lookup = ((struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_registry = ((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_classes = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":131
 *     cdef _NamespaceRegistry registry
 *     cdef char* c_namespace_utf
 *     if state is None:             # <<<<<<<<<<<<<<
 *         return _lookupDefaultElementClass(None, doc, c_node)
 * 
 */
  __pyx_t_1 = (__pyx_v_state == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":132
 *     cdef char* c_namespace_utf
 *     if state is None:
 *         return _lookupDefaultElementClass(None, doc, c_node)             # <<<<<<<<<<<<<<
 * 
 *     lookup = <ElementNamespaceClassLookup>state
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __pyx_f_4lxml_5etree__lookupDefaultElementClass(Py_None, __pyx_v_doc, __pyx_v_c_node); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":134
 *         return _lookupDefaultElementClass(None, doc, c_node)
 * 
 *     lookup = <ElementNamespaceClassLookup>state             # <<<<<<<<<<<<<<
 *     if c_node.type != tree.XML_ELEMENT_NODE:
 *         return _callLookupFallback(lookup, doc, c_node)
 */
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *)__pyx_v_state)));
  __Pyx_DECREF(((PyObject *)__pyx_v_lookup));
  __pyx_v_lookup = ((struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *)__pyx_v_state);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":135
 * 
 *     lookup = <ElementNamespaceClassLookup>state
 *     if c_node.type != tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         return _callLookupFallback(lookup, doc, c_node)
 * 
 */
  __pyx_t_1 = (__pyx_v_c_node->type != XML_ELEMENT_NODE);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":136
 *     lookup = <ElementNamespaceClassLookup>state
 *     if c_node.type != tree.XML_ELEMENT_NODE:
 *         return _callLookupFallback(lookup, doc, c_node)             # <<<<<<<<<<<<<<
 * 
 *     c_namespace_utf = _getNs(c_node)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __pyx_f_4lxml_5etree__callLookupFallback(((struct LxmlFallbackElementClassLookup *)__pyx_v_lookup), __pyx_v_doc, __pyx_v_c_node); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":138
 *         return _callLookupFallback(lookup, doc, c_node)
 * 
 *     c_namespace_utf = _getNs(c_node)             # <<<<<<<<<<<<<<
 *     if c_namespace_utf is not NULL:
 *         dict_result = python.PyDict_GetItem(
 */
  __pyx_v_c_namespace_utf = _getNs(__pyx_v_c_node);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":139
 * 
 *     c_namespace_utf = _getNs(c_node)
 *     if c_namespace_utf is not NULL:             # <<<<<<<<<<<<<<
 *         dict_result = python.PyDict_GetItem(
 *             lookup._namespace_registries, c_namespace_utf)
 */
  __pyx_t_1 = (__pyx_v_c_namespace_utf != NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":141
 *     if c_namespace_utf is not NULL:
 *         dict_result = python.PyDict_GetItem(
 *             lookup._namespace_registries, c_namespace_utf)             # <<<<<<<<<<<<<<
 *     else:
 *         dict_result = python.PyDict_GetItem(
 */
    __pyx_t_2 = ((PyObject *)__pyx_v_lookup->_namespace_registries);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = PyBytes_FromString(__pyx_v_c_namespace_utf); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __pyx_v_dict_result = PyDict_GetItem(__pyx_t_2, ((PyObject *)__pyx_t_3));
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":144
 *     else:
 *         dict_result = python.PyDict_GetItem(
 *             lookup._namespace_registries, None)             # <<<<<<<<<<<<<<
 *     if dict_result is not NULL:
 *         registry = <_NamespaceRegistry>dict_result
 */
    __pyx_t_3 = ((PyObject *)__pyx_v_lookup->_namespace_registries);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_v_dict_result = PyDict_GetItem(__pyx_t_3, Py_None);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":145
 *         dict_result = python.PyDict_GetItem(
 *             lookup._namespace_registries, None)
 *     if dict_result is not NULL:             # <<<<<<<<<<<<<<
 *         registry = <_NamespaceRegistry>dict_result
 *         classes = registry._entries
 */
  __pyx_t_1 = (__pyx_v_dict_result != NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":146
 *             lookup._namespace_registries, None)
 *     if dict_result is not NULL:
 *         registry = <_NamespaceRegistry>dict_result             # <<<<<<<<<<<<<<
 *         classes = registry._entries
 * 
 */
    __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_v_dict_result)));
    __Pyx_DECREF(((PyObject *)__pyx_v_registry));
    __pyx_v_registry = ((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_v_dict_result);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":147
 *     if dict_result is not NULL:
 *         registry = <_NamespaceRegistry>dict_result
 *         classes = registry._entries             # <<<<<<<<<<<<<<
 * 
 *         if c_node.name is not NULL:
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_registry->_entries));
    __Pyx_DECREF(((PyObject *)__pyx_v_classes));
    __pyx_v_classes = __pyx_v_registry->_entries;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":149
 *         classes = registry._entries
 * 
 *         if c_node.name is not NULL:             # <<<<<<<<<<<<<<
 *             dict_result = python.PyDict_GetItem(
 *                 classes, c_node.name)
 */
    __pyx_t_1 = (__pyx_v_c_node->name != NULL);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":151
 *         if c_node.name is not NULL:
 *             dict_result = python.PyDict_GetItem(
 *                 classes, c_node.name)             # <<<<<<<<<<<<<<
 *         else:
 *             dict_result = NULL
 */
      __pyx_t_3 = PyBytes_FromString(__pyx_v_c_node->name); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
      __pyx_v_dict_result = PyDict_GetItem(((PyObject *)__pyx_v_classes), ((PyObject *)__pyx_t_3));
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      goto __pyx_L7;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":153
 *                 classes, c_node.name)
 *         else:
 *             dict_result = NULL             # <<<<<<<<<<<<<<
 * 
 *         if dict_result is NULL:
 */
      __pyx_v_dict_result = NULL;
    }
    __pyx_L7:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":155
 *             dict_result = NULL
 * 
 *         if dict_result is NULL:             # <<<<<<<<<<<<<<
 *             dict_result = python.PyDict_GetItem(classes, None)
 * 
 */
    __pyx_t_1 = (__pyx_v_dict_result == NULL);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":156
 * 
 *         if dict_result is NULL:
 *             dict_result = python.PyDict_GetItem(classes, None)             # <<<<<<<<<<<<<<
 * 
 *         if dict_result is not NULL:
 */
      __pyx_v_dict_result = PyDict_GetItem(((PyObject *)__pyx_v_classes), Py_None);
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":158
 *             dict_result = python.PyDict_GetItem(classes, None)
 * 
 *         if dict_result is not NULL:             # <<<<<<<<<<<<<<
 *             return <object>dict_result
 *     return _callLookupFallback(lookup, doc, c_node)
 */
    __pyx_t_1 = (__pyx_v_dict_result != NULL);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":159
 * 
 *         if dict_result is not NULL:
 *             return <object>dict_result             # <<<<<<<<<<<<<<
 *     return _callLookupFallback(lookup, doc, c_node)
 * 
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_dict_result));
      __pyx_r = ((PyObject *)__pyx_v_dict_result);
      goto __pyx_L0;
      goto __pyx_L9;
    }
    __pyx_L9:;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":160
 *         if dict_result is not NULL:
 *             return <object>dict_result
 *     return _callLookupFallback(lookup, doc, c_node)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __pyx_f_4lxml_5etree__callLookupFallback(((struct LxmlFallbackElementClassLookup *)__pyx_v_lookup), __pyx_v_doc, __pyx_v_c_node); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._find_nselement_class");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_lookup);
  __Pyx_DECREF((PyObject *)__pyx_v_registry);
  __Pyx_DECREF(__pyx_v_classes);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":169
 * __FUNCTION_NAMESPACE_REGISTRIES = {}
 * 
 * def FunctionNamespace(ns_uri):             # <<<<<<<<<<<<<<
 *     u"""FunctionNamespace(ns_uri)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_20FunctionNamespace(PyObject *__pyx_self, PyObject *__pyx_v_ns_uri); /*proto*/
static char __pyx_doc_4lxml_5etree_20FunctionNamespace[] = "FunctionNamespace(ns_uri)\n\n    Retrieve the function namespace object associated with the given\n    URI.\n\n    Creates a new one if it does not yet exist. A function namespace\n    can only be used to register extension functions.";
static PyMethodDef __pyx_mdef_4lxml_5etree_20FunctionNamespace = {__Pyx_NAMESTR("FunctionNamespace"), (PyCFunction)__pyx_pf_4lxml_5etree_20FunctionNamespace, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_20FunctionNamespace)};
static PyObject *__pyx_pf_4lxml_5etree_20FunctionNamespace(PyObject *__pyx_self, PyObject *__pyx_v_ns_uri) {
  PyObject *__pyx_v_ns_utf;
  struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *__pyx_v_registry;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("FunctionNamespace");
  __pyx_self = __pyx_self;
  __pyx_v_ns_utf = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_registry = ((struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":177
 *     Creates a new one if it does not yet exist. A function namespace
 *     can only be used to register extension functions."""
 *     if ns_uri:             # <<<<<<<<<<<<<<
 *         ns_utf = _utf8(ns_uri)
 *     else:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_ns_uri); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":178
 *     can only be used to register extension functions."""
 *     if ns_uri:
 *         ns_utf = _utf8(ns_uri)             # <<<<<<<<<<<<<<
 *     else:
 *         ns_utf = None
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_v_ns_uri)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_v_ns_utf);
    __pyx_v_ns_utf = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":180
 *         ns_utf = _utf8(ns_uri)
 *     else:
 *         ns_utf = None             # <<<<<<<<<<<<<<
 *     try:
 *         return __FUNCTION_NAMESPACE_REGISTRIES[ns_utf]
 */
    __Pyx_INCREF(Py_None);
    __Pyx_DECREF(__pyx_v_ns_utf);
    __pyx_v_ns_utf = Py_None;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":181
 *     else:
 *         ns_utf = None
 *     try:             # <<<<<<<<<<<<<<
 *         return __FUNCTION_NAMESPACE_REGISTRIES[ns_utf]
 *     except KeyError:
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":182
 *         ns_utf = None
 *     try:
 *         return __FUNCTION_NAMESPACE_REGISTRIES[ns_utf]             # <<<<<<<<<<<<<<
 *     except KeyError:
 *         registry = __FUNCTION_NAMESPACE_REGISTRIES[ns_utf] = \
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_4lxml_5etree___FUNCTION_NAMESPACE_REGISTRIES), __pyx_v_ns_utf); if (!__pyx_t_2) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L10_try_return;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L13_try_end;
    __pyx_L10_try_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;
    __pyx_L6_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":183
 *     try:
 *         return __FUNCTION_NAMESPACE_REGISTRIES[ns_utf]
 *     except KeyError:             # <<<<<<<<<<<<<<
 *         registry = __FUNCTION_NAMESPACE_REGISTRIES[ns_utf] = \
 *                    _XPathFunctionNamespaceRegistry(ns_uri)
 */
    __pyx_t_3 = PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_3) {
      __Pyx_AddTraceback("lxml.etree.FunctionNamespace");
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_4, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_5);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":185
 *     except KeyError:
 *         registry = __FUNCTION_NAMESPACE_REGISTRIES[ns_utf] = \
 *                    _XPathFunctionNamespaceRegistry(ns_uri)             # <<<<<<<<<<<<<<
 *         return registry
 * 
 */
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
      __Pyx_INCREF(__pyx_v_ns_uri);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_ns_uri);
      __Pyx_GIVEREF(__pyx_v_ns_uri);
      __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__XPathFunctionNamespaceRegistry)), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_DECREF(((PyObject *)__pyx_v_registry));
      __pyx_v_registry = ((struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *)__pyx_t_7);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":184
 *         return __FUNCTION_NAMESPACE_REGISTRIES[ns_utf]
 *     except KeyError:
 *         registry = __FUNCTION_NAMESPACE_REGISTRIES[ns_utf] = \             # <<<<<<<<<<<<<<
 *                    _XPathFunctionNamespaceRegistry(ns_uri)
 *         return registry
 */
      if (PyDict_SetItem(((PyObject *)__pyx_v_4lxml_5etree___FUNCTION_NAMESPACE_REGISTRIES), __pyx_v_ns_utf, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":186
 *         registry = __FUNCTION_NAMESPACE_REGISTRIES[ns_utf] = \
 *                    _XPathFunctionNamespaceRegistry(ns_uri)
 *         return registry             # <<<<<<<<<<<<<<
 * 
 * cdef class _FunctionNamespaceRegistry(_NamespaceRegistry):
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_registry));
      __pyx_r = ((PyObject *)__pyx_v_registry);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L9_except_return;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L7_exception_handled;
    }
    __pyx_L8_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L9_except_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;
    __pyx_L7_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L13_try_end:;
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree.FunctionNamespace");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_ns_utf);
  __Pyx_DECREF((PyObject *)__pyx_v_registry);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":189
 * 
 * cdef class _FunctionNamespaceRegistry(_NamespaceRegistry):
 *     def __setitem__(self, name, item):             # <<<<<<<<<<<<<<
 *         if not callable(item):
 *             raise NamespaceRegistryError, \
 */

static int __pyx_pf_4lxml_5etree_26_FunctionNamespaceRegistry___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_item); /*proto*/
static int __pyx_pf_4lxml_5etree_26_FunctionNamespaceRegistry___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_item) {
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("__setitem__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":190
 * cdef class _FunctionNamespaceRegistry(_NamespaceRegistry):
 *     def __setitem__(self, name, item):
 *         if not callable(item):             # <<<<<<<<<<<<<<
 *             raise NamespaceRegistryError, \
 *                 u"Registered functions must be callable."
 */
  __pyx_t_1 = (!PyCallable_Check(__pyx_v_item));
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":191
 *     def __setitem__(self, name, item):
 *         if not callable(item):
 *             raise NamespaceRegistryError, \             # <<<<<<<<<<<<<<
 *                 u"Registered functions must be callable."
 *         if not name:
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s_150); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, ((PyObject *)__pyx_kp_u_154), 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[10]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":193
 *             raise NamespaceRegistryError, \
 *                 u"Registered functions must be callable."
 *         if not name:             # <<<<<<<<<<<<<<
 *             raise ValueError, \
 *                 u"extensions must have non empty names"
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_name); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = (!__pyx_t_1);
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":194
 *                 u"Registered functions must be callable."
 *         if not name:
 *             raise ValueError, \             # <<<<<<<<<<<<<<
 *                 u"extensions must have non empty names"
 *         self._entries[_utf8(name)] = item
 */
    __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_u_155), 0);
    {__pyx_filename = __pyx_f[10]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":196
 *             raise ValueError, \
 *                 u"extensions must have non empty names"
 *         self._entries[_utf8(name)] = item             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_v_name)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(((PyObject *)((struct __pyx_obj_4lxml_5etree__FunctionNamespaceRegistry *)__pyx_v_self)->__pyx_base._entries), __pyx_t_2, __pyx_v_item) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._FunctionNamespaceRegistry.__setitem__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":198
 *         self._entries[_utf8(name)] = item
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return u"FunctionNamespace(%r)" % self._ns_uri
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_26_FunctionNamespaceRegistry_1__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_26_FunctionNamespaceRegistry_1__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__repr__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":199
 * 
 *     def __repr__(self):
 *         return u"FunctionNamespace(%r)" % self._ns_uri             # <<<<<<<<<<<<<<
 * 
 * cdef class _XPathFunctionNamespaceRegistry(_FunctionNamespaceRegistry):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_156), ((struct __pyx_obj_4lxml_5etree__FunctionNamespaceRegistry *)__pyx_v_self)->__pyx_base._ns_uri); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_r = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._FunctionNamespaceRegistry.__repr__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":207
 *     property prefix:
 *         u"Namespace prefix for extension functions."
 *         def __del__(self):             # <<<<<<<<<<<<<<
 *             self._prefix = None # no prefix configured
 *             self._prefix_utf = None
 */

static int __pyx_pf_4lxml_5etree_31_XPathFunctionNamespaceRegistry_6prefix___del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pf_4lxml_5etree_31_XPathFunctionNamespaceRegistry_6prefix___del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("__del__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":208
 *         u"Namespace prefix for extension functions."
 *         def __del__(self):
 *             self._prefix = None # no prefix configured             # <<<<<<<<<<<<<<
 *             self._prefix_utf = None
 *         def __get__(self):
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *)__pyx_v_self)->_prefix);
  __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *)__pyx_v_self)->_prefix);
  ((struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *)__pyx_v_self)->_prefix = Py_None;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":209
 *         def __del__(self):
 *             self._prefix = None # no prefix configured
 *             self._prefix_utf = None             # <<<<<<<<<<<<<<
 *         def __get__(self):
 *             if self._prefix is None:
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *)__pyx_v_self)->_prefix_utf);
  __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *)__pyx_v_self)->_prefix_utf);
  ((struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *)__pyx_v_self)->_prefix_utf = Py_None;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":210
 *             self._prefix = None # no prefix configured
 *             self._prefix_utf = None
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if self._prefix is None:
 *                 return ''
 */

static PyObject *__pyx_pf_4lxml_5etree_31_XPathFunctionNamespaceRegistry_6prefix_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_31_XPathFunctionNamespaceRegistry_6prefix_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__get__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":211
 *             self._prefix_utf = None
 *         def __get__(self):
 *             if self._prefix is None:             # <<<<<<<<<<<<<<
 *                 return ''
 *             else:
 */
  __pyx_t_1 = (((struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *)__pyx_v_self)->_prefix == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":212
 *         def __get__(self):
 *             if self._prefix is None:
 *                 return ''             # <<<<<<<<<<<<<<
 *             else:
 *                 return self._prefix
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_25));
    __pyx_r = ((PyObject *)__pyx_kp_s_25);
    goto __pyx_L0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":214
 *                 return ''
 *             else:
 *                 return self._prefix             # <<<<<<<<<<<<<<
 *         def __set__(self, prefix):
 *             if prefix == '':
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *)__pyx_v_self)->_prefix);
    __pyx_r = ((struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *)__pyx_v_self)->_prefix;
    goto __pyx_L0;
  }
  __pyx_L5:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":215
 *             else:
 *                 return self._prefix
 *         def __set__(self, prefix):             # <<<<<<<<<<<<<<
 *             if prefix == '':
 *                 prefix = None # empty prefix
 */

static int __pyx_pf_4lxml_5etree_31_XPathFunctionNamespaceRegistry_6prefix_2__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_prefix); /*proto*/
static int __pyx_pf_4lxml_5etree_31_XPathFunctionNamespaceRegistry_6prefix_2__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_prefix) {
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("__set__");
  __Pyx_INCREF(__pyx_v_prefix);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":216
 *                 return self._prefix
 *         def __set__(self, prefix):
 *             if prefix == '':             # <<<<<<<<<<<<<<
 *                 prefix = None # empty prefix
 *             if prefix is None:
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_prefix, ((PyObject *)__pyx_kp_s_25), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":217
 *         def __set__(self, prefix):
 *             if prefix == '':
 *                 prefix = None # empty prefix             # <<<<<<<<<<<<<<
 *             if prefix is None:
 *                 self._prefix_utf = None
 */
    __Pyx_INCREF(Py_None);
    __Pyx_DECREF(__pyx_v_prefix);
    __pyx_v_prefix = Py_None;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":218
 *             if prefix == '':
 *                 prefix = None # empty prefix
 *             if prefix is None:             # <<<<<<<<<<<<<<
 *                 self._prefix_utf = None
 *             else:
 */
  __pyx_t_2 = (__pyx_v_prefix == Py_None);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":219
 *                 prefix = None # empty prefix
 *             if prefix is None:
 *                 self._prefix_utf = None             # <<<<<<<<<<<<<<
 *             else:
 *                 self._prefix_utf = _utf8(prefix)
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *)__pyx_v_self)->_prefix_utf);
    __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *)__pyx_v_self)->_prefix_utf);
    ((struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *)__pyx_v_self)->_prefix_utf = Py_None;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":221
 *                 self._prefix_utf = None
 *             else:
 *                 self._prefix_utf = _utf8(prefix)             # <<<<<<<<<<<<<<
 *             self._prefix = prefix
 * 
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_v_prefix)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *)__pyx_v_self)->_prefix_utf);
    __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *)__pyx_v_self)->_prefix_utf);
    ((struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *)__pyx_v_self)->_prefix_utf = __pyx_t_1;
    __pyx_t_1 = 0;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":222
 *             else:
 *                 self._prefix_utf = _utf8(prefix)
 *             self._prefix = prefix             # <<<<<<<<<<<<<<
 * 
 * cdef list _find_all_extension_prefixes():
 */
  __Pyx_INCREF(__pyx_v_prefix);
  __Pyx_GIVEREF(__pyx_v_prefix);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *)__pyx_v_self)->_prefix);
  __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *)__pyx_v_self)->_prefix);
  ((struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *)__pyx_v_self)->_prefix = __pyx_v_prefix;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._XPathFunctionNamespaceRegistry.prefix.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_prefix);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":224
 *             self._prefix = prefix
 * 
 * cdef list _find_all_extension_prefixes():             # <<<<<<<<<<<<<<
 *     u"Internal lookup function to find all function prefixes for XSLT/XPath."
 *     cdef _XPathFunctionNamespaceRegistry registry
 */

static  PyObject *__pyx_f_4lxml_5etree__find_all_extension_prefixes(void) {
  struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *__pyx_v_registry;
  PyObject *__pyx_v_ns_prefixes = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  void *__pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("_find_all_extension_prefixes");
  __pyx_v_registry = ((struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":227
 *     u"Internal lookup function to find all function prefixes for XSLT/XPath."
 *     cdef _XPathFunctionNamespaceRegistry registry
 *     cdef list ns_prefixes = []             # <<<<<<<<<<<<<<
 *     for registry in __FUNCTION_NAMESPACE_REGISTRIES.itervalues():
 *         if registry._prefix_utf is not None:
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_ns_prefixes = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":228
 *     cdef _XPathFunctionNamespaceRegistry registry
 *     cdef list ns_prefixes = []
 *     for registry in __FUNCTION_NAMESPACE_REGISTRIES.itervalues():             # <<<<<<<<<<<<<<
 *         if registry._prefix_utf is not None:
 *             if registry._ns_uri_utf is not None:
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_4lxml_5etree___FUNCTION_NAMESPACE_REGISTRIES));
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = ((PyObject *)__pyx_v_4lxml_5etree___FUNCTION_NAMESPACE_REGISTRIES);
  __pyx_t_2 = 0;
  while (1) {
    if (!PyDict_Next(__pyx_t_1, (&__pyx_t_2), NULL, ((PyObject **)(&__pyx_t_3)))) break;
    if (!(likely(__Pyx_TypeTest(((PyObject *)__pyx_t_3), __pyx_ptype_4lxml_5etree__XPathFunctionNamespaceRegistry)))) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *)__pyx_t_3)));
    __Pyx_DECREF(((PyObject *)__pyx_v_registry));
    __pyx_v_registry = ((struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *)__pyx_t_3);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":229
 *     cdef list ns_prefixes = []
 *     for registry in __FUNCTION_NAMESPACE_REGISTRIES.itervalues():
 *         if registry._prefix_utf is not None:             # <<<<<<<<<<<<<<
 *             if registry._ns_uri_utf is not None:
 *                 ns_prefixes.append(
 */
    __pyx_t_4 = (__pyx_v_registry->_prefix_utf != Py_None);
    if (__pyx_t_4) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":230
 *     for registry in __FUNCTION_NAMESPACE_REGISTRIES.itervalues():
 *         if registry._prefix_utf is not None:
 *             if registry._ns_uri_utf is not None:             # <<<<<<<<<<<<<<
 *                 ns_prefixes.append(
 *                     (registry._prefix_utf, registry._ns_uri_utf))
 */
      __pyx_t_4 = (__pyx_v_registry->__pyx_base.__pyx_base._ns_uri_utf != Py_None);
      if (__pyx_t_4) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":231
 *         if registry._prefix_utf is not None:
 *             if registry._ns_uri_utf is not None:
 *                 ns_prefixes.append(             # <<<<<<<<<<<<<<
 *                     (registry._prefix_utf, registry._ns_uri_utf))
 *     return ns_prefixes
 */
        if (unlikely(__pyx_v_ns_prefixes == Py_None)) {
          PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[10]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
        }

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":232
 *             if registry._ns_uri_utf is not None:
 *                 ns_prefixes.append(
 *                     (registry._prefix_utf, registry._ns_uri_utf))             # <<<<<<<<<<<<<<
 *     return ns_prefixes
 * 
 */
        __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_5));
        __Pyx_INCREF(__pyx_v_registry->_prefix_utf);
        PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_registry->_prefix_utf);
        __Pyx_GIVEREF(__pyx_v_registry->_prefix_utf);
        __Pyx_INCREF(__pyx_v_registry->__pyx_base.__pyx_base._ns_uri_utf);
        PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_registry->__pyx_base.__pyx_base._ns_uri_utf);
        __Pyx_GIVEREF(__pyx_v_registry->__pyx_base.__pyx_base._ns_uri_utf);
        __pyx_t_6 = PyList_Append(__pyx_v_ns_prefixes, ((PyObject *)__pyx_t_5)); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
        goto __pyx_L6;
      }
      __pyx_L6:;
      goto __pyx_L5;
    }
    __pyx_L5:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":233
 *                 ns_prefixes.append(
 *                     (registry._prefix_utf, registry._ns_uri_utf))
 *     return ns_prefixes             # <<<<<<<<<<<<<<
 * 
 * cdef object _find_extension(ns_uri_utf, name_utf):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_ns_prefixes));
  __pyx_r = __pyx_v_ns_prefixes;
  goto __pyx_L0;

  __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._find_all_extension_prefixes");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_registry);
  __Pyx_XDECREF(__pyx_v_ns_prefixes);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":235
 *     return ns_prefixes
 * 
 * cdef object _find_extension(ns_uri_utf, name_utf):             # <<<<<<<<<<<<<<
 *     cdef python.PyObject* dict_result
 *     dict_result = python.PyDict_GetItem(
 */

static  PyObject *__pyx_f_4lxml_5etree__find_extension(PyObject *__pyx_v_ns_uri_utf, PyObject *__pyx_v_name_utf) {
  PyObject *__pyx_v_dict_result;
  PyObject *__pyx_v_extensions;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_find_extension");
  __pyx_v_extensions = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":238
 *     cdef python.PyObject* dict_result
 *     dict_result = python.PyDict_GetItem(
 *         __FUNCTION_NAMESPACE_REGISTRIES, ns_uri_utf)             # <<<<<<<<<<<<<<
 *     if dict_result is NULL:
 *         return None
 */
  __pyx_v_dict_result = PyDict_GetItem(((PyObject *)__pyx_v_4lxml_5etree___FUNCTION_NAMESPACE_REGISTRIES), __pyx_v_ns_uri_utf);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":239
 *     dict_result = python.PyDict_GetItem(
 *         __FUNCTION_NAMESPACE_REGISTRIES, ns_uri_utf)
 *     if dict_result is NULL:             # <<<<<<<<<<<<<<
 *         return None
 *     extensions = (<_NamespaceRegistry>dict_result)._entries
 */
  __pyx_t_1 = (__pyx_v_dict_result == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":240
 *         __FUNCTION_NAMESPACE_REGISTRIES, ns_uri_utf)
 *     if dict_result is NULL:
 *         return None             # <<<<<<<<<<<<<<
 *     extensions = (<_NamespaceRegistry>dict_result)._entries
 *     dict_result = python.PyDict_GetItem(extensions, name_utf)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":241
 *     if dict_result is NULL:
 *         return None
 *     extensions = (<_NamespaceRegistry>dict_result)._entries             # <<<<<<<<<<<<<<
 *     dict_result = python.PyDict_GetItem(extensions, name_utf)
 *     if dict_result is NULL:
 */
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_v_dict_result)->_entries));
  __Pyx_DECREF(((PyObject *)__pyx_v_extensions));
  __pyx_v_extensions = ((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_v_dict_result)->_entries;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":242
 *         return None
 *     extensions = (<_NamespaceRegistry>dict_result)._entries
 *     dict_result = python.PyDict_GetItem(extensions, name_utf)             # <<<<<<<<<<<<<<
 *     if dict_result is NULL:
 *         return None
 */
  __pyx_v_dict_result = PyDict_GetItem(((PyObject *)__pyx_v_extensions), __pyx_v_name_utf);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":243
 *     extensions = (<_NamespaceRegistry>dict_result)._entries
 *     dict_result = python.PyDict_GetItem(extensions, name_utf)
 *     if dict_result is NULL:             # <<<<<<<<<<<<<<
 *         return None
 *     else:
 */
  __pyx_t_1 = (__pyx_v_dict_result == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":244
 *     dict_result = python.PyDict_GetItem(extensions, name_utf)
 *     if dict_result is NULL:
 *         return None             # <<<<<<<<<<<<<<
 *     else:
 *         return <object>dict_result
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":246
 *         return None
 *     else:
 *         return <object>dict_result             # <<<<<<<<<<<<<<
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_dict_result));
    __pyx_r = ((PyObject *)__pyx_v_dict_result);
    goto __pyx_L0;
  }
  __pyx_L4:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_extensions);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":16
 *     cdef object _file
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._type = PARSER_DATA_INVALID
 * 
 */

static int __pyx_pf_4lxml_5etree_14_InputDocument___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_14_InputDocument___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("__cinit__");
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":17
 * 
 *     def __cinit__(self):
 *         self._type = PARSER_DATA_INVALID             # <<<<<<<<<<<<<<
 * 
 * 
 */
  ((struct __pyx_obj_4lxml_5etree__InputDocument *)__pyx_v_self)->_type = __pyx_e_4lxml_5etree_PARSER_DATA_INVALID;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":22
 * cdef class Resolver:
 *     u"This is the base class of all resolvers."
 *     def resolve(self, system_url, public_id, context):             # <<<<<<<<<<<<<<
 *         u"""resolve(self, system_url, public_id, context)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_8Resolver_resolve(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_8Resolver_resolve[] = "resolve(self, system_url, public_id, context)\n\n        Override this method to resolve an external source by\n        ``system_url`` and ``public_id``.  The third argument is an\n        opaque context object.\n\n        Return the result of one of the ``resolve_*()`` methods.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_8Resolver_resolve(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_system_url = 0;
  PyObject *__pyx_v_public_id = 0;
  PyObject *__pyx_v_context = 0;
  PyObject *__pyx_r = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__system_url,&__pyx_n_s__public_id,&__pyx_n_s__context,0};
  __Pyx_RefNannySetupContext("resolve");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__system_url);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__public_id);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("resolve", 1, 3, 3, 1); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__context);
      if (likely(values[2])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("resolve", 1, 3, 3, 2); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "resolve") < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_system_url = values[0];
    __pyx_v_public_id = values[1];
    __pyx_v_context = values[2];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_system_url = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_public_id = PyTuple_GET_ITEM(__pyx_args, 1);
    __pyx_v_context = PyTuple_GET_ITEM(__pyx_args, 2);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("resolve", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.Resolver.resolve");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":31
 *         Return the result of one of the ``resolve_*()`` methods.
 *         """
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     def resolve_empty(self, context):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_None);
  __pyx_r = Py_None;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":33
 *         return None
 * 
 *     def resolve_empty(self, context):             # <<<<<<<<<<<<<<
 *         u"""resolve_empty(self, context)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_8Resolver_1resolve_empty(PyObject *__pyx_v_self, PyObject *__pyx_v_context); /*proto*/
static char __pyx_doc_4lxml_5etree_8Resolver_1resolve_empty[] = "resolve_empty(self, context)\n\n        Return an empty input document.\n\n        Pass context as parameter.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_8Resolver_1resolve_empty(PyObject *__pyx_v_self, PyObject *__pyx_v_context) {
  struct __pyx_obj_4lxml_5etree__InputDocument *__pyx_v_doc_ref;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("resolve_empty");
  __pyx_v_doc_ref = ((struct __pyx_obj_4lxml_5etree__InputDocument *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":41
 *         """
 *         cdef _InputDocument doc_ref
 *         doc_ref = _InputDocument()             # <<<<<<<<<<<<<<
 *         doc_ref._type = PARSER_DATA_EMPTY
 *         return doc_ref
 */
  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__InputDocument)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_doc_ref));
  __pyx_v_doc_ref = ((struct __pyx_obj_4lxml_5etree__InputDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":42
 *         cdef _InputDocument doc_ref
 *         doc_ref = _InputDocument()
 *         doc_ref._type = PARSER_DATA_EMPTY             # <<<<<<<<<<<<<<
 *         return doc_ref
 * 
 */
  __pyx_v_doc_ref->_type = __pyx_e_4lxml_5etree_PARSER_DATA_EMPTY;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":43
 *         doc_ref = _InputDocument()
 *         doc_ref._type = PARSER_DATA_EMPTY
 *         return doc_ref             # <<<<<<<<<<<<<<
 * 
 *     def resolve_string(self, string, context, *, base_url=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_doc_ref));
  __pyx_r = ((PyObject *)__pyx_v_doc_ref);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.Resolver.resolve_empty");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_doc_ref);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":45
 *         return doc_ref
 * 
 *     def resolve_string(self, string, context, *, base_url=None):             # <<<<<<<<<<<<<<
 *         u"""resolve_string(self, string, context, base_url=None)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_8Resolver_2resolve_string(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_8Resolver_2resolve_string[] = "resolve_string(self, string, context, base_url=None)\n\n        Return a parsable string as input document.\n\n        Pass data string and context as parameters.  You can pass the\n        source URL or filename through the ``base_url`` keyword\n        argument.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_8Resolver_2resolve_string(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_string = 0;
  PyObject *__pyx_v_context = 0;
  PyObject *__pyx_v_base_url = 0;
  struct __pyx_obj_4lxml_5etree__InputDocument *__pyx_v_doc_ref;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__string,&__pyx_n_s__context,&__pyx_n_s__base_url,0};
  __Pyx_RefNannySetupContext("resolve_string");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    values[2] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__string);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__context);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("resolve_string", 1, 2, 2, 1); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    while (kw_args > 0) {
      PyObject* value;
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__base_url);
      if (value) { values[2] = value; if (!(--kw_args)) break; }
      break;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "resolve_string") < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_string = values[0];
    __pyx_v_context = values[1];
    __pyx_v_base_url = values[2];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_string = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_context = PyTuple_GET_ITEM(__pyx_args, 1);
    __pyx_v_base_url = ((PyObject *)Py_None);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("resolve_string", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.Resolver.resolve_string");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF(__pyx_v_string);
  __pyx_v_doc_ref = ((struct __pyx_obj_4lxml_5etree__InputDocument *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":55
 *         """
 *         cdef _InputDocument doc_ref
 *         if python.PyUnicode_Check(string):             # <<<<<<<<<<<<<<
 *             string = python.PyUnicode_AsUTF8String(string)
 *         elif not python.PyBytes_Check(string):
 */
  __pyx_t_1 = PyUnicode_Check(__pyx_v_string);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":56
 *         cdef _InputDocument doc_ref
 *         if python.PyUnicode_Check(string):
 *             string = python.PyUnicode_AsUTF8String(string)             # <<<<<<<<<<<<<<
 *         elif not python.PyBytes_Check(string):
 *             raise TypeError, "argument must be a byte string or unicode string"
 */
    __pyx_t_2 = ((PyObject *)PyUnicode_AsUTF8String(__pyx_v_string)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_v_string);
    __pyx_v_string = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L6;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":57
 *         if python.PyUnicode_Check(string):
 *             string = python.PyUnicode_AsUTF8String(string)
 *         elif not python.PyBytes_Check(string):             # <<<<<<<<<<<<<<
 *             raise TypeError, "argument must be a byte string or unicode string"
 *         doc_ref = _InputDocument()
 */
  __pyx_t_1 = (!PyBytes_Check(__pyx_v_string));
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":58
 *             string = python.PyUnicode_AsUTF8String(string)
 *         elif not python.PyBytes_Check(string):
 *             raise TypeError, "argument must be a byte string or unicode string"             # <<<<<<<<<<<<<<
 *         doc_ref = _InputDocument()
 *         doc_ref._type = PARSER_DATA_STRING
 */
    __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_s_157), 0);
    {__pyx_filename = __pyx_f[11]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":59
 *         elif not python.PyBytes_Check(string):
 *             raise TypeError, "argument must be a byte string or unicode string"
 *         doc_ref = _InputDocument()             # <<<<<<<<<<<<<<
 *         doc_ref._type = PARSER_DATA_STRING
 *         doc_ref._data_bytes = string
 */
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__InputDocument)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_v_doc_ref));
  __pyx_v_doc_ref = ((struct __pyx_obj_4lxml_5etree__InputDocument *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":60
 *             raise TypeError, "argument must be a byte string or unicode string"
 *         doc_ref = _InputDocument()
 *         doc_ref._type = PARSER_DATA_STRING             # <<<<<<<<<<<<<<
 *         doc_ref._data_bytes = string
 *         if base_url is not None:
 */
  __pyx_v_doc_ref->_type = __pyx_e_4lxml_5etree_PARSER_DATA_STRING;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":61
 *         doc_ref = _InputDocument()
 *         doc_ref._type = PARSER_DATA_STRING
 *         doc_ref._data_bytes = string             # <<<<<<<<<<<<<<
 *         if base_url is not None:
 *             doc_ref._filename = _encodeFilename(base_url)
 */
  __Pyx_INCREF(__pyx_v_string);
  __Pyx_GIVEREF(__pyx_v_string);
  __Pyx_GOTREF(__pyx_v_doc_ref->_data_bytes);
  __Pyx_DECREF(__pyx_v_doc_ref->_data_bytes);
  __pyx_v_doc_ref->_data_bytes = __pyx_v_string;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":62
 *         doc_ref._type = PARSER_DATA_STRING
 *         doc_ref._data_bytes = string
 *         if base_url is not None:             # <<<<<<<<<<<<<<
 *             doc_ref._filename = _encodeFilename(base_url)
 *         return doc_ref
 */
  __pyx_t_1 = (__pyx_v_base_url != Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":63
 *         doc_ref._data_bytes = string
 *         if base_url is not None:
 *             doc_ref._filename = _encodeFilename(base_url)             # <<<<<<<<<<<<<<
 *         return doc_ref
 * 
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_base_url); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_GOTREF(__pyx_v_doc_ref->_filename);
    __Pyx_DECREF(__pyx_v_doc_ref->_filename);
    __pyx_v_doc_ref->_filename = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":64
 *         if base_url is not None:
 *             doc_ref._filename = _encodeFilename(base_url)
 *         return doc_ref             # <<<<<<<<<<<<<<
 * 
 *     def resolve_filename(self, filename, context):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_doc_ref));
  __pyx_r = ((PyObject *)__pyx_v_doc_ref);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.Resolver.resolve_string");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_doc_ref);
  __Pyx_DECREF(__pyx_v_string);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":66
 *         return doc_ref
 * 
 *     def resolve_filename(self, filename, context):             # <<<<<<<<<<<<<<
 *         u"""resolve_filename(self, filename, context)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_8Resolver_3resolve_filename(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_8Resolver_3resolve_filename[] = "resolve_filename(self, filename, context)\n\n        Return the name of a parsable file as input document.\n\n        Pass filename and context as parameters.  You can also pass a\n        URL with an HTTP, FTP or file target.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_8Resolver_3resolve_filename(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  PyObject *__pyx_v_context = 0;
  struct __pyx_obj_4lxml_5etree__InputDocument *__pyx_v_doc_ref;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__filename,&__pyx_n_s__context,0};
  __Pyx_RefNannySetupContext("resolve_filename");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__context);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("resolve_filename", 1, 2, 2, 1); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "resolve_filename") < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_filename = values[0];
    __pyx_v_context = values[1];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_filename = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_context = PyTuple_GET_ITEM(__pyx_args, 1);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("resolve_filename", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.Resolver.resolve_filename");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_doc_ref = ((struct __pyx_obj_4lxml_5etree__InputDocument *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":75
 *         """
 *         cdef _InputDocument doc_ref
 *         doc_ref = _InputDocument()             # <<<<<<<<<<<<<<
 *         doc_ref._type = PARSER_DATA_FILENAME
 *         doc_ref._filename = _encodeFilename(filename)
 */
  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__InputDocument)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_doc_ref));
  __pyx_v_doc_ref = ((struct __pyx_obj_4lxml_5etree__InputDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":76
 *         cdef _InputDocument doc_ref
 *         doc_ref = _InputDocument()
 *         doc_ref._type = PARSER_DATA_FILENAME             # <<<<<<<<<<<<<<
 *         doc_ref._filename = _encodeFilename(filename)
 *         return doc_ref
 */
  __pyx_v_doc_ref->_type = __pyx_e_4lxml_5etree_PARSER_DATA_FILENAME;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":77
 *         doc_ref = _InputDocument()
 *         doc_ref._type = PARSER_DATA_FILENAME
 *         doc_ref._filename = _encodeFilename(filename)             # <<<<<<<<<<<<<<
 *         return doc_ref
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_doc_ref->_filename);
  __Pyx_DECREF(__pyx_v_doc_ref->_filename);
  __pyx_v_doc_ref->_filename = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":78
 *         doc_ref._type = PARSER_DATA_FILENAME
 *         doc_ref._filename = _encodeFilename(filename)
 *         return doc_ref             # <<<<<<<<<<<<<<
 * 
 *     def resolve_file(self, f, context, *, base_url=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_doc_ref));
  __pyx_r = ((PyObject *)__pyx_v_doc_ref);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.Resolver.resolve_filename");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_doc_ref);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":80
 *         return doc_ref
 * 
 *     def resolve_file(self, f, context, *, base_url=None):             # <<<<<<<<<<<<<<
 *         u"""resolve_file(self, f, context, base_url=None)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_8Resolver_4resolve_file(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_8Resolver_4resolve_file[] = "resolve_file(self, f, context, base_url=None)\n\n        Return an open file-like object as input document.\n\n        Pass open file and context as parameters.  You can pass the\n        base URL or filename of the file through the ``base_url``\n        keyword argument.\n\n        Note that using ``.resolve_filename()`` is more efficient,\n        especially in threaded environments.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_8Resolver_4resolve_file(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_f = 0;
  PyObject *__pyx_v_context = 0;
  PyObject *__pyx_v_base_url = 0;
  struct __pyx_obj_4lxml_5etree__InputDocument *__pyx_v_doc_ref;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__f,&__pyx_n_s__context,&__pyx_n_s__base_url,0};
  __Pyx_RefNannySetupContext("resolve_file");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    values[2] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__f);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__context);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("resolve_file", 1, 2, 2, 1); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    while (kw_args > 0) {
      PyObject* value;
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__base_url);
      if (value) { values[2] = value; if (!(--kw_args)) break; }
      break;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "resolve_file") < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_f = values[0];
    __pyx_v_context = values[1];
    __pyx_v_base_url = values[2];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_f = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_context = PyTuple_GET_ITEM(__pyx_args, 1);
    __pyx_v_base_url = ((PyObject *)Py_None);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("resolve_file", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.Resolver.resolve_file");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_doc_ref = ((struct __pyx_obj_4lxml_5etree__InputDocument *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":93
 *         """
 *         cdef _InputDocument doc_ref
 *         try:             # <<<<<<<<<<<<<<
 *             f.read
 *         except AttributeError:
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":94
 *         cdef _InputDocument doc_ref
 *         try:
 *             f.read             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             raise TypeError, u"Argument is not a file-like object"
 */
      __pyx_t_1 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__read); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L13_try_end;
    __pyx_L6_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":95
 *         try:
 *             f.read
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             raise TypeError, u"Argument is not a file-like object"
 *         doc_ref = _InputDocument()
 */
    __pyx_t_2 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
    if (__pyx_t_2) {
      __Pyx_AddTraceback("lxml.etree.Resolver.resolve_file");
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_4);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":96
 *             f.read
 *         except AttributeError:
 *             raise TypeError, u"Argument is not a file-like object"             # <<<<<<<<<<<<<<
 *         doc_ref = _InputDocument()
 *         doc_ref._type = PARSER_DATA_FILE
 */
      __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_u_158), 0);
      {__pyx_filename = __pyx_f[11]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L7_exception_handled;
    }
    __pyx_L8_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L7_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L13_try_end:;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":97
 *         except AttributeError:
 *             raise TypeError, u"Argument is not a file-like object"
 *         doc_ref = _InputDocument()             # <<<<<<<<<<<<<<
 *         doc_ref._type = PARSER_DATA_FILE
 *         if base_url is not None:
 */
  __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__InputDocument)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(((PyObject *)__pyx_v_doc_ref));
  __pyx_v_doc_ref = ((struct __pyx_obj_4lxml_5etree__InputDocument *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":98
 *             raise TypeError, u"Argument is not a file-like object"
 *         doc_ref = _InputDocument()
 *         doc_ref._type = PARSER_DATA_FILE             # <<<<<<<<<<<<<<
 *         if base_url is not None:
 *             doc_ref._filename = _encodeFilename(base_url)
 */
  __pyx_v_doc_ref->_type = __pyx_e_4lxml_5etree_PARSER_DATA_FILE;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":99
 *         doc_ref = _InputDocument()
 *         doc_ref._type = PARSER_DATA_FILE
 *         if base_url is not None:             # <<<<<<<<<<<<<<
 *             doc_ref._filename = _encodeFilename(base_url)
 *         else:
 */
  __pyx_t_5 = (__pyx_v_base_url != Py_None);
  if (__pyx_t_5) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":100
 *         doc_ref._type = PARSER_DATA_FILE
 *         if base_url is not None:
 *             doc_ref._filename = _encodeFilename(base_url)             # <<<<<<<<<<<<<<
 *         else:
 *             doc_ref._filename = _getFilenameForFile(f)
 */
    __pyx_t_4 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_base_url); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __Pyx_GOTREF(__pyx_v_doc_ref->_filename);
    __Pyx_DECREF(__pyx_v_doc_ref->_filename);
    __pyx_v_doc_ref->_filename = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L16;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":102
 *             doc_ref._filename = _encodeFilename(base_url)
 *         else:
 *             doc_ref._filename = _getFilenameForFile(f)             # <<<<<<<<<<<<<<
 *         doc_ref._file = f
 *         return doc_ref
 */
    __pyx_t_4 = __pyx_f_4lxml_5etree__getFilenameForFile(__pyx_v_f); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __Pyx_GOTREF(__pyx_v_doc_ref->_filename);
    __Pyx_DECREF(__pyx_v_doc_ref->_filename);
    __pyx_v_doc_ref->_filename = __pyx_t_4;
    __pyx_t_4 = 0;
  }
  __pyx_L16:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":103
 *         else:
 *             doc_ref._filename = _getFilenameForFile(f)
 *         doc_ref._file = f             # <<<<<<<<<<<<<<
 *         return doc_ref
 * 
 */
  __Pyx_INCREF(__pyx_v_f);
  __Pyx_GIVEREF(__pyx_v_f);
  __Pyx_GOTREF(__pyx_v_doc_ref->_file);
  __Pyx_DECREF(__pyx_v_doc_ref->_file);
  __pyx_v_doc_ref->_file = __pyx_v_f;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":104
 *             doc_ref._filename = _getFilenameForFile(f)
 *         doc_ref._file = f
 *         return doc_ref             # <<<<<<<<<<<<<<
 * 
 * cdef class _ResolverRegistry:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_doc_ref));
  __pyx_r = ((PyObject *)__pyx_v_doc_ref);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.Resolver.resolve_file");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_doc_ref);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":109
 *     cdef object _resolvers
 *     cdef Resolver _default_resolver
 *     def __cinit__(self, Resolver default_resolver=None):             # <<<<<<<<<<<<<<
 *         self._resolvers = set()
 *         self._default_resolver = default_resolver
 */

static int __pyx_pf_4lxml_5etree_17_ResolverRegistry___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_17_ResolverRegistry___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_4lxml_5etree_Resolver *__pyx_v_default_resolver = 0;
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__default_resolver,0};
  __Pyx_RefNannySetupContext("__cinit__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[1] = {0};
    values[0] = (PyObject *)((struct __pyx_obj_4lxml_5etree_Resolver *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__default_resolver);
        if (value) { values[0] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_default_resolver = ((struct __pyx_obj_4lxml_5etree_Resolver *)values[0]);
  } else {
    __pyx_v_default_resolver = ((struct __pyx_obj_4lxml_5etree_Resolver *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: __pyx_v_default_resolver = ((struct __pyx_obj_4lxml_5etree_Resolver *)PyTuple_GET_ITEM(__pyx_args, 0));
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._ResolverRegistry.__cinit__");
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_default_resolver), __pyx_ptype_4lxml_5etree_Resolver, 1, "default_resolver", 0))) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":110
 *     cdef Resolver _default_resolver
 *     def __cinit__(self, Resolver default_resolver=None):
 *         self._resolvers = set()             # <<<<<<<<<<<<<<
 *         self._default_resolver = default_resolver
 * 
 */
  __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_v_self)->_resolvers);
  __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_v_self)->_resolvers);
  ((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_v_self)->_resolvers = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":111
 *     def __cinit__(self, Resolver default_resolver=None):
 *         self._resolvers = set()
 *         self._default_resolver = default_resolver             # <<<<<<<<<<<<<<
 * 
 *     def add(self, Resolver resolver not None):
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_default_resolver));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_default_resolver));
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_v_self)->_default_resolver);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_v_self)->_default_resolver));
  ((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_v_self)->_default_resolver = __pyx_v_default_resolver;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ResolverRegistry.__cinit__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":113
 *         self._default_resolver = default_resolver
 * 
 *     def add(self, Resolver resolver not None):             # <<<<<<<<<<<<<<
 *         u"""add(self, resolver)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_17_ResolverRegistry_1add(PyObject *__pyx_v_self, PyObject *__pyx_v_resolver); /*proto*/
static char __pyx_doc_4lxml_5etree_17_ResolverRegistry_1add[] = "add(self, resolver)\n\n        Register a resolver.\n\n        For each requested entity, the 'resolve' method of the resolver will\n        be called and the result will be passed to the parser.  If this method\n        returns None, the request will be delegated to other resolvers or the\n        default resolver.  The resolvers will be tested in an arbitrary order\n        until the first match is found.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_17_ResolverRegistry_1add(PyObject *__pyx_v_self, PyObject *__pyx_v_resolver) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("add");
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_resolver), __pyx_ptype_4lxml_5etree_Resolver, 0, "resolver", 0))) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":124
 *         until the first match is found.
 *         """
 *         self._resolvers.add(resolver)             # <<<<<<<<<<<<<<
 * 
 *     def remove(self, resolver):
 */
  __pyx_t_1 = PyObject_GetAttr(((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_v_self)->_resolvers, __pyx_n_s__add); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(__pyx_v_resolver);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_resolver);
  __Pyx_GIVEREF(__pyx_v_resolver);
  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ResolverRegistry.add");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":126
 *         self._resolvers.add(resolver)
 * 
 *     def remove(self, resolver):             # <<<<<<<<<<<<<<
 *         u"remove(self, resolver)"
 *         self._resolvers.discard(resolver)
 */

static PyObject *__pyx_pf_4lxml_5etree_17_ResolverRegistry_2remove(PyObject *__pyx_v_self, PyObject *__pyx_v_resolver); /*proto*/
static char __pyx_doc_4lxml_5etree_17_ResolverRegistry_2remove[] = "remove(self, resolver)";
static PyObject *__pyx_pf_4lxml_5etree_17_ResolverRegistry_2remove(PyObject *__pyx_v_self, PyObject *__pyx_v_resolver) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("remove");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":128
 *     def remove(self, resolver):
 *         u"remove(self, resolver)"
 *         self._resolvers.discard(resolver)             # <<<<<<<<<<<<<<
 * 
 *     cdef _ResolverRegistry _copy(self):
 */
  __pyx_t_1 = PyObject_GetAttr(((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_v_self)->_resolvers, __pyx_n_s__discard); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(__pyx_v_resolver);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_resolver);
  __Pyx_GIVEREF(__pyx_v_resolver);
  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ResolverRegistry.remove");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":130
 *         self._resolvers.discard(resolver)
 * 
 *     cdef _ResolverRegistry _copy(self):             # <<<<<<<<<<<<<<
 *         cdef _ResolverRegistry registry
 *         registry = _ResolverRegistry(self._default_resolver)
 */

static  struct __pyx_obj_4lxml_5etree__ResolverRegistry *__pyx_f_4lxml_5etree_17_ResolverRegistry__copy(struct __pyx_obj_4lxml_5etree__ResolverRegistry *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree__ResolverRegistry *__pyx_v_registry;
  struct __pyx_obj_4lxml_5etree__ResolverRegistry *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_copy");
  __pyx_v_registry = ((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":132
 *     cdef _ResolverRegistry _copy(self):
 *         cdef _ResolverRegistry registry
 *         registry = _ResolverRegistry(self._default_resolver)             # <<<<<<<<<<<<<<
 *         registry._resolvers = self._resolvers.copy()
 *         return registry
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_default_resolver));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self->_default_resolver));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->_default_resolver));
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ResolverRegistry)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_v_registry));
  __pyx_v_registry = ((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":133
 *         cdef _ResolverRegistry registry
 *         registry = _ResolverRegistry(self._default_resolver)
 *         registry._resolvers = self._resolvers.copy()             # <<<<<<<<<<<<<<
 *         return registry
 * 
 */
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self->_resolvers, __pyx_n_s__copy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_registry->_resolvers);
  __Pyx_DECREF(__pyx_v_registry->_resolvers);
  __pyx_v_registry->_resolvers = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":134
 *         registry = _ResolverRegistry(self._default_resolver)
 *         registry._resolvers = self._resolvers.copy()
 *         return registry             # <<<<<<<<<<<<<<
 * 
 *     def copy(self):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_registry));
  __pyx_r = __pyx_v_registry;
  goto __pyx_L0;

  __pyx_r = ((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ResolverRegistry._copy");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_registry);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":136
 *         return registry
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         u"copy(self)"
 *         return self._copy()
 */

static PyObject *__pyx_pf_4lxml_5etree_17_ResolverRegistry_3copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_17_ResolverRegistry_3copy[] = "copy(self)";
static PyObject *__pyx_pf_4lxml_5etree_17_ResolverRegistry_3copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("copy");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":138
 *     def copy(self):
 *         u"copy(self)"
 *         return self._copy()             # <<<<<<<<<<<<<<
 * 
 *     def resolve(self, system_url, public_id, context):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__ResolverRegistry *)((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_v_self)->__pyx_vtab)->_copy(((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_v_self))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ResolverRegistry.copy");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":140
 *         return self._copy()
 * 
 *     def resolve(self, system_url, public_id, context):             # <<<<<<<<<<<<<<
 *         u"resolve(self, system_url, public_id, context)"
 *         for resolver in self._resolvers:
 */

static PyObject *__pyx_pf_4lxml_5etree_17_ResolverRegistry_4resolve(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_17_ResolverRegistry_4resolve[] = "resolve(self, system_url, public_id, context)";
static PyObject *__pyx_pf_4lxml_5etree_17_ResolverRegistry_4resolve(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_system_url = 0;
  PyObject *__pyx_v_public_id = 0;
  PyObject *__pyx_v_context = 0;
  PyObject *__pyx_v_resolver;
  PyObject *__pyx_v_result;
  PyObject *__pyx_r = NULL;
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__system_url,&__pyx_n_s__public_id,&__pyx_n_s__context,0};
  __Pyx_RefNannySetupContext("resolve");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__system_url);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__public_id);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("resolve", 1, 3, 3, 1); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__context);
      if (likely(values[2])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("resolve", 1, 3, 3, 2); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "resolve") < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_system_url = values[0];
    __pyx_v_public_id = values[1];
    __pyx_v_context = values[2];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_system_url = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_public_id = PyTuple_GET_ITEM(__pyx_args, 1);
    __pyx_v_context = PyTuple_GET_ITEM(__pyx_args, 2);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("resolve", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._ResolverRegistry.resolve");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_resolver = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_result = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":142
 *     def resolve(self, system_url, public_id, context):
 *         u"resolve(self, system_url, public_id, context)"
 *         for resolver in self._resolvers:             # <<<<<<<<<<<<<<
 *             result = resolver.resolve(system_url, public_id, context)
 *             if result is not None:
 */
  if (PyList_CheckExact(((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_v_self)->_resolvers) || PyTuple_CheckExact(((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_v_self)->_resolvers)) {
    __pyx_t_1 = 0; __pyx_t_2 = ((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_v_self)->_resolvers; __Pyx_INCREF(__pyx_t_2);
  } else {
    __pyx_t_1 = -1; __pyx_t_2 = PyObject_GetIter(((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_v_self)->_resolvers); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
  }
  for (;;) {
    if (likely(PyList_CheckExact(__pyx_t_2))) {
      if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++;
    } else if (likely(PyTuple_CheckExact(__pyx_t_2))) {
      if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++;
    } else {
      __pyx_t_3 = PyIter_Next(__pyx_t_2);
      if (!__pyx_t_3) {
        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_DECREF(__pyx_v_resolver);
    __pyx_v_resolver = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":143
 *         u"resolve(self, system_url, public_id, context)"
 *         for resolver in self._resolvers:
 *             result = resolver.resolve(system_url, public_id, context)             # <<<<<<<<<<<<<<
 *             if result is not None:
 *                 return result
 */
    __pyx_t_3 = PyObject_GetAttr(__pyx_v_resolver, __pyx_n_s__resolve); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_INCREF(__pyx_v_system_url);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_system_url);
    __Pyx_GIVEREF(__pyx_v_system_url);
    __Pyx_INCREF(__pyx_v_public_id);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_public_id);
    __Pyx_GIVEREF(__pyx_v_public_id);
    __Pyx_INCREF(__pyx_v_context);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_context);
    __Pyx_GIVEREF(__pyx_v_context);
    __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_v_result);
    __pyx_v_result = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":144
 *         for resolver in self._resolvers:
 *             result = resolver.resolve(system_url, public_id, context)
 *             if result is not None:             # <<<<<<<<<<<<<<
 *                 return result
 *         if self._default_resolver is None:
 */
    __pyx_t_6 = (__pyx_v_result != Py_None);
    if (__pyx_t_6) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":145
 *             result = resolver.resolve(system_url, public_id, context)
 *             if result is not None:
 *                 return result             # <<<<<<<<<<<<<<
 *         if self._default_resolver is None:
 *             return None
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_result);
      __pyx_r = __pyx_v_result;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L0;
      goto __pyx_L8;
    }
    __pyx_L8:;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":146
 *             if result is not None:
 *                 return result
 *         if self._default_resolver is None:             # <<<<<<<<<<<<<<
 *             return None
 *         return self._default_resolver.resolve(system_url, public_id, context)
 */
  __pyx_t_6 = (((PyObject *)((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_v_self)->_default_resolver) == Py_None);
  if (__pyx_t_6) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":147
 *                 return result
 *         if self._default_resolver is None:
 *             return None             # <<<<<<<<<<<<<<
 *         return self._default_resolver.resolve(system_url, public_id, context)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
    goto __pyx_L9;
  }
  __pyx_L9:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":148
 *         if self._default_resolver is None:
 *             return None
 *         return self._default_resolver.resolve(system_url, public_id, context)             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_v_self)->_default_resolver), __pyx_n_s__resolve); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  __Pyx_INCREF(__pyx_v_system_url);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_system_url);
  __Pyx_GIVEREF(__pyx_v_system_url);
  __Pyx_INCREF(__pyx_v_public_id);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_public_id);
  __Pyx_GIVEREF(__pyx_v_public_id);
  __Pyx_INCREF(__pyx_v_context);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_context);
  __Pyx_GIVEREF(__pyx_v_context);
  __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._ResolverRegistry.resolve");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_resolver);
  __Pyx_DECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":150
 *         return self._default_resolver.resolve(system_url, public_id, context)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return repr(self._resolvers)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_17_ResolverRegistry_5__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_17_ResolverRegistry_5__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__repr__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":151
 * 
 *     def __repr__(self):
 *         return repr(self._resolvers)             # <<<<<<<<<<<<<<
 * 
 * cdef class _ResolverContext(_ExceptionContext):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_v_self)->_resolvers;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Repr(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ResolverRegistry.__repr__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":157
 *     cdef _TempStore _storage
 * 
 *     cdef void clear(self):             # <<<<<<<<<<<<<<
 *         _ExceptionContext.clear(self)
 *         self._storage.clear()
 */

static  void __pyx_f_4lxml_5etree_16_ResolverContext_clear(struct __pyx_obj_4lxml_5etree__ResolverContext *__pyx_v_self) {
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("clear");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":158
 * 
 *     cdef void clear(self):
 *         _ExceptionContext.clear(self)             # <<<<<<<<<<<<<<
 *         self._storage.clear()
 * 
 */
  __pyx_vtabptr_4lxml_5etree__ExceptionContext->clear(((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_v_self));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":159
 *     cdef void clear(self):
 *         _ExceptionContext.clear(self)
 *         self._storage.clear()             # <<<<<<<<<<<<<<
 * 
 * cdef _initResolverContext(_ResolverContext context,
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__TempStore *)__pyx_v_self->_storage->__pyx_vtab)->clear(__pyx_v_self->_storage); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("lxml.etree._ResolverContext.clear");
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":161
 *         self._storage.clear()
 * 
 * cdef _initResolverContext(_ResolverContext context,             # <<<<<<<<<<<<<<
 *                           _ResolverRegistry resolvers):
 *     if resolvers is None:
 */

static  PyObject *__pyx_f_4lxml_5etree__initResolverContext(struct __pyx_obj_4lxml_5etree__ResolverContext *__pyx_v_context, struct __pyx_obj_4lxml_5etree__ResolverRegistry *__pyx_v_resolvers) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_initResolverContext");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":163
 * cdef _initResolverContext(_ResolverContext context,
 *                           _ResolverRegistry resolvers):
 *     if resolvers is None:             # <<<<<<<<<<<<<<
 *         context._resolvers = _ResolverRegistry()
 *     else:
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_resolvers) == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":164
 *                           _ResolverRegistry resolvers):
 *     if resolvers is None:
 *         context._resolvers = _ResolverRegistry()             # <<<<<<<<<<<<<<
 *     else:
 *         context._resolvers = resolvers
 */
    __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ResolverRegistry)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_GOTREF(__pyx_v_context->_resolvers);
    __Pyx_DECREF(((PyObject *)__pyx_v_context->_resolvers));
    __pyx_v_context->_resolvers = ((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":166
 *         context._resolvers = _ResolverRegistry()
 *     else:
 *         context._resolvers = resolvers             # <<<<<<<<<<<<<<
 *     context._storage = _TempStore()
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_resolvers));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_resolvers));
    __Pyx_GOTREF(__pyx_v_context->_resolvers);
    __Pyx_DECREF(((PyObject *)__pyx_v_context->_resolvers));
    __pyx_v_context->_resolvers = __pyx_v_resolvers;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/docloader.pxi":167
 *     else:
 *         context._resolvers = resolvers
 *     context._storage = _TempStore()             # <<<<<<<<<<<<<<
 */
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__TempStore)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_context->_storage);
  __Pyx_DECREF(((PyObject *)__pyx_v_context->_storage));
  __pyx_v_context->_storage = ((struct __pyx_obj_4lxml_5etree__TempStore *)__pyx_t_2);
  __pyx_t_2 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._initResolverContext");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":18
 *     For compatibility with ElementTree 1.3 and later.
 *     """
 *     def __init__(self, message, code, line, column):             # <<<<<<<<<<<<<<
 *         if python.PY_VERSION_HEX >= 0x02050000:
 *             # Python >= 2.5 uses new style class exceptions
 */

static PyObject *__pyx_pf_4lxml_5etree_10ParseError___init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_10ParseError___init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pf_4lxml_5etree_10ParseError___init__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pf_4lxml_5etree_10ParseError___init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_message = 0;
  PyObject *__pyx_v_code = 0;
  PyObject *__pyx_v_line = 0;
  PyObject *__pyx_v_column = 0;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__message,&__pyx_n_s__code,&__pyx_n_s__line,&__pyx_n_s__column,0};
  __Pyx_RefNannySetupContext("__init__");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[5] = {0,0,0,0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__message);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__code);
      if (likely(values[2])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 2); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  3:
      values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__line);
      if (likely(values[3])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 3); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  4:
      values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__column);
      if (likely(values[4])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 4); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_self = values[0];
    __pyx_v_message = values[1];
    __pyx_v_code = values[2];
    __pyx_v_line = values[3];
    __pyx_v_column = values[4];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_message = PyTuple_GET_ITEM(__pyx_args, 1);
    __pyx_v_code = PyTuple_GET_ITEM(__pyx_args, 2);
    __pyx_v_line = PyTuple_GET_ITEM(__pyx_args, 3);
    __pyx_v_column = PyTuple_GET_ITEM(__pyx_args, 4);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.ParseError.__init__");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":19
 *     """
 *     def __init__(self, message, code, line, column):
 *         if python.PY_VERSION_HEX >= 0x02050000:             # <<<<<<<<<<<<<<
 *             # Python >= 2.5 uses new style class exceptions
 *             super(_ParseError, self).__init__(message)
 */
  __pyx_t_1 = (PY_VERSION_HEX >= 0x02050000);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":21
 *         if python.PY_VERSION_HEX >= 0x02050000:
 *             # Python >= 2.5 uses new style class exceptions
 *             super(_ParseError, self).__init__(message)             # <<<<<<<<<<<<<<
 *         else:
 *             _LxmlSyntaxError.__init__(self, message)
 */
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __Pyx_INCREF(__pyx_v_4lxml_5etree__ParseError);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_4lxml_5etree__ParseError);
    __Pyx_GIVEREF(__pyx_v_4lxml_5etree__ParseError);
    __Pyx_INCREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    __pyx_t_3 = PyObject_Call(__pyx_builtin_super, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s____init__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_INCREF(__pyx_v_message);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_message);
    __Pyx_GIVEREF(__pyx_v_message);
    __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":23
 *             super(_ParseError, self).__init__(message)
 *         else:
 *             _LxmlSyntaxError.__init__(self, message)             # <<<<<<<<<<<<<<
 *         self.position = (line, column)
 *         self.code = code
 */
    __pyx_t_4 = PyObject_GetAttr(__pyx_v_4lxml_5etree__LxmlSyntaxError, __pyx_n_s____init__); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_INCREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    __Pyx_INCREF(__pyx_v_message);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_message);
    __Pyx_GIVEREF(__pyx_v_message);
    __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":24
 *         else:
 *             _LxmlSyntaxError.__init__(self, message)
 *         self.position = (line, column)             # <<<<<<<<<<<<<<
 *         self.code = code
 * 
 */
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(__pyx_v_line);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_line);
  __Pyx_GIVEREF(__pyx_v_line);
  __Pyx_INCREF(__pyx_v_column);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_column);
  __Pyx_GIVEREF(__pyx_v_column);
  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__position, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":25
 *             _LxmlSyntaxError.__init__(self, message)
 *         self.position = (line, column)
 *         self.code = code             # <<<<<<<<<<<<<<
 * 
 * cdef object _LxmlSyntaxError = LxmlSyntaxError
 */
  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__code, __pyx_v_code) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.ParseError.__init__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":54
 *     cdef list _implied_parser_contexts
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._c_dict = NULL
 *         self._implied_parser_contexts = []
 */

static int __pyx_pf_4lxml_5etree_24_ParserDictionaryContext___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_24_ParserDictionaryContext___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__cinit__");
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":55
 * 
 *     def __cinit__(self):
 *         self._c_dict = NULL             # <<<<<<<<<<<<<<
 *         self._implied_parser_contexts = []
 * 
 */
  ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)__pyx_v_self)->_c_dict = NULL;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":56
 *     def __cinit__(self):
 *         self._c_dict = NULL
 *         self._implied_parser_contexts = []             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)__pyx_v_self)->_implied_parser_contexts);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)__pyx_v_self)->_implied_parser_contexts));
  ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)__pyx_v_self)->_implied_parser_contexts = __pyx_t_1;
  __pyx_t_1 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ParserDictionaryContext.__cinit__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":58
 *         self._implied_parser_contexts = []
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._c_dict is not NULL:
 *             xmlparser.xmlDictFree(self._c_dict)
 */

static void __pyx_pf_4lxml_5etree_24_ParserDictionaryContext_1__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pf_4lxml_5etree_24_ParserDictionaryContext_1__dealloc__(PyObject *__pyx_v_self) {
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__dealloc__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":59
 * 
 *     def __dealloc__(self):
 *         if self._c_dict is not NULL:             # <<<<<<<<<<<<<<
 *             xmlparser.xmlDictFree(self._c_dict)
 * 
 */
  __pyx_t_1 = (((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)__pyx_v_self)->_c_dict != NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":60
 *     def __dealloc__(self):
 *         if self._c_dict is not NULL:
 *             xmlparser.xmlDictFree(self._c_dict)             # <<<<<<<<<<<<<<
 * 
 *     cdef void initMainParserContext(self):
 */
    xmlDictFree(((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)__pyx_v_self)->_c_dict);
    goto __pyx_L5;
  }
  __pyx_L5:;

  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":62
 *             xmlparser.xmlDictFree(self._c_dict)
 * 
 *     cdef void initMainParserContext(self):             # <<<<<<<<<<<<<<
 *         u"""Put the global context into the thread dictionary of the main
 *         thread.  To be called once and only in the main thread."""
 */

static  void __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initMainParserContext(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self) {
  PyObject *__pyx_v_thread_dict;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("initMainParserContext");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":67
 *         cdef python.PyObject* thread_dict
 *         cdef python.PyObject* result
 *         thread_dict = python.PyThreadState_GetDict()             # <<<<<<<<<<<<<<
 *         if thread_dict is not NULL:
 *             (<dict>thread_dict)[u"_ParserDictionaryContext"] = self
 */
  __pyx_v_thread_dict = PyThreadState_GetDict();

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":68
 *         cdef python.PyObject* result
 *         thread_dict = python.PyThreadState_GetDict()
 *         if thread_dict is not NULL:             # <<<<<<<<<<<<<<
 *             (<dict>thread_dict)[u"_ParserDictionaryContext"] = self
 * 
 */
  __pyx_t_1 = (__pyx_v_thread_dict != NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":69
 *         thread_dict = python.PyThreadState_GetDict()
 *         if thread_dict is not NULL:
 *             (<dict>thread_dict)[u"_ParserDictionaryContext"] = self             # <<<<<<<<<<<<<<
 * 
 *     cdef _ParserDictionaryContext _findThreadParserContext(self):
 */
    if (PyDict_SetItem(((PyObject *)__pyx_v_thread_dict), ((PyObject *)__pyx_n_u_160), ((PyObject *)__pyx_v_self)) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("lxml.etree._ParserDictionaryContext.initMainParserContext");
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":71
 *             (<dict>thread_dict)[u"_ParserDictionaryContext"] = self
 * 
 *     cdef _ParserDictionaryContext _findThreadParserContext(self):             # <<<<<<<<<<<<<<
 *         u"Find (or create) the _ParserDictionaryContext object for the current thread"
 *         cdef python.PyObject* thread_dict
 */

static  struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_f_4lxml_5etree_24_ParserDictionaryContext__findThreadParserContext(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self) {
  PyObject *__pyx_v_thread_dict;
  PyObject *__pyx_v_result;
  struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_context;
  PyObject *__pyx_v_d;
  struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_findThreadParserContext");
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_d = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":76
 *         cdef python.PyObject* result
 *         cdef _ParserDictionaryContext context
 *         thread_dict = python.PyThreadState_GetDict()             # <<<<<<<<<<<<<<
 *         if thread_dict is NULL:
 *             return self
 */
  __pyx_v_thread_dict = PyThreadState_GetDict();

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":77
 *         cdef _ParserDictionaryContext context
 *         thread_dict = python.PyThreadState_GetDict()
 *         if thread_dict is NULL:             # <<<<<<<<<<<<<<
 *             return self
 *         d = <dict>thread_dict
 */
  __pyx_t_1 = (__pyx_v_thread_dict == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":78
 *         thread_dict = python.PyThreadState_GetDict()
 *         if thread_dict is NULL:
 *             return self             # <<<<<<<<<<<<<<
 *         d = <dict>thread_dict
 *         result = python.PyDict_GetItem(d, u"_ParserDictionaryContext")
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __pyx_r = __pyx_v_self;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":79
 *         if thread_dict is NULL:
 *             return self
 *         d = <dict>thread_dict             # <<<<<<<<<<<<<<
 *         result = python.PyDict_GetItem(d, u"_ParserDictionaryContext")
 *         if result is not NULL:
 */
  __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_v_thread_dict)));
  __Pyx_DECREF(((PyObject *)__pyx_v_d));
  __pyx_v_d = ((PyObject*)__pyx_v_thread_dict);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":80
 *             return self
 *         d = <dict>thread_dict
 *         result = python.PyDict_GetItem(d, u"_ParserDictionaryContext")             # <<<<<<<<<<<<<<
 *         if result is not NULL:
 *             return <object>result
 */
  __pyx_v_result = PyDict_GetItem(((PyObject *)__pyx_v_d), ((PyObject *)__pyx_n_u_160));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":81
 *         d = <dict>thread_dict
 *         result = python.PyDict_GetItem(d, u"_ParserDictionaryContext")
 *         if result is not NULL:             # <<<<<<<<<<<<<<
 *             return <object>result
 *         context = _ParserDictionaryContext()
 */
  __pyx_t_1 = (__pyx_v_result != NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":82
 *         result = python.PyDict_GetItem(d, u"_ParserDictionaryContext")
 *         if result is not NULL:
 *             return <object>result             # <<<<<<<<<<<<<<
 *         context = _ParserDictionaryContext()
 *         d[u"_ParserDictionaryContext"] = context
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    if (!(likely(((((PyObject *)__pyx_v_result)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_result), __pyx_ptype_4lxml_5etree__ParserDictionaryContext))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_INCREF(((PyObject *)__pyx_v_result));
    __pyx_r = ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)((PyObject *)__pyx_v_result));
    goto __pyx_L0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":83
 *         if result is not NULL:
 *             return <object>result
 *         context = _ParserDictionaryContext()             # <<<<<<<<<<<<<<
 *         d[u"_ParserDictionaryContext"] = context
 *         return context
 */
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ParserDictionaryContext)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_v_context));
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":84
 *             return <object>result
 *         context = _ParserDictionaryContext()
 *         d[u"_ParserDictionaryContext"] = context             # <<<<<<<<<<<<<<
 *         return context
 * 
 */
  if (PyDict_SetItem(((PyObject *)__pyx_v_d), ((PyObject *)__pyx_n_u_160), ((PyObject *)__pyx_v_context)) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":85
 *         context = _ParserDictionaryContext()
 *         d[u"_ParserDictionaryContext"] = context
 *         return context             # <<<<<<<<<<<<<<
 * 
 *     cdef void setDefaultParser(self, _BaseParser parser):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_context));
  __pyx_r = __pyx_v_context;
  goto __pyx_L0;

  __pyx_r = ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ParserDictionaryContext._findThreadParserContext");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_context);
  __Pyx_DECREF(__pyx_v_d);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":87
 *         return context
 * 
 *     cdef void setDefaultParser(self, _BaseParser parser):             # <<<<<<<<<<<<<<
 *         u"Set the default parser for the current thread"
 *         cdef _ParserDictionaryContext context
 */

static  void __pyx_f_4lxml_5etree_24_ParserDictionaryContext_setDefaultParser(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser) {
  struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_context;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setDefaultParser");
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":90
 *         u"Set the default parser for the current thread"
 *         cdef _ParserDictionaryContext context
 *         context = self._findThreadParserContext()             # <<<<<<<<<<<<<<
 *         context._default_parser = parser
 * 
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext *)__pyx_v_self->__pyx_vtab)->_findThreadParserContext(__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_context));
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":91
 *         cdef _ParserDictionaryContext context
 *         context = self._findThreadParserContext()
 *         context._default_parser = parser             # <<<<<<<<<<<<<<
 * 
 *     cdef _BaseParser getDefaultParser(self):
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_parser));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_parser));
  __Pyx_GOTREF(__pyx_v_context->_default_parser);
  __Pyx_DECREF(((PyObject *)__pyx_v_context->_default_parser));
  __pyx_v_context->_default_parser = __pyx_v_parser;

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_WriteUnraisable("lxml.etree._ParserDictionaryContext.setDefaultParser");
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":93
 *         context._default_parser = parser
 * 
 *     cdef _BaseParser getDefaultParser(self):             # <<<<<<<<<<<<<<
 *         u"Return (or create) the default parser of the current thread"
 *         cdef _ParserDictionaryContext context
 */

static  struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_f_4lxml_5etree_24_ParserDictionaryContext_getDefaultParser(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_context;
  struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("getDefaultParser");
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":96
 *         u"Return (or create) the default parser of the current thread"
 *         cdef _ParserDictionaryContext context
 *         context = self._findThreadParserContext()             # <<<<<<<<<<<<<<
 *         if context._default_parser is None:
 *             if self._default_parser is None:
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext *)__pyx_v_self->__pyx_vtab)->_findThreadParserContext(__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_context));
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":97
 *         cdef _ParserDictionaryContext context
 *         context = self._findThreadParserContext()
 *         if context._default_parser is None:             # <<<<<<<<<<<<<<
 *             if self._default_parser is None:
 *                 self._default_parser = __DEFAULT_XML_PARSER._copy()
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_context->_default_parser) == Py_None);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":98
 *         context = self._findThreadParserContext()
 *         if context._default_parser is None:
 *             if self._default_parser is None:             # <<<<<<<<<<<<<<
 *                 self._default_parser = __DEFAULT_XML_PARSER._copy()
 *             if context is not self:
 */
    __pyx_t_2 = (((PyObject *)__pyx_v_self->_default_parser) == Py_None);
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":99
 *         if context._default_parser is None:
 *             if self._default_parser is None:
 *                 self._default_parser = __DEFAULT_XML_PARSER._copy()             # <<<<<<<<<<<<<<
 *             if context is not self:
 *                 context._default_parser = self._default_parser._copy()
 */
      __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree_XMLParser *)__pyx_v_4lxml_5etree___DEFAULT_XML_PARSER->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._copy(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_4lxml_5etree___DEFAULT_XML_PARSER))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_v_self->_default_parser);
      __Pyx_DECREF(((PyObject *)__pyx_v_self->_default_parser));
      __pyx_v_self->_default_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_1);
      __pyx_t_1 = 0;
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":100
 *             if self._default_parser is None:
 *                 self._default_parser = __DEFAULT_XML_PARSER._copy()
 *             if context is not self:             # <<<<<<<<<<<<<<
 *                 context._default_parser = self._default_parser._copy()
 *         return context._default_parser
 */
    __pyx_t_2 = (__pyx_v_context != __pyx_v_self);
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":101
 *                 self._default_parser = __DEFAULT_XML_PARSER._copy()
 *             if context is not self:
 *                 context._default_parser = self._default_parser._copy()             # <<<<<<<<<<<<<<
 *         return context._default_parser
 * 
 */
      __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)__pyx_v_self->_default_parser->__pyx_vtab)->_copy(__pyx_v_self->_default_parser)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_v_context->_default_parser);
      __Pyx_DECREF(((PyObject *)__pyx_v_context->_default_parser));
      __pyx_v_context->_default_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_1);
      __pyx_t_1 = 0;
      goto __pyx_L5;
    }
    __pyx_L5:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":102
 *             if context is not self:
 *                 context._default_parser = self._default_parser._copy()
 *         return context._default_parser             # <<<<<<<<<<<<<<
 * 
 *     cdef tree.xmlDict* _getThreadDict(self, tree.xmlDict* default):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_context->_default_parser));
  __pyx_r = __pyx_v_context->_default_parser;
  goto __pyx_L0;

  __pyx_r = ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ParserDictionaryContext.getDefaultParser");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_context);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":104
 *         return context._default_parser
 * 
 *     cdef tree.xmlDict* _getThreadDict(self, tree.xmlDict* default):             # <<<<<<<<<<<<<<
 *         u"Return the thread-local dict or create a new one if necessary."
 *         cdef _ParserDictionaryContext context
 */

static  xmlDict *__pyx_f_4lxml_5etree_24_ParserDictionaryContext__getThreadDict(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self, xmlDict *__pyx_v_default) {
  struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_context;
  xmlDict *__pyx_r;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("_getThreadDict");
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":107
 *         u"Return the thread-local dict or create a new one if necessary."
 *         cdef _ParserDictionaryContext context
 *         context = self._findThreadParserContext()             # <<<<<<<<<<<<<<
 *         if context._c_dict is NULL:
 *             # thread dict not yet set up => use default or create a new one
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext *)__pyx_v_self->__pyx_vtab)->_findThreadParserContext(__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_context));
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":108
 *         cdef _ParserDictionaryContext context
 *         context = self._findThreadParserContext()
 *         if context._c_dict is NULL:             # <<<<<<<<<<<<<<
 *             # thread dict not yet set up => use default or create a new one
 *             if default is not NULL:
 */
  __pyx_t_2 = (__pyx_v_context->_c_dict == NULL);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":110
 *         if context._c_dict is NULL:
 *             # thread dict not yet set up => use default or create a new one
 *             if default is not NULL:             # <<<<<<<<<<<<<<
 *                 context._c_dict = default
 *                 xmlparser.xmlDictReference(default)
 */
    __pyx_t_2 = (__pyx_v_default != NULL);
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":111
 *             # thread dict not yet set up => use default or create a new one
 *             if default is not NULL:
 *                 context._c_dict = default             # <<<<<<<<<<<<<<
 *                 xmlparser.xmlDictReference(default)
 *                 return default
 */
      __pyx_v_context->_c_dict = __pyx_v_default;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":112
 *             if default is not NULL:
 *                 context._c_dict = default
 *                 xmlparser.xmlDictReference(default)             # <<<<<<<<<<<<<<
 *                 return default
 *             if self._c_dict is NULL:
 */
      xmlDictReference(__pyx_v_default);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":113
 *                 context._c_dict = default
 *                 xmlparser.xmlDictReference(default)
 *                 return default             # <<<<<<<<<<<<<<
 *             if self._c_dict is NULL:
 *                 self._c_dict = xmlparser.xmlDictCreate()
 */
      __pyx_r = __pyx_v_default;
      goto __pyx_L0;
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":114
 *                 xmlparser.xmlDictReference(default)
 *                 return default
 *             if self._c_dict is NULL:             # <<<<<<<<<<<<<<
 *                 self._c_dict = xmlparser.xmlDictCreate()
 *             if context is not self:
 */
    __pyx_t_2 = (__pyx_v_self->_c_dict == NULL);
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":115
 *                 return default
 *             if self._c_dict is NULL:
 *                 self._c_dict = xmlparser.xmlDictCreate()             # <<<<<<<<<<<<<<
 *             if context is not self:
 *                 context._c_dict = xmlparser.xmlDictCreateSub(self._c_dict)
 */
      __pyx_v_self->_c_dict = xmlDictCreate();
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":116
 *             if self._c_dict is NULL:
 *                 self._c_dict = xmlparser.xmlDictCreate()
 *             if context is not self:             # <<<<<<<<<<<<<<
 *                 context._c_dict = xmlparser.xmlDictCreateSub(self._c_dict)
 *         return context._c_dict
 */
    __pyx_t_2 = (__pyx_v_context != __pyx_v_self);
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":117
 *                 self._c_dict = xmlparser.xmlDictCreate()
 *             if context is not self:
 *                 context._c_dict = xmlparser.xmlDictCreateSub(self._c_dict)             # <<<<<<<<<<<<<<
 *         return context._c_dict
 * 
 */
      __pyx_v_context->_c_dict = xmlDictCreateSub(__pyx_v_self->_c_dict);
      goto __pyx_L6;
    }
    __pyx_L6:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":118
 *             if context is not self:
 *                 context._c_dict = xmlparser.xmlDictCreateSub(self._c_dict)
 *         return context._c_dict             # <<<<<<<<<<<<<<
 * 
 *     cdef void initThreadDictRef(self, tree.xmlDict** c_dict_ref):
 */
  __pyx_r = __pyx_v_context->_c_dict;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_WriteUnraisable("lxml.etree._ParserDictionaryContext._getThreadDict");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":120
 *         return context._c_dict
 * 
 *     cdef void initThreadDictRef(self, tree.xmlDict** c_dict_ref):             # <<<<<<<<<<<<<<
 *         cdef tree.xmlDict* c_dict
 *         cdef tree.xmlDict* c_thread_dict
 */

static  void __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initThreadDictRef(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self, xmlDict **__pyx_v_c_dict_ref) {
  xmlDict *__pyx_v_c_dict;
  xmlDict *__pyx_v_c_thread_dict;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("initThreadDictRef");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":123
 *         cdef tree.xmlDict* c_dict
 *         cdef tree.xmlDict* c_thread_dict
 *         c_dict = c_dict_ref[0]             # <<<<<<<<<<<<<<
 *         c_thread_dict = self._getThreadDict(c_dict)
 *         if c_dict is c_thread_dict:
 */
  __pyx_v_c_dict = (__pyx_v_c_dict_ref[0]);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":124
 *         cdef tree.xmlDict* c_thread_dict
 *         c_dict = c_dict_ref[0]
 *         c_thread_dict = self._getThreadDict(c_dict)             # <<<<<<<<<<<<<<
 *         if c_dict is c_thread_dict:
 *             return
 */
  __pyx_v_c_thread_dict = ((struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext *)__pyx_v_self->__pyx_vtab)->_getThreadDict(__pyx_v_self, __pyx_v_c_dict);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":125
 *         c_dict = c_dict_ref[0]
 *         c_thread_dict = self._getThreadDict(c_dict)
 *         if c_dict is c_thread_dict:             # <<<<<<<<<<<<<<
 *             return
 *         if c_dict is not NULL:
 */
  __pyx_t_1 = (__pyx_v_c_dict == __pyx_v_c_thread_dict);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":126
 *         c_thread_dict = self._getThreadDict(c_dict)
 *         if c_dict is c_thread_dict:
 *             return             # <<<<<<<<<<<<<<
 *         if c_dict is not NULL:
 *             xmlparser.xmlDictFree(c_dict)
 */
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":127
 *         if c_dict is c_thread_dict:
 *             return
 *         if c_dict is not NULL:             # <<<<<<<<<<<<<<
 *             xmlparser.xmlDictFree(c_dict)
 *         c_dict_ref[0] = c_thread_dict
 */
  __pyx_t_1 = (__pyx_v_c_dict != NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":128
 *             return
 *         if c_dict is not NULL:
 *             xmlparser.xmlDictFree(c_dict)             # <<<<<<<<<<<<<<
 *         c_dict_ref[0] = c_thread_dict
 *         xmlparser.xmlDictReference(c_thread_dict)
 */
    xmlDictFree(__pyx_v_c_dict);
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":129
 *         if c_dict is not NULL:
 *             xmlparser.xmlDictFree(c_dict)
 *         c_dict_ref[0] = c_thread_dict             # <<<<<<<<<<<<<<
 *         xmlparser.xmlDictReference(c_thread_dict)
 * 
 */
  (__pyx_v_c_dict_ref[0]) = __pyx_v_c_thread_dict;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":130
 *             xmlparser.xmlDictFree(c_dict)
 *         c_dict_ref[0] = c_thread_dict
 *         xmlparser.xmlDictReference(c_thread_dict)             # <<<<<<<<<<<<<<
 * 
 *     cdef void initParserDict(self, xmlparser.xmlParserCtxt* pctxt):
 */
  xmlDictReference(__pyx_v_c_thread_dict);

  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":132
 *         xmlparser.xmlDictReference(c_thread_dict)
 * 
 *     cdef void initParserDict(self, xmlparser.xmlParserCtxt* pctxt):             # <<<<<<<<<<<<<<
 *         u"Assure we always use the same string dictionary."
 *         self.initThreadDictRef(&pctxt.dict)
 */

static  void __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initParserDict(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self, xmlParserCtxt *__pyx_v_pctxt) {
  __Pyx_RefNannySetupContext("initParserDict");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":134
 *     cdef void initParserDict(self, xmlparser.xmlParserCtxt* pctxt):
 *         u"Assure we always use the same string dictionary."
 *         self.initThreadDictRef(&pctxt.dict)             # <<<<<<<<<<<<<<
 * 
 *     cdef void initXPathParserDict(self, xpath.xmlXPathContext* pctxt):
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext *)__pyx_v_self->__pyx_vtab)->initThreadDictRef(__pyx_v_self, (&__pyx_v_pctxt->dict));

  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":136
 *         self.initThreadDictRef(&pctxt.dict)
 * 
 *     cdef void initXPathParserDict(self, xpath.xmlXPathContext* pctxt):             # <<<<<<<<<<<<<<
 *         u"Assure we always use the same string dictionary."
 *         self.initThreadDictRef(&pctxt.dict)
 */

static  void __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initXPathParserDict(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self, xmlXPathContext *__pyx_v_pctxt) {
  __Pyx_RefNannySetupContext("initXPathParserDict");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":138
 *     cdef void initXPathParserDict(self, xpath.xmlXPathContext* pctxt):
 *         u"Assure we always use the same string dictionary."
 *         self.initThreadDictRef(&pctxt.dict)             # <<<<<<<<<<<<<<
 * 
 *     cdef void initDocDict(self, xmlDoc* result):
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext *)__pyx_v_self->__pyx_vtab)->initThreadDictRef(__pyx_v_self, (&__pyx_v_pctxt->dict));

  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":140
 *         self.initThreadDictRef(&pctxt.dict)
 * 
 *     cdef void initDocDict(self, xmlDoc* result):             # <<<<<<<<<<<<<<
 *         u"Store dict of last object parsed if no shared dict yet"
 *         # XXX We also free the result dict here if there already was one.
 */

static  void __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initDocDict(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self, xmlDoc *__pyx_v_result) {
  __Pyx_RefNannySetupContext("initDocDict");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":145
 *         # This case should only occur for new documents with empty dicts,
 *         # otherwise we'd free data that's in use => segfault
 *         self.initThreadDictRef(&result.dict)             # <<<<<<<<<<<<<<
 * 
 *     cdef _ParserContext findImpliedContext(self):
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext *)__pyx_v_self->__pyx_vtab)->initThreadDictRef(__pyx_v_self, (&__pyx_v_result->dict));

  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":147
 *         self.initThreadDictRef(&result.dict)
 * 
 *     cdef _ParserContext findImpliedContext(self):             # <<<<<<<<<<<<<<
 *         u"""Return any current implied xml parser context for the current
 *         thread.  This is used when the resolver functions are called
 */

static  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_f_4lxml_5etree_24_ParserDictionaryContext_findImpliedContext(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_context;
  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_implied_context;
  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  __Pyx_RefNannySetupContext("findImpliedContext");
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_implied_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":157
 * 
 *         # see if we have a current implied parser
 *         context = self._findThreadParserContext()             # <<<<<<<<<<<<<<
 *         if python.PyList_GET_SIZE(context._implied_parser_contexts):
 *             implied_context = context._implied_parser_contexts[-1]
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext *)__pyx_v_self->__pyx_vtab)->_findThreadParserContext(__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_context));
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":158
 *         # see if we have a current implied parser
 *         context = self._findThreadParserContext()
 *         if python.PyList_GET_SIZE(context._implied_parser_contexts):             # <<<<<<<<<<<<<<
 *             implied_context = context._implied_parser_contexts[-1]
 *             return implied_context
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_context->_implied_parser_contexts);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = PyList_GET_SIZE(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":159
 *         context = self._findThreadParserContext()
 *         if python.PyList_GET_SIZE(context._implied_parser_contexts):
 *             implied_context = context._implied_parser_contexts[-1]             # <<<<<<<<<<<<<<
 *             return implied_context
 *         return None
 */
    __pyx_t_1 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_context->_implied_parser_contexts), -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__ParserContext))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_v_implied_context));
    __pyx_v_implied_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":160
 *         if python.PyList_GET_SIZE(context._implied_parser_contexts):
 *             implied_context = context._implied_parser_contexts[-1]
 *             return implied_context             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __Pyx_INCREF(((PyObject *)__pyx_v_implied_context));
    __pyx_r = __pyx_v_implied_context;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":161
 *             implied_context = context._implied_parser_contexts[-1]
 *             return implied_context
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     cdef void pushImpliedContextFromParser(self, _BaseParser parser):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(Py_None);
  __pyx_r = ((struct __pyx_obj_4lxml_5etree__ParserContext *)Py_None);
  goto __pyx_L0;

  __pyx_r = ((struct __pyx_obj_4lxml_5etree__ParserContext *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ParserDictionaryContext.findImpliedContext");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_context);
  __Pyx_DECREF((PyObject *)__pyx_v_implied_context);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":163
 *         return None
 * 
 *     cdef void pushImpliedContextFromParser(self, _BaseParser parser):             # <<<<<<<<<<<<<<
 *         u"Push a new implied context object taken from the parser."
 *         if parser is not None:
 */

static  void __pyx_f_4lxml_5etree_24_ParserDictionaryContext_pushImpliedContextFromParser(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser) {
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("pushImpliedContextFromParser");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":165
 *     cdef void pushImpliedContextFromParser(self, _BaseParser parser):
 *         u"Push a new implied context object taken from the parser."
 *         if parser is not None:             # <<<<<<<<<<<<<<
 *             self.pushImpliedContext(parser._getParserContext())
 *         else:
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_parser) != Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":166
 *         u"Push a new implied context object taken from the parser."
 *         if parser is not None:
 *             self.pushImpliedContext(parser._getParserContext())             # <<<<<<<<<<<<<<
 *         else:
 *             self.pushImpliedContext(None)
 */
    __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)__pyx_v_parser->__pyx_vtab)->_getParserContext(__pyx_v_parser)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    ((struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext *)__pyx_v_self->__pyx_vtab)->pushImpliedContext(__pyx_v_self, ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_2));
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":168
 *             self.pushImpliedContext(parser._getParserContext())
 *         else:
 *             self.pushImpliedContext(None)             # <<<<<<<<<<<<<<
 * 
 *     cdef void pushImpliedContext(self, _ParserContext parser_context):
 */
    ((struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext *)__pyx_v_self->__pyx_vtab)->pushImpliedContext(__pyx_v_self, ((struct __pyx_obj_4lxml_5etree__ParserContext *)Py_None));
  }
  __pyx_L3:;

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_WriteUnraisable("lxml.etree._ParserDictionaryContext.pushImpliedContextFromParser");
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":170
 *             self.pushImpliedContext(None)
 * 
 *     cdef void pushImpliedContext(self, _ParserContext parser_context):             # <<<<<<<<<<<<<<
 *         u"Push a new implied context object."
 *         cdef _ParserDictionaryContext context
 */

static  void __pyx_f_4lxml_5etree_24_ParserDictionaryContext_pushImpliedContext(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self, struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_parser_context) {
  struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_context;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("pushImpliedContext");
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":173
 *         u"Push a new implied context object."
 *         cdef _ParserDictionaryContext context
 *         context = self._findThreadParserContext()             # <<<<<<<<<<<<<<
 *         context._implied_parser_contexts.append(parser_context)
 * 
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext *)__pyx_v_self->__pyx_vtab)->_findThreadParserContext(__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_context));
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":174
 *         cdef _ParserDictionaryContext context
 *         context = self._findThreadParserContext()
 *         context._implied_parser_contexts.append(parser_context)             # <<<<<<<<<<<<<<
 * 
 *     cdef void popImpliedContext(self):
 */
  if (unlikely(__pyx_v_context->_implied_parser_contexts == Py_None)) {
    PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_2 = PyList_Append(__pyx_v_context->_implied_parser_contexts, ((PyObject *)__pyx_v_parser_context)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_WriteUnraisable("lxml.etree._ParserDictionaryContext.pushImpliedContext");
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":176
 *         context._implied_parser_contexts.append(parser_context)
 * 
 *     cdef void popImpliedContext(self):             # <<<<<<<<<<<<<<
 *         u"Pop the current implied context object."
 *         cdef _ParserDictionaryContext context
 */

static  void __pyx_f_4lxml_5etree_24_ParserDictionaryContext_popImpliedContext(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_context;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("popImpliedContext");
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":179
 *         u"Pop the current implied context object."
 *         cdef _ParserDictionaryContext context
 *         context = self._findThreadParserContext()             # <<<<<<<<<<<<<<
 *         context._implied_parser_contexts.pop()
 * 
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext *)__pyx_v_self->__pyx_vtab)->_findThreadParserContext(__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_context));
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":180
 *         cdef _ParserDictionaryContext context
 *         context = self._findThreadParserContext()
 *         context._implied_parser_contexts.pop()             # <<<<<<<<<<<<<<
 * 
 * cdef _ParserDictionaryContext __GLOBAL_PARSER_CONTEXT
 */
  __pyx_t_1 = __Pyx_PyObject_Pop(((PyObject *)__pyx_v_context->_implied_parser_contexts)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_WriteUnraisable("lxml.etree._ParserDictionaryContext.popImpliedContext");
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":186
 * __GLOBAL_PARSER_CONTEXT.initMainParserContext()
 * 
 * cdef int _checkThreadDict(tree.xmlDict* c_dict):             # <<<<<<<<<<<<<<
 *     u"""Check that c_dict is either the local thread dictionary or the global
 *     parent dictionary.
 */

static  int __pyx_f_4lxml_5etree__checkThreadDict(xmlDict *__pyx_v_c_dict) {
  int __pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_checkThreadDict");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":192
 *     #if __GLOBAL_PARSER_CONTEXT._c_dict is c_dict:
 *     #    return 1 # main thread
 *     if __GLOBAL_PARSER_CONTEXT._getThreadDict(NULL) is c_dict:             # <<<<<<<<<<<<<<
 *         return 1 # local thread dict
 *     return 0
 */
  __pyx_t_1 = (((struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext *)__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT->__pyx_vtab)->_getThreadDict(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, NULL) == __pyx_v_c_dict);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":193
 *     #    return 1 # main thread
 *     if __GLOBAL_PARSER_CONTEXT._getThreadDict(NULL) is c_dict:
 *         return 1 # local thread dict             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    __pyx_r = 1;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":194
 *     if __GLOBAL_PARSER_CONTEXT._getThreadDict(NULL) is c_dict:
 *         return 1 # local thread dict
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * ############################################################
 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":203
 * cdef char* _UNICODE_ENCODING = NULL
 * 
 * cdef void _setupPythonUnicode():             # <<<<<<<<<<<<<<
 *     u"""Sets _UNICODE_ENCODING to the internal encoding name of Python unicode
 *     strings if libxml2 supports reading native Python unicode.  This depends
 */

static  void __pyx_f_4lxml_5etree__setupPythonUnicode(void) {
  xmlCharEncodingHandler *__pyx_v_enchandler;
  Py_ssize_t __pyx_v_l;
  char *__pyx_v_buffer;
  char *__pyx_v_enc;
  PyObject *__pyx_v_utext;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  __Pyx_RefNannySetupContext("_setupPythonUnicode");
  __pyx_v_utext = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":213
 *     cdef char* buffer
 *     cdef char* enc
 *     utext = python.PyUnicode_DecodeUTF8("<test/>", 7, NULL)             # <<<<<<<<<<<<<<
 *     l = python.PyUnicode_GET_DATA_SIZE(utext)
 *     buffer = python.PyUnicode_AS_DATA(utext)
 */
  __pyx_t_1 = ((PyObject *)PyUnicode_DecodeUTF8(__pyx_k_162, 7, NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_utext));
  __pyx_v_utext = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":214
 *     cdef char* enc
 *     utext = python.PyUnicode_DecodeUTF8("<test/>", 7, NULL)
 *     l = python.PyUnicode_GET_DATA_SIZE(utext)             # <<<<<<<<<<<<<<
 *     buffer = python.PyUnicode_AS_DATA(utext)
 *     enc = _findEncodingName(buffer, l)
 */
  __pyx_v_l = PyUnicode_GET_DATA_SIZE(((PyObject *)__pyx_v_utext));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":215
 *     utext = python.PyUnicode_DecodeUTF8("<test/>", 7, NULL)
 *     l = python.PyUnicode_GET_DATA_SIZE(utext)
 *     buffer = python.PyUnicode_AS_DATA(utext)             # <<<<<<<<<<<<<<
 *     enc = _findEncodingName(buffer, l)
 *     if enc == NULL:
 */
  __pyx_v_buffer = PyUnicode_AS_DATA(((PyObject *)__pyx_v_utext));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":216
 *     l = python.PyUnicode_GET_DATA_SIZE(utext)
 *     buffer = python.PyUnicode_AS_DATA(utext)
 *     enc = _findEncodingName(buffer, l)             # <<<<<<<<<<<<<<
 *     if enc == NULL:
 *         # apparently, libxml2 can't detect UTF-16 on some systems
 */
  __pyx_v_enc = __pyx_f_4lxml_5etree__findEncodingName(__pyx_v_buffer, __pyx_v_l);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":217
 *     buffer = python.PyUnicode_AS_DATA(utext)
 *     enc = _findEncodingName(buffer, l)
 *     if enc == NULL:             # <<<<<<<<<<<<<<
 *         # apparently, libxml2 can't detect UTF-16 on some systems
 *         if l >= 4 and \
 */
  __pyx_t_2 = (__pyx_v_enc == NULL);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":219
 *     if enc == NULL:
 *         # apparently, libxml2 can't detect UTF-16 on some systems
 *         if l >= 4 and \             # <<<<<<<<<<<<<<
 *                buffer[0] == c'<' and buffer[1] == c'\0' and \
 *                buffer[2] == c't' and buffer[3] == c'\0':
 */
    __pyx_t_2 = (__pyx_v_l >= 4);
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":220
 *         # apparently, libxml2 can't detect UTF-16 on some systems
 *         if l >= 4 and \
 *                buffer[0] == c'<' and buffer[1] == c'\0' and \             # <<<<<<<<<<<<<<
 *                buffer[2] == c't' and buffer[3] == c'\0':
 *             enc = "UTF-16LE"
 */
      __pyx_t_3 = ((__pyx_v_buffer[0]) == '<');
      if (__pyx_t_3) {
        __pyx_t_4 = ((__pyx_v_buffer[1]) == '\x00');
        if (__pyx_t_4) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":221
 *         if l >= 4 and \
 *                buffer[0] == c'<' and buffer[1] == c'\0' and \
 *                buffer[2] == c't' and buffer[3] == c'\0':             # <<<<<<<<<<<<<<
 *             enc = "UTF-16LE"
 *         elif l >= 4 and \
 */
          __pyx_t_5 = ((__pyx_v_buffer[2]) == 't');
          if (__pyx_t_5) {
            __pyx_t_6 = ((__pyx_v_buffer[3]) == '\x00');
            __pyx_t_7 = __pyx_t_6;
          } else {
            __pyx_t_7 = __pyx_t_5;
          }
          __pyx_t_5 = __pyx_t_7;
        } else {
          __pyx_t_5 = __pyx_t_4;
        }
        __pyx_t_4 = __pyx_t_5;
      } else {
        __pyx_t_4 = __pyx_t_3;
      }
      __pyx_t_3 = __pyx_t_4;
    } else {
      __pyx_t_3 = __pyx_t_2;
    }
    if (__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":222
 *                buffer[0] == c'<' and buffer[1] == c'\0' and \
 *                buffer[2] == c't' and buffer[3] == c'\0':
 *             enc = "UTF-16LE"             # <<<<<<<<<<<<<<
 *         elif l >= 4 and \
 *                buffer[0] == c'\0' and buffer[1] == c'<' and \
 */
      __pyx_v_enc = __pyx_k_163;
      goto __pyx_L4;
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":223
 *                buffer[2] == c't' and buffer[3] == c'\0':
 *             enc = "UTF-16LE"
 *         elif l >= 4 and \             # <<<<<<<<<<<<<<
 *                buffer[0] == c'\0' and buffer[1] == c'<' and \
 *                buffer[2] == c'\0' and buffer[3] == c't':
 */
    __pyx_t_3 = (__pyx_v_l >= 4);
    if (__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":224
 *             enc = "UTF-16LE"
 *         elif l >= 4 and \
 *                buffer[0] == c'\0' and buffer[1] == c'<' and \             # <<<<<<<<<<<<<<
 *                buffer[2] == c'\0' and buffer[3] == c't':
 *             enc = "UTF-16BE"
 */
      __pyx_t_2 = ((__pyx_v_buffer[0]) == '\x00');
      if (__pyx_t_2) {
        __pyx_t_4 = ((__pyx_v_buffer[1]) == '<');
        if (__pyx_t_4) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":225
 *         elif l >= 4 and \
 *                buffer[0] == c'\0' and buffer[1] == c'<' and \
 *                buffer[2] == c'\0' and buffer[3] == c't':             # <<<<<<<<<<<<<<
 *             enc = "UTF-16BE"
 *         else:
 */
          __pyx_t_5 = ((__pyx_v_buffer[2]) == '\x00');
          if (__pyx_t_5) {
            __pyx_t_7 = ((__pyx_v_buffer[3]) == 't');
            __pyx_t_6 = __pyx_t_7;
          } else {
            __pyx_t_6 = __pyx_t_5;
          }
          __pyx_t_5 = __pyx_t_6;
        } else {
          __pyx_t_5 = __pyx_t_4;
        }
        __pyx_t_4 = __pyx_t_5;
      } else {
        __pyx_t_4 = __pyx_t_2;
      }
      __pyx_t_2 = __pyx_t_4;
    } else {
      __pyx_t_2 = __pyx_t_3;
    }
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":226
 *                buffer[0] == c'\0' and buffer[1] == c'<' and \
 *                buffer[2] == c'\0' and buffer[3] == c't':
 *             enc = "UTF-16BE"             # <<<<<<<<<<<<<<
 *         else:
 *             # not my fault, it's YOUR broken system :)
 */
      __pyx_v_enc = __pyx_k_164;
      goto __pyx_L4;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":229
 *         else:
 *             # not my fault, it's YOUR broken system :)
 *             return             # <<<<<<<<<<<<<<
 *     enchandler = tree.xmlFindCharEncodingHandler(enc)
 *     if enchandler is not NULL:
 */
      goto __pyx_L0;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":230
 *             # not my fault, it's YOUR broken system :)
 *             return
 *     enchandler = tree.xmlFindCharEncodingHandler(enc)             # <<<<<<<<<<<<<<
 *     if enchandler is not NULL:
 *         global _UNICODE_ENCODING
 */
  __pyx_v_enchandler = xmlFindCharEncodingHandler(__pyx_v_enc);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":231
 *             return
 *     enchandler = tree.xmlFindCharEncodingHandler(enc)
 *     if enchandler is not NULL:             # <<<<<<<<<<<<<<
 *         global _UNICODE_ENCODING
 *         tree.xmlCharEncCloseFunc(enchandler)
 */
  __pyx_t_2 = (__pyx_v_enchandler != NULL);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":233
 *     if enchandler is not NULL:
 *         global _UNICODE_ENCODING
 *         tree.xmlCharEncCloseFunc(enchandler)             # <<<<<<<<<<<<<<
 *         _UNICODE_ENCODING = enc
 * 
 */
    xmlCharEncCloseFunc(__pyx_v_enchandler);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":234
 *         global _UNICODE_ENCODING
 *         tree.xmlCharEncCloseFunc(enchandler)
 *         _UNICODE_ENCODING = enc             # <<<<<<<<<<<<<<
 * 
 * cdef char* _findEncodingName(char* buffer, int size):
 */
    __pyx_v_4lxml_5etree__UNICODE_ENCODING = __pyx_v_enc;
    goto __pyx_L5;
  }
  __pyx_L5:;

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_WriteUnraisable("lxml.etree._setupPythonUnicode");
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_utext);
  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":236
 *         _UNICODE_ENCODING = enc
 * 
 * cdef char* _findEncodingName(char* buffer, int size):             # <<<<<<<<<<<<<<
 *     u"Work around bug in libxml2: find iconv name of encoding on our own."
 *     cdef tree.xmlCharEncoding enc
 */

static  char *__pyx_f_4lxml_5etree__findEncodingName(char *__pyx_v_buffer, int __pyx_v_size) {
  xmlCharEncoding __pyx_v_enc;
  char *__pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_findEncodingName");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":239
 *     u"Work around bug in libxml2: find iconv name of encoding on our own."
 *     cdef tree.xmlCharEncoding enc
 *     enc = tree.xmlDetectCharEncoding(buffer, size)             # <<<<<<<<<<<<<<
 *     if enc == tree.XML_CHAR_ENCODING_UTF16LE:
 *         return "UTF-16LE"
 */
  __pyx_v_enc = xmlDetectCharEncoding(__pyx_v_buffer, __pyx_v_size);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":240
 *     cdef tree.xmlCharEncoding enc
 *     enc = tree.xmlDetectCharEncoding(buffer, size)
 *     if enc == tree.XML_CHAR_ENCODING_UTF16LE:             # <<<<<<<<<<<<<<
 *         return "UTF-16LE"
 *     elif enc == tree.XML_CHAR_ENCODING_UTF16BE:
 */
  __pyx_t_1 = (__pyx_v_enc == XML_CHAR_ENCODING_UTF16LE);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":241
 *     enc = tree.xmlDetectCharEncoding(buffer, size)
 *     if enc == tree.XML_CHAR_ENCODING_UTF16LE:
 *         return "UTF-16LE"             # <<<<<<<<<<<<<<
 *     elif enc == tree.XML_CHAR_ENCODING_UTF16BE:
 *         return "UTF-16BE"
 */
    __pyx_r = __pyx_k_163;
    goto __pyx_L0;
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":242
 *     if enc == tree.XML_CHAR_ENCODING_UTF16LE:
 *         return "UTF-16LE"
 *     elif enc == tree.XML_CHAR_ENCODING_UTF16BE:             # <<<<<<<<<<<<<<
 *         return "UTF-16BE"
 *     elif enc == tree.XML_CHAR_ENCODING_UCS4LE:
 */
  __pyx_t_1 = (__pyx_v_enc == XML_CHAR_ENCODING_UTF16BE);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":243
 *         return "UTF-16LE"
 *     elif enc == tree.XML_CHAR_ENCODING_UTF16BE:
 *         return "UTF-16BE"             # <<<<<<<<<<<<<<
 *     elif enc == tree.XML_CHAR_ENCODING_UCS4LE:
 *         return "UCS-4LE"
 */
    __pyx_r = __pyx_k_164;
    goto __pyx_L0;
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":244
 *     elif enc == tree.XML_CHAR_ENCODING_UTF16BE:
 *         return "UTF-16BE"
 *     elif enc == tree.XML_CHAR_ENCODING_UCS4LE:             # <<<<<<<<<<<<<<
 *         return "UCS-4LE"
 *     elif enc == tree.XML_CHAR_ENCODING_UCS4BE:
 */
  __pyx_t_1 = (__pyx_v_enc == XML_CHAR_ENCODING_UCS4LE);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":245
 *         return "UTF-16BE"
 *     elif enc == tree.XML_CHAR_ENCODING_UCS4LE:
 *         return "UCS-4LE"             # <<<<<<<<<<<<<<
 *     elif enc == tree.XML_CHAR_ENCODING_UCS4BE:
 *         return "UCS-4BE"
 */
    __pyx_r = __pyx_k_165;
    goto __pyx_L0;
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":246
 *     elif enc == tree.XML_CHAR_ENCODING_UCS4LE:
 *         return "UCS-4LE"
 *     elif enc == tree.XML_CHAR_ENCODING_UCS4BE:             # <<<<<<<<<<<<<<
 *         return "UCS-4BE"
 *     elif enc == tree.XML_CHAR_ENCODING_NONE:
 */
  __pyx_t_1 = (__pyx_v_enc == XML_CHAR_ENCODING_UCS4BE);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":247
 *         return "UCS-4LE"
 *     elif enc == tree.XML_CHAR_ENCODING_UCS4BE:
 *         return "UCS-4BE"             # <<<<<<<<<<<<<<
 *     elif enc == tree.XML_CHAR_ENCODING_NONE:
 *         return NULL
 */
    __pyx_r = __pyx_k_166;
    goto __pyx_L0;
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":248
 *     elif enc == tree.XML_CHAR_ENCODING_UCS4BE:
 *         return "UCS-4BE"
 *     elif enc == tree.XML_CHAR_ENCODING_NONE:             # <<<<<<<<<<<<<<
 *         return NULL
 *     else:
 */
  __pyx_t_1 = (__pyx_v_enc == XML_CHAR_ENCODING_NONE);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":249
 *         return "UCS-4BE"
 *     elif enc == tree.XML_CHAR_ENCODING_NONE:
 *         return NULL             # <<<<<<<<<<<<<<
 *     else:
 *         # returns a constant char*, no need to free it
 */
    __pyx_r = NULL;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":252
 *     else:
 *         # returns a constant char*, no need to free it
 *         return tree.xmlGetCharEncodingName(enc)             # <<<<<<<<<<<<<<
 * 
 * _setupPythonUnicode()
 */
    __pyx_r = xmlGetCharEncodingName(__pyx_v_enc);
    goto __pyx_L0;
  }
  __pyx_L3:;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":269
 *     cdef char* _c_url
 * 
 *     def __cinit__(self, filelike, exc_context, url, encoding):             # <<<<<<<<<<<<<<
 *         self._exc_context = exc_context
 *         self._filelike = filelike
 */

static int __pyx_pf_4lxml_5etree_18_FileReaderContext___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_18_FileReaderContext___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filelike = 0;
  PyObject *__pyx_v_exc_context = 0;
  PyObject *__pyx_v_url = 0;
  PyObject *__pyx_v_encoding = 0;
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__filelike,&__pyx_n_s__exc_context,&__pyx_n_s__url,&__pyx_n_s__encoding,0};
  __Pyx_RefNannySetupContext("__cinit__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[4] = {0,0,0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filelike);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__exc_context);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__url);
      if (likely(values[2])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, 2); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  3:
      values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__encoding);
      if (likely(values[3])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, 3); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_filelike = values[0];
    __pyx_v_exc_context = values[1];
    __pyx_v_url = values[2];
    __pyx_v_encoding = values[3];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_filelike = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_exc_context = PyTuple_GET_ITEM(__pyx_args, 1);
    __pyx_v_url = PyTuple_GET_ITEM(__pyx_args, 2);
    __pyx_v_encoding = PyTuple_GET_ITEM(__pyx_args, 3);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._FileReaderContext.__cinit__");
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF(__pyx_v_url);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":270
 * 
 *     def __cinit__(self, filelike, exc_context, url, encoding):
 *         self._exc_context = exc_context             # <<<<<<<<<<<<<<
 *         self._filelike = filelike
 *         self._encoding = encoding
 */
  if (!(likely(((__pyx_v_exc_context) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_exc_context, __pyx_ptype_4lxml_5etree__ExceptionContext))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_exc_context);
  __Pyx_GIVEREF(__pyx_v_exc_context);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__FileReaderContext *)__pyx_v_self)->_exc_context);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__FileReaderContext *)__pyx_v_self)->_exc_context));
  ((struct __pyx_obj_4lxml_5etree__FileReaderContext *)__pyx_v_self)->_exc_context = ((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_v_exc_context);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":271
 *     def __cinit__(self, filelike, exc_context, url, encoding):
 *         self._exc_context = exc_context
 *         self._filelike = filelike             # <<<<<<<<<<<<<<
 *         self._encoding = encoding
 *         if url is None:
 */
  __Pyx_INCREF(__pyx_v_filelike);
  __Pyx_GIVEREF(__pyx_v_filelike);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__FileReaderContext *)__pyx_v_self)->_filelike);
  __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree__FileReaderContext *)__pyx_v_self)->_filelike);
  ((struct __pyx_obj_4lxml_5etree__FileReaderContext *)__pyx_v_self)->_filelike = __pyx_v_filelike;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":272
 *         self._exc_context = exc_context
 *         self._filelike = filelike
 *         self._encoding = encoding             # <<<<<<<<<<<<<<
 *         if url is None:
 *             self._c_url = NULL
 */
  __Pyx_INCREF(__pyx_v_encoding);
  __Pyx_GIVEREF(__pyx_v_encoding);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__FileReaderContext *)__pyx_v_self)->_encoding);
  __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree__FileReaderContext *)__pyx_v_self)->_encoding);
  ((struct __pyx_obj_4lxml_5etree__FileReaderContext *)__pyx_v_self)->_encoding = __pyx_v_encoding;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":273
 *         self._filelike = filelike
 *         self._encoding = encoding
 *         if url is None:             # <<<<<<<<<<<<<<
 *             self._c_url = NULL
 *         else:
 */
  __pyx_t_1 = (__pyx_v_url == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":274
 *         self._encoding = encoding
 *         if url is None:
 *             self._c_url = NULL             # <<<<<<<<<<<<<<
 *         else:
 *             url = _encodeFilename(url)
 */
    ((struct __pyx_obj_4lxml_5etree__FileReaderContext *)__pyx_v_self)->_c_url = NULL;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":276
 *             self._c_url = NULL
 *         else:
 *             url = _encodeFilename(url)             # <<<<<<<<<<<<<<
 *             self._c_url = _cstr(url)
 *         self._url = url
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_url); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_v_url);
    __pyx_v_url = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":277
 *         else:
 *             url = _encodeFilename(url)
 *             self._c_url = _cstr(url)             # <<<<<<<<<<<<<<
 *         self._url = url
 *         self._bytes  = b''
 */
    ((struct __pyx_obj_4lxml_5etree__FileReaderContext *)__pyx_v_self)->_c_url = PyBytes_AS_STRING(__pyx_v_url);
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":278
 *             url = _encodeFilename(url)
 *             self._c_url = _cstr(url)
 *         self._url = url             # <<<<<<<<<<<<<<
 *         self._bytes  = b''
 *         self._bytes_read = 0
 */
  __Pyx_INCREF(__pyx_v_url);
  __Pyx_GIVEREF(__pyx_v_url);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__FileReaderContext *)__pyx_v_self)->_url);
  __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree__FileReaderContext *)__pyx_v_self)->_url);
  ((struct __pyx_obj_4lxml_5etree__FileReaderContext *)__pyx_v_self)->_url = __pyx_v_url;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":279
 *             self._c_url = _cstr(url)
 *         self._url = url
 *         self._bytes  = b''             # <<<<<<<<<<<<<<
 *         self._bytes_read = 0
 * 
 */
  __Pyx_INCREF(((PyObject *)__pyx_kp_b_25));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_b_25));
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__FileReaderContext *)__pyx_v_self)->_bytes);
  __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree__FileReaderContext *)__pyx_v_self)->_bytes);
  ((struct __pyx_obj_4lxml_5etree__FileReaderContext *)__pyx_v_self)->_bytes = ((PyObject *)__pyx_kp_b_25);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":280
 *         self._url = url
 *         self._bytes  = b''
 *         self._bytes_read = 0             # <<<<<<<<<<<<<<
 * 
 *     cdef _close_file(self):
 */
  ((struct __pyx_obj_4lxml_5etree__FileReaderContext *)__pyx_v_self)->_bytes_read = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._FileReaderContext.__cinit__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_url);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":282
 *         self._bytes_read = 0
 * 
 *     cdef _close_file(self):             # <<<<<<<<<<<<<<
 *         if self._filelike is None:
 *             return
 */

static  PyObject *__pyx_f_4lxml_5etree_18_FileReaderContext__close_file(struct __pyx_obj_4lxml_5etree__FileReaderContext *__pyx_v_self) {
  PyObject *__pyx_v_close;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("_close_file");
  __pyx_v_close = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":283
 * 
 *     cdef _close_file(self):
 *         if self._filelike is None:             # <<<<<<<<<<<<<<
 *             return
 *         try:
 */
  __pyx_t_1 = (__pyx_v_self->_filelike == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":284
 *     cdef _close_file(self):
 *         if self._filelike is None:
 *             return             # <<<<<<<<<<<<<<
 *         try:
 *             close = self._filelike.close
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":285
 *         if self._filelike is None:
 *             return
 *         try:             # <<<<<<<<<<<<<<
 *             close = self._filelike.close
 *         except AttributeError:
 */
  /*try:*/ {
    {
      PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
      __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
      __Pyx_XGOTREF(__pyx_save_exc_type);
      __Pyx_XGOTREF(__pyx_save_exc_value);
      __Pyx_XGOTREF(__pyx_save_exc_tb);
      /*try:*/ {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":286
 *             return
 *         try:
 *             close = self._filelike.close             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             close = None
 */
        __pyx_t_2 = PyObject_GetAttr(__pyx_v_self->_filelike, __pyx_n_s__close); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_v_close);
        __pyx_v_close = __pyx_t_2;
        __pyx_t_2 = 0;
      }
      __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
      __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
      __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
      goto __pyx_L14_try_end;
      __pyx_L7_error:;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":287
 *         try:
 *             close = self._filelike.close
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             close = None
 *         finally:
 */
      __pyx_t_3 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
      if (__pyx_t_3) {
        __Pyx_AddTraceback("lxml.etree._FileReaderContext._close_file");
        if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_4, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GOTREF(__pyx_t_5);

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":288
 *             close = self._filelike.close
 *         except AttributeError:
 *             close = None             # <<<<<<<<<<<<<<
 *         finally:
 *             self._filelike = None
 */
        __Pyx_INCREF(Py_None);
        __Pyx_DECREF(__pyx_v_close);
        __pyx_v_close = Py_None;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        goto __pyx_L8_exception_handled;
      }
      __pyx_L9_except_error:;
      __Pyx_XGIVEREF(__pyx_save_exc_type);
      __Pyx_XGIVEREF(__pyx_save_exc_value);
      __Pyx_XGIVEREF(__pyx_save_exc_tb);
      __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
      goto __pyx_L5;
      __pyx_L8_exception_handled:;
      __Pyx_XGIVEREF(__pyx_save_exc_type);
      __Pyx_XGIVEREF(__pyx_save_exc_value);
      __Pyx_XGIVEREF(__pyx_save_exc_tb);
      __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
      __pyx_L14_try_end:;
    }
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":290
 *             close = None
 *         finally:
 *             self._filelike = None             # <<<<<<<<<<<<<<
 *         if close is not None:
 *             close()
 */
  /*finally:*/ {
    int __pyx_why;
    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
    int __pyx_exc_lineno;
    __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 0; goto __pyx_L6;
    __pyx_L5: {
      __pyx_why = 4;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
      __pyx_exc_lineno = __pyx_lineno;
      goto __pyx_L6;
    }
    __pyx_L6:;
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_self->_filelike);
    __Pyx_DECREF(__pyx_v_self->_filelike);
    __pyx_v_self->_filelike = Py_None;
    switch (__pyx_why) {
      case 4: {
        __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
        __pyx_lineno = __pyx_exc_lineno;
        __pyx_exc_type = 0;
        __pyx_exc_value = 0;
        __pyx_exc_tb = 0;
        goto __pyx_L1_error;
      }
    }
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":291
 *         finally:
 *             self._filelike = None
 *         if close is not None:             # <<<<<<<<<<<<<<
 *             close()
 * 
 */
  __pyx_t_1 = (__pyx_v_close != Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":292
 *             self._filelike = None
 *         if close is not None:
 *             close()             # <<<<<<<<<<<<<<
 * 
 *     cdef xmlparser.xmlParserInputBuffer* _createParserInputBuffer(self):
 */
    __pyx_t_5 = PyObject_Call(__pyx_v_close, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L18;
  }
  __pyx_L18:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._FileReaderContext._close_file");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_close);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":294
 *             close()
 * 
 *     cdef xmlparser.xmlParserInputBuffer* _createParserInputBuffer(self):             # <<<<<<<<<<<<<<
 *         cdef cstd.FILE* c_stream
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer
 */

static  xmlParserInputBuffer *__pyx_f_4lxml_5etree_18_FileReaderContext__createParserInputBuffer(struct __pyx_obj_4lxml_5etree__FileReaderContext *__pyx_v_self) {
  FILE *__pyx_v_c_stream;
  xmlParserInputBuffer *__pyx_v_c_buffer;
  xmlParserInputBuffer *__pyx_r;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("_createParserInputBuffer");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":297
 *         cdef cstd.FILE* c_stream
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer
 *         c_buffer = xmlparser.xmlAllocParserInputBuffer(0)             # <<<<<<<<<<<<<<
 *         c_stream = python.PyFile_AsFile(self._filelike)
 *         if c_stream is NULL:
 */
  __pyx_v_c_buffer = xmlAllocParserInputBuffer(0);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":298
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer
 *         c_buffer = xmlparser.xmlAllocParserInputBuffer(0)
 *         c_stream = python.PyFile_AsFile(self._filelike)             # <<<<<<<<<<<<<<
 *         if c_stream is NULL:
 *             c_buffer.readcallback  = _readFilelikeParser
 */
  __pyx_t_1 = __pyx_v_self->_filelike;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_c_stream = PyFile_AsFile(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":299
 *         c_buffer = xmlparser.xmlAllocParserInputBuffer(0)
 *         c_stream = python.PyFile_AsFile(self._filelike)
 *         if c_stream is NULL:             # <<<<<<<<<<<<<<
 *             c_buffer.readcallback  = _readFilelikeParser
 *             c_buffer.context = <python.PyObject*>self
 */
  __pyx_t_2 = (__pyx_v_c_stream == NULL);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":300
 *         c_stream = python.PyFile_AsFile(self._filelike)
 *         if c_stream is NULL:
 *             c_buffer.readcallback  = _readFilelikeParser             # <<<<<<<<<<<<<<
 *             c_buffer.context = <python.PyObject*>self
 *         else:
 */
    __pyx_v_c_buffer->readcallback = __pyx_f_4lxml_5etree__readFilelikeParser;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":301
 *         if c_stream is NULL:
 *             c_buffer.readcallback  = _readFilelikeParser
 *             c_buffer.context = <python.PyObject*>self             # <<<<<<<<<<<<<<
 *         else:
 *             c_buffer.readcallback  = _readFileParser
 */
    __pyx_v_c_buffer->context = ((PyObject *)__pyx_v_self);
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":303
 *             c_buffer.context = <python.PyObject*>self
 *         else:
 *             c_buffer.readcallback  = _readFileParser             # <<<<<<<<<<<<<<
 *             c_buffer.context = c_stream
 *         return c_buffer
 */
    __pyx_v_c_buffer->readcallback = __pyx_f_4lxml_5etree__readFileParser;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":304
 *         else:
 *             c_buffer.readcallback  = _readFileParser
 *             c_buffer.context = c_stream             # <<<<<<<<<<<<<<
 *         return c_buffer
 * 
 */
    __pyx_v_c_buffer->context = __pyx_v_c_stream;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":305
 *             c_buffer.readcallback  = _readFileParser
 *             c_buffer.context = c_stream
 *         return c_buffer             # <<<<<<<<<<<<<<
 * 
 *     cdef xmlparser.xmlParserInput* _createParserInput(
 */
  __pyx_r = __pyx_v_c_buffer;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":307
 *         return c_buffer
 * 
 *     cdef xmlparser.xmlParserInput* _createParserInput(             # <<<<<<<<<<<<<<
 *             self, xmlparser.xmlParserCtxt* ctxt):
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer
 */

static  xmlParserInput *__pyx_f_4lxml_5etree_18_FileReaderContext__createParserInput(struct __pyx_obj_4lxml_5etree__FileReaderContext *__pyx_v_self, xmlParserCtxt *__pyx_v_ctxt) {
  xmlParserInputBuffer *__pyx_v_c_buffer;
  xmlParserInput *__pyx_r;
  __Pyx_RefNannySetupContext("_createParserInput");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":310
 *             self, xmlparser.xmlParserCtxt* ctxt):
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer
 *         c_buffer = self._createParserInputBuffer()             # <<<<<<<<<<<<<<
 *         return xmlparser.xmlNewIOInputStream(ctxt, c_buffer, 0)
 * 
 */
  __pyx_v_c_buffer = ((struct __pyx_vtabstruct_4lxml_5etree__FileReaderContext *)__pyx_v_self->__pyx_vtab)->_createParserInputBuffer(__pyx_v_self);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":311
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer
 *         c_buffer = self._createParserInputBuffer()
 *         return xmlparser.xmlNewIOInputStream(ctxt, c_buffer, 0)             # <<<<<<<<<<<<<<
 * 
 *     cdef tree.xmlDtd* _readDtd(self):
 */
  __pyx_r = xmlNewIOInputStream(__pyx_v_ctxt, __pyx_v_c_buffer, 0);
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":313
 *         return xmlparser.xmlNewIOInputStream(ctxt, c_buffer, 0)
 * 
 *     cdef tree.xmlDtd* _readDtd(self):             # <<<<<<<<<<<<<<
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer
 *         c_buffer = self._createParserInputBuffer()
 */

static  xmlDtd *__pyx_f_4lxml_5etree_18_FileReaderContext__readDtd(struct __pyx_obj_4lxml_5etree__FileReaderContext *__pyx_v_self) {
  xmlParserInputBuffer *__pyx_v_c_buffer;
  xmlDtd *__pyx_r;
  __Pyx_RefNannySetupContext("_readDtd");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":315
 *     cdef tree.xmlDtd* _readDtd(self):
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer
 *         c_buffer = self._createParserInputBuffer()             # <<<<<<<<<<<<<<
 *         with nogil:
 *             return xmlparser.xmlIOParseDTD(NULL, c_buffer, 0)
 */
  __pyx_v_c_buffer = ((struct __pyx_vtabstruct_4lxml_5etree__FileReaderContext *)__pyx_v_self->__pyx_vtab)->_createParserInputBuffer(__pyx_v_self);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":316
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer
 *         c_buffer = self._createParserInputBuffer()
 *         with nogil:             # <<<<<<<<<<<<<<
 *             return xmlparser.xmlIOParseDTD(NULL, c_buffer, 0)
 * 
 */
  {
    #ifdef WITH_THREAD
    PyThreadState *_save;
    #endif
    Py_UNBLOCK_THREADS
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":317
 *         c_buffer = self._createParserInputBuffer()
 *         with nogil:
 *             return xmlparser.xmlIOParseDTD(NULL, c_buffer, 0)             # <<<<<<<<<<<<<<
 * 
 *     cdef xmlDoc* _readDoc(self, xmlparser.xmlParserCtxt* ctxt, int options):
 */
      __pyx_r = xmlIOParseDTD(NULL, __pyx_v_c_buffer, 0);
      goto __pyx_L3;
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":316
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer
 *         c_buffer = self._createParserInputBuffer()
 *         with nogil:             # <<<<<<<<<<<<<<
 *             return xmlparser.xmlIOParseDTD(NULL, c_buffer, 0)
 * 
 */
    /*finally:*/ {
      int __pyx_why;
      __pyx_why = 0; goto __pyx_L5;
      __pyx_L3: __pyx_why = 3; goto __pyx_L5;
      __pyx_L5:;
      Py_BLOCK_THREADS
      switch (__pyx_why) {
        case 3: goto __pyx_L0;
      }
    }
  }

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":319
 *             return xmlparser.xmlIOParseDTD(NULL, c_buffer, 0)
 * 
 *     cdef xmlDoc* _readDoc(self, xmlparser.xmlParserCtxt* ctxt, int options):             # <<<<<<<<<<<<<<
 *         cdef xmlDoc* result
 *         cdef char* c_encoding
 */

static  xmlDoc *__pyx_f_4lxml_5etree_18_FileReaderContext__readDoc(struct __pyx_obj_4lxml_5etree__FileReaderContext *__pyx_v_self, xmlParserCtxt *__pyx_v_ctxt, int __pyx_v_options) {
  xmlDoc *__pyx_v_result;
  char *__pyx_v_c_encoding;
  FILE *__pyx_v_c_stream;
  xmlInputReadCallback __pyx_v_c_read_callback;
  void *__pyx_v_c_callback_context;
  xmlDoc *__pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_readDoc");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":327
 *         cdef void* c_callback_context
 * 
 *         if self._encoding is None:             # <<<<<<<<<<<<<<
 *             c_encoding = NULL
 *         else:
 */
  __pyx_t_1 = (__pyx_v_self->_encoding == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":328
 * 
 *         if self._encoding is None:
 *             c_encoding = NULL             # <<<<<<<<<<<<<<
 *         else:
 *             c_encoding = _cstr(self._encoding)
 */
    __pyx_v_c_encoding = NULL;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":330
 *             c_encoding = NULL
 *         else:
 *             c_encoding = _cstr(self._encoding)             # <<<<<<<<<<<<<<
 * 
 *         c_stream = python.PyFile_AsFile(self._filelike)
 */
    __pyx_t_2 = __pyx_v_self->_encoding;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v_c_encoding = PyBytes_AS_STRING(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":332
 *             c_encoding = _cstr(self._encoding)
 * 
 *         c_stream = python.PyFile_AsFile(self._filelike)             # <<<<<<<<<<<<<<
 *         if c_stream is NULL:
 *             c_read_callback  = _readFilelikeParser
 */
  __pyx_t_2 = __pyx_v_self->_filelike;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_c_stream = PyFile_AsFile(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":333
 * 
 *         c_stream = python.PyFile_AsFile(self._filelike)
 *         if c_stream is NULL:             # <<<<<<<<<<<<<<
 *             c_read_callback  = _readFilelikeParser
 *             c_callback_context = <python.PyObject*>self
 */
  __pyx_t_1 = (__pyx_v_c_stream == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":334
 *         c_stream = python.PyFile_AsFile(self._filelike)
 *         if c_stream is NULL:
 *             c_read_callback  = _readFilelikeParser             # <<<<<<<<<<<<<<
 *             c_callback_context = <python.PyObject*>self
 *         else:
 */
    __pyx_v_c_read_callback = __pyx_f_4lxml_5etree__readFilelikeParser;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":335
 *         if c_stream is NULL:
 *             c_read_callback  = _readFilelikeParser
 *             c_callback_context = <python.PyObject*>self             # <<<<<<<<<<<<<<
 *         else:
 *             c_read_callback  = _readFileParser
 */
    __pyx_v_c_callback_context = ((PyObject *)__pyx_v_self);
    goto __pyx_L4;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":337
 *             c_callback_context = <python.PyObject*>self
 *         else:
 *             c_read_callback  = _readFileParser             # <<<<<<<<<<<<<<
 *             c_callback_context = c_stream
 * 
 */
    __pyx_v_c_read_callback = __pyx_f_4lxml_5etree__readFileParser;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":338
 *         else:
 *             c_read_callback  = _readFileParser
 *             c_callback_context = c_stream             # <<<<<<<<<<<<<<
 * 
 *         with nogil:
 */
    __pyx_v_c_callback_context = __pyx_v_c_stream;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":340
 *             c_callback_context = c_stream
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             if ctxt.html:
 *                 result = htmlparser.htmlCtxtReadIO(
 */
  {
    #ifdef WITH_THREAD
    PyThreadState *_save;
    #endif
    Py_UNBLOCK_THREADS
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":341
 * 
 *         with nogil:
 *             if ctxt.html:             # <<<<<<<<<<<<<<
 *                 result = htmlparser.htmlCtxtReadIO(
 *                         ctxt, c_read_callback, NULL, c_callback_context,
 */
      if (__pyx_v_ctxt->html) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":344
 *                 result = htmlparser.htmlCtxtReadIO(
 *                         ctxt, c_read_callback, NULL, c_callback_context,
 *                         self._c_url, c_encoding, options)             # <<<<<<<<<<<<<<
 *                 if result is not NULL:
 *                     if _fixHtmlDictNames(ctxt.dict, result) < 0:
 */
        __pyx_v_result = htmlCtxtReadIO(__pyx_v_ctxt, __pyx_v_c_read_callback, NULL, __pyx_v_c_callback_context, __pyx_v_self->_c_url, __pyx_v_c_encoding, __pyx_v_options);

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":345
 *                         ctxt, c_read_callback, NULL, c_callback_context,
 *                         self._c_url, c_encoding, options)
 *                 if result is not NULL:             # <<<<<<<<<<<<<<
 *                     if _fixHtmlDictNames(ctxt.dict, result) < 0:
 *                         tree.xmlFreeDoc(result)
 */
        __pyx_t_1 = (__pyx_v_result != NULL);
        if (__pyx_t_1) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":346
 *                         self._c_url, c_encoding, options)
 *                 if result is not NULL:
 *                     if _fixHtmlDictNames(ctxt.dict, result) < 0:             # <<<<<<<<<<<<<<
 *                         tree.xmlFreeDoc(result)
 *                         result = NULL
 */
          __pyx_t_1 = (__pyx_f_4lxml_5etree__fixHtmlDictNames(__pyx_v_ctxt->dict, __pyx_v_result) < 0);
          if (__pyx_t_1) {

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":347
 *                 if result is not NULL:
 *                     if _fixHtmlDictNames(ctxt.dict, result) < 0:
 *                         tree.xmlFreeDoc(result)             # <<<<<<<<<<<<<<
 *                         result = NULL
 *             else:
 */
            xmlFreeDoc(__pyx_v_result);

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":348
 *                     if _fixHtmlDictNames(ctxt.dict, result) < 0:
 *                         tree.xmlFreeDoc(result)
 *                         result = NULL             # <<<<<<<<<<<<<<
 *             else:
 *                 result = xmlparser.xmlCtxtReadIO(
 */
            __pyx_v_result = NULL;
            goto __pyx_L10;
          }
          __pyx_L10:;
          goto __pyx_L9;
        }
        __pyx_L9:;
        goto __pyx_L8;
      }
      /*else*/ {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":352
 *                 result = xmlparser.xmlCtxtReadIO(
 *                     ctxt, c_read_callback, NULL, c_callback_context,
 *                     self._c_url, c_encoding, options)             # <<<<<<<<<<<<<<
 *         self._close_file()
 *         return result
 */
        __pyx_v_result = xmlCtxtReadIO(__pyx_v_ctxt, __pyx_v_c_read_callback, NULL, __pyx_v_c_callback_context, __pyx_v_self->_c_url, __pyx_v_c_encoding, __pyx_v_options);
      }
      __pyx_L8:;
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":340
 *             c_callback_context = c_stream
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             if ctxt.html:
 *                 result = htmlparser.htmlCtxtReadIO(
 */
    /*finally:*/ {
      Py_BLOCK_THREADS
    }
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":353
 *                     ctxt, c_read_callback, NULL, c_callback_context,
 *                     self._c_url, c_encoding, options)
 *         self._close_file()             # <<<<<<<<<<<<<<
 *         return result
 * 
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__FileReaderContext *)__pyx_v_self->__pyx_vtab)->_close_file(__pyx_v_self); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":354
 *                     self._c_url, c_encoding, options)
 *         self._close_file()
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     cdef int copyToBuffer(self, char* c_buffer, int c_requested):
 */
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_WriteUnraisable("lxml.etree._FileReaderContext._readDoc");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":356
 *         return result
 * 
 *     cdef int copyToBuffer(self, char* c_buffer, int c_requested):             # <<<<<<<<<<<<<<
 *         cdef int c_byte_count
 *         cdef char* c_start
 */

static  int __pyx_f_4lxml_5etree_18_FileReaderContext_copyToBuffer(struct __pyx_obj_4lxml_5etree__FileReaderContext *__pyx_v_self, char *__pyx_v_c_buffer, int __pyx_v_c_requested) {
  int __pyx_v_c_byte_count;
  char *__pyx_v_c_start;
  Py_ssize_t __pyx_v_byte_count;
  Py_ssize_t __pyx_v_remaining;
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("copyToBuffer");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":360
 *         cdef char* c_start
 *         cdef Py_ssize_t byte_count, remaining
 *         if self._bytes_read < 0:             # <<<<<<<<<<<<<<
 *             return 0
 *         try:
 */
  __pyx_t_1 = (__pyx_v_self->_bytes_read < 0);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":361
 *         cdef Py_ssize_t byte_count, remaining
 *         if self._bytes_read < 0:
 *             return 0             # <<<<<<<<<<<<<<
 *         try:
 *             c_byte_count = 0
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":362
 *         if self._bytes_read < 0:
 *             return 0
 *         try:             # <<<<<<<<<<<<<<
 *             c_byte_count = 0
 *             byte_count = python.PyBytes_GET_SIZE(self._bytes)
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":363
 *             return 0
 *         try:
 *             c_byte_count = 0             # <<<<<<<<<<<<<<
 *             byte_count = python.PyBytes_GET_SIZE(self._bytes)
 *             remaining  = byte_count - self._bytes_read
 */
      __pyx_v_c_byte_count = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":364
 *         try:
 *             c_byte_count = 0
 *             byte_count = python.PyBytes_GET_SIZE(self._bytes)             # <<<<<<<<<<<<<<
 *             remaining  = byte_count - self._bytes_read
 *             while c_requested > remaining:
 */
      __pyx_t_2 = __pyx_v_self->_bytes;
      __Pyx_INCREF(__pyx_t_2);
      __pyx_v_byte_count = PyBytes_GET_SIZE(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":365
 *             c_byte_count = 0
 *             byte_count = python.PyBytes_GET_SIZE(self._bytes)
 *             remaining  = byte_count - self._bytes_read             # <<<<<<<<<<<<<<
 *             while c_requested > remaining:
 *                 c_start = _cstr(self._bytes) + self._bytes_read
 */
      __pyx_v_remaining = (__pyx_v_byte_count - __pyx_v_self->_bytes_read);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":366
 *             byte_count = python.PyBytes_GET_SIZE(self._bytes)
 *             remaining  = byte_count - self._bytes_read
 *             while c_requested > remaining:             # <<<<<<<<<<<<<<
 *                 c_start = _cstr(self._bytes) + self._bytes_read
 *                 cstd.memcpy(c_buffer, c_start, remaining)
 */
      while (1) {
        __pyx_t_1 = (__pyx_v_c_requested > __pyx_v_remaining);
        if (!__pyx_t_1) break;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":367
 *             remaining  = byte_count - self._bytes_read
 *             while c_requested > remaining:
 *                 c_start = _cstr(self._bytes) + self._bytes_read             # <<<<<<<<<<<<<<
 *                 cstd.memcpy(c_buffer, c_start, remaining)
 *                 c_byte_count += remaining
 */
        __pyx_t_2 = __pyx_v_self->_bytes;
        __Pyx_INCREF(__pyx_t_2);
        __pyx_v_c_start = (PyBytes_AS_STRING(__pyx_t_2) + __pyx_v_self->_bytes_read);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":368
 *             while c_requested > remaining:
 *                 c_start = _cstr(self._bytes) + self._bytes_read
 *                 cstd.memcpy(c_buffer, c_start, remaining)             # <<<<<<<<<<<<<<
 *                 c_byte_count += remaining
 *                 c_buffer += remaining
 */
        memcpy(__pyx_v_c_buffer, __pyx_v_c_start, __pyx_v_remaining);

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":369
 *                 c_start = _cstr(self._bytes) + self._bytes_read
 *                 cstd.memcpy(c_buffer, c_start, remaining)
 *                 c_byte_count += remaining             # <<<<<<<<<<<<<<
 *                 c_buffer += remaining
 *                 c_requested -= remaining
 */
        __pyx_v_c_byte_count = (__pyx_v_c_byte_count + __pyx_v_remaining);

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":370
 *                 cstd.memcpy(c_buffer, c_start, remaining)
 *                 c_byte_count += remaining
 *                 c_buffer += remaining             # <<<<<<<<<<<<<<
 *                 c_requested -= remaining
 * 
 */
        __pyx_v_c_buffer = (__pyx_v_c_buffer + __pyx_v_remaining);

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":371
 *                 c_byte_count += remaining
 *                 c_buffer += remaining
 *                 c_requested -= remaining             # <<<<<<<<<<<<<<
 * 
 *                 self._bytes = self._filelike.read(c_requested)
 */
        __pyx_v_c_requested = (__pyx_v_c_requested - __pyx_v_remaining);

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":373
 *                 c_requested -= remaining
 * 
 *                 self._bytes = self._filelike.read(c_requested)             # <<<<<<<<<<<<<<
 *                 if not python.PyBytes_Check(self._bytes):
 *                     if python.PyUnicode_Check(self._bytes):
 */
        __pyx_t_2 = PyObject_GetAttr(__pyx_v_self->_filelike, __pyx_n_s__read); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = PyInt_FromLong(__pyx_v_c_requested); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_4));
        PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
        __Pyx_GIVEREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_v_self->_bytes);
        __Pyx_DECREF(__pyx_v_self->_bytes);
        __pyx_v_self->_bytes = __pyx_t_3;
        __pyx_t_3 = 0;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":374
 * 
 *                 self._bytes = self._filelike.read(c_requested)
 *                 if not python.PyBytes_Check(self._bytes):             # <<<<<<<<<<<<<<
 *                     if python.PyUnicode_Check(self._bytes):
 *                         if self._encoding is None:
 */
        __pyx_t_3 = __pyx_v_self->_bytes;
        __Pyx_INCREF(__pyx_t_3);
        __pyx_t_1 = (!PyBytes_Check(__pyx_t_3));
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (__pyx_t_1) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":375
 *                 self._bytes = self._filelike.read(c_requested)
 *                 if not python.PyBytes_Check(self._bytes):
 *                     if python.PyUnicode_Check(self._bytes):             # <<<<<<<<<<<<<<
 *                         if self._encoding is None:
 *                             self._bytes = python.PyUnicode_AsUTF8String(self._bytes)
 */
          __pyx_t_3 = __pyx_v_self->_bytes;
          __Pyx_INCREF(__pyx_t_3);
          __pyx_t_1 = PyUnicode_Check(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          if (__pyx_t_1) {

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":376
 *                 if not python.PyBytes_Check(self._bytes):
 *                     if python.PyUnicode_Check(self._bytes):
 *                         if self._encoding is None:             # <<<<<<<<<<<<<<
 *                             self._bytes = python.PyUnicode_AsUTF8String(self._bytes)
 *                         else:
 */
            __pyx_t_1 = (__pyx_v_self->_encoding == Py_None);
            if (__pyx_t_1) {

              /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":377
 *                     if python.PyUnicode_Check(self._bytes):
 *                         if self._encoding is None:
 *                             self._bytes = python.PyUnicode_AsUTF8String(self._bytes)             # <<<<<<<<<<<<<<
 *                         else:
 *                             self._bytes = python.PyUnicode_AsEncodedString(
 */
              __pyx_t_3 = __pyx_v_self->_bytes;
              __Pyx_INCREF(__pyx_t_3);
              __pyx_t_4 = ((PyObject *)PyUnicode_AsUTF8String(__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
              __Pyx_GOTREF(__pyx_t_4);
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
              __Pyx_GIVEREF(__pyx_t_4);
              __Pyx_GOTREF(__pyx_v_self->_bytes);
              __Pyx_DECREF(__pyx_v_self->_bytes);
              __pyx_v_self->_bytes = __pyx_t_4;
              __pyx_t_4 = 0;
              goto __pyx_L16;
            }
            /*else*/ {

              /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":380
 *                         else:
 *                             self._bytes = python.PyUnicode_AsEncodedString(
 *                                 self._bytes, _cstr(self._encoding), NULL)             # <<<<<<<<<<<<<<
 *                     else:
 *                         self._close_file()
 */
              __pyx_t_4 = __pyx_v_self->_bytes;
              __Pyx_INCREF(__pyx_t_4);
              __pyx_t_3 = __pyx_v_self->_encoding;
              __Pyx_INCREF(__pyx_t_3);
              __pyx_t_2 = ((PyObject *)PyUnicode_AsEncodedString(__pyx_t_4, PyBytes_AS_STRING(__pyx_t_3), NULL)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
              __Pyx_GOTREF(__pyx_t_2);
              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

              /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":379
 *                             self._bytes = python.PyUnicode_AsUTF8String(self._bytes)
 *                         else:
 *                             self._bytes = python.PyUnicode_AsEncodedString(             # <<<<<<<<<<<<<<
 *                                 self._bytes, _cstr(self._encoding), NULL)
 *                     else:
 */
              __Pyx_GIVEREF(__pyx_t_2);
              __Pyx_GOTREF(__pyx_v_self->_bytes);
              __Pyx_DECREF(__pyx_v_self->_bytes);
              __pyx_v_self->_bytes = __pyx_t_2;
              __pyx_t_2 = 0;
            }
            __pyx_L16:;
            goto __pyx_L15;
          }
          /*else*/ {

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":382
 *                                 self._bytes, _cstr(self._encoding), NULL)
 *                     else:
 *                         self._close_file()             # <<<<<<<<<<<<<<
 *                         raise TypeError, \
 *                             u"reading from file-like objects must return byte strings or unicode strings"
 */
            __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__FileReaderContext *)__pyx_v_self->__pyx_vtab)->_close_file(__pyx_v_self); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":383
 *                     else:
 *                         self._close_file()
 *                         raise TypeError, \             # <<<<<<<<<<<<<<
 *                             u"reading from file-like objects must return byte strings or unicode strings"
 * 
 */
            __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_u_168), 0);
            {__pyx_filename = __pyx_f[3]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
          }
          __pyx_L15:;
          goto __pyx_L14;
        }
        __pyx_L14:;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":386
 *                             u"reading from file-like objects must return byte strings or unicode strings"
 * 
 *                 remaining = python.PyBytes_GET_SIZE(self._bytes)             # <<<<<<<<<<<<<<
 *                 if remaining == 0:
 *                     self._bytes_read = -1
 */
        __pyx_t_2 = __pyx_v_self->_bytes;
        __Pyx_INCREF(__pyx_t_2);
        __pyx_v_remaining = PyBytes_GET_SIZE(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":387
 * 
 *                 remaining = python.PyBytes_GET_SIZE(self._bytes)
 *                 if remaining == 0:             # <<<<<<<<<<<<<<
 *                     self._bytes_read = -1
 *                     self._close_file()
 */
        __pyx_t_1 = (__pyx_v_remaining == 0);
        if (__pyx_t_1) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":388
 *                 remaining = python.PyBytes_GET_SIZE(self._bytes)
 *                 if remaining == 0:
 *                     self._bytes_read = -1             # <<<<<<<<<<<<<<
 *                     self._close_file()
 *                     return c_byte_count
 */
          __pyx_v_self->_bytes_read = -1;

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":389
 *                 if remaining == 0:
 *                     self._bytes_read = -1
 *                     self._close_file()             # <<<<<<<<<<<<<<
 *                     return c_byte_count
 *                 self._bytes_read = 0
 */
          __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__FileReaderContext *)__pyx_v_self->__pyx_vtab)->_close_file(__pyx_v_self); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":390
 *                     self._bytes_read = -1
 *                     self._close_file()
 *                     return c_byte_count             # <<<<<<<<<<<<<<
 *                 self._bytes_read = 0
 * 
 */
          __pyx_r = __pyx_v_c_byte_count;
          goto __pyx_L8_try_return;
          goto __pyx_L17;
        }
        __pyx_L17:;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":391
 *                     self._close_file()
 *                     return c_byte_count
 *                 self._bytes_read = 0             # <<<<<<<<<<<<<<
 * 
 *             if c_requested > 0:
 */
        __pyx_v_self->_bytes_read = 0;
      }

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":393
 *                 self._bytes_read = 0
 * 
 *             if c_requested > 0:             # <<<<<<<<<<<<<<
 *                 c_start = _cstr(self._bytes) + self._bytes_read
 *                 cstd.memcpy(c_buffer, c_start, c_requested)
 */
      __pyx_t_1 = (__pyx_v_c_requested > 0);
      if (__pyx_t_1) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":394
 * 
 *             if c_requested > 0:
 *                 c_start = _cstr(self._bytes) + self._bytes_read             # <<<<<<<<<<<<<<
 *                 cstd.memcpy(c_buffer, c_start, c_requested)
 *                 c_byte_count += c_requested
 */
        __pyx_t_2 = __pyx_v_self->_bytes;
        __Pyx_INCREF(__pyx_t_2);
        __pyx_v_c_start = (PyBytes_AS_STRING(__pyx_t_2) + __pyx_v_self->_bytes_read);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":395
 *             if c_requested > 0:
 *                 c_start = _cstr(self._bytes) + self._bytes_read
 *                 cstd.memcpy(c_buffer, c_start, c_requested)             # <<<<<<<<<<<<<<
 *                 c_byte_count += c_requested
 *                 self._bytes_read += c_requested
 */
        memcpy(__pyx_v_c_buffer, __pyx_v_c_start, __pyx_v_c_requested);

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":396
 *                 c_start = _cstr(self._bytes) + self._bytes_read
 *                 cstd.memcpy(c_buffer, c_start, c_requested)
 *                 c_byte_count += c_requested             # <<<<<<<<<<<<<<
 *                 self._bytes_read += c_requested
 *             return c_byte_count
 */
        __pyx_v_c_byte_count = (__pyx_v_c_byte_count + __pyx_v_c_requested);

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":397
 *                 cstd.memcpy(c_buffer, c_start, c_requested)
 *                 c_byte_count += c_requested
 *                 self._bytes_read += c_requested             # <<<<<<<<<<<<<<
 *             return c_byte_count
 *         except:
 */
        __pyx_v_self->_bytes_read = (__pyx_v_self->_bytes_read + __pyx_v_c_requested);
        goto __pyx_L18;
      }
      __pyx_L18:;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":398
 *                 c_byte_count += c_requested
 *                 self._bytes_read += c_requested
 *             return c_byte_count             # <<<<<<<<<<<<<<
 *         except:
 *             self._exc_context._store_raised()
 */
      __pyx_r = __pyx_v_c_byte_count;
      goto __pyx_L8_try_return;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L11_try_end;
    __pyx_L8_try_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;
    __pyx_L4_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":399
 *                 self._bytes_read += c_requested
 *             return c_byte_count
 *         except:             # <<<<<<<<<<<<<<
 *             self._exc_context._store_raised()
 *             self._close_file()
 */
    /*except:*/ {
      __Pyx_AddTraceback("lxml.etree._FileReaderContext.copyToBuffer");
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_4);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":400
 *             return c_byte_count
 *         except:
 *             self._exc_context._store_raised()             # <<<<<<<<<<<<<<
 *             self._close_file()
 *             return -1
 */
      ((struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext *)__pyx_v_self->_exc_context->__pyx_vtab)->_store_raised(__pyx_v_self->_exc_context);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":401
 *         except:
 *             self._exc_context._store_raised()
 *             self._close_file()             # <<<<<<<<<<<<<<
 *             return -1
 * 
 */
      __pyx_t_5 = ((struct __pyx_vtabstruct_4lxml_5etree__FileReaderContext *)__pyx_v_self->__pyx_vtab)->_close_file(__pyx_v_self); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":402
 *             self._exc_context._store_raised()
 *             self._close_file()
 *             return -1             # <<<<<<<<<<<<<<
 * 
 * cdef int _readFilelikeParser(void* ctxt, char* c_buffer, int c_size) with gil:
 */
      __pyx_r = -1;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L7_except_return;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L5_exception_handled;
    }
    __pyx_L6_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L7_except_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;
    __pyx_L5_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L11_try_end:;
  }

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_WriteUnraisable("lxml.etree._FileReaderContext.copyToBuffer");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":404
 *             return -1
 * 
 * cdef int _readFilelikeParser(void* ctxt, char* c_buffer, int c_size) with gil:             # <<<<<<<<<<<<<<
 *     return (<_FileReaderContext>ctxt).copyToBuffer(c_buffer, c_size)
 * 
 */

static  int __pyx_f_4lxml_5etree__readFilelikeParser(void *__pyx_v_ctxt, char *__pyx_v_c_buffer, int __pyx_v_c_size) {
  int __pyx_r;
  #ifdef WITH_THREAD
  PyGILState_STATE _save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_readFilelikeParser");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":405
 * 
 * cdef int _readFilelikeParser(void* ctxt, char* c_buffer, int c_size) with gil:
 *     return (<_FileReaderContext>ctxt).copyToBuffer(c_buffer, c_size)             # <<<<<<<<<<<<<<
 * 
 * cdef int _readFileParser(void* ctxt, char* c_buffer, int c_size) nogil:
 */
  __pyx_r = ((struct __pyx_vtabstruct_4lxml_5etree__FileReaderContext *)((struct __pyx_obj_4lxml_5etree__FileReaderContext *)__pyx_v_ctxt)->__pyx_vtab)->copyToBuffer(((struct __pyx_obj_4lxml_5etree__FileReaderContext *)__pyx_v_ctxt), __pyx_v_c_buffer, __pyx_v_c_size);
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(_save);
  #endif
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":407
 *     return (<_FileReaderContext>ctxt).copyToBuffer(c_buffer, c_size)
 * 
 * cdef int _readFileParser(void* ctxt, char* c_buffer, int c_size) nogil:             # <<<<<<<<<<<<<<
 *     return cstd.fread(c_buffer, 1,  c_size, <cstd.FILE*>ctxt)
 * 
 */

static  int __pyx_f_4lxml_5etree__readFileParser(void *__pyx_v_ctxt, char *__pyx_v_c_buffer, int __pyx_v_c_size) {
  int __pyx_r;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":408
 * 
 * cdef int _readFileParser(void* ctxt, char* c_buffer, int c_size) nogil:
 *     return cstd.fread(c_buffer, 1,  c_size, <cstd.FILE*>ctxt)             # <<<<<<<<<<<<<<
 * 
 * ############################################################
 */
  __pyx_r = fread(__pyx_v_c_buffer, 1, __pyx_v_c_size, ((FILE *)__pyx_v_ctxt));
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":414
 * ############################################################
 * 
 * cdef xmlparser.xmlParserInput* _local_resolver(char* c_url, char* c_pubid,             # <<<<<<<<<<<<<<
 *                                                xmlparser.xmlParserCtxt* c_context) with gil:
 *     cdef _ResolverContext context
 */

static  xmlParserInput *__pyx_f_4lxml_5etree__local_resolver(char *__pyx_v_c_url, char *__pyx_v_c_pubid, xmlParserCtxt *__pyx_v_c_context) {
  struct __pyx_obj_4lxml_5etree__ResolverContext *__pyx_v_context;
  xmlParserInput *__pyx_v_c_input;
  struct __pyx_obj_4lxml_5etree__InputDocument *__pyx_v_doc_ref;
  struct __pyx_obj_4lxml_5etree__FileReaderContext *__pyx_v_file_context;
  PyObject *__pyx_v_url;
  PyObject *__pyx_v_pubid;
  PyObject *__pyx_v_data;
  xmlParserInput *__pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  #ifdef WITH_THREAD
  PyGILState_STATE _save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_local_resolver");
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ResolverContext *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_doc_ref = ((struct __pyx_obj_4lxml_5etree__InputDocument *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_file_context = ((struct __pyx_obj_4lxml_5etree__FileReaderContext *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_url = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_pubid = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_data = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":423
 *     # passed, check to see if the thread state object has an implied
 *     # context.
 *     if c_context._private is not NULL:             # <<<<<<<<<<<<<<
 *         context = <_ResolverContext>c_context._private
 *     else:
 */
  __pyx_t_1 = (__pyx_v_c_context->_private != NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":424
 *     # context.
 *     if c_context._private is not NULL:
 *         context = <_ResolverContext>c_context._private             # <<<<<<<<<<<<<<
 *     else:
 *         context = __GLOBAL_PARSER_CONTEXT.findImpliedContext()
 */
    __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__ResolverContext *)__pyx_v_c_context->_private)));
    __Pyx_DECREF(((PyObject *)__pyx_v_context));
    __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ResolverContext *)__pyx_v_c_context->_private);
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":426
 *         context = <_ResolverContext>c_context._private
 *     else:
 *         context = __GLOBAL_PARSER_CONTEXT.findImpliedContext()             # <<<<<<<<<<<<<<
 * 
 *     if context is None:
 */
    __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext *)__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT->__pyx_vtab)->findImpliedContext(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_v_context));
    __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ResolverContext *)__pyx_t_2);
    __pyx_t_2 = 0;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":428
 *         context = __GLOBAL_PARSER_CONTEXT.findImpliedContext()
 * 
 *     if context is None:             # <<<<<<<<<<<<<<
 *         if __DEFAULT_ENTITY_LOADER is NULL:
 *             return NULL
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_context) == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":429
 * 
 *     if context is None:
 *         if __DEFAULT_ENTITY_LOADER is NULL:             # <<<<<<<<<<<<<<
 *             return NULL
 *         return __DEFAULT_ENTITY_LOADER(c_url, c_pubid, c_context)
 */
    __pyx_t_1 = (__pyx_v_4lxml_5etree___DEFAULT_ENTITY_LOADER == NULL);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":430
 *     if context is None:
 *         if __DEFAULT_ENTITY_LOADER is NULL:
 *             return NULL             # <<<<<<<<<<<<<<
 *         return __DEFAULT_ENTITY_LOADER(c_url, c_pubid, c_context)
 * 
 */
      __pyx_r = NULL;
      goto __pyx_L0;
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":431
 *         if __DEFAULT_ENTITY_LOADER is NULL:
 *             return NULL
 *         return __DEFAULT_ENTITY_LOADER(c_url, c_pubid, c_context)             # <<<<<<<<<<<<<<
 * 
 *     try:
 */
    __pyx_r = __pyx_v_4lxml_5etree___DEFAULT_ENTITY_LOADER(__pyx_v_c_url, __pyx_v_c_pubid, __pyx_v_c_context);
    goto __pyx_L0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":433
 *         return __DEFAULT_ENTITY_LOADER(c_url, c_pubid, c_context)
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         if c_url is NULL:
 *             url = None
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":434
 * 
 *     try:
 *         if c_url is NULL:             # <<<<<<<<<<<<<<
 *             url = None
 *         else:
 */
      __pyx_t_1 = (__pyx_v_c_url == NULL);
      if (__pyx_t_1) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":435
 *     try:
 *         if c_url is NULL:
 *             url = None             # <<<<<<<<<<<<<<
 *         else:
 *             # parsing a related document (DTD etc.) => UTF-8 encoded URL?
 */
        __Pyx_INCREF(Py_None);
        __Pyx_DECREF(__pyx_v_url);
        __pyx_v_url = Py_None;
        goto __pyx_L14;
      }
      /*else*/ {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":438
 *         else:
 *             # parsing a related document (DTD etc.) => UTF-8 encoded URL?
 *             url = _decodeFilename(c_url)             # <<<<<<<<<<<<<<
 *         if c_pubid is NULL:
 *             pubid = None
 */
        __pyx_t_2 = __pyx_f_4lxml_5etree__decodeFilename(__pyx_v_c_url); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_v_url);
        __pyx_v_url = __pyx_t_2;
        __pyx_t_2 = 0;
      }
      __pyx_L14:;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":439
 *             # parsing a related document (DTD etc.) => UTF-8 encoded URL?
 *             url = _decodeFilename(c_url)
 *         if c_pubid is NULL:             # <<<<<<<<<<<<<<
 *             pubid = None
 *         else:
 */
      __pyx_t_1 = (__pyx_v_c_pubid == NULL);
      if (__pyx_t_1) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":440
 *             url = _decodeFilename(c_url)
 *         if c_pubid is NULL:
 *             pubid = None             # <<<<<<<<<<<<<<
 *         else:
 *             pubid = funicode(c_pubid) # always UTF-8
 */
        __Pyx_INCREF(Py_None);
        __Pyx_DECREF(__pyx_v_pubid);
        __pyx_v_pubid = Py_None;
        goto __pyx_L15;
      }
      /*else*/ {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":442
 *             pubid = None
 *         else:
 *             pubid = funicode(c_pubid) # always UTF-8             # <<<<<<<<<<<<<<
 * 
 *         doc_ref = context._resolvers.resolve(url, pubid, context)
 */
        __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_pubid); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_v_pubid);
        __pyx_v_pubid = __pyx_t_2;
        __pyx_t_2 = 0;
      }
      __pyx_L15:;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":444
 *             pubid = funicode(c_pubid) # always UTF-8
 * 
 *         doc_ref = context._resolvers.resolve(url, pubid, context)             # <<<<<<<<<<<<<<
 *     except:
 *         context._store_raised()
 */
      __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_context->_resolvers), __pyx_n_s__resolve); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
      __Pyx_INCREF(__pyx_v_url);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_url);
      __Pyx_GIVEREF(__pyx_v_url);
      __Pyx_INCREF(__pyx_v_pubid);
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_pubid);
      __Pyx_GIVEREF(__pyx_v_pubid);
      __Pyx_INCREF(((PyObject *)__pyx_v_context));
      PyTuple_SET_ITEM(__pyx_t_3, 2, ((PyObject *)__pyx_v_context));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_context));
      __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4lxml_5etree__InputDocument))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_DECREF(((PyObject *)__pyx_v_doc_ref));
      __pyx_v_doc_ref = ((struct __pyx_obj_4lxml_5etree__InputDocument *)__pyx_t_4);
      __pyx_t_4 = 0;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L13_try_end;
    __pyx_L6_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":445
 * 
 *         doc_ref = context._resolvers.resolve(url, pubid, context)
 *     except:             # <<<<<<<<<<<<<<
 *         context._store_raised()
 *         return NULL
 */
    /*except:*/ {
      __Pyx_AddTraceback("lxml.etree._local_resolver");
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_2);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":446
 *         doc_ref = context._resolvers.resolve(url, pubid, context)
 *     except:
 *         context._store_raised()             # <<<<<<<<<<<<<<
 *         return NULL
 * 
 */
      ((struct __pyx_vtabstruct_4lxml_5etree__ResolverContext *)__pyx_v_context->__pyx_base.__pyx_vtab)->__pyx_base._store_raised(((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_v_context));

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":447
 *     except:
 *         context._store_raised()
 *         return NULL             # <<<<<<<<<<<<<<
 * 
 *     if doc_ref is not None:
 */
      __pyx_r = NULL;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L9_except_return;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L7_exception_handled;
    }
    __pyx_L8_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L9_except_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;
    __pyx_L7_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L13_try_end:;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":449
 *         return NULL
 * 
 *     if doc_ref is not None:             # <<<<<<<<<<<<<<
 *         if doc_ref._type == PARSER_DATA_STRING:
 *             data = doc_ref._data_bytes
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_doc_ref) != Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":450
 * 
 *     if doc_ref is not None:
 *         if doc_ref._type == PARSER_DATA_STRING:             # <<<<<<<<<<<<<<
 *             data = doc_ref._data_bytes
 *             c_input = xmlparser.xmlNewInputStream(c_context)
 */
    __pyx_t_1 = (__pyx_v_doc_ref->_type == __pyx_e_4lxml_5etree_PARSER_DATA_STRING);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":451
 *     if doc_ref is not None:
 *         if doc_ref._type == PARSER_DATA_STRING:
 *             data = doc_ref._data_bytes             # <<<<<<<<<<<<<<
 *             c_input = xmlparser.xmlNewInputStream(c_context)
 *             if c_input is not NULL:
 */
      __Pyx_INCREF(__pyx_v_doc_ref->_data_bytes);
      __Pyx_DECREF(__pyx_v_data);
      __pyx_v_data = __pyx_v_doc_ref->_data_bytes;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":452
 *         if doc_ref._type == PARSER_DATA_STRING:
 *             data = doc_ref._data_bytes
 *             c_input = xmlparser.xmlNewInputStream(c_context)             # <<<<<<<<<<<<<<
 *             if c_input is not NULL:
 *                 c_input.base = _cstr(data)
 */
      __pyx_v_c_input = xmlNewInputStream(__pyx_v_c_context);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":453
 *             data = doc_ref._data_bytes
 *             c_input = xmlparser.xmlNewInputStream(c_context)
 *             if c_input is not NULL:             # <<<<<<<<<<<<<<
 *                 c_input.base = _cstr(data)
 *                 c_input.length = python.PyBytes_GET_SIZE(data)
 */
      __pyx_t_1 = (__pyx_v_c_input != NULL);
      if (__pyx_t_1) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":454
 *             c_input = xmlparser.xmlNewInputStream(c_context)
 *             if c_input is not NULL:
 *                 c_input.base = _cstr(data)             # <<<<<<<<<<<<<<
 *                 c_input.length = python.PyBytes_GET_SIZE(data)
 *                 c_input.cur = c_input.base
 */
        __pyx_v_c_input->base = PyBytes_AS_STRING(__pyx_v_data);

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":455
 *             if c_input is not NULL:
 *                 c_input.base = _cstr(data)
 *                 c_input.length = python.PyBytes_GET_SIZE(data)             # <<<<<<<<<<<<<<
 *                 c_input.cur = c_input.base
 *                 c_input.end = &c_input.base[c_input.length]
 */
        __pyx_v_c_input->length = PyBytes_GET_SIZE(__pyx_v_data);

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":456
 *                 c_input.base = _cstr(data)
 *                 c_input.length = python.PyBytes_GET_SIZE(data)
 *                 c_input.cur = c_input.base             # <<<<<<<<<<<<<<
 *                 c_input.end = &c_input.base[c_input.length]
 *         elif doc_ref._type == PARSER_DATA_FILENAME:
 */
        __pyx_v_c_input->cur = __pyx_v_c_input->base;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":457
 *                 c_input.length = python.PyBytes_GET_SIZE(data)
 *                 c_input.cur = c_input.base
 *                 c_input.end = &c_input.base[c_input.length]             # <<<<<<<<<<<<<<
 *         elif doc_ref._type == PARSER_DATA_FILENAME:
 *             c_input = xmlparser.xmlNewInputFromFile(
 */
        __pyx_v_c_input->end = (&(__pyx_v_c_input->base[__pyx_v_c_input->length]));
        goto __pyx_L20;
      }
      __pyx_L20:;
      goto __pyx_L19;
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":458
 *                 c_input.cur = c_input.base
 *                 c_input.end = &c_input.base[c_input.length]
 *         elif doc_ref._type == PARSER_DATA_FILENAME:             # <<<<<<<<<<<<<<
 *             c_input = xmlparser.xmlNewInputFromFile(
 *                 c_context, _cstr(doc_ref._filename))
 */
    __pyx_t_1 = (__pyx_v_doc_ref->_type == __pyx_e_4lxml_5etree_PARSER_DATA_FILENAME);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":460
 *         elif doc_ref._type == PARSER_DATA_FILENAME:
 *             c_input = xmlparser.xmlNewInputFromFile(
 *                 c_context, _cstr(doc_ref._filename))             # <<<<<<<<<<<<<<
 *         elif doc_ref._type == PARSER_DATA_FILE:
 *             file_context = _FileReaderContext(doc_ref._file, context, url, None)
 */
      __pyx_t_2 = __pyx_v_doc_ref->_filename;
      __Pyx_INCREF(__pyx_t_2);
      __pyx_v_c_input = xmlNewInputFromFile(__pyx_v_c_context, PyBytes_AS_STRING(__pyx_t_2));
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L19;
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":461
 *             c_input = xmlparser.xmlNewInputFromFile(
 *                 c_context, _cstr(doc_ref._filename))
 *         elif doc_ref._type == PARSER_DATA_FILE:             # <<<<<<<<<<<<<<
 *             file_context = _FileReaderContext(doc_ref._file, context, url, None)
 *             c_input = file_context._createParserInput(c_context)
 */
    __pyx_t_1 = (__pyx_v_doc_ref->_type == __pyx_e_4lxml_5etree_PARSER_DATA_FILE);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":462
 *                 c_context, _cstr(doc_ref._filename))
 *         elif doc_ref._type == PARSER_DATA_FILE:
 *             file_context = _FileReaderContext(doc_ref._file, context, url, None)             # <<<<<<<<<<<<<<
 *             c_input = file_context._createParserInput(c_context)
 *             data = file_context
 */
      __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __Pyx_INCREF(__pyx_v_doc_ref->_file);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_doc_ref->_file);
      __Pyx_GIVEREF(__pyx_v_doc_ref->_file);
      __Pyx_INCREF(((PyObject *)__pyx_v_context));
      PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_context));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_context));
      __Pyx_INCREF(__pyx_v_url);
      PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_url);
      __Pyx_GIVEREF(__pyx_v_url);
      __Pyx_INCREF(Py_None);
      PyTuple_SET_ITEM(__pyx_t_2, 3, Py_None);
      __Pyx_GIVEREF(Py_None);
      __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__FileReaderContext)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_v_file_context));
      __pyx_v_file_context = ((struct __pyx_obj_4lxml_5etree__FileReaderContext *)__pyx_t_3);
      __pyx_t_3 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":463
 *         elif doc_ref._type == PARSER_DATA_FILE:
 *             file_context = _FileReaderContext(doc_ref._file, context, url, None)
 *             c_input = file_context._createParserInput(c_context)             # <<<<<<<<<<<<<<
 *             data = file_context
 *         else:
 */
      __pyx_v_c_input = ((struct __pyx_vtabstruct_4lxml_5etree__FileReaderContext *)__pyx_v_file_context->__pyx_vtab)->_createParserInput(__pyx_v_file_context, __pyx_v_c_context);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":464
 *             file_context = _FileReaderContext(doc_ref._file, context, url, None)
 *             c_input = file_context._createParserInput(c_context)
 *             data = file_context             # <<<<<<<<<<<<<<
 *         else:
 *             data = None
 */
      __Pyx_INCREF(((PyObject *)__pyx_v_file_context));
      __Pyx_DECREF(__pyx_v_data);
      __pyx_v_data = ((PyObject *)__pyx_v_file_context);
      goto __pyx_L19;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":466
 *             data = file_context
 *         else:
 *             data = None             # <<<<<<<<<<<<<<
 *             c_input = NULL
 * 
 */
      __Pyx_INCREF(Py_None);
      __Pyx_DECREF(__pyx_v_data);
      __pyx_v_data = Py_None;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":467
 *         else:
 *             data = None
 *             c_input = NULL             # <<<<<<<<<<<<<<
 * 
 *         if data is not None:
 */
      __pyx_v_c_input = NULL;
    }
    __pyx_L19:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":469
 *             c_input = NULL
 * 
 *         if data is not None:             # <<<<<<<<<<<<<<
 *             context._storage.add(data)
 *         if c_input is not NULL:
 */
    __pyx_t_1 = (__pyx_v_data != Py_None);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":470
 * 
 *         if data is not None:
 *             context._storage.add(data)             # <<<<<<<<<<<<<<
 *         if c_input is not NULL:
 *             return c_input
 */
      __pyx_t_5 = ((struct __pyx_vtabstruct_4lxml_5etree__TempStore *)__pyx_v_context->_storage->__pyx_vtab)->add(__pyx_v_context->_storage, __pyx_v_data); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L21;
    }
    __pyx_L21:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":471
 *         if data is not None:
 *             context._storage.add(data)
 *         if c_input is not NULL:             # <<<<<<<<<<<<<<
 *             return c_input
 * 
 */
    __pyx_t_1 = (__pyx_v_c_input != NULL);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":472
 *             context._storage.add(data)
 *         if c_input is not NULL:
 *             return c_input             # <<<<<<<<<<<<<<
 * 
 *     if __DEFAULT_ENTITY_LOADER is NULL:
 */
      __pyx_r = __pyx_v_c_input;
      goto __pyx_L0;
      goto __pyx_L22;
    }
    __pyx_L22:;
    goto __pyx_L18;
  }
  __pyx_L18:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":474
 *             return c_input
 * 
 *     if __DEFAULT_ENTITY_LOADER is NULL:             # <<<<<<<<<<<<<<
 *         return NULL
 *     return __DEFAULT_ENTITY_LOADER(c_url, c_pubid, c_context)
 */
  __pyx_t_1 = (__pyx_v_4lxml_5etree___DEFAULT_ENTITY_LOADER == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":475
 * 
 *     if __DEFAULT_ENTITY_LOADER is NULL:
 *         return NULL             # <<<<<<<<<<<<<<
 *     return __DEFAULT_ENTITY_LOADER(c_url, c_pubid, c_context)
 * 
 */
    __pyx_r = NULL;
    goto __pyx_L0;
    goto __pyx_L23;
  }
  __pyx_L23:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":476
 *     if __DEFAULT_ENTITY_LOADER is NULL:
 *         return NULL
 *     return __DEFAULT_ENTITY_LOADER(c_url, c_pubid, c_context)             # <<<<<<<<<<<<<<
 * 
 * cdef xmlparser.xmlExternalEntityLoader __DEFAULT_ENTITY_LOADER
 */
  __pyx_r = __pyx_v_4lxml_5etree___DEFAULT_ENTITY_LOADER(__pyx_v_c_url, __pyx_v_c_pubid, __pyx_v_c_context);
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_WriteUnraisable("lxml.etree._local_resolver");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_context);
  __Pyx_DECREF((PyObject *)__pyx_v_doc_ref);
  __Pyx_DECREF((PyObject *)__pyx_v_file_context);
  __Pyx_DECREF(__pyx_v_url);
  __Pyx_DECREF(__pyx_v_pubid);
  __Pyx_DECREF(__pyx_v_data);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(_save);
  #endif
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":492
 *     cdef xmlparser.xmlParserCtxt* _c_ctxt
 *     cdef python.PyThread_type_lock _lock
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._c_ctxt = NULL
 *         if not config.ENABLE_THREADING:
 */

static int __pyx_pf_4lxml_5etree_14_ParserContext___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_14_ParserContext___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__cinit__");
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":493
 *     cdef python.PyThread_type_lock _lock
 *     def __cinit__(self):
 *         self._c_ctxt = NULL             # <<<<<<<<<<<<<<
 *         if not config.ENABLE_THREADING:
 *             self._lock = NULL
 */
  ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_v_self)->_c_ctxt = NULL;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":494
 *     def __cinit__(self):
 *         self._c_ctxt = NULL
 *         if not config.ENABLE_THREADING:             # <<<<<<<<<<<<<<
 *             self._lock = NULL
 *         else:
 */
  __pyx_t_1 = (!ENABLE_THREADING);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":495
 *         self._c_ctxt = NULL
 *         if not config.ENABLE_THREADING:
 *             self._lock = NULL             # <<<<<<<<<<<<<<
 *         else:
 *             self._lock = python.PyThread_allocate_lock()
 */
    ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_v_self)->_lock = NULL;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":497
 *             self._lock = NULL
 *         else:
 *             self._lock = python.PyThread_allocate_lock()             # <<<<<<<<<<<<<<
 *         self._error_log = _ErrorLog()
 * 
 */
    ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_v_self)->_lock = PyThread_allocate_lock();
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":498
 *         else:
 *             self._lock = python.PyThread_allocate_lock()
 *         self._error_log = _ErrorLog()             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ErrorLog)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_v_self)->_error_log);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_v_self)->_error_log));
  ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_v_self)->_error_log = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_t_2);
  __pyx_t_2 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ParserContext.__cinit__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":500
 *         self._error_log = _ErrorLog()
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._validator is not None:
 *             self._validator.disconnect()
 */

static void __pyx_pf_4lxml_5etree_14_ParserContext_1__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pf_4lxml_5etree_14_ParserContext_1__dealloc__(PyObject *__pyx_v_self) {
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__dealloc__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":501
 * 
 *     def __dealloc__(self):
 *         if self._validator is not None:             # <<<<<<<<<<<<<<
 *             self._validator.disconnect()
 *         if self._lock is not NULL:
 */
  __pyx_t_1 = (((PyObject *)((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_v_self)->_validator) != Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":502
 *     def __dealloc__(self):
 *         if self._validator is not None:
 *             self._validator.disconnect()             # <<<<<<<<<<<<<<
 *         if self._lock is not NULL:
 *             python.PyThread_free_lock(self._lock)
 */
    ((struct __pyx_vtabstruct_4lxml_5etree__ParserSchemaValidationContext *)((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_v_self)->_validator->__pyx_vtab)->disconnect(((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_v_self)->_validator);
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":503
 *         if self._validator is not None:
 *             self._validator.disconnect()
 *         if self._lock is not NULL:             # <<<<<<<<<<<<<<
 *             python.PyThread_free_lock(self._lock)
 *         if self._c_ctxt is not NULL:
 */
  __pyx_t_1 = (((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_v_self)->_lock != NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":504
 *             self._validator.disconnect()
 *         if self._lock is not NULL:
 *             python.PyThread_free_lock(self._lock)             # <<<<<<<<<<<<<<
 *         if self._c_ctxt is not NULL:
 *             xmlparser.xmlFreeParserCtxt(self._c_ctxt)
 */
    PyThread_free_lock(((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_v_self)->_lock);
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":505
 *         if self._lock is not NULL:
 *             python.PyThread_free_lock(self._lock)
 *         if self._c_ctxt is not NULL:             # <<<<<<<<<<<<<<
 *             xmlparser.xmlFreeParserCtxt(self._c_ctxt)
 * 
 */
  __pyx_t_1 = (((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_v_self)->_c_ctxt != NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":506
 *             python.PyThread_free_lock(self._lock)
 *         if self._c_ctxt is not NULL:
 *             xmlparser.xmlFreeParserCtxt(self._c_ctxt)             # <<<<<<<<<<<<<<
 * 
 *     cdef _ParserContext _copy(self):
 */
    xmlFreeParserCtxt(((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_v_self)->_c_ctxt);
    goto __pyx_L7;
  }
  __pyx_L7:;

  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":508
 *             xmlparser.xmlFreeParserCtxt(self._c_ctxt)
 * 
 *     cdef _ParserContext _copy(self):             # <<<<<<<<<<<<<<
 *         cdef _ParserContext context
 *         context = self.__class__()
 */

static  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_f_4lxml_5etree_14_ParserContext__copy(struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_context;
  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_copy");
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":510
 *     cdef _ParserContext _copy(self):
 *         cdef _ParserContext context
 *         context = self.__class__()             # <<<<<<<<<<<<<<
 *         context._validator = self._validator.copy()
 *         _initParserContext(context, self._resolvers._copy(), NULL)
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s____class__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4lxml_5etree__ParserContext))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_v_context));
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":511
 *         cdef _ParserContext context
 *         context = self.__class__()
 *         context._validator = self._validator.copy()             # <<<<<<<<<<<<<<
 *         _initParserContext(context, self._resolvers._copy(), NULL)
 *         return context
 */
  __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__ParserSchemaValidationContext *)__pyx_v_self->_validator->__pyx_vtab)->copy(__pyx_v_self->_validator)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_context->_validator);
  __Pyx_DECREF(((PyObject *)__pyx_v_context->_validator));
  __pyx_v_context->_validator = ((struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":512
 *         context = self.__class__()
 *         context._validator = self._validator.copy()
 *         _initParserContext(context, self._resolvers._copy(), NULL)             # <<<<<<<<<<<<<<
 *         return context
 * 
 */
  __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__ResolverRegistry *)__pyx_v_self->__pyx_base._resolvers->__pyx_vtab)->_copy(__pyx_v_self->__pyx_base._resolvers)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __pyx_f_4lxml_5etree__initParserContext(__pyx_v_context, ((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":513
 *         context._validator = self._validator.copy()
 *         _initParserContext(context, self._resolvers._copy(), NULL)
 *         return context             # <<<<<<<<<<<<<<
 * 
 *     cdef void _initParserContext(self, xmlparser.xmlParserCtxt* c_ctxt):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_context));
  __pyx_r = __pyx_v_context;
  goto __pyx_L0;

  __pyx_r = ((struct __pyx_obj_4lxml_5etree__ParserContext *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ParserContext._copy");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_context);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":515
 *         return context
 * 
 *     cdef void _initParserContext(self, xmlparser.xmlParserCtxt* c_ctxt):             # <<<<<<<<<<<<<<
 *         self._c_ctxt = c_ctxt
 *         c_ctxt._private = <void*>self
 */

static  void __pyx_f_4lxml_5etree_14_ParserContext__initParserContext(struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_self, xmlParserCtxt *__pyx_v_c_ctxt) {
  __Pyx_RefNannySetupContext("_initParserContext");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":516
 * 
 *     cdef void _initParserContext(self, xmlparser.xmlParserCtxt* c_ctxt):
 *         self._c_ctxt = c_ctxt             # <<<<<<<<<<<<<<
 *         c_ctxt._private = <void*>self
 * 
 */
  __pyx_v_self->_c_ctxt = __pyx_v_c_ctxt;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":517
 *     cdef void _initParserContext(self, xmlparser.xmlParserCtxt* c_ctxt):
 *         self._c_ctxt = c_ctxt
 *         c_ctxt._private = <void*>self             # <<<<<<<<<<<<<<
 * 
 *     cdef void _resetParserContext(self):
 */
  __pyx_v_c_ctxt->_private = ((void *)__pyx_v_self);

  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":519
 *         c_ctxt._private = <void*>self
 * 
 *     cdef void _resetParserContext(self):             # <<<<<<<<<<<<<<
 *         if self._c_ctxt is not NULL:
 *             if self._c_ctxt.html:
 */

static  void __pyx_f_4lxml_5etree_14_ParserContext__resetParserContext(struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_self) {
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("_resetParserContext");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":520
 * 
 *     cdef void _resetParserContext(self):
 *         if self._c_ctxt is not NULL:             # <<<<<<<<<<<<<<
 *             if self._c_ctxt.html:
 *                 htmlparser.htmlCtxtReset(self._c_ctxt)
 */
  __pyx_t_1 = (__pyx_v_self->_c_ctxt != NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":521
 *     cdef void _resetParserContext(self):
 *         if self._c_ctxt is not NULL:
 *             if self._c_ctxt.html:             # <<<<<<<<<<<<<<
 *                 htmlparser.htmlCtxtReset(self._c_ctxt)
 *                 self._c_ctxt.disableSAX = 0 # work around bug in libxml2
 */
    if (__pyx_v_self->_c_ctxt->html) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":522
 *         if self._c_ctxt is not NULL:
 *             if self._c_ctxt.html:
 *                 htmlparser.htmlCtxtReset(self._c_ctxt)             # <<<<<<<<<<<<<<
 *                 self._c_ctxt.disableSAX = 0 # work around bug in libxml2
 *             elif self._c_ctxt.spaceTab is not NULL or \
 */
      htmlCtxtReset(__pyx_v_self->_c_ctxt);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":523
 *             if self._c_ctxt.html:
 *                 htmlparser.htmlCtxtReset(self._c_ctxt)
 *                 self._c_ctxt.disableSAX = 0 # work around bug in libxml2             # <<<<<<<<<<<<<<
 *             elif self._c_ctxt.spaceTab is not NULL or \
 *                     _LIBXML_VERSION_INT >= 20629: # work around bug in libxml2
 */
      __pyx_v_self->_c_ctxt->disableSAX = 0;
      goto __pyx_L4;
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":524
 *                 htmlparser.htmlCtxtReset(self._c_ctxt)
 *                 self._c_ctxt.disableSAX = 0 # work around bug in libxml2
 *             elif self._c_ctxt.spaceTab is not NULL or \             # <<<<<<<<<<<<<<
 *                     _LIBXML_VERSION_INT >= 20629: # work around bug in libxml2
 *                 xmlparser.xmlClearParserCtxt(self._c_ctxt)
 */
    __pyx_t_1 = (__pyx_v_self->_c_ctxt->spaceTab != NULL);
    if (!__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":525
 *                 self._c_ctxt.disableSAX = 0 # work around bug in libxml2
 *             elif self._c_ctxt.spaceTab is not NULL or \
 *                     _LIBXML_VERSION_INT >= 20629: # work around bug in libxml2             # <<<<<<<<<<<<<<
 *                 xmlparser.xmlClearParserCtxt(self._c_ctxt)
 * 
 */
      __pyx_t_2 = (__pyx_v_4lxml_5etree__LIBXML_VERSION_INT >= 20629);
      __pyx_t_3 = __pyx_t_2;
    } else {
      __pyx_t_3 = __pyx_t_1;
    }
    if (__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":526
 *             elif self._c_ctxt.spaceTab is not NULL or \
 *                     _LIBXML_VERSION_INT >= 20629: # work around bug in libxml2
 *                 xmlparser.xmlClearParserCtxt(self._c_ctxt)             # <<<<<<<<<<<<<<
 * 
 *     cdef int prepare(self) except -1:
 */
      xmlClearParserCtxt(__pyx_v_self->_c_ctxt);
      goto __pyx_L4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":528
 *                 xmlparser.xmlClearParserCtxt(self._c_ctxt)
 * 
 *     cdef int prepare(self) except -1:             # <<<<<<<<<<<<<<
 *         cdef int result
 *         if config.ENABLE_THREADING and self._lock is not NULL:
 */

static  int __pyx_f_4lxml_5etree_14_ParserContext_prepare(struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_self) {
  int __pyx_v_result;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("prepare");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":530
 *     cdef int prepare(self) except -1:
 *         cdef int result
 *         if config.ENABLE_THREADING and self._lock is not NULL:             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 result = python.PyThread_acquire_lock(
 */
  if (ENABLE_THREADING) {
    __pyx_t_1 = (__pyx_v_self->_lock != NULL);
    __pyx_t_2 = __pyx_t_1;
  } else {
    __pyx_t_2 = ENABLE_THREADING;
  }
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":531
 *         cdef int result
 *         if config.ENABLE_THREADING and self._lock is not NULL:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 result = python.PyThread_acquire_lock(
 *                     self._lock, python.WAIT_LOCK)
 */
    {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      #endif
      Py_UNBLOCK_THREADS
      /*try:*/ {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":533
 *             with nogil:
 *                 result = python.PyThread_acquire_lock(
 *                     self._lock, python.WAIT_LOCK)             # <<<<<<<<<<<<<<
 *             if result == 0:
 *                 raise ParserError, u"parser locking failed"
 */
        __pyx_v_result = PyThread_acquire_lock(__pyx_v_self->_lock, WAIT_LOCK);
      }

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":531
 *         cdef int result
 *         if config.ENABLE_THREADING and self._lock is not NULL:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 result = python.PyThread_acquire_lock(
 *                     self._lock, python.WAIT_LOCK)
 */
      /*finally:*/ {
        Py_BLOCK_THREADS
      }
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":534
 *                 result = python.PyThread_acquire_lock(
 *                     self._lock, python.WAIT_LOCK)
 *             if result == 0:             # <<<<<<<<<<<<<<
 *                 raise ParserError, u"parser locking failed"
 *         self._error_log.connect()
 */
    __pyx_t_2 = (__pyx_v_result == 0);
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":535
 *                     self._lock, python.WAIT_LOCK)
 *             if result == 0:
 *                 raise ParserError, u"parser locking failed"             # <<<<<<<<<<<<<<
 *         self._error_log.connect()
 *         if self._validator is not None:
 */
      __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__ParserError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_Raise(__pyx_t_3, ((PyObject *)__pyx_kp_u_169), 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      {__pyx_filename = __pyx_f[3]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L7;
    }
    __pyx_L7:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":536
 *             if result == 0:
 *                 raise ParserError, u"parser locking failed"
 *         self._error_log.connect()             # <<<<<<<<<<<<<<
 *         if self._validator is not None:
 *             self._validator.connect(self._c_ctxt)
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)__pyx_v_self->_error_log->__pyx_base.__pyx_base.__pyx_vtab)->connect(__pyx_v_self->_error_log);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":537
 *                 raise ParserError, u"parser locking failed"
 *         self._error_log.connect()
 *         if self._validator is not None:             # <<<<<<<<<<<<<<
 *             self._validator.connect(self._c_ctxt)
 *         return 0
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_self->_validator) != Py_None);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":538
 *         self._error_log.connect()
 *         if self._validator is not None:
 *             self._validator.connect(self._c_ctxt)             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
    __pyx_t_4 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserSchemaValidationContext *)__pyx_v_self->_validator->__pyx_vtab)->connect(__pyx_v_self->_validator, __pyx_v_self->_c_ctxt); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L8;
  }
  __pyx_L8:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":539
 *         if self._validator is not None:
 *             self._validator.connect(self._c_ctxt)
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cdef int cleanup(self) except -1:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ParserContext.prepare");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":541
 *         return 0
 * 
 *     cdef int cleanup(self) except -1:             # <<<<<<<<<<<<<<
 *         if self._validator is not None:
 *             self._validator.disconnect()
 */

static  int __pyx_f_4lxml_5etree_14_ParserContext_cleanup(struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_self) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("cleanup");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":542
 * 
 *     cdef int cleanup(self) except -1:
 *         if self._validator is not None:             # <<<<<<<<<<<<<<
 *             self._validator.disconnect()
 *         self._resetParserContext()
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_self->_validator) != Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":543
 *     cdef int cleanup(self) except -1:
 *         if self._validator is not None:
 *             self._validator.disconnect()             # <<<<<<<<<<<<<<
 *         self._resetParserContext()
 *         self.clear()
 */
    ((struct __pyx_vtabstruct_4lxml_5etree__ParserSchemaValidationContext *)__pyx_v_self->_validator->__pyx_vtab)->disconnect(__pyx_v_self->_validator);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":544
 *         if self._validator is not None:
 *             self._validator.disconnect()
 *         self._resetParserContext()             # <<<<<<<<<<<<<<
 *         self.clear()
 *         self._error_log.disconnect()
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->_resetParserContext(__pyx_v_self);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":545
 *             self._validator.disconnect()
 *         self._resetParserContext()
 *         self.clear()             # <<<<<<<<<<<<<<
 *         self._error_log.disconnect()
 *         if config.ENABLE_THREADING and self._lock is not NULL:
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.clear(((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_v_self));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":546
 *         self._resetParserContext()
 *         self.clear()
 *         self._error_log.disconnect()             # <<<<<<<<<<<<<<
 *         if config.ENABLE_THREADING and self._lock is not NULL:
 *             python.PyThread_release_lock(self._lock)
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)__pyx_v_self->_error_log->__pyx_base.__pyx_base.__pyx_vtab)->disconnect(__pyx_v_self->_error_log);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":547
 *         self.clear()
 *         self._error_log.disconnect()
 *         if config.ENABLE_THREADING and self._lock is not NULL:             # <<<<<<<<<<<<<<
 *             python.PyThread_release_lock(self._lock)
 *         return 0
 */
  if (ENABLE_THREADING) {
    __pyx_t_1 = (__pyx_v_self->_lock != NULL);
    __pyx_t_2 = __pyx_t_1;
  } else {
    __pyx_t_2 = ENABLE_THREADING;
  }
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":548
 *         self._error_log.disconnect()
 *         if config.ENABLE_THREADING and self._lock is not NULL:
 *             python.PyThread_release_lock(self._lock)             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
    PyThread_release_lock(__pyx_v_self->_lock);
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":549
 *         if config.ENABLE_THREADING and self._lock is not NULL:
 *             python.PyThread_release_lock(self._lock)
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cdef object _handleParseResult(self, _BaseParser parser,
 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":551
 *         return 0
 * 
 *     cdef object _handleParseResult(self, _BaseParser parser,             # <<<<<<<<<<<<<<
 *                                    xmlDoc* result, filename):
 *         cdef xmlDoc* c_doc
 */

static  PyObject *__pyx_f_4lxml_5etree_14_ParserContext__handleParseResult(struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_self, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser, xmlDoc *__pyx_v_result, PyObject *__pyx_v_filename) {
  xmlDoc *__pyx_v_c_doc;
  int __pyx_v_recover;
  PyObject *__pyx_r = NULL;
  xmlDoc *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_handleParseResult");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":555
 *         cdef xmlDoc* c_doc
 *         cdef bint recover
 *         recover = parser._parse_options & xmlparser.XML_PARSE_RECOVER             # <<<<<<<<<<<<<<
 *         c_doc = _handleParseResult(self, self._c_ctxt, result,
 *                                    filename, recover)
 */
  __pyx_v_recover = (__pyx_v_parser->_parse_options & XML_PARSE_RECOVER);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":557
 *         recover = parser._parse_options & xmlparser.XML_PARSE_RECOVER
 *         c_doc = _handleParseResult(self, self._c_ctxt, result,
 *                                    filename, recover)             # <<<<<<<<<<<<<<
 *         return _documentFactory(c_doc, parser)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__handleParseResult(__pyx_v_self, __pyx_v_self->_c_ctxt, __pyx_v_result, __pyx_v_filename, __pyx_v_recover); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_doc = __pyx_t_1;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":558
 *         c_doc = _handleParseResult(self, self._c_ctxt, result,
 *                                    filename, recover)
 *         return _documentFactory(c_doc, parser)             # <<<<<<<<<<<<<<
 * 
 *     cdef xmlDoc* _handleParseResultDoc(self, _BaseParser parser,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, __pyx_v_parser)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ParserContext._handleParseResult");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":560
 *         return _documentFactory(c_doc, parser)
 * 
 *     cdef xmlDoc* _handleParseResultDoc(self, _BaseParser parser,             # <<<<<<<<<<<<<<
 *                                        xmlDoc* result, filename) except NULL:
 *         cdef bint recover
 */

static  xmlDoc *__pyx_f_4lxml_5etree_14_ParserContext__handleParseResultDoc(struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_self, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser, xmlDoc *__pyx_v_result, PyObject *__pyx_v_filename) {
  int __pyx_v_recover;
  xmlDoc *__pyx_r;
  xmlDoc *__pyx_t_1;
  __Pyx_RefNannySetupContext("_handleParseResultDoc");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":563
 *                                        xmlDoc* result, filename) except NULL:
 *         cdef bint recover
 *         recover = parser._parse_options & xmlparser.XML_PARSE_RECOVER             # <<<<<<<<<<<<<<
 *         return _handleParseResult(self, self._c_ctxt, result,
 *                                    filename, recover)
 */
  __pyx_v_recover = (__pyx_v_parser->_parse_options & XML_PARSE_RECOVER);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":565
 *         recover = parser._parse_options & xmlparser.XML_PARSE_RECOVER
 *         return _handleParseResult(self, self._c_ctxt, result,
 *                                    filename, recover)             # <<<<<<<<<<<<<<
 * 
 * cdef _initParserContext(_ParserContext context,
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__handleParseResult(__pyx_v_self, __pyx_v_self->_c_ctxt, __pyx_v_result, __pyx_v_filename, __pyx_v_recover); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._ParserContext._handleParseResultDoc");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":567
 *                                    filename, recover)
 * 
 * cdef _initParserContext(_ParserContext context,             # <<<<<<<<<<<<<<
 *                         _ResolverRegistry resolvers,
 *                         xmlparser.xmlParserCtxt* c_ctxt):
 */

static  PyObject *__pyx_f_4lxml_5etree__initParserContext(struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_context, struct __pyx_obj_4lxml_5etree__ResolverRegistry *__pyx_v_resolvers, xmlParserCtxt *__pyx_v_c_ctxt) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("_initParserContext");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":570
 *                         _ResolverRegistry resolvers,
 *                         xmlparser.xmlParserCtxt* c_ctxt):
 *     _initResolverContext(context, resolvers)             # <<<<<<<<<<<<<<
 *     if c_ctxt is not NULL:
 *         context._initParserContext(c_ctxt)
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__initResolverContext(((struct __pyx_obj_4lxml_5etree__ResolverContext *)__pyx_v_context), __pyx_v_resolvers); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":571
 *                         xmlparser.xmlParserCtxt* c_ctxt):
 *     _initResolverContext(context, resolvers)
 *     if c_ctxt is not NULL:             # <<<<<<<<<<<<<<
 *         context._initParserContext(c_ctxt)
 * 
 */
  __pyx_t_2 = (__pyx_v_c_ctxt != NULL);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":572
 *     _initResolverContext(context, resolvers)
 *     if c_ctxt is not NULL:
 *         context._initParserContext(c_ctxt)             # <<<<<<<<<<<<<<
 * 
 * cdef int _raiseParseError(xmlparser.xmlParserCtxt* ctxt, filename,
 */
    ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->_initParserContext(__pyx_v_context, __pyx_v_c_ctxt);
    goto __pyx_L3;
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._initParserContext");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":574
 *         context._initParserContext(c_ctxt)
 * 
 * cdef int _raiseParseError(xmlparser.xmlParserCtxt* ctxt, filename,             # <<<<<<<<<<<<<<
 *                           _ErrorLog error_log) except 0:
 *     if filename is not None and \
 */

static  int __pyx_f_4lxml_5etree__raiseParseError(xmlParserCtxt *__pyx_v_ctxt, PyObject *__pyx_v_filename, struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_error_log) {
  PyObject *__pyx_v_message;
  int __pyx_v_code;
  int __pyx_v_line;
  int __pyx_v_column;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("_raiseParseError");
  __pyx_v_message = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":576
 * cdef int _raiseParseError(xmlparser.xmlParserCtxt* ctxt, filename,
 *                           _ErrorLog error_log) except 0:
 *     if filename is not None and \             # <<<<<<<<<<<<<<
 *            ctxt.lastError.domain == xmlerror.XML_FROM_IO:
 *         if ctxt.lastError.message is not NULL:
 */
  __pyx_t_1 = (__pyx_v_filename != Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":577
 *                           _ErrorLog error_log) except 0:
 *     if filename is not None and \
 *            ctxt.lastError.domain == xmlerror.XML_FROM_IO:             # <<<<<<<<<<<<<<
 *         if ctxt.lastError.message is not NULL:
 *             message = u"Error reading file '%s': %s" % (
 */
    __pyx_t_2 = (__pyx_v_ctxt->lastError.domain == XML_FROM_IO);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":578
 *     if filename is not None and \
 *            ctxt.lastError.domain == xmlerror.XML_FROM_IO:
 *         if ctxt.lastError.message is not NULL:             # <<<<<<<<<<<<<<
 *             message = u"Error reading file '%s': %s" % (
 *                 filename, (ctxt.lastError.message).strip())
 */
    __pyx_t_3 = (__pyx_v_ctxt->lastError.message != NULL);
    if (__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":580
 *         if ctxt.lastError.message is not NULL:
 *             message = u"Error reading file '%s': %s" % (
 *                 filename, (ctxt.lastError.message).strip())             # <<<<<<<<<<<<<<
 *         else:
 *             message = u"Error reading '%s'" % filename
 */
      __pyx_t_4 = PyBytes_FromString(__pyx_v_ctxt->lastError.message); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_t_4), __pyx_n_s__strip); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
      __Pyx_INCREF(__pyx_v_filename);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_filename);
      __Pyx_GIVEREF(__pyx_v_filename);
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_170), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_v_message);
      __pyx_v_message = ((PyObject *)__pyx_t_4);
      __pyx_t_4 = 0;
      goto __pyx_L4;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":582
 *                 filename, (ctxt.lastError.message).strip())
 *         else:
 *             message = u"Error reading '%s'" % filename             # <<<<<<<<<<<<<<
 *         raise IOError, message
 *     elif error_log:
 */
      __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_171), __pyx_v_filename); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      __Pyx_DECREF(__pyx_v_message);
      __pyx_v_message = ((PyObject *)__pyx_t_4);
      __pyx_t_4 = 0;
    }
    __pyx_L4:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":583
 *         else:
 *             message = u"Error reading '%s'" % filename
 *         raise IOError, message             # <<<<<<<<<<<<<<
 *     elif error_log:
 *         raise error_log._buildParseException(
 */
    __Pyx_Raise(__pyx_builtin_IOError, __pyx_v_message, 0);
    {__pyx_filename = __pyx_f[3]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":584
 *             message = u"Error reading '%s'" % filename
 *         raise IOError, message
 *     elif error_log:             # <<<<<<<<<<<<<<
 *         raise error_log._buildParseException(
 *             XMLSyntaxError, u"Document is not well formed")
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_error_log)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":586
 *     elif error_log:
 *         raise error_log._buildParseException(
 *             XMLSyntaxError, u"Document is not well formed")             # <<<<<<<<<<<<<<
 *     elif ctxt.lastError.message is not NULL:
 *         message = (ctxt.lastError.message).strip()
 */
    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__XMLSyntaxError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)__pyx_v_error_log->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._buildParseException(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_error_log), __pyx_t_4, ((PyObject *)__pyx_kp_u_173)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_5, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    {__pyx_filename = __pyx_f[3]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":587
 *         raise error_log._buildParseException(
 *             XMLSyntaxError, u"Document is not well formed")
 *     elif ctxt.lastError.message is not NULL:             # <<<<<<<<<<<<<<
 *         message = (ctxt.lastError.message).strip()
 *         code = ctxt.lastError.code
 */
  __pyx_t_3 = (__pyx_v_ctxt->lastError.message != NULL);
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":588
 *             XMLSyntaxError, u"Document is not well formed")
 *     elif ctxt.lastError.message is not NULL:
 *         message = (ctxt.lastError.message).strip()             # <<<<<<<<<<<<<<
 *         code = ctxt.lastError.code
 *         line = ctxt.lastError.line
 */
    __pyx_t_5 = PyBytes_FromString(__pyx_v_ctxt->lastError.message); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
    __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_t_5), __pyx_n_s__strip); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_v_message);
    __pyx_v_message = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":589
 *     elif ctxt.lastError.message is not NULL:
 *         message = (ctxt.lastError.message).strip()
 *         code = ctxt.lastError.code             # <<<<<<<<<<<<<<
 *         line = ctxt.lastError.line
 *         column = ctxt.lastError.int2
 */
    __pyx_v_code = __pyx_v_ctxt->lastError.code;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":590
 *         message = (ctxt.lastError.message).strip()
 *         code = ctxt.lastError.code
 *         line = ctxt.lastError.line             # <<<<<<<<<<<<<<
 *         column = ctxt.lastError.int2
 *         if ctxt.lastError.line > 0:
 */
    __pyx_v_line = __pyx_v_ctxt->lastError.line;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":591
 *         code = ctxt.lastError.code
 *         line = ctxt.lastError.line
 *         column = ctxt.lastError.int2             # <<<<<<<<<<<<<<
 *         if ctxt.lastError.line > 0:
 *             message = u"line %d: %s" % (line, message)
 */
    __pyx_v_column = __pyx_v_ctxt->lastError.int2;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":592
 *         line = ctxt.lastError.line
 *         column = ctxt.lastError.int2
 *         if ctxt.lastError.line > 0:             # <<<<<<<<<<<<<<
 *             message = u"line %d: %s" % (line, message)
 *         raise XMLSyntaxError(message, code, line, column)
 */
    __pyx_t_3 = (__pyx_v_ctxt->lastError.line > 0);
    if (__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":593
 *         column = ctxt.lastError.int2
 *         if ctxt.lastError.line > 0:
 *             message = u"line %d: %s" % (line, message)             # <<<<<<<<<<<<<<
 *         raise XMLSyntaxError(message, code, line, column)
 *     else:
 */
      __pyx_t_5 = PyInt_FromLong(__pyx_v_line); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_v_message);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_message);
      __Pyx_GIVEREF(__pyx_v_message);
      __pyx_t_5 = 0;
      __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_174), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_v_message);
      __pyx_v_message = ((PyObject *)__pyx_t_5);
      __pyx_t_5 = 0;
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":594
 *         if ctxt.lastError.line > 0:
 *             message = u"line %d: %s" % (line, message)
 *         raise XMLSyntaxError(message, code, line, column)             # <<<<<<<<<<<<<<
 *     else:
 *         raise XMLSyntaxError(None, xmlerror.XML_ERR_INTERNAL_ERROR, 0, 0)
 */
    __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__XMLSyntaxError); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyInt_FromLong(__pyx_v_code); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = PyInt_FromLong(__pyx_v_line); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyInt_FromLong(__pyx_v_column); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = PyTuple_New(4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_8));
    __Pyx_INCREF(__pyx_v_message);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_message);
    __Pyx_GIVEREF(__pyx_v_message);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    __pyx_t_4 = 0;
    __pyx_t_6 = 0;
    __pyx_t_7 = 0;
    __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
    __Pyx_Raise(__pyx_t_7, 0, 0);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    {__pyx_filename = __pyx_f[3]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":596
 *         raise XMLSyntaxError(message, code, line, column)
 *     else:
 *         raise XMLSyntaxError(None, xmlerror.XML_ERR_INTERNAL_ERROR, 0, 0)             # <<<<<<<<<<<<<<
 * 
 * cdef xmlDoc* _handleParseResult(_ParserContext context,
 */
    __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__XMLSyntaxError); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = PyInt_FromLong(XML_ERR_INTERNAL_ERROR); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
    __Pyx_INCREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_5, 0, Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_8);
    __Pyx_INCREF(__pyx_int_0);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    __Pyx_INCREF(__pyx_int_0);
    PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    __pyx_t_8 = 0;
    __pyx_t_8 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __Pyx_Raise(__pyx_t_8, 0, 0);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    {__pyx_filename = __pyx_f[3]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L3:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("lxml.etree._raiseParseError");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_message);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":598
 *         raise XMLSyntaxError(None, xmlerror.XML_ERR_INTERNAL_ERROR, 0, 0)
 * 
 * cdef xmlDoc* _handleParseResult(_ParserContext context,             # <<<<<<<<<<<<<<
 *                                 xmlparser.xmlParserCtxt* c_ctxt,
 *                                 xmlDoc* result, filename,
 */

static  xmlDoc *__pyx_f_4lxml_5etree__handleParseResult(struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_context, xmlParserCtxt *__pyx_v_c_ctxt, xmlDoc *__pyx_v_result, PyObject *__pyx_v_filename, int __pyx_v_recover) {
  int __pyx_v_well_formed;
  PyObject *__pyx_v_error;
  xmlDoc *__pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  __Pyx_RefNannySetupContext("_handleParseResult");
  __pyx_v_error = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":603
 *                                 bint recover) except NULL:
 *     cdef bint well_formed
 *     if result is not NULL:             # <<<<<<<<<<<<<<
 *         __GLOBAL_PARSER_CONTEXT.initDocDict(result)
 * 
 */
  __pyx_t_1 = (__pyx_v_result != NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":604
 *     cdef bint well_formed
 *     if result is not NULL:
 *         __GLOBAL_PARSER_CONTEXT.initDocDict(result)             # <<<<<<<<<<<<<<
 * 
 *     if c_ctxt.myDoc is not NULL:
 */
    ((struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext *)__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT->__pyx_vtab)->initDocDict(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, __pyx_v_result);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":606
 *         __GLOBAL_PARSER_CONTEXT.initDocDict(result)
 * 
 *     if c_ctxt.myDoc is not NULL:             # <<<<<<<<<<<<<<
 *         if c_ctxt.myDoc is not result:
 *             __GLOBAL_PARSER_CONTEXT.initDocDict(c_ctxt.myDoc)
 */
  __pyx_t_1 = (__pyx_v_c_ctxt->myDoc != NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":607
 * 
 *     if c_ctxt.myDoc is not NULL:
 *         if c_ctxt.myDoc is not result:             # <<<<<<<<<<<<<<
 *             __GLOBAL_PARSER_CONTEXT.initDocDict(c_ctxt.myDoc)
 *             tree.xmlFreeDoc(c_ctxt.myDoc)
 */
    __pyx_t_1 = (__pyx_v_c_ctxt->myDoc != __pyx_v_result);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":608
 *     if c_ctxt.myDoc is not NULL:
 *         if c_ctxt.myDoc is not result:
 *             __GLOBAL_PARSER_CONTEXT.initDocDict(c_ctxt.myDoc)             # <<<<<<<<<<<<<<
 *             tree.xmlFreeDoc(c_ctxt.myDoc)
 *         c_ctxt.myDoc = NULL
 */
      ((struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext *)__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT->__pyx_vtab)->initDocDict(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, __pyx_v_c_ctxt->myDoc);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":609
 *         if c_ctxt.myDoc is not result:
 *             __GLOBAL_PARSER_CONTEXT.initDocDict(c_ctxt.myDoc)
 *             tree.xmlFreeDoc(c_ctxt.myDoc)             # <<<<<<<<<<<<<<
 *         c_ctxt.myDoc = NULL
 * 
 */
      xmlFreeDoc(__pyx_v_c_ctxt->myDoc);
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":610
 *             __GLOBAL_PARSER_CONTEXT.initDocDict(c_ctxt.myDoc)
 *             tree.xmlFreeDoc(c_ctxt.myDoc)
 *         c_ctxt.myDoc = NULL             # <<<<<<<<<<<<<<
 * 
 *     if result is not NULL:
 */
    __pyx_v_c_ctxt->myDoc = NULL;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":612
 *         c_ctxt.myDoc = NULL
 * 
 *     if result is not NULL:             # <<<<<<<<<<<<<<
 *         if context._validator is not None and \
 *                 not context._validator.isvalid():
 */
  __pyx_t_1 = (__pyx_v_result != NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":613
 * 
 *     if result is not NULL:
 *         if context._validator is not None and \             # <<<<<<<<<<<<<<
 *                 not context._validator.isvalid():
 *             well_formed = 0 # actually not 'valid', but anyway ...
 */
    __pyx_t_1 = (((PyObject *)__pyx_v_context->_validator) != Py_None);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":614
 *     if result is not NULL:
 *         if context._validator is not None and \
 *                 not context._validator.isvalid():             # <<<<<<<<<<<<<<
 *             well_formed = 0 # actually not 'valid', but anyway ...
 *         elif recover or (c_ctxt.wellFormed and \
 */
      __pyx_t_2 = (!((struct __pyx_vtabstruct_4lxml_5etree__ParserSchemaValidationContext *)__pyx_v_context->_validator->__pyx_vtab)->isvalid(__pyx_v_context->_validator));
      __pyx_t_3 = __pyx_t_2;
    } else {
      __pyx_t_3 = __pyx_t_1;
    }
    if (__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":615
 *         if context._validator is not None and \
 *                 not context._validator.isvalid():
 *             well_formed = 0 # actually not 'valid', but anyway ...             # <<<<<<<<<<<<<<
 *         elif recover or (c_ctxt.wellFormed and \
 *                              c_ctxt.lastError.level < xmlerror.XML_ERR_ERROR):
 */
      __pyx_v_well_formed = 0;
      goto __pyx_L7;
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":616
 *                 not context._validator.isvalid():
 *             well_formed = 0 # actually not 'valid', but anyway ...
 *         elif recover or (c_ctxt.wellFormed and \             # <<<<<<<<<<<<<<
 *                              c_ctxt.lastError.level < xmlerror.XML_ERR_ERROR):
 *             well_formed = 1
 */
    if (!__pyx_v_recover) {
      if (__pyx_v_c_ctxt->wellFormed) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":617
 *             well_formed = 0 # actually not 'valid', but anyway ...
 *         elif recover or (c_ctxt.wellFormed and \
 *                              c_ctxt.lastError.level < xmlerror.XML_ERR_ERROR):             # <<<<<<<<<<<<<<
 *             well_formed = 1
 *         elif not c_ctxt.replaceEntities and not c_ctxt.validate \
 */
        __pyx_t_3 = (__pyx_v_c_ctxt->lastError.level < XML_ERR_ERROR);
        __pyx_t_1 = __pyx_t_3;
      } else {
        __pyx_t_1 = __pyx_v_c_ctxt->wellFormed;
      }
      __pyx_t_3 = __pyx_t_1;
    } else {
      __pyx_t_3 = __pyx_v_recover;
    }
    if (__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":618
 *         elif recover or (c_ctxt.wellFormed and \
 *                              c_ctxt.lastError.level < xmlerror.XML_ERR_ERROR):
 *             well_formed = 1             # <<<<<<<<<<<<<<
 *         elif not c_ctxt.replaceEntities and not c_ctxt.validate \
 *                  and context is not None:
 */
      __pyx_v_well_formed = 1;
      goto __pyx_L7;
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":619
 *                              c_ctxt.lastError.level < xmlerror.XML_ERR_ERROR):
 *             well_formed = 1
 *         elif not c_ctxt.replaceEntities and not c_ctxt.validate \             # <<<<<<<<<<<<<<
 *                  and context is not None:
 *             # in this mode, we ignore errors about undefined entities
 */
    __pyx_t_3 = (!__pyx_v_c_ctxt->replaceEntities);
    if (__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":620
 *             well_formed = 1
 *         elif not c_ctxt.replaceEntities and not c_ctxt.validate \
 *                  and context is not None:             # <<<<<<<<<<<<<<
 *             # in this mode, we ignore errors about undefined entities
 *             for error in context._error_log.filter_from_errors():
 */
      __pyx_t_1 = (!__pyx_v_c_ctxt->validate);
      if (__pyx_t_1) {
        __pyx_t_2 = (((PyObject *)__pyx_v_context) != Py_None);
        __pyx_t_4 = __pyx_t_2;
      } else {
        __pyx_t_4 = __pyx_t_1;
      }
      __pyx_t_1 = __pyx_t_4;
    } else {
      __pyx_t_1 = __pyx_t_3;
    }
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":622
 *                  and context is not None:
 *             # in this mode, we ignore errors about undefined entities
 *             for error in context._error_log.filter_from_errors():             # <<<<<<<<<<<<<<
 *                 if error.type != ErrorTypes.WAR_UNDECLARED_ENTITY and \
 *                        error.type != ErrorTypes.ERR_UNDECLARED_ENTITY:
 */
      __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_context->_error_log), __pyx_n_s__filter_from_errors); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (PyList_CheckExact(__pyx_t_7) || PyTuple_CheckExact(__pyx_t_7)) {
        __pyx_t_5 = 0; __pyx_t_6 = __pyx_t_7; __Pyx_INCREF(__pyx_t_6);
      } else {
        __pyx_t_5 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
      }
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      for (;;) {
        if (likely(PyList_CheckExact(__pyx_t_6))) {
          if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_6)) break;
          __pyx_t_7 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++;
        } else if (likely(PyTuple_CheckExact(__pyx_t_6))) {
          if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
          __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++;
        } else {
          __pyx_t_7 = PyIter_Next(__pyx_t_6);
          if (!__pyx_t_7) {
            if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            break;
          }
          __Pyx_GOTREF(__pyx_t_7);
        }
        __Pyx_DECREF(__pyx_v_error);
        __pyx_v_error = __pyx_t_7;
        __pyx_t_7 = 0;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":623
 *             # in this mode, we ignore errors about undefined entities
 *             for error in context._error_log.filter_from_errors():
 *                 if error.type != ErrorTypes.WAR_UNDECLARED_ENTITY and \             # <<<<<<<<<<<<<<
 *                        error.type != ErrorTypes.ERR_UNDECLARED_ENTITY:
 *                     well_formed = 0
 */
        __pyx_t_7 = PyObject_GetAttr(__pyx_v_error, __pyx_n_s__type); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__ErrorTypes); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_9 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s_175); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_8 = PyObject_RichCompare(__pyx_t_7, __pyx_t_9, Py_NE); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (__pyx_t_1) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":624
 *             for error in context._error_log.filter_from_errors():
 *                 if error.type != ErrorTypes.WAR_UNDECLARED_ENTITY and \
 *                        error.type != ErrorTypes.ERR_UNDECLARED_ENTITY:             # <<<<<<<<<<<<<<
 *                     well_formed = 0
 *                     break
 */
          __pyx_t_8 = PyObject_GetAttr(__pyx_v_error, __pyx_n_s__type); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__ErrorTypes); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_7 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s_176); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_t_9 = PyObject_RichCompare(__pyx_t_8, __pyx_t_7, Py_NE); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_t_4 = __pyx_t_3;
        } else {
          __pyx_t_4 = __pyx_t_1;
        }
        if (__pyx_t_4) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":625
 *                 if error.type != ErrorTypes.WAR_UNDECLARED_ENTITY and \
 *                        error.type != ErrorTypes.ERR_UNDECLARED_ENTITY:
 *                     well_formed = 0             # <<<<<<<<<<<<<<
 *                     break
 *             else:
 */
          __pyx_v_well_formed = 0;

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":626
 *                        error.type != ErrorTypes.ERR_UNDECLARED_ENTITY:
 *                     well_formed = 0
 *                     break             # <<<<<<<<<<<<<<
 *             else:
 *                 well_formed = 1
 */
          goto __pyx_L9_break;
          goto __pyx_L10;
        }
        __pyx_L10:;
      }
      /*else*/ {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":628
 *                     break
 *             else:
 *                 well_formed = 1             # <<<<<<<<<<<<<<
 *         else:
 *             well_formed = 0
 */
        __pyx_v_well_formed = 1;
      }
      __pyx_L9_break:;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L7;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":630
 *                 well_formed = 1
 *         else:
 *             well_formed = 0             # <<<<<<<<<<<<<<
 * 
 *         if not well_formed:
 */
      __pyx_v_well_formed = 0;
    }
    __pyx_L7:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":632
 *             well_formed = 0
 * 
 *         if not well_formed:             # <<<<<<<<<<<<<<
 *             # free broken document
 *             tree.xmlFreeDoc(result)
 */
    __pyx_t_4 = (!__pyx_v_well_formed);
    if (__pyx_t_4) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":634
 *         if not well_formed:
 *             # free broken document
 *             tree.xmlFreeDoc(result)             # <<<<<<<<<<<<<<
 *             result = NULL
 * 
 */
      xmlFreeDoc(__pyx_v_result);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":635
 *             # free broken document
 *             tree.xmlFreeDoc(result)
 *             result = NULL             # <<<<<<<<<<<<<<
 * 
 *     if context is not None and context._has_raised():
 */
      __pyx_v_result = NULL;
      goto __pyx_L12;
    }
    __pyx_L12:;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":637
 *             result = NULL
 * 
 *     if context is not None and context._has_raised():             # <<<<<<<<<<<<<<
 *         if result is not NULL:
 *             tree.xmlFreeDoc(result)
 */
  __pyx_t_4 = (((PyObject *)__pyx_v_context) != Py_None);
  if (__pyx_t_4) {
    __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._has_raised(((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_v_context));
    __pyx_t_3 = __pyx_t_1;
  } else {
    __pyx_t_3 = __pyx_t_4;
  }
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":638
 * 
 *     if context is not None and context._has_raised():
 *         if result is not NULL:             # <<<<<<<<<<<<<<
 *             tree.xmlFreeDoc(result)
 *             result = NULL
 */
    __pyx_t_3 = (__pyx_v_result != NULL);
    if (__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":639
 *     if context is not None and context._has_raised():
 *         if result is not NULL:
 *             tree.xmlFreeDoc(result)             # <<<<<<<<<<<<<<
 *             result = NULL
 *         context._raise_if_stored()
 */
      xmlFreeDoc(__pyx_v_result);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":640
 *         if result is not NULL:
 *             tree.xmlFreeDoc(result)
 *             result = NULL             # <<<<<<<<<<<<<<
 *         context._raise_if_stored()
 * 
 */
      __pyx_v_result = NULL;
      goto __pyx_L14;
    }
    __pyx_L14:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":641
 *             tree.xmlFreeDoc(result)
 *             result = NULL
 *         context._raise_if_stored()             # <<<<<<<<<<<<<<
 * 
 *     if result is NULL:
 */
    __pyx_t_10 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._raise_if_stored(((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_v_context)); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L13;
  }
  __pyx_L13:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":643
 *         context._raise_if_stored()
 * 
 *     if result is NULL:             # <<<<<<<<<<<<<<
 *         if context is not None:
 *             _raiseParseError(c_ctxt, filename, context._error_log)
 */
  __pyx_t_3 = (__pyx_v_result == NULL);
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":644
 * 
 *     if result is NULL:
 *         if context is not None:             # <<<<<<<<<<<<<<
 *             _raiseParseError(c_ctxt, filename, context._error_log)
 *         else:
 */
    __pyx_t_3 = (((PyObject *)__pyx_v_context) != Py_None);
    if (__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":645
 *     if result is NULL:
 *         if context is not None:
 *             _raiseParseError(c_ctxt, filename, context._error_log)             # <<<<<<<<<<<<<<
 *         else:
 *             _raiseParseError(c_ctxt, filename, None)
 */
      __pyx_t_6 = ((PyObject *)__pyx_v_context->_error_log);
      __Pyx_INCREF(__pyx_t_6);
      __pyx_t_10 = __pyx_f_4lxml_5etree__raiseParseError(__pyx_v_c_ctxt, __pyx_v_filename, ((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_t_6)); if (unlikely(__pyx_t_10 == 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L16;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":647
 *             _raiseParseError(c_ctxt, filename, context._error_log)
 *         else:
 *             _raiseParseError(c_ctxt, filename, None)             # <<<<<<<<<<<<<<
 *     else:
 *         if result.URL is NULL and filename is not None:
 */
      __pyx_t_10 = __pyx_f_4lxml_5etree__raiseParseError(__pyx_v_c_ctxt, __pyx_v_filename, ((struct __pyx_obj_4lxml_5etree__ErrorLog *)Py_None)); if (unlikely(__pyx_t_10 == 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_L16:;
    goto __pyx_L15;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":649
 *             _raiseParseError(c_ctxt, filename, None)
 *     else:
 *         if result.URL is NULL and filename is not None:             # <<<<<<<<<<<<<<
 *             result.URL = tree.xmlStrdup(_cstr(filename))
 *         if result.encoding is NULL:
 */
    __pyx_t_3 = (__pyx_v_result->URL == NULL);
    if (__pyx_t_3) {
      __pyx_t_4 = (__pyx_v_filename != Py_None);
      __pyx_t_1 = __pyx_t_4;
    } else {
      __pyx_t_1 = __pyx_t_3;
    }
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":650
 *     else:
 *         if result.URL is NULL and filename is not None:
 *             result.URL = tree.xmlStrdup(_cstr(filename))             # <<<<<<<<<<<<<<
 *         if result.encoding is NULL:
 *             result.encoding = tree.xmlStrdup("UTF-8")
 */
      __pyx_v_result->URL = xmlStrdup(PyBytes_AS_STRING(__pyx_v_filename));
      goto __pyx_L17;
    }
    __pyx_L17:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":651
 *         if result.URL is NULL and filename is not None:
 *             result.URL = tree.xmlStrdup(_cstr(filename))
 *         if result.encoding is NULL:             # <<<<<<<<<<<<<<
 *             result.encoding = tree.xmlStrdup("UTF-8")
 * 
 */
    __pyx_t_1 = (__pyx_v_result->encoding == NULL);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":652
 *             result.URL = tree.xmlStrdup(_cstr(filename))
 *         if result.encoding is NULL:
 *             result.encoding = tree.xmlStrdup("UTF-8")             # <<<<<<<<<<<<<<
 * 
 *     if context._validator is not None and \
 */
      __pyx_v_result->encoding = xmlStrdup(__pyx_k_31);
      goto __pyx_L18;
    }
    __pyx_L18:;
  }
  __pyx_L15:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":654
 *             result.encoding = tree.xmlStrdup("UTF-8")
 * 
 *     if context._validator is not None and \             # <<<<<<<<<<<<<<
 *            context._validator._add_default_attributes:
 *         # we currently need to do this here as libxml2 does not
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_context->_validator) != Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":655
 * 
 *     if context._validator is not None and \
 *            context._validator._add_default_attributes:             # <<<<<<<<<<<<<<
 *         # we currently need to do this here as libxml2 does not
 *         # support inserting default attributes during parse-time
 */
    __pyx_t_3 = __pyx_v_context->_validator->_add_default_attributes;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":659
 *         # support inserting default attributes during parse-time
 *         # validation
 *         context._validator.inject_default_attributes(result)             # <<<<<<<<<<<<<<
 * 
 *     return result
 */
    ((struct __pyx_vtabstruct_4lxml_5etree__ParserSchemaValidationContext *)__pyx_v_context->_validator->__pyx_vtab)->inject_default_attributes(__pyx_v_context->_validator, __pyx_v_result);
    goto __pyx_L19;
  }
  __pyx_L19:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":661
 *         context._validator.inject_default_attributes(result)
 * 
 *     return result             # <<<<<<<<<<<<<<
 * 
 * cdef int _fixHtmlDictNames(tree.xmlDict* c_dict, xmlDoc* c_doc) nogil:
 */
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("lxml.etree._handleParseResult");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_error);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":663
 *     return result
 * 
 * cdef int _fixHtmlDictNames(tree.xmlDict* c_dict, xmlDoc* c_doc) nogil:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     if c_doc is NULL:
 */

static  int __pyx_f_4lxml_5etree__fixHtmlDictNames(xmlDict *__pyx_v_c_dict, xmlDoc *__pyx_v_c_doc) {
  xmlNode *__pyx_v_c_node;
  int __pyx_r;
  int __pyx_t_1;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":665
 * cdef int _fixHtmlDictNames(tree.xmlDict* c_dict, xmlDoc* c_doc) nogil:
 *     cdef xmlNode* c_node
 *     if c_doc is NULL:             # <<<<<<<<<<<<<<
 *         return 0
 *     c_node = c_doc.children
 */
  __pyx_t_1 = (__pyx_v_c_doc == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":666
 *     cdef xmlNode* c_node
 *     if c_doc is NULL:
 *         return 0             # <<<<<<<<<<<<<<
 *     c_node = c_doc.children
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(<xmlNode*>c_doc, c_node, 0)
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":667
 *     if c_doc is NULL:
 *         return 0
 *     c_node = c_doc.children             # <<<<<<<<<<<<<<
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(<xmlNode*>c_doc, c_node, 0)
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 */
  __pyx_v_c_node = __pyx_v_c_doc->children;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":668
 *         return 0
 *     c_node = c_doc.children
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(<xmlNode*>c_doc, c_node, 0)             # <<<<<<<<<<<<<<
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         if _fixHtmlDictNodeNames(c_dict, c_node) < 0:
 */
  BEGIN_FOR_EACH_ELEMENT_FROM(((xmlNode *)__pyx_v_c_doc), __pyx_v_c_node, 0);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":669
 *     c_node = c_doc.children
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(<xmlNode*>c_doc, c_node, 0)
 *     if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         if _fixHtmlDictNodeNames(c_dict, c_node) < 0:
 *             return -1
 */
  __pyx_t_1 = (__pyx_v_c_node->type == XML_ELEMENT_NODE);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":670
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(<xmlNode*>c_doc, c_node, 0)
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         if _fixHtmlDictNodeNames(c_dict, c_node) < 0:             # <<<<<<<<<<<<<<
 *             return -1
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 */
    __pyx_t_1 = (__pyx_f_4lxml_5etree__fixHtmlDictNodeNames(__pyx_v_c_dict, __pyx_v_c_node) < 0);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":671
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         if _fixHtmlDictNodeNames(c_dict, c_node) < 0:
 *             return -1             # <<<<<<<<<<<<<<
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 *     return 0
 */
      __pyx_r = -1;
      goto __pyx_L0;
      goto __pyx_L5;
    }
    __pyx_L5:;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":672
 *         if _fixHtmlDictNodeNames(c_dict, c_node) < 0:
 *             return -1
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  END_FOR_EACH_ELEMENT_FROM(__pyx_v_c_node);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":673
 *             return -1
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef inline int _fixHtmlDictNodeNames(tree.xmlDict* c_dict,
 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":675
 *     return 0
 * 
 * cdef inline int _fixHtmlDictNodeNames(tree.xmlDict* c_dict,             # <<<<<<<<<<<<<<
 *                                       xmlNode* c_node) nogil:
 *     cdef xmlNode* c_attr
 */

static CYTHON_INLINE int __pyx_f_4lxml_5etree__fixHtmlDictNodeNames(xmlDict *__pyx_v_c_dict, xmlNode *__pyx_v_c_node) {
  xmlNode *__pyx_v_c_attr;
  char *__pyx_v_c_name;
  int __pyx_r;
  int __pyx_t_1;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":679
 *     cdef xmlNode* c_attr
 *     cdef char* c_name
 *     c_name = tree.xmlDictLookup(c_dict, c_node.name, -1)             # <<<<<<<<<<<<<<
 *     if c_name is NULL:
 *         return -1
 */
  __pyx_v_c_name = xmlDictLookup(__pyx_v_c_dict, __pyx_v_c_node->name, -1);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":680
 *     cdef char* c_name
 *     c_name = tree.xmlDictLookup(c_dict, c_node.name, -1)
 *     if c_name is NULL:             # <<<<<<<<<<<<<<
 *         return -1
 *     if c_name is not c_node.name:
 */
  __pyx_t_1 = (__pyx_v_c_name == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":681
 *     c_name = tree.xmlDictLookup(c_dict, c_node.name, -1)
 *     if c_name is NULL:
 *         return -1             # <<<<<<<<<<<<<<
 *     if c_name is not c_node.name:
 *         tree.xmlFree(c_node.name)
 */
    __pyx_r = -1;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":682
 *     if c_name is NULL:
 *         return -1
 *     if c_name is not c_node.name:             # <<<<<<<<<<<<<<
 *         tree.xmlFree(c_node.name)
 *         c_node.name = c_name
 */
  __pyx_t_1 = (__pyx_v_c_name != __pyx_v_c_node->name);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":683
 *         return -1
 *     if c_name is not c_node.name:
 *         tree.xmlFree(c_node.name)             # <<<<<<<<<<<<<<
 *         c_node.name = c_name
 *     c_attr = <xmlNode*>c_node.properties
 */
    xmlFree(__pyx_v_c_node->name);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":684
 *     if c_name is not c_node.name:
 *         tree.xmlFree(c_node.name)
 *         c_node.name = c_name             # <<<<<<<<<<<<<<
 *     c_attr = <xmlNode*>c_node.properties
 *     while c_attr is not NULL:
 */
    __pyx_v_c_node->name = __pyx_v_c_name;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":685
 *         tree.xmlFree(c_node.name)
 *         c_node.name = c_name
 *     c_attr = <xmlNode*>c_node.properties             # <<<<<<<<<<<<<<
 *     while c_attr is not NULL:
 *         c_name = tree.xmlDictLookup(c_dict, c_attr.name, -1)
 */
  __pyx_v_c_attr = ((xmlNode *)__pyx_v_c_node->properties);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":686
 *         c_node.name = c_name
 *     c_attr = <xmlNode*>c_node.properties
 *     while c_attr is not NULL:             # <<<<<<<<<<<<<<
 *         c_name = tree.xmlDictLookup(c_dict, c_attr.name, -1)
 *         if c_name is NULL:
 */
  while (1) {
    __pyx_t_1 = (__pyx_v_c_attr != NULL);
    if (!__pyx_t_1) break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":687
 *     c_attr = <xmlNode*>c_node.properties
 *     while c_attr is not NULL:
 *         c_name = tree.xmlDictLookup(c_dict, c_attr.name, -1)             # <<<<<<<<<<<<<<
 *         if c_name is NULL:
 *             return -1
 */
    __pyx_v_c_name = xmlDictLookup(__pyx_v_c_dict, __pyx_v_c_attr->name, -1);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":688
 *     while c_attr is not NULL:
 *         c_name = tree.xmlDictLookup(c_dict, c_attr.name, -1)
 *         if c_name is NULL:             # <<<<<<<<<<<<<<
 *             return -1
 *         if c_name is not c_attr.name:
 */
    __pyx_t_1 = (__pyx_v_c_name == NULL);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":689
 *         c_name = tree.xmlDictLookup(c_dict, c_attr.name, -1)
 *         if c_name is NULL:
 *             return -1             # <<<<<<<<<<<<<<
 *         if c_name is not c_attr.name:
 *             tree.xmlFree(c_attr.name)
 */
      __pyx_r = -1;
      goto __pyx_L0;
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":690
 *         if c_name is NULL:
 *             return -1
 *         if c_name is not c_attr.name:             # <<<<<<<<<<<<<<
 *             tree.xmlFree(c_attr.name)
 *             c_attr.name = c_name
 */
    __pyx_t_1 = (__pyx_v_c_name != __pyx_v_c_attr->name);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":691
 *             return -1
 *         if c_name is not c_attr.name:
 *             tree.xmlFree(c_attr.name)             # <<<<<<<<<<<<<<
 *             c_attr.name = c_name
 *         c_attr = c_attr.next
 */
      xmlFree(__pyx_v_c_attr->name);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":692
 *         if c_name is not c_attr.name:
 *             tree.xmlFree(c_attr.name)
 *             c_attr.name = c_name             # <<<<<<<<<<<<<<
 *         c_attr = c_attr.next
 *     return 0
 */
      __pyx_v_c_attr->name = __pyx_v_c_name;
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":693
 *             tree.xmlFree(c_attr.name)
 *             c_attr.name = c_name
 *         c_attr = c_attr.next             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    __pyx_v_c_attr = __pyx_v_c_attr->next;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":694
 *             c_attr.name = c_name
 *         c_attr = c_attr.next
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef class _BaseParser:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":711
 *     cdef object _default_encoding
 * 
 *     def __init__(self, int parse_options, bint for_html, XMLSchema schema,             # <<<<<<<<<<<<<<
 *                  remove_comments, remove_pis, strip_cdata, target,
 *                  filename, encoding):
 */

static int __pyx_pf_4lxml_5etree_11_BaseParser___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_11_BaseParser___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_parse_options;
  int __pyx_v_for_html;
  struct __pyx_obj_4lxml_5etree_XMLSchema *__pyx_v_schema = 0;
  PyObject *__pyx_v_remove_comments = 0;
  PyObject *__pyx_v_remove_pis = 0;
  PyObject *__pyx_v_strip_cdata = 0;
  PyObject *__pyx_v_target = 0;
  PyObject *__pyx_v_filename = 0;
  PyObject *__pyx_v_encoding = 0;
  xmlCharEncodingHandler *__pyx_v_enchandler;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__parse_options,&__pyx_n_s__for_html,&__pyx_n_s__schema,&__pyx_n_s__remove_comments,&__pyx_n_s__remove_pis,&__pyx_n_s__strip_cdata,&__pyx_n_s__target,&__pyx_n_s__filename,&__pyx_n_s__encoding,0};
  __Pyx_RefNannySetupContext("__init__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
      case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
      case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parse_options);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__for_html);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__init__", 1, 9, 9, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__schema);
      if (likely(values[2])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__init__", 1, 9, 9, 2); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  3:
      values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__remove_comments);
      if (likely(values[3])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__init__", 1, 9, 9, 3); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  4:
      values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__remove_pis);
      if (likely(values[4])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__init__", 1, 9, 9, 4); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  5:
      values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__strip_cdata);
      if (likely(values[5])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__init__", 1, 9, 9, 5); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  6:
      values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__target);
      if (likely(values[6])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__init__", 1, 9, 9, 6); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  7:
      values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename);
      if (likely(values[7])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__init__", 1, 9, 9, 7); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  8:
      values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__encoding);
      if (likely(values[8])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__init__", 1, 9, 9, 8); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_parse_options = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_parse_options == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_for_html = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_for_html == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_schema = ((struct __pyx_obj_4lxml_5etree_XMLSchema *)values[2]);
    __pyx_v_remove_comments = values[3];
    __pyx_v_remove_pis = values[4];
    __pyx_v_strip_cdata = values[5];
    __pyx_v_target = values[6];
    __pyx_v_filename = values[7];
    __pyx_v_encoding = values[8];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 9) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_parse_options = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_parse_options == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_for_html = __Pyx_PyObject_IsTrue(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_for_html == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_schema = ((struct __pyx_obj_4lxml_5etree_XMLSchema *)PyTuple_GET_ITEM(__pyx_args, 2));
    __pyx_v_remove_comments = PyTuple_GET_ITEM(__pyx_args, 3);
    __pyx_v_remove_pis = PyTuple_GET_ITEM(__pyx_args, 4);
    __pyx_v_strip_cdata = PyTuple_GET_ITEM(__pyx_args, 5);
    __pyx_v_target = PyTuple_GET_ITEM(__pyx_args, 6);
    __pyx_v_filename = PyTuple_GET_ITEM(__pyx_args, 7);
    __pyx_v_encoding = PyTuple_GET_ITEM(__pyx_args, 8);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._BaseParser.__init__");
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF(__pyx_v_encoding);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_schema), __pyx_ptype_4lxml_5etree_XMLSchema, 1, "schema", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":716
 *         cdef tree.xmlCharEncodingHandler* enchandler
 *         cdef int c_encoding
 *         if not isinstance(self, HTMLParser) and \             # <<<<<<<<<<<<<<
 *                 not isinstance(self, XMLParser) and \
 *                 not isinstance(self, iterparse):
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_self, ((PyObject*)__pyx_ptype_4lxml_5etree_HTMLParser)); 
  __pyx_t_2 = (!__pyx_t_1);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":717
 *         cdef int c_encoding
 *         if not isinstance(self, HTMLParser) and \
 *                 not isinstance(self, XMLParser) and \             # <<<<<<<<<<<<<<
 *                 not isinstance(self, iterparse):
 *             raise TypeError, u"This class cannot be instantiated"
 */
    __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_self, ((PyObject*)__pyx_ptype_4lxml_5etree_XMLParser)); 
    __pyx_t_3 = (!__pyx_t_1);
    if (__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":718
 *         if not isinstance(self, HTMLParser) and \
 *                 not isinstance(self, XMLParser) and \
 *                 not isinstance(self, iterparse):             # <<<<<<<<<<<<<<
 *             raise TypeError, u"This class cannot be instantiated"
 * 
 */
      __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_self, ((PyObject*)__pyx_ptype_4lxml_5etree_iterparse)); 
      __pyx_t_4 = (!__pyx_t_1);
      __pyx_t_1 = __pyx_t_4;
    } else {
      __pyx_t_1 = __pyx_t_3;
    }
    __pyx_t_3 = __pyx_t_1;
  } else {
    __pyx_t_3 = __pyx_t_2;
  }
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":719
 *                 not isinstance(self, XMLParser) and \
 *                 not isinstance(self, iterparse):
 *             raise TypeError, u"This class cannot be instantiated"             # <<<<<<<<<<<<<<
 * 
 *         self._parse_options = parse_options
 */
    __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_u_179), 0);
    {__pyx_filename = __pyx_f[3]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":721
 *             raise TypeError, u"This class cannot be instantiated"
 * 
 *         self._parse_options = parse_options             # <<<<<<<<<<<<<<
 *         self._filename = filename
 *         self.target = target
 */
  ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self)->_parse_options = __pyx_v_parse_options;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":722
 * 
 *         self._parse_options = parse_options
 *         self._filename = filename             # <<<<<<<<<<<<<<
 *         self.target = target
 *         self._for_html = for_html
 */
  __Pyx_INCREF(__pyx_v_filename);
  __Pyx_GIVEREF(__pyx_v_filename);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self)->_filename);
  __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self)->_filename);
  ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self)->_filename = __pyx_v_filename;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":723
 *         self._parse_options = parse_options
 *         self._filename = filename
 *         self.target = target             # <<<<<<<<<<<<<<
 *         self._for_html = for_html
 *         self._remove_comments = remove_comments
 */
  __Pyx_INCREF(__pyx_v_target);
  __Pyx_GIVEREF(__pyx_v_target);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self)->target);
  __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self)->target);
  ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self)->target = __pyx_v_target;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":724
 *         self._filename = filename
 *         self.target = target
 *         self._for_html = for_html             # <<<<<<<<<<<<<<
 *         self._remove_comments = remove_comments
 *         self._remove_pis = remove_pis
 */
  ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self)->_for_html = __pyx_v_for_html;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":725
 *         self.target = target
 *         self._for_html = for_html
 *         self._remove_comments = remove_comments             # <<<<<<<<<<<<<<
 *         self._remove_pis = remove_pis
 *         self._strip_cdata = strip_cdata
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_remove_comments); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self)->_remove_comments = __pyx_t_3;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":726
 *         self._for_html = for_html
 *         self._remove_comments = remove_comments
 *         self._remove_pis = remove_pis             # <<<<<<<<<<<<<<
 *         self._strip_cdata = strip_cdata
 *         self._schema = schema
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_remove_pis); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self)->_remove_pis = __pyx_t_3;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":727
 *         self._remove_comments = remove_comments
 *         self._remove_pis = remove_pis
 *         self._strip_cdata = strip_cdata             # <<<<<<<<<<<<<<
 *         self._schema = schema
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_strip_cdata); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self)->_strip_cdata = __pyx_t_3;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":728
 *         self._remove_pis = remove_pis
 *         self._strip_cdata = strip_cdata
 *         self._schema = schema             # <<<<<<<<<<<<<<
 * 
 *         self._resolvers = _ResolverRegistry()
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_schema));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_schema));
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self)->_schema);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self)->_schema));
  ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self)->_schema = __pyx_v_schema;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":730
 *         self._schema = schema
 * 
 *         self._resolvers = _ResolverRegistry()             # <<<<<<<<<<<<<<
 * 
 *         if encoding is None:
 */
  __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ResolverRegistry)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self)->_resolvers);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self)->_resolvers));
  ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self)->_resolvers = ((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":732
 *         self._resolvers = _ResolverRegistry()
 * 
 *         if encoding is None:             # <<<<<<<<<<<<<<
 *             self._default_encoding = None
 *         else:
 */
  __pyx_t_3 = (__pyx_v_encoding == Py_None);
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":733
 * 
 *         if encoding is None:
 *             self._default_encoding = None             # <<<<<<<<<<<<<<
 *         else:
 *             encoding = _utf8(encoding)
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self)->_default_encoding);
    __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self)->_default_encoding);
    ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self)->_default_encoding = Py_None;
    goto __pyx_L7;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":735
 *             self._default_encoding = None
 *         else:
 *             encoding = _utf8(encoding)             # <<<<<<<<<<<<<<
 *             enchandler = tree.xmlFindCharEncodingHandler(_cstr(encoding))
 *             if enchandler is NULL:
 */
    __pyx_t_5 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_v_encoding)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_v_encoding);
    __pyx_v_encoding = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":736
 *         else:
 *             encoding = _utf8(encoding)
 *             enchandler = tree.xmlFindCharEncodingHandler(_cstr(encoding))             # <<<<<<<<<<<<<<
 *             if enchandler is NULL:
 *                 raise LookupError, u"unknown encoding: '%s'" % encoding
 */
    __pyx_v_enchandler = xmlFindCharEncodingHandler(PyBytes_AS_STRING(__pyx_v_encoding));

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":737
 *             encoding = _utf8(encoding)
 *             enchandler = tree.xmlFindCharEncodingHandler(_cstr(encoding))
 *             if enchandler is NULL:             # <<<<<<<<<<<<<<
 *                 raise LookupError, u"unknown encoding: '%s'" % encoding
 *             tree.xmlCharEncCloseFunc(enchandler)
 */
    __pyx_t_3 = (__pyx_v_enchandler == NULL);
    if (__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":738
 *             enchandler = tree.xmlFindCharEncodingHandler(_cstr(encoding))
 *             if enchandler is NULL:
 *                 raise LookupError, u"unknown encoding: '%s'" % encoding             # <<<<<<<<<<<<<<
 *             tree.xmlCharEncCloseFunc(enchandler)
 *             self._default_encoding = encoding
 */
      __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_180), __pyx_v_encoding); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
      __Pyx_Raise(__pyx_builtin_LookupError, ((PyObject *)__pyx_t_5), 0);
      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
      {__pyx_filename = __pyx_f[3]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":739
 *             if enchandler is NULL:
 *                 raise LookupError, u"unknown encoding: '%s'" % encoding
 *             tree.xmlCharEncCloseFunc(enchandler)             # <<<<<<<<<<<<<<
 *             self._default_encoding = encoding
 * 
 */
    xmlCharEncCloseFunc(__pyx_v_enchandler);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":740
 *                 raise LookupError, u"unknown encoding: '%s'" % encoding
 *             tree.xmlCharEncCloseFunc(enchandler)
 *             self._default_encoding = encoding             # <<<<<<<<<<<<<<
 * 
 *     cdef _ParserContext _getParserContext(self):
 */
    __Pyx_INCREF(__pyx_v_encoding);
    __Pyx_GIVEREF(__pyx_v_encoding);
    __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self)->_default_encoding);
    __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self)->_default_encoding);
    ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self)->_default_encoding = __pyx_v_encoding;
  }
  __pyx_L7:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._BaseParser.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_encoding);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":742
 *             self._default_encoding = encoding
 * 
 *     cdef _ParserContext _getParserContext(self):             # <<<<<<<<<<<<<<
 *         cdef xmlparser.xmlParserCtxt* pctxt
 *         if self._parser_context is None:
 */

static  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_f_4lxml_5etree_11_BaseParser__getParserContext(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self) {
  xmlParserCtxt *__pyx_v_pctxt;
  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("_getParserContext");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":744
 *     cdef _ParserContext _getParserContext(self):
 *         cdef xmlparser.xmlParserCtxt* pctxt
 *         if self._parser_context is None:             # <<<<<<<<<<<<<<
 *             self._parser_context = self._createContext(self.target)
 *             if self._schema is not None:
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_self->_parser_context) == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":745
 *         cdef xmlparser.xmlParserCtxt* pctxt
 *         if self._parser_context is None:
 *             self._parser_context = self._createContext(self.target)             # <<<<<<<<<<<<<<
 *             if self._schema is not None:
 *                 self._parser_context._validator = \
 */
    __pyx_t_2 = __pyx_v_self->target;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)__pyx_v_self->__pyx_vtab)->_createContext(__pyx_v_self, __pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF(__pyx_v_self->_parser_context);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->_parser_context));
    __pyx_v_self->_parser_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":746
 *         if self._parser_context is None:
 *             self._parser_context = self._createContext(self.target)
 *             if self._schema is not None:             # <<<<<<<<<<<<<<
 *                 self._parser_context._validator = \
 *                     self._schema._newSaxValidator(
 */
    __pyx_t_1 = (((PyObject *)__pyx_v_self->_schema) != Py_None);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":749
 *                 self._parser_context._validator = \
 *                     self._schema._newSaxValidator(
 *                         self._parse_options & xmlparser.XML_PARSE_DTDATTR)             # <<<<<<<<<<<<<<
 *             pctxt = self._newParserCtxt()
 *             if pctxt is NULL:
 */
      __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree_XMLSchema *)__pyx_v_self->_schema->__pyx_base.__pyx_vtab)->_newSaxValidator(__pyx_v_self->_schema, (__pyx_v_self->_parse_options & XML_PARSE_DTDATTR))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":747
 *             self._parser_context = self._createContext(self.target)
 *             if self._schema is not None:
 *                 self._parser_context._validator = \             # <<<<<<<<<<<<<<
 *                     self._schema._newSaxValidator(
 *                         self._parse_options & xmlparser.XML_PARSE_DTDATTR)
 */
      __Pyx_GIVEREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_v_self->_parser_context->_validator);
      __Pyx_DECREF(((PyObject *)__pyx_v_self->_parser_context->_validator));
      __pyx_v_self->_parser_context->_validator = ((struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *)__pyx_t_3);
      __pyx_t_3 = 0;
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":750
 *                     self._schema._newSaxValidator(
 *                         self._parse_options & xmlparser.XML_PARSE_DTDATTR)
 *             pctxt = self._newParserCtxt()             # <<<<<<<<<<<<<<
 *             if pctxt is NULL:
 *                 python.PyErr_NoMemory()
 */
    __pyx_v_pctxt = ((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)__pyx_v_self->__pyx_vtab)->_newParserCtxt(__pyx_v_self);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":751
 *                         self._parse_options & xmlparser.XML_PARSE_DTDATTR)
 *             pctxt = self._newParserCtxt()
 *             if pctxt is NULL:             # <<<<<<<<<<<<<<
 *                 python.PyErr_NoMemory()
 *             _initParserContext(self._parser_context, self._resolvers, pctxt)
 */
    __pyx_t_1 = (__pyx_v_pctxt == NULL);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":752
 *             pctxt = self._newParserCtxt()
 *             if pctxt is NULL:
 *                 python.PyErr_NoMemory()             # <<<<<<<<<<<<<<
 *             _initParserContext(self._parser_context, self._resolvers, pctxt)
 *             if self._remove_comments:
 */
      __pyx_t_3 = PyErr_NoMemory(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":753
 *             if pctxt is NULL:
 *                 python.PyErr_NoMemory()
 *             _initParserContext(self._parser_context, self._resolvers, pctxt)             # <<<<<<<<<<<<<<
 *             if self._remove_comments:
 *                 pctxt.sax.comment = NULL
 */
    __pyx_t_3 = ((PyObject *)__pyx_v_self->_parser_context);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_2 = ((PyObject *)__pyx_v_self->_resolvers);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_4 = __pyx_f_4lxml_5etree__initParserContext(((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_3), ((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_t_2), __pyx_v_pctxt); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":754
 *                 python.PyErr_NoMemory()
 *             _initParserContext(self._parser_context, self._resolvers, pctxt)
 *             if self._remove_comments:             # <<<<<<<<<<<<<<
 *                 pctxt.sax.comment = NULL
 *             if self._remove_pis:
 */
    if (__pyx_v_self->_remove_comments) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":755
 *             _initParserContext(self._parser_context, self._resolvers, pctxt)
 *             if self._remove_comments:
 *                 pctxt.sax.comment = NULL             # <<<<<<<<<<<<<<
 *             if self._remove_pis:
 *                 pctxt.sax.processingInstruction = NULL
 */
      __pyx_v_pctxt->sax->comment = NULL;
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":756
 *             if self._remove_comments:
 *                 pctxt.sax.comment = NULL
 *             if self._remove_pis:             # <<<<<<<<<<<<<<
 *                 pctxt.sax.processingInstruction = NULL
 *             if self._strip_cdata:
 */
    if (__pyx_v_self->_remove_pis) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":757
 *                 pctxt.sax.comment = NULL
 *             if self._remove_pis:
 *                 pctxt.sax.processingInstruction = NULL             # <<<<<<<<<<<<<<
 *             if self._strip_cdata:
 *                 # hard switch-off for CDATA nodes => makes them plain text
 */
      __pyx_v_pctxt->sax->processingInstruction = NULL;
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":758
 *             if self._remove_pis:
 *                 pctxt.sax.processingInstruction = NULL
 *             if self._strip_cdata:             # <<<<<<<<<<<<<<
 *                 # hard switch-off for CDATA nodes => makes them plain text
 *                 pctxt.sax.cdataBlock = NULL
 */
    if (__pyx_v_self->_strip_cdata) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":760
 *             if self._strip_cdata:
 *                 # hard switch-off for CDATA nodes => makes them plain text
 *                 pctxt.sax.cdataBlock = NULL             # <<<<<<<<<<<<<<
 *         return self._parser_context
 * 
 */
      __pyx_v_pctxt->sax->cdataBlock = NULL;
      goto __pyx_L8;
    }
    __pyx_L8:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":761
 *                 # hard switch-off for CDATA nodes => makes them plain text
 *                 pctxt.sax.cdataBlock = NULL
 *         return self._parser_context             # <<<<<<<<<<<<<<
 * 
 *     cdef _ParserContext _getPushParserContext(self):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_parser_context));
  __pyx_r = __pyx_v_self->_parser_context;
  goto __pyx_L0;

  __pyx_r = ((struct __pyx_obj_4lxml_5etree__ParserContext *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._BaseParser._getParserContext");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":763
 *         return self._parser_context
 * 
 *     cdef _ParserContext _getPushParserContext(self):             # <<<<<<<<<<<<<<
 *         cdef xmlparser.xmlParserCtxt* pctxt
 *         if self._push_parser_context is None:
 */

static  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_f_4lxml_5etree_11_BaseParser__getPushParserContext(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self) {
  xmlParserCtxt *__pyx_v_pctxt;
  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("_getPushParserContext");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":765
 *     cdef _ParserContext _getPushParserContext(self):
 *         cdef xmlparser.xmlParserCtxt* pctxt
 *         if self._push_parser_context is None:             # <<<<<<<<<<<<<<
 *             self._push_parser_context = self._createContext(self.target)
 *             if self._schema is not None:
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_self->_push_parser_context) == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":766
 *         cdef xmlparser.xmlParserCtxt* pctxt
 *         if self._push_parser_context is None:
 *             self._push_parser_context = self._createContext(self.target)             # <<<<<<<<<<<<<<
 *             if self._schema is not None:
 *                 self._push_parser_context._validator = \
 */
    __pyx_t_2 = __pyx_v_self->target;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)__pyx_v_self->__pyx_vtab)->_createContext(__pyx_v_self, __pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF(__pyx_v_self->_push_parser_context);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->_push_parser_context));
    __pyx_v_self->_push_parser_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":767
 *         if self._push_parser_context is None:
 *             self._push_parser_context = self._createContext(self.target)
 *             if self._schema is not None:             # <<<<<<<<<<<<<<
 *                 self._push_parser_context._validator = \
 *                     self._schema._newSaxValidator(
 */
    __pyx_t_1 = (((PyObject *)__pyx_v_self->_schema) != Py_None);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":770
 *                 self._push_parser_context._validator = \
 *                     self._schema._newSaxValidator(
 *                         self._parse_options & xmlparser.XML_PARSE_DTDATTR)             # <<<<<<<<<<<<<<
 *             pctxt = self._newPushParserCtxt()
 *             if pctxt is NULL:
 */
      __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree_XMLSchema *)__pyx_v_self->_schema->__pyx_base.__pyx_vtab)->_newSaxValidator(__pyx_v_self->_schema, (__pyx_v_self->_parse_options & XML_PARSE_DTDATTR))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":768
 *             self._push_parser_context = self._createContext(self.target)
 *             if self._schema is not None:
 *                 self._push_parser_context._validator = \             # <<<<<<<<<<<<<<
 *                     self._schema._newSaxValidator(
 *                         self._parse_options & xmlparser.XML_PARSE_DTDATTR)
 */
      __Pyx_GIVEREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_v_self->_push_parser_context->_validator);
      __Pyx_DECREF(((PyObject *)__pyx_v_self->_push_parser_context->_validator));
      __pyx_v_self->_push_parser_context->_validator = ((struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *)__pyx_t_3);
      __pyx_t_3 = 0;
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":771
 *                     self._schema._newSaxValidator(
 *                         self._parse_options & xmlparser.XML_PARSE_DTDATTR)
 *             pctxt = self._newPushParserCtxt()             # <<<<<<<<<<<<<<
 *             if pctxt is NULL:
 *                 python.PyErr_NoMemory()
 */
    __pyx_v_pctxt = ((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)__pyx_v_self->__pyx_vtab)->_newPushParserCtxt(__pyx_v_self);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":772
 *                         self._parse_options & xmlparser.XML_PARSE_DTDATTR)
 *             pctxt = self._newPushParserCtxt()
 *             if pctxt is NULL:             # <<<<<<<<<<<<<<
 *                 python.PyErr_NoMemory()
 *             _initParserContext(
 */
    __pyx_t_1 = (__pyx_v_pctxt == NULL);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":773
 *             pctxt = self._newPushParserCtxt()
 *             if pctxt is NULL:
 *                 python.PyErr_NoMemory()             # <<<<<<<<<<<<<<
 *             _initParserContext(
 *                 self._push_parser_context, self._resolvers, pctxt)
 */
      __pyx_t_3 = PyErr_NoMemory(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":775
 *                 python.PyErr_NoMemory()
 *             _initParserContext(
 *                 self._push_parser_context, self._resolvers, pctxt)             # <<<<<<<<<<<<<<
 *             if self._remove_comments:
 *                 pctxt.sax.comment = NULL
 */
    __pyx_t_3 = ((PyObject *)__pyx_v_self->_push_parser_context);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_2 = ((PyObject *)__pyx_v_self->_resolvers);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_4 = __pyx_f_4lxml_5etree__initParserContext(((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_3), ((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_t_2), __pyx_v_pctxt); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":776
 *             _initParserContext(
 *                 self._push_parser_context, self._resolvers, pctxt)
 *             if self._remove_comments:             # <<<<<<<<<<<<<<
 *                 pctxt.sax.comment = NULL
 *             if self._remove_pis:
 */
    if (__pyx_v_self->_remove_comments) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":777
 *                 self._push_parser_context, self._resolvers, pctxt)
 *             if self._remove_comments:
 *                 pctxt.sax.comment = NULL             # <<<<<<<<<<<<<<
 *             if self._remove_pis:
 *                 pctxt.sax.processingInstruction = NULL
 */
      __pyx_v_pctxt->sax->comment = NULL;
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":778
 *             if self._remove_comments:
 *                 pctxt.sax.comment = NULL
 *             if self._remove_pis:             # <<<<<<<<<<<<<<
 *                 pctxt.sax.processingInstruction = NULL
 *             if self._strip_cdata:
 */
    if (__pyx_v_self->_remove_pis) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":779
 *                 pctxt.sax.comment = NULL
 *             if self._remove_pis:
 *                 pctxt.sax.processingInstruction = NULL             # <<<<<<<<<<<<<<
 *             if self._strip_cdata:
 *                 # hard switch-off for CDATA nodes => makes them plain text
 */
      __pyx_v_pctxt->sax->processingInstruction = NULL;
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":780
 *             if self._remove_pis:
 *                 pctxt.sax.processingInstruction = NULL
 *             if self._strip_cdata:             # <<<<<<<<<<<<<<
 *                 # hard switch-off for CDATA nodes => makes them plain text
 *                 pctxt.sax.cdataBlock = NULL
 */
    if (__pyx_v_self->_strip_cdata) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":782
 *             if self._strip_cdata:
 *                 # hard switch-off for CDATA nodes => makes them plain text
 *                 pctxt.sax.cdataBlock = NULL             # <<<<<<<<<<<<<<
 *         return self._push_parser_context
 * 
 */
      __pyx_v_pctxt->sax->cdataBlock = NULL;
      goto __pyx_L8;
    }
    __pyx_L8:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":783
 *                 # hard switch-off for CDATA nodes => makes them plain text
 *                 pctxt.sax.cdataBlock = NULL
 *         return self._push_parser_context             # <<<<<<<<<<<<<<
 * 
 *     cdef _ParserContext _createContext(self, target):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_push_parser_context));
  __pyx_r = __pyx_v_self->_push_parser_context;
  goto __pyx_L0;

  __pyx_r = ((struct __pyx_obj_4lxml_5etree__ParserContext *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._BaseParser._getPushParserContext");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":785
 *         return self._push_parser_context
 * 
 *     cdef _ParserContext _createContext(self, target):             # <<<<<<<<<<<<<<
 *         cdef _TargetParserContext context
 *         if target is None:
 */

static  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_f_4lxml_5etree_11_BaseParser__createContext(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self, PyObject *__pyx_v_target) {
  struct __pyx_obj_4lxml_5etree__TargetParserContext *__pyx_v_context;
  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("_createContext");
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__TargetParserContext *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":787
 *     cdef _ParserContext _createContext(self, target):
 *         cdef _TargetParserContext context
 *         if target is None:             # <<<<<<<<<<<<<<
 *             return _ParserContext()
 *         context = _TargetParserContext()
 */
  __pyx_t_1 = (__pyx_v_target == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":788
 *         cdef _TargetParserContext context
 *         if target is None:
 *             return _ParserContext()             # <<<<<<<<<<<<<<
 *         context = _TargetParserContext()
 *         context._setTarget(target)
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ParserContext)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 788; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":789
 *         if target is None:
 *             return _ParserContext()
 *         context = _TargetParserContext()             # <<<<<<<<<<<<<<
 *         context._setTarget(target)
 *         return context
 */
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__TargetParserContext)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_v_context));
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__TargetParserContext *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":790
 *             return _ParserContext()
 *         context = _TargetParserContext()
 *         context._setTarget(target)             # <<<<<<<<<<<<<<
 *         return context
 * 
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree__TargetParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->_setTarget(__pyx_v_context, __pyx_v_target); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":791
 *         context = _TargetParserContext()
 *         context._setTarget(target)
 *         return context             # <<<<<<<<<<<<<<
 * 
 *     cdef xmlparser.xmlParserCtxt* _newParserCtxt(self):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_context));
  __pyx_r = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_v_context);
  goto __pyx_L0;

  __pyx_r = ((struct __pyx_obj_4lxml_5etree__ParserContext *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._BaseParser._createContext");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_context);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":793
 *         return context
 * 
 *     cdef xmlparser.xmlParserCtxt* _newParserCtxt(self):             # <<<<<<<<<<<<<<
 *         if self._for_html:
 *             return htmlparser.htmlCreateMemoryParserCtxt('dummy', 5)
 */

static  xmlParserCtxt *__pyx_f_4lxml_5etree_11_BaseParser__newParserCtxt(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self) {
  xmlParserCtxt *__pyx_r;
  __Pyx_RefNannySetupContext("_newParserCtxt");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":794
 * 
 *     cdef xmlparser.xmlParserCtxt* _newParserCtxt(self):
 *         if self._for_html:             # <<<<<<<<<<<<<<
 *             return htmlparser.htmlCreateMemoryParserCtxt('dummy', 5)
 *         else:
 */
  if (__pyx_v_self->_for_html) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":795
 *     cdef xmlparser.xmlParserCtxt* _newParserCtxt(self):
 *         if self._for_html:
 *             return htmlparser.htmlCreateMemoryParserCtxt('dummy', 5)             # <<<<<<<<<<<<<<
 *         else:
 *             return xmlparser.xmlNewParserCtxt()
 */
    __pyx_r = htmlCreateMemoryParserCtxt(__pyx_k__dummy, 5);
    goto __pyx_L0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":797
 *             return htmlparser.htmlCreateMemoryParserCtxt('dummy', 5)
 *         else:
 *             return xmlparser.xmlNewParserCtxt()             # <<<<<<<<<<<<<<
 * 
 *     cdef xmlparser.xmlParserCtxt* _newPushParserCtxt(self):
 */
    __pyx_r = xmlNewParserCtxt();
    goto __pyx_L0;
  }
  __pyx_L3:;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":799
 *             return xmlparser.xmlNewParserCtxt()
 * 
 *     cdef xmlparser.xmlParserCtxt* _newPushParserCtxt(self):             # <<<<<<<<<<<<<<
 *         cdef xmlparser.xmlParserCtxt* c_ctxt
 *         cdef char* c_filename
 */

static  xmlParserCtxt *__pyx_f_4lxml_5etree_11_BaseParser__newPushParserCtxt(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self) {
  xmlParserCtxt *__pyx_v_c_ctxt;
  char *__pyx_v_c_filename;
  xmlParserCtxt *__pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_newPushParserCtxt");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":802
 *         cdef xmlparser.xmlParserCtxt* c_ctxt
 *         cdef char* c_filename
 *         if self._filename is not None:             # <<<<<<<<<<<<<<
 *             c_filename = _cstr(self._filename)
 *         else:
 */
  __pyx_t_1 = (__pyx_v_self->_filename != Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":803
 *         cdef char* c_filename
 *         if self._filename is not None:
 *             c_filename = _cstr(self._filename)             # <<<<<<<<<<<<<<
 *         else:
 *             c_filename = NULL
 */
    __pyx_t_2 = __pyx_v_self->_filename;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v_c_filename = PyBytes_AS_STRING(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":805
 *             c_filename = _cstr(self._filename)
 *         else:
 *             c_filename = NULL             # <<<<<<<<<<<<<<
 *         if self._for_html:
 *             c_ctxt = htmlparser.htmlCreatePushParserCtxt(
 */
    __pyx_v_c_filename = NULL;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":806
 *         else:
 *             c_filename = NULL
 *         if self._for_html:             # <<<<<<<<<<<<<<
 *             c_ctxt = htmlparser.htmlCreatePushParserCtxt(
 *                 NULL, NULL, NULL, 0, c_filename, tree.XML_CHAR_ENCODING_NONE)
 */
  if (__pyx_v_self->_for_html) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":808
 *         if self._for_html:
 *             c_ctxt = htmlparser.htmlCreatePushParserCtxt(
 *                 NULL, NULL, NULL, 0, c_filename, tree.XML_CHAR_ENCODING_NONE)             # <<<<<<<<<<<<<<
 *             if c_ctxt is not NULL:
 *                 htmlparser.htmlCtxtUseOptions(c_ctxt, self._parse_options)
 */
    __pyx_v_c_ctxt = htmlCreatePushParserCtxt(NULL, NULL, NULL, 0, __pyx_v_c_filename, XML_CHAR_ENCODING_NONE);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":809
 *             c_ctxt = htmlparser.htmlCreatePushParserCtxt(
 *                 NULL, NULL, NULL, 0, c_filename, tree.XML_CHAR_ENCODING_NONE)
 *             if c_ctxt is not NULL:             # <<<<<<<<<<<<<<
 *                 htmlparser.htmlCtxtUseOptions(c_ctxt, self._parse_options)
 *         else:
 */
    __pyx_t_1 = (__pyx_v_c_ctxt != NULL);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":810
 *                 NULL, NULL, NULL, 0, c_filename, tree.XML_CHAR_ENCODING_NONE)
 *             if c_ctxt is not NULL:
 *                 htmlparser.htmlCtxtUseOptions(c_ctxt, self._parse_options)             # <<<<<<<<<<<<<<
 *         else:
 *             c_ctxt = xmlparser.xmlCreatePushParserCtxt(
 */
      htmlCtxtUseOptions(__pyx_v_c_ctxt, __pyx_v_self->_parse_options);
      goto __pyx_L5;
    }
    __pyx_L5:;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":813
 *         else:
 *             c_ctxt = xmlparser.xmlCreatePushParserCtxt(
 *                 NULL, NULL, NULL, 0, c_filename)             # <<<<<<<<<<<<<<
 *             if c_ctxt is not NULL:
 *                 xmlparser.xmlCtxtUseOptions(c_ctxt, self._parse_options)
 */
    __pyx_v_c_ctxt = xmlCreatePushParserCtxt(NULL, NULL, NULL, 0, __pyx_v_c_filename);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":814
 *             c_ctxt = xmlparser.xmlCreatePushParserCtxt(
 *                 NULL, NULL, NULL, 0, c_filename)
 *             if c_ctxt is not NULL:             # <<<<<<<<<<<<<<
 *                 xmlparser.xmlCtxtUseOptions(c_ctxt, self._parse_options)
 *         return c_ctxt
 */
    __pyx_t_1 = (__pyx_v_c_ctxt != NULL);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":815
 *                 NULL, NULL, NULL, 0, c_filename)
 *             if c_ctxt is not NULL:
 *                 xmlparser.xmlCtxtUseOptions(c_ctxt, self._parse_options)             # <<<<<<<<<<<<<<
 *         return c_ctxt
 * 
 */
      xmlCtxtUseOptions(__pyx_v_c_ctxt, __pyx_v_self->_parse_options);
      goto __pyx_L6;
    }
    __pyx_L6:;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":816
 *             if c_ctxt is not NULL:
 *                 xmlparser.xmlCtxtUseOptions(c_ctxt, self._parse_options)
 *         return c_ctxt             # <<<<<<<<<<<<<<
 * 
 *     property error_log:
 */
  __pyx_r = __pyx_v_c_ctxt;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":821
 *         u"""The error log of the last parser run.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef _ParserContext context
 *             context = self._getParserContext()
 */

static PyObject *__pyx_pf_4lxml_5etree_11_BaseParser_9error_log___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_11_BaseParser_9error_log___get__(PyObject *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_context;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":823
 *         def __get__(self):
 *             cdef _ParserContext context
 *             context = self._getParserContext()             # <<<<<<<<<<<<<<
 *             return context._error_log.copy()
 * 
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self)->__pyx_vtab)->_getParserContext(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_context));
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":824
 *             cdef _ParserContext context
 *             context = self._getParserContext()
 *             return context._error_log.copy()             # <<<<<<<<<<<<<<
 * 
 *     property resolvers:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_context->_error_log), __pyx_n_s__copy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._BaseParser.error_log.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_context);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":828
 *     property resolvers:
 *         u"The custom resolver registry of this parser."
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._resolvers
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_11_BaseParser_9resolvers___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_11_BaseParser_9resolvers___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("__get__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":829
 *         u"The custom resolver registry of this parser."
 *         def __get__(self):
 *             return self._resolvers             # <<<<<<<<<<<<<<
 * 
 *     property version:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self)->_resolvers));
  __pyx_r = ((PyObject *)((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self)->_resolvers);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":833
 *     property version:
 *         u"The version of the underlying XML parser."
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return u"libxml2 %d.%d.%d" % LIBXML_VERSION
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_11_BaseParser_7version___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_11_BaseParser_7version___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__get__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":834
 *         u"The version of the underlying XML parser."
 *         def __get__(self):
 *             return u"libxml2 %d.%d.%d" % LIBXML_VERSION             # <<<<<<<<<<<<<<
 * 
 *     def setElementClassLookup(self, ElementClassLookup lookup = None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__LIBXML_VERSION); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_183), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = ((PyObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._BaseParser.version.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":836
 *             return u"libxml2 %d.%d.%d" % LIBXML_VERSION
 * 
 *     def setElementClassLookup(self, ElementClassLookup lookup = None):             # <<<<<<<<<<<<<<
 *         u":deprecated: use ``parser.set_element_class_lookup(lookup)`` instead."
 *         self.set_element_class_lookup(lookup)
 */

static PyObject *__pyx_pf_4lxml_5etree_11_BaseParser_1setElementClassLookup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_11_BaseParser_1setElementClassLookup[] = ":deprecated: use ``parser.set_element_class_lookup(lookup)`` instead.";
static PyObject *__pyx_pf_4lxml_5etree_11_BaseParser_1setElementClassLookup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct LxmlElementClassLookup *__pyx_v_lookup = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__lookup,0};
  __Pyx_RefNannySetupContext("setElementClassLookup");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[1] = {0};
    values[0] = (PyObject *)((struct LxmlElementClassLookup *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__lookup);
        if (value) { values[0] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "setElementClassLookup") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_lookup = ((struct LxmlElementClassLookup *)values[0]);
  } else {
    __pyx_v_lookup = ((struct LxmlElementClassLookup *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: __pyx_v_lookup = ((struct LxmlElementClassLookup *)PyTuple_GET_ITEM(__pyx_args, 0));
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setElementClassLookup", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._BaseParser.setElementClassLookup");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lookup), __pyx_ptype_4lxml_5etree_ElementClassLookup, 1, "lookup", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":838
 *     def setElementClassLookup(self, ElementClassLookup lookup = None):
 *         u":deprecated: use ``parser.set_element_class_lookup(lookup)`` instead."
 *         self.set_element_class_lookup(lookup)             # <<<<<<<<<<<<<<
 * 
 *     def set_element_class_lookup(self, ElementClassLookup lookup = None):
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_184); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(((PyObject *)__pyx_v_lookup));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_lookup));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_lookup));
  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._BaseParser.setElementClassLookup");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":840
 *         self.set_element_class_lookup(lookup)
 * 
 *     def set_element_class_lookup(self, ElementClassLookup lookup = None):             # <<<<<<<<<<<<<<
 *         u"""set_element_class_lookup(self, lookup = None)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_11_BaseParser_2set_element_class_lookup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_11_BaseParser_2set_element_class_lookup[] = "set_element_class_lookup(self, lookup = None)\n\n        Set a lookup scheme for element classes generated from this parser.\n\n        Reset it by passing None or nothing.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_11_BaseParser_2set_element_class_lookup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct LxmlElementClassLookup *__pyx_v_lookup = 0;
  PyObject *__pyx_r = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__lookup,0};
  __Pyx_RefNannySetupContext("set_element_class_lookup");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[1] = {0};
    values[0] = (PyObject *)((struct LxmlElementClassLookup *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__lookup);
        if (value) { values[0] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "set_element_class_lookup") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_lookup = ((struct LxmlElementClassLookup *)values[0]);
  } else {
    __pyx_v_lookup = ((struct LxmlElementClassLookup *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: __pyx_v_lookup = ((struct LxmlElementClassLookup *)PyTuple_GET_ITEM(__pyx_args, 0));
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_element_class_lookup", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._BaseParser.set_element_class_lookup");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lookup), __pyx_ptype_4lxml_5etree_ElementClassLookup, 1, "lookup", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":847
 *         Reset it by passing None or nothing.
 *         """
 *         self._class_lookup = lookup             # <<<<<<<<<<<<<<
 * 
 *     cdef _BaseParser _copy(self):
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_lookup));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_lookup));
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self)->_class_lookup);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self)->_class_lookup));
  ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self)->_class_lookup = __pyx_v_lookup;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._BaseParser.set_element_class_lookup");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":849
 *         self._class_lookup = lookup
 * 
 *     cdef _BaseParser _copy(self):             # <<<<<<<<<<<<<<
 *         u"Create a new parser with the same configuration."
 *         cdef _BaseParser parser
 */

static  struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_f_4lxml_5etree_11_BaseParser__copy(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser;
  struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_copy");
  __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":852
 *         u"Create a new parser with the same configuration."
 *         cdef _BaseParser parser
 *         parser = self.__class__()             # <<<<<<<<<<<<<<
 *         parser._parse_options = self._parse_options
 *         parser._for_html = self._for_html
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s____class__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4lxml_5etree__BaseParser))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_v_parser));
  __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":853
 *         cdef _BaseParser parser
 *         parser = self.__class__()
 *         parser._parse_options = self._parse_options             # <<<<<<<<<<<<<<
 *         parser._for_html = self._for_html
 *         parser._remove_comments = self._remove_comments
 */
  __pyx_v_parser->_parse_options = __pyx_v_self->_parse_options;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":854
 *         parser = self.__class__()
 *         parser._parse_options = self._parse_options
 *         parser._for_html = self._for_html             # <<<<<<<<<<<<<<
 *         parser._remove_comments = self._remove_comments
 *         parser._remove_pis = self._remove_pis
 */
  __pyx_v_parser->_for_html = __pyx_v_self->_for_html;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":855
 *         parser._parse_options = self._parse_options
 *         parser._for_html = self._for_html
 *         parser._remove_comments = self._remove_comments             # <<<<<<<<<<<<<<
 *         parser._remove_pis = self._remove_pis
 *         parser._strip_cdata = self._strip_cdata
 */
  __pyx_v_parser->_remove_comments = __pyx_v_self->_remove_comments;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":856
 *         parser._for_html = self._for_html
 *         parser._remove_comments = self._remove_comments
 *         parser._remove_pis = self._remove_pis             # <<<<<<<<<<<<<<
 *         parser._strip_cdata = self._strip_cdata
 *         parser._filename = self._filename
 */
  __pyx_v_parser->_remove_pis = __pyx_v_self->_remove_pis;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":857
 *         parser._remove_comments = self._remove_comments
 *         parser._remove_pis = self._remove_pis
 *         parser._strip_cdata = self._strip_cdata             # <<<<<<<<<<<<<<
 *         parser._filename = self._filename
 *         parser._resolvers = self._resolvers
 */
  __pyx_v_parser->_strip_cdata = __pyx_v_self->_strip_cdata;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":858
 *         parser._remove_pis = self._remove_pis
 *         parser._strip_cdata = self._strip_cdata
 *         parser._filename = self._filename             # <<<<<<<<<<<<<<
 *         parser._resolvers = self._resolvers
 *         parser.target = self.target
 */
  __Pyx_INCREF(__pyx_v_self->_filename);
  __Pyx_GIVEREF(__pyx_v_self->_filename);
  __Pyx_GOTREF(__pyx_v_parser->_filename);
  __Pyx_DECREF(__pyx_v_parser->_filename);
  __pyx_v_parser->_filename = __pyx_v_self->_filename;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":859
 *         parser._strip_cdata = self._strip_cdata
 *         parser._filename = self._filename
 *         parser._resolvers = self._resolvers             # <<<<<<<<<<<<<<
 *         parser.target = self.target
 *         parser._class_lookup  = self._class_lookup
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_resolvers));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->_resolvers));
  __Pyx_GOTREF(__pyx_v_parser->_resolvers);
  __Pyx_DECREF(((PyObject *)__pyx_v_parser->_resolvers));
  __pyx_v_parser->_resolvers = __pyx_v_self->_resolvers;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":860
 *         parser._filename = self._filename
 *         parser._resolvers = self._resolvers
 *         parser.target = self.target             # <<<<<<<<<<<<<<
 *         parser._class_lookup  = self._class_lookup
 *         parser._default_encoding = self._default_encoding
 */
  __Pyx_INCREF(__pyx_v_self->target);
  __Pyx_GIVEREF(__pyx_v_self->target);
  __Pyx_GOTREF(__pyx_v_parser->target);
  __Pyx_DECREF(__pyx_v_parser->target);
  __pyx_v_parser->target = __pyx_v_self->target;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":861
 *         parser._resolvers = self._resolvers
 *         parser.target = self.target
 *         parser._class_lookup  = self._class_lookup             # <<<<<<<<<<<<<<
 *         parser._default_encoding = self._default_encoding
 *         parser._schema = self._schema
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_class_lookup));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->_class_lookup));
  __Pyx_GOTREF(__pyx_v_parser->_class_lookup);
  __Pyx_DECREF(((PyObject *)__pyx_v_parser->_class_lookup));
  __pyx_v_parser->_class_lookup = __pyx_v_self->_class_lookup;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":862
 *         parser.target = self.target
 *         parser._class_lookup  = self._class_lookup
 *         parser._default_encoding = self._default_encoding             # <<<<<<<<<<<<<<
 *         parser._schema = self._schema
 *         return parser
 */
  __Pyx_INCREF(__pyx_v_self->_default_encoding);
  __Pyx_GIVEREF(__pyx_v_self->_default_encoding);
  __Pyx_GOTREF(__pyx_v_parser->_default_encoding);
  __Pyx_DECREF(__pyx_v_parser->_default_encoding);
  __pyx_v_parser->_default_encoding = __pyx_v_self->_default_encoding;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":863
 *         parser._class_lookup  = self._class_lookup
 *         parser._default_encoding = self._default_encoding
 *         parser._schema = self._schema             # <<<<<<<<<<<<<<
 *         return parser
 * 
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_schema));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->_schema));
  __Pyx_GOTREF(__pyx_v_parser->_schema);
  __Pyx_DECREF(((PyObject *)__pyx_v_parser->_schema));
  __pyx_v_parser->_schema = __pyx_v_self->_schema;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":864
 *         parser._default_encoding = self._default_encoding
 *         parser._schema = self._schema
 *         return parser             # <<<<<<<<<<<<<<
 * 
 *     def copy(self):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_parser));
  __pyx_r = __pyx_v_parser;
  goto __pyx_L0;

  __pyx_r = ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._BaseParser._copy");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_parser);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":866
 *         return parser
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         u"""copy(self)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_11_BaseParser_3copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_11_BaseParser_3copy[] = "copy(self)\n\n        Create a new parser with the same configuration.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_11_BaseParser_3copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("copy");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":871
 *         Create a new parser with the same configuration.
 *         """
 *         return self._copy()             # <<<<<<<<<<<<<<
 * 
 *     def makeelement(self, _tag, attrib=None, nsmap=None, **_extra):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self)->__pyx_vtab)->_copy(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._BaseParser.copy");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":873
 *         return self._copy()
 * 
 *     def makeelement(self, _tag, attrib=None, nsmap=None, **_extra):             # <<<<<<<<<<<<<<
 *         u"""makeelement(self, _tag, attrib=None, nsmap=None, **_extra)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_11_BaseParser_4makeelement(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_11_BaseParser_4makeelement[] = "makeelement(self, _tag, attrib=None, nsmap=None, **_extra)\n\n        Creates a new element associated with this parser.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_11_BaseParser_4makeelement(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v__tag = 0;
  PyObject *__pyx_v_attrib = 0;
  PyObject *__pyx_v_nsmap = 0;
  PyObject *__pyx_v__extra = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s___tag,&__pyx_n_s__attrib,&__pyx_n_s__nsmap,0};
  __Pyx_RefNannySetupContext("makeelement");
  __pyx_v__extra = PyDict_New(); if (unlikely(!__pyx_v__extra)) return NULL;
  __Pyx_GOTREF(__pyx_v__extra);
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s___tag);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__attrib);
        if (value) { values[1] = value; kw_args--; }
      }
      case  2:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nsmap);
        if (value) { values[2] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v__extra, values, PyTuple_GET_SIZE(__pyx_args), "makeelement") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v__tag = values[0];
    __pyx_v_attrib = values[1];
    __pyx_v_nsmap = values[2];
  } else {
    __pyx_v_attrib = ((PyObject *)Py_None);
    __pyx_v_nsmap = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: __pyx_v_nsmap = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: __pyx_v_attrib = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v__tag = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("makeelement", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v__extra);
  __Pyx_AddTraceback("lxml.etree._BaseParser.makeelement");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":878
 *         Creates a new element associated with this parser.
 *         """
 *         return _makeElement(_tag, NULL, None, self, None, None,             # <<<<<<<<<<<<<<
 *                             attrib, nsmap, _extra)
 * 
 */
  __Pyx_XDECREF(__pyx_r);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":879
 *         """
 *         return _makeElement(_tag, NULL, None, self, None, None,
 *                             attrib, nsmap, _extra)             # <<<<<<<<<<<<<<
 * 
 *     # internal parser methods
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__makeElement(__pyx_v__tag, NULL, ((struct LxmlDocument *)Py_None), ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self), Py_None, Py_None, __pyx_v_attrib, __pyx_v_nsmap, ((PyObject *)__pyx_v__extra))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._BaseParser.makeelement");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v__extra);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":883
 *     # internal parser methods
 * 
 *     cdef xmlDoc* _parseUnicodeDoc(self, utext, char* c_filename) except NULL:             # <<<<<<<<<<<<<<
 *         u"""Parse unicode document, share dictionary if possible.
 *         """
 */

static  xmlDoc *__pyx_f_4lxml_5etree_11_BaseParser__parseUnicodeDoc(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self, PyObject *__pyx_v_utext, char *__pyx_v_c_filename) {
  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_context;
  xmlDoc *__pyx_v_result;
  xmlParserCtxt *__pyx_v_pctxt;
  Py_ssize_t __pyx_v_py_buffer_len;
  int __pyx_v_buffer_len;
  char *__pyx_v_c_text;
  PyObject *__pyx_v_text_utf;
  xmlDoc *__pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  xmlDoc *__pyx_t_5;
  int __pyx_t_6;
  xmlDoc *__pyx_t_7;
  __Pyx_RefNannySetupContext("_parseUnicodeDoc");
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_text_utf = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":892
 *         cdef int buffer_len
 *         cdef char* c_text
 *         py_buffer_len = python.PyUnicode_GET_DATA_SIZE(utext)             # <<<<<<<<<<<<<<
 *         if py_buffer_len > python.INT_MAX or _UNICODE_ENCODING is NULL:
 *             text_utf = python.PyUnicode_AsUTF8String(utext)
 */
  __pyx_v_py_buffer_len = PyUnicode_GET_DATA_SIZE(__pyx_v_utext);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":893
 *         cdef char* c_text
 *         py_buffer_len = python.PyUnicode_GET_DATA_SIZE(utext)
 *         if py_buffer_len > python.INT_MAX or _UNICODE_ENCODING is NULL:             # <<<<<<<<<<<<<<
 *             text_utf = python.PyUnicode_AsUTF8String(utext)
 *             py_buffer_len = python.PyBytes_GET_SIZE(text_utf)
 */
  __pyx_t_1 = (__pyx_v_py_buffer_len > INT_MAX);
  if (!__pyx_t_1) {
    __pyx_t_2 = (__pyx_v_4lxml_5etree__UNICODE_ENCODING == NULL);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":894
 *         py_buffer_len = python.PyUnicode_GET_DATA_SIZE(utext)
 *         if py_buffer_len > python.INT_MAX or _UNICODE_ENCODING is NULL:
 *             text_utf = python.PyUnicode_AsUTF8String(utext)             # <<<<<<<<<<<<<<
 *             py_buffer_len = python.PyBytes_GET_SIZE(text_utf)
 *             return self._parseDoc(_cstr(text_utf), py_buffer_len, c_filename)
 */
    __pyx_t_4 = ((PyObject *)PyUnicode_AsUTF8String(__pyx_v_utext)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(((PyObject *)__pyx_v_text_utf));
    __pyx_v_text_utf = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":895
 *         if py_buffer_len > python.INT_MAX or _UNICODE_ENCODING is NULL:
 *             text_utf = python.PyUnicode_AsUTF8String(utext)
 *             py_buffer_len = python.PyBytes_GET_SIZE(text_utf)             # <<<<<<<<<<<<<<
 *             return self._parseDoc(_cstr(text_utf), py_buffer_len, c_filename)
 *         buffer_len = py_buffer_len
 */
    __pyx_v_py_buffer_len = PyBytes_GET_SIZE(((PyObject *)__pyx_v_text_utf));

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":896
 *             text_utf = python.PyUnicode_AsUTF8String(utext)
 *             py_buffer_len = python.PyBytes_GET_SIZE(text_utf)
 *             return self._parseDoc(_cstr(text_utf), py_buffer_len, c_filename)             # <<<<<<<<<<<<<<
 *         buffer_len = py_buffer_len
 * 
 */
    __pyx_t_5 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)__pyx_v_self->__pyx_vtab)->_parseDoc(__pyx_v_self, PyBytes_AS_STRING(((PyObject *)__pyx_v_text_utf)), __pyx_v_py_buffer_len, __pyx_v_c_filename); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_r = __pyx_t_5;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":897
 *             py_buffer_len = python.PyBytes_GET_SIZE(text_utf)
 *             return self._parseDoc(_cstr(text_utf), py_buffer_len, c_filename)
 *         buffer_len = py_buffer_len             # <<<<<<<<<<<<<<
 * 
 *         context = self._getParserContext()
 */
  __pyx_v_buffer_len = __pyx_v_py_buffer_len;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":899
 *         buffer_len = py_buffer_len
 * 
 *         context = self._getParserContext()             # <<<<<<<<<<<<<<
 *         context.prepare()
 *         try:
 */
  __pyx_t_4 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)__pyx_v_self->__pyx_vtab)->_getParserContext(__pyx_v_self)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(((PyObject *)__pyx_v_context));
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":900
 * 
 *         context = self._getParserContext()
 *         context.prepare()             # <<<<<<<<<<<<<<
 *         try:
 *             pctxt = context._c_ctxt
 */
  __pyx_t_6 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->prepare(__pyx_v_context); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":901
 *         context = self._getParserContext()
 *         context.prepare()
 *         try:             # <<<<<<<<<<<<<<
 *             pctxt = context._c_ctxt
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 */
  /*try:*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":902
 *         context.prepare()
 *         try:
 *             pctxt = context._c_ctxt             # <<<<<<<<<<<<<<
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 * 
 */
    __pyx_v_pctxt = __pyx_v_context->_c_ctxt;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":903
 *         try:
 *             pctxt = context._c_ctxt
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)             # <<<<<<<<<<<<<<
 * 
 *             c_text = python.PyUnicode_AS_DATA(utext)
 */
    ((struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext *)__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT->__pyx_vtab)->initParserDict(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, __pyx_v_pctxt);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":905
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 * 
 *             c_text = python.PyUnicode_AS_DATA(utext)             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 if self._for_html:
 */
    __pyx_v_c_text = PyUnicode_AS_DATA(__pyx_v_utext);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":906
 * 
 *             c_text = python.PyUnicode_AS_DATA(utext)
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 if self._for_html:
 *                     result = htmlparser.htmlCtxtReadMemory(
 */
    {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      #endif
      Py_UNBLOCK_THREADS
      /*try:*/ {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":907
 *             c_text = python.PyUnicode_AS_DATA(utext)
 *             with nogil:
 *                 if self._for_html:             # <<<<<<<<<<<<<<
 *                     result = htmlparser.htmlCtxtReadMemory(
 *                         pctxt, c_text, buffer_len, c_filename, _UNICODE_ENCODING,
 */
        if (__pyx_v_self->_for_html) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":910
 *                     result = htmlparser.htmlCtxtReadMemory(
 *                         pctxt, c_text, buffer_len, c_filename, _UNICODE_ENCODING,
 *                         self._parse_options)             # <<<<<<<<<<<<<<
 *                     if result is not NULL:
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:
 */
          __pyx_v_result = htmlCtxtReadMemory(__pyx_v_pctxt, __pyx_v_c_text, __pyx_v_buffer_len, __pyx_v_c_filename, __pyx_v_4lxml_5etree__UNICODE_ENCODING, __pyx_v_self->_parse_options);

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":911
 *                         pctxt, c_text, buffer_len, c_filename, _UNICODE_ENCODING,
 *                         self._parse_options)
 *                     if result is not NULL:             # <<<<<<<<<<<<<<
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:
 *                             tree.xmlFreeDoc(result)
 */
          __pyx_t_3 = (__pyx_v_result != NULL);
          if (__pyx_t_3) {

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":912
 *                         self._parse_options)
 *                     if result is not NULL:
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:             # <<<<<<<<<<<<<<
 *                             tree.xmlFreeDoc(result)
 *                             result = NULL
 */
            __pyx_t_3 = (__pyx_f_4lxml_5etree__fixHtmlDictNames(__pyx_v_pctxt->dict, __pyx_v_result) < 0);
            if (__pyx_t_3) {

              /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":913
 *                     if result is not NULL:
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:
 *                             tree.xmlFreeDoc(result)             # <<<<<<<<<<<<<<
 *                             result = NULL
 *                 else:
 */
              xmlFreeDoc(__pyx_v_result);

              /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":914
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:
 *                             tree.xmlFreeDoc(result)
 *                             result = NULL             # <<<<<<<<<<<<<<
 *                 else:
 *                     result = xmlparser.xmlCtxtReadMemory(
 */
              __pyx_v_result = NULL;
              goto __pyx_L12;
            }
            __pyx_L12:;
            goto __pyx_L11;
          }
          __pyx_L11:;
          goto __pyx_L10;
        }
        /*else*/ {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":918
 *                     result = xmlparser.xmlCtxtReadMemory(
 *                         pctxt, c_text, buffer_len, c_filename, _UNICODE_ENCODING,
 *                         self._parse_options)             # <<<<<<<<<<<<<<
 * 
 *             return context._handleParseResultDoc(self, result, None)
 */
          __pyx_v_result = xmlCtxtReadMemory(__pyx_v_pctxt, __pyx_v_c_text, __pyx_v_buffer_len, __pyx_v_c_filename, __pyx_v_4lxml_5etree__UNICODE_ENCODING, __pyx_v_self->_parse_options);
        }
        __pyx_L10:;
      }

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":906
 * 
 *             c_text = python.PyUnicode_AS_DATA(utext)
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 if self._for_html:
 *                     result = htmlparser.htmlCtxtReadMemory(
 */
      /*finally:*/ {
        Py_BLOCK_THREADS
      }
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":920
 *                         self._parse_options)
 * 
 *             return context._handleParseResultDoc(self, result, None)             # <<<<<<<<<<<<<<
 *         finally:
 *             context.cleanup()
 */
    __pyx_t_7 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->_handleParseResultDoc(__pyx_v_context, __pyx_v_self, __pyx_v_result, Py_None); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 920; __pyx_clineno = __LINE__; goto __pyx_L5;}
    __pyx_r = __pyx_t_7;
    goto __pyx_L4;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":922
 *             return context._handleParseResultDoc(self, result, None)
 *         finally:
 *             context.cleanup()             # <<<<<<<<<<<<<<
 * 
 *     cdef xmlDoc* _parseDoc(self, char* c_text, Py_ssize_t c_len,
 */
  /*finally:*/ {
    int __pyx_why;
    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
    int __pyx_exc_lineno;
    __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 0; goto __pyx_L6;
    __pyx_L4: __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 3; goto __pyx_L6;
    __pyx_L5: {
      __pyx_why = 4;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
      __pyx_exc_lineno = __pyx_lineno;
      goto __pyx_L6;
    }
    __pyx_L6:;
    __pyx_t_6 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->cleanup(__pyx_v_context); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
    goto __pyx_L14;
    __pyx_L13_error:;
    if (__pyx_why == 4) {
      Py_XDECREF(__pyx_exc_type);
      Py_XDECREF(__pyx_exc_value);
      Py_XDECREF(__pyx_exc_tb);
    }
    goto __pyx_L1_error;
    __pyx_L14:;
    switch (__pyx_why) {
      case 3: goto __pyx_L0;
      case 4: {
        __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
        __pyx_lineno = __pyx_exc_lineno;
        __pyx_exc_type = 0;
        __pyx_exc_value = 0;
        __pyx_exc_tb = 0;
        goto __pyx_L1_error;
      }
    }
  }

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._BaseParser._parseUnicodeDoc");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_context);
  __Pyx_DECREF(__pyx_v_text_utf);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":924
 *             context.cleanup()
 * 
 *     cdef xmlDoc* _parseDoc(self, char* c_text, Py_ssize_t c_len,             # <<<<<<<<<<<<<<
 *                            char* c_filename) except NULL:
 *         u"""Parse document, share dictionary if possible.
 */

static  xmlDoc *__pyx_f_4lxml_5etree_11_BaseParser__parseDoc(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self, char *__pyx_v_c_text, Py_ssize_t __pyx_v_c_len, char *__pyx_v_c_filename) {
  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_context;
  xmlDoc *__pyx_v_result;
  xmlParserCtxt *__pyx_v_pctxt;
  char *__pyx_v_c_encoding;
  xmlDoc *__pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  xmlDoc *__pyx_t_4;
  __Pyx_RefNannySetupContext("_parseDoc");
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":932
 *         cdef xmlparser.xmlParserCtxt* pctxt
 *         cdef char* c_encoding
 *         if c_len > python.INT_MAX:             # <<<<<<<<<<<<<<
 *             raise ParserError, u"string is too long to parse it with libxml2"
 * 
 */
  __pyx_t_1 = (__pyx_v_c_len > INT_MAX);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":933
 *         cdef char* c_encoding
 *         if c_len > python.INT_MAX:
 *             raise ParserError, u"string is too long to parse it with libxml2"             # <<<<<<<<<<<<<<
 * 
 *         context = self._getParserContext()
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__ParserError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, ((PyObject *)__pyx_kp_u_186), 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[3]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":935
 *             raise ParserError, u"string is too long to parse it with libxml2"
 * 
 *         context = self._getParserContext()             # <<<<<<<<<<<<<<
 *         context.prepare()
 *         try:
 */
  __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)__pyx_v_self->__pyx_vtab)->_getParserContext(__pyx_v_self)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_v_context));
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":936
 * 
 *         context = self._getParserContext()
 *         context.prepare()             # <<<<<<<<<<<<<<
 *         try:
 *             pctxt = context._c_ctxt
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->prepare(__pyx_v_context); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 936; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":937
 *         context = self._getParserContext()
 *         context.prepare()
 *         try:             # <<<<<<<<<<<<<<
 *             pctxt = context._c_ctxt
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 */
  /*try:*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":938
 *         context.prepare()
 *         try:
 *             pctxt = context._c_ctxt             # <<<<<<<<<<<<<<
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 * 
 */
    __pyx_v_pctxt = __pyx_v_context->_c_ctxt;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":939
 *         try:
 *             pctxt = context._c_ctxt
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)             # <<<<<<<<<<<<<<
 * 
 *             if self._default_encoding is None:
 */
    ((struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext *)__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT->__pyx_vtab)->initParserDict(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, __pyx_v_pctxt);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":941
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 * 
 *             if self._default_encoding is None:             # <<<<<<<<<<<<<<
 *                 c_encoding = NULL
 *             else:
 */
    __pyx_t_1 = (__pyx_v_self->_default_encoding == Py_None);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":942
 * 
 *             if self._default_encoding is None:
 *                 c_encoding = NULL             # <<<<<<<<<<<<<<
 *             else:
 *                 c_encoding = _cstr(self._default_encoding)
 */
      __pyx_v_c_encoding = NULL;
      goto __pyx_L7;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":944
 *                 c_encoding = NULL
 *             else:
 *                 c_encoding = _cstr(self._default_encoding)             # <<<<<<<<<<<<<<
 * 
 *             with nogil:
 */
      __pyx_t_2 = __pyx_v_self->_default_encoding;
      __Pyx_INCREF(__pyx_t_2);
      __pyx_v_c_encoding = PyBytes_AS_STRING(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __pyx_L7:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":946
 *                 c_encoding = _cstr(self._default_encoding)
 * 
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 if self._for_html:
 *                     result = htmlparser.htmlCtxtReadMemory(
 */
    {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      #endif
      Py_UNBLOCK_THREADS
      /*try:*/ {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":947
 * 
 *             with nogil:
 *                 if self._for_html:             # <<<<<<<<<<<<<<
 *                     result = htmlparser.htmlCtxtReadMemory(
 *                         pctxt, c_text, c_len, c_filename,
 */
        if (__pyx_v_self->_for_html) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":950
 *                     result = htmlparser.htmlCtxtReadMemory(
 *                         pctxt, c_text, c_len, c_filename,
 *                         c_encoding, self._parse_options)             # <<<<<<<<<<<<<<
 *                     if result is not NULL:
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:
 */
          __pyx_v_result = htmlCtxtReadMemory(__pyx_v_pctxt, __pyx_v_c_text, __pyx_v_c_len, __pyx_v_c_filename, __pyx_v_c_encoding, __pyx_v_self->_parse_options);

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":951
 *                         pctxt, c_text, c_len, c_filename,
 *                         c_encoding, self._parse_options)
 *                     if result is not NULL:             # <<<<<<<<<<<<<<
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:
 *                             tree.xmlFreeDoc(result)
 */
          __pyx_t_1 = (__pyx_v_result != NULL);
          if (__pyx_t_1) {

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":952
 *                         c_encoding, self._parse_options)
 *                     if result is not NULL:
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:             # <<<<<<<<<<<<<<
 *                             tree.xmlFreeDoc(result)
 *                             result = NULL
 */
            __pyx_t_1 = (__pyx_f_4lxml_5etree__fixHtmlDictNames(__pyx_v_pctxt->dict, __pyx_v_result) < 0);
            if (__pyx_t_1) {

              /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":953
 *                     if result is not NULL:
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:
 *                             tree.xmlFreeDoc(result)             # <<<<<<<<<<<<<<
 *                             result = NULL
 *                 else:
 */
              xmlFreeDoc(__pyx_v_result);

              /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":954
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:
 *                             tree.xmlFreeDoc(result)
 *                             result = NULL             # <<<<<<<<<<<<<<
 *                 else:
 *                     result = xmlparser.xmlCtxtReadMemory(
 */
              __pyx_v_result = NULL;
              goto __pyx_L13;
            }
            __pyx_L13:;
            goto __pyx_L12;
          }
          __pyx_L12:;
          goto __pyx_L11;
        }
        /*else*/ {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":958
 *                     result = xmlparser.xmlCtxtReadMemory(
 *                         pctxt, c_text, c_len, c_filename,
 *                         c_encoding, self._parse_options)             # <<<<<<<<<<<<<<
 * 
 *             return context._handleParseResultDoc(self, result, None)
 */
          __pyx_v_result = xmlCtxtReadMemory(__pyx_v_pctxt, __pyx_v_c_text, __pyx_v_c_len, __pyx_v_c_filename, __pyx_v_c_encoding, __pyx_v_self->_parse_options);
        }
        __pyx_L11:;
      }

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":946
 *                 c_encoding = _cstr(self._default_encoding)
 * 
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 if self._for_html:
 *                     result = htmlparser.htmlCtxtReadMemory(
 */
      /*finally:*/ {
        Py_BLOCK_THREADS
      }
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":960
 *                         c_encoding, self._parse_options)
 * 
 *             return context._handleParseResultDoc(self, result, None)             # <<<<<<<<<<<<<<
 *         finally:
 *             context.cleanup()
 */
    __pyx_t_4 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->_handleParseResultDoc(__pyx_v_context, __pyx_v_self, __pyx_v_result, Py_None); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 960; __pyx_clineno = __LINE__; goto __pyx_L5;}
    __pyx_r = __pyx_t_4;
    goto __pyx_L4;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":962
 *             return context._handleParseResultDoc(self, result, None)
 *         finally:
 *             context.cleanup()             # <<<<<<<<<<<<<<
 * 
 *     cdef xmlDoc* _parseDocFromFile(self, char* c_filename) except NULL:
 */
  /*finally:*/ {
    int __pyx_why;
    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
    int __pyx_exc_lineno;
    __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 0; goto __pyx_L6;
    __pyx_L4: __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 3; goto __pyx_L6;
    __pyx_L5: {
      __pyx_why = 4;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
      __pyx_exc_lineno = __pyx_lineno;
      goto __pyx_L6;
    }
    __pyx_L6:;
    __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->cleanup(__pyx_v_context); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 962; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
    goto __pyx_L15;
    __pyx_L14_error:;
    if (__pyx_why == 4) {
      Py_XDECREF(__pyx_exc_type);
      Py_XDECREF(__pyx_exc_value);
      Py_XDECREF(__pyx_exc_tb);
    }
    goto __pyx_L1_error;
    __pyx_L15:;
    switch (__pyx_why) {
      case 3: goto __pyx_L0;
      case 4: {
        __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
        __pyx_lineno = __pyx_exc_lineno;
        __pyx_exc_type = 0;
        __pyx_exc_value = 0;
        __pyx_exc_tb = 0;
        goto __pyx_L1_error;
      }
    }
  }

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._BaseParser._parseDoc");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":964
 *             context.cleanup()
 * 
 *     cdef xmlDoc* _parseDocFromFile(self, char* c_filename) except NULL:             # <<<<<<<<<<<<<<
 *         cdef _ParserContext context
 *         cdef xmlDoc* result
 */

static  xmlDoc *__pyx_f_4lxml_5etree_11_BaseParser__parseDocFromFile(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self, char *__pyx_v_c_filename) {
  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_context;
  xmlDoc *__pyx_v_result;
  xmlParserCtxt *__pyx_v_pctxt;
  int __pyx_v_orig_options;
  char *__pyx_v_c_encoding;
  xmlDoc *__pyx_r;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  xmlDoc *__pyx_t_4;
  __Pyx_RefNannySetupContext("_parseDocFromFile");
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":970
 *         cdef int orig_options
 *         cdef char* c_encoding
 *         result = NULL             # <<<<<<<<<<<<<<
 * 
 *         context = self._getParserContext()
 */
  __pyx_v_result = NULL;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":972
 *         result = NULL
 * 
 *         context = self._getParserContext()             # <<<<<<<<<<<<<<
 *         context.prepare()
 *         try:
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)__pyx_v_self->__pyx_vtab)->_getParserContext(__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_context));
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":973
 * 
 *         context = self._getParserContext()
 *         context.prepare()             # <<<<<<<<<<<<<<
 *         try:
 *             pctxt = context._c_ctxt
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->prepare(__pyx_v_context); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":974
 *         context = self._getParserContext()
 *         context.prepare()
 *         try:             # <<<<<<<<<<<<<<
 *             pctxt = context._c_ctxt
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 */
  /*try:*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":975
 *         context.prepare()
 *         try:
 *             pctxt = context._c_ctxt             # <<<<<<<<<<<<<<
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 * 
 */
    __pyx_v_pctxt = __pyx_v_context->_c_ctxt;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":976
 *         try:
 *             pctxt = context._c_ctxt
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)             # <<<<<<<<<<<<<<
 * 
 *             if self._default_encoding is None:
 */
    ((struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext *)__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT->__pyx_vtab)->initParserDict(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, __pyx_v_pctxt);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":978
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 * 
 *             if self._default_encoding is None:             # <<<<<<<<<<<<<<
 *                 c_encoding = NULL
 *             else:
 */
    __pyx_t_3 = (__pyx_v_self->_default_encoding == Py_None);
    if (__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":979
 * 
 *             if self._default_encoding is None:
 *                 c_encoding = NULL             # <<<<<<<<<<<<<<
 *             else:
 *                 c_encoding = _cstr(self._default_encoding)
 */
      __pyx_v_c_encoding = NULL;
      goto __pyx_L6;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":981
 *                 c_encoding = NULL
 *             else:
 *                 c_encoding = _cstr(self._default_encoding)             # <<<<<<<<<<<<<<
 * 
 *             orig_options = pctxt.options
 */
      __pyx_t_1 = __pyx_v_self->_default_encoding;
      __Pyx_INCREF(__pyx_t_1);
      __pyx_v_c_encoding = PyBytes_AS_STRING(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __pyx_L6:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":983
 *                 c_encoding = _cstr(self._default_encoding)
 * 
 *             orig_options = pctxt.options             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 if self._for_html:
 */
    __pyx_v_orig_options = __pyx_v_pctxt->options;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":984
 * 
 *             orig_options = pctxt.options
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 if self._for_html:
 *                     result = htmlparser.htmlCtxtReadFile(
 */
    {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      #endif
      Py_UNBLOCK_THREADS
      /*try:*/ {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":985
 *             orig_options = pctxt.options
 *             with nogil:
 *                 if self._for_html:             # <<<<<<<<<<<<<<
 *                     result = htmlparser.htmlCtxtReadFile(
 *                         pctxt, c_filename, c_encoding, self._parse_options)
 */
        if (__pyx_v_self->_for_html) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":987
 *                 if self._for_html:
 *                     result = htmlparser.htmlCtxtReadFile(
 *                         pctxt, c_filename, c_encoding, self._parse_options)             # <<<<<<<<<<<<<<
 *                     if result is not NULL:
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:
 */
          __pyx_v_result = htmlCtxtReadFile(__pyx_v_pctxt, __pyx_v_c_filename, __pyx_v_c_encoding, __pyx_v_self->_parse_options);

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":988
 *                     result = htmlparser.htmlCtxtReadFile(
 *                         pctxt, c_filename, c_encoding, self._parse_options)
 *                     if result is not NULL:             # <<<<<<<<<<<<<<
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:
 *                             tree.xmlFreeDoc(result)
 */
          __pyx_t_3 = (__pyx_v_result != NULL);
          if (__pyx_t_3) {

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":989
 *                         pctxt, c_filename, c_encoding, self._parse_options)
 *                     if result is not NULL:
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:             # <<<<<<<<<<<<<<
 *                             tree.xmlFreeDoc(result)
 *                             result = NULL
 */
            __pyx_t_3 = (__pyx_f_4lxml_5etree__fixHtmlDictNames(__pyx_v_pctxt->dict, __pyx_v_result) < 0);
            if (__pyx_t_3) {

              /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":990
 *                     if result is not NULL:
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:
 *                             tree.xmlFreeDoc(result)             # <<<<<<<<<<<<<<
 *                             result = NULL
 *                 else:
 */
              xmlFreeDoc(__pyx_v_result);

              /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":991
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:
 *                             tree.xmlFreeDoc(result)
 *                             result = NULL             # <<<<<<<<<<<<<<
 *                 else:
 *                     result = xmlparser.xmlCtxtReadFile(
 */
              __pyx_v_result = NULL;
              goto __pyx_L12;
            }
            __pyx_L12:;
            goto __pyx_L11;
          }
          __pyx_L11:;
          goto __pyx_L10;
        }
        /*else*/ {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":994
 *                 else:
 *                     result = xmlparser.xmlCtxtReadFile(
 *                         pctxt, c_filename, c_encoding, self._parse_options)             # <<<<<<<<<<<<<<
 *             pctxt.options = orig_options # work around libxml2 problem
 * 
 */
          __pyx_v_result = xmlCtxtReadFile(__pyx_v_pctxt, __pyx_v_c_filename, __pyx_v_c_encoding, __pyx_v_self->_parse_options);
        }
        __pyx_L10:;
      }

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":984
 * 
 *             orig_options = pctxt.options
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 if self._for_html:
 *                     result = htmlparser.htmlCtxtReadFile(
 */
      /*finally:*/ {
        Py_BLOCK_THREADS
      }
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":995
 *                     result = xmlparser.xmlCtxtReadFile(
 *                         pctxt, c_filename, c_encoding, self._parse_options)
 *             pctxt.options = orig_options # work around libxml2 problem             # <<<<<<<<<<<<<<
 * 
 *             return context._handleParseResultDoc(self, result, c_filename)
 */
    __pyx_v_pctxt->options = __pyx_v_orig_options;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":997
 *             pctxt.options = orig_options # work around libxml2 problem
 * 
 *             return context._handleParseResultDoc(self, result, c_filename)             # <<<<<<<<<<<<<<
 *         finally:
 *             context.cleanup()
 */
    __pyx_t_1 = PyBytes_FromString(__pyx_v_c_filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 997; __pyx_clineno = __LINE__; goto __pyx_L4;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __pyx_t_4 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->_handleParseResultDoc(__pyx_v_context, __pyx_v_self, __pyx_v_result, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 997; __pyx_clineno = __LINE__; goto __pyx_L4;}
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_4;
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":999
 *             return context._handleParseResultDoc(self, result, c_filename)
 *         finally:
 *             context.cleanup()             # <<<<<<<<<<<<<<
 * 
 *     cdef xmlDoc* _parseDocFromFilelike(self, filelike, filename) except NULL:
 */
  /*finally:*/ {
    int __pyx_why;
    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
    int __pyx_exc_lineno;
    __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 0; goto __pyx_L5;
    __pyx_L3: __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 3; goto __pyx_L5;
    __pyx_L4: {
      __pyx_why = 4;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
      __pyx_exc_lineno = __pyx_lineno;
      goto __pyx_L5;
    }
    __pyx_L5:;
    __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->cleanup(__pyx_v_context); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 999; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
    goto __pyx_L14;
    __pyx_L13_error:;
    if (__pyx_why == 4) {
      Py_XDECREF(__pyx_exc_type);
      Py_XDECREF(__pyx_exc_value);
      Py_XDECREF(__pyx_exc_tb);
    }
    goto __pyx_L1_error;
    __pyx_L14:;
    switch (__pyx_why) {
      case 3: goto __pyx_L0;
      case 4: {
        __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
        __pyx_lineno = __pyx_exc_lineno;
        __pyx_exc_type = 0;
        __pyx_exc_value = 0;
        __pyx_exc_tb = 0;
        goto __pyx_L1_error;
      }
    }
  }

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._BaseParser._parseDocFromFile");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1001
 *             context.cleanup()
 * 
 *     cdef xmlDoc* _parseDocFromFilelike(self, filelike, filename) except NULL:             # <<<<<<<<<<<<<<
 *         cdef _ParserContext context
 *         cdef _FileReaderContext file_context
 */

static  xmlDoc *__pyx_f_4lxml_5etree_11_BaseParser__parseDocFromFilelike(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self, PyObject *__pyx_v_filelike, PyObject *__pyx_v_filename) {
  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_context;
  struct __pyx_obj_4lxml_5etree__FileReaderContext *__pyx_v_file_context;
  xmlDoc *__pyx_v_result;
  xmlParserCtxt *__pyx_v_pctxt;
  xmlDoc *__pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  xmlDoc *__pyx_t_6;
  __Pyx_RefNannySetupContext("_parseDocFromFilelike");
  __Pyx_INCREF(__pyx_v_filename);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_file_context = ((struct __pyx_obj_4lxml_5etree__FileReaderContext *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1007
 *         cdef xmlparser.xmlParserCtxt* pctxt
 *         cdef char* c_filename
 *         if not filename:             # <<<<<<<<<<<<<<
 *             filename = None
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_filename); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = (!__pyx_t_1);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1008
 *         cdef char* c_filename
 *         if not filename:
 *             filename = None             # <<<<<<<<<<<<<<
 * 
 *         context = self._getParserContext()
 */
    __Pyx_INCREF(Py_None);
    __Pyx_DECREF(__pyx_v_filename);
    __pyx_v_filename = Py_None;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1010
 *             filename = None
 * 
 *         context = self._getParserContext()             # <<<<<<<<<<<<<<
 *         context.prepare()
 *         try:
 */
  __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)__pyx_v_self->__pyx_vtab)->_getParserContext(__pyx_v_self)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1010; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_v_context));
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1011
 * 
 *         context = self._getParserContext()
 *         context.prepare()             # <<<<<<<<<<<<<<
 *         try:
 *             pctxt = context._c_ctxt
 */
  __pyx_t_4 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->prepare(__pyx_v_context); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1012
 *         context = self._getParserContext()
 *         context.prepare()
 *         try:             # <<<<<<<<<<<<<<
 *             pctxt = context._c_ctxt
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 */
  /*try:*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1013
 *         context.prepare()
 *         try:
 *             pctxt = context._c_ctxt             # <<<<<<<<<<<<<<
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 *             file_context = _FileReaderContext(
 */
    __pyx_v_pctxt = __pyx_v_context->_c_ctxt;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1014
 *         try:
 *             pctxt = context._c_ctxt
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)             # <<<<<<<<<<<<<<
 *             file_context = _FileReaderContext(
 *                 filelike, context, filename, self._default_encoding)
 */
    ((struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext *)__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT->__pyx_vtab)->initParserDict(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, __pyx_v_pctxt);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1016
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 *             file_context = _FileReaderContext(
 *                 filelike, context, filename, self._default_encoding)             # <<<<<<<<<<<<<<
 *             result = file_context._readDoc(pctxt, self._parse_options)
 * 
 */
    __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1015; __pyx_clineno = __LINE__; goto __pyx_L5;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_INCREF(__pyx_v_filelike);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_filelike);
    __Pyx_GIVEREF(__pyx_v_filelike);
    __Pyx_INCREF(((PyObject *)__pyx_v_context));
    PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_context));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_context));
    __Pyx_INCREF(__pyx_v_filename);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_filename);
    __Pyx_GIVEREF(__pyx_v_filename);
    __Pyx_INCREF(__pyx_v_self->_default_encoding);
    PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_v_self->_default_encoding);
    __Pyx_GIVEREF(__pyx_v_self->_default_encoding);
    __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__FileReaderContext)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1015; __pyx_clineno = __LINE__; goto __pyx_L5;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_v_file_context));
    __pyx_v_file_context = ((struct __pyx_obj_4lxml_5etree__FileReaderContext *)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1017
 *             file_context = _FileReaderContext(
 *                 filelike, context, filename, self._default_encoding)
 *             result = file_context._readDoc(pctxt, self._parse_options)             # <<<<<<<<<<<<<<
 * 
 *             return context._handleParseResultDoc(
 */
    __pyx_v_result = ((struct __pyx_vtabstruct_4lxml_5etree__FileReaderContext *)__pyx_v_file_context->__pyx_vtab)->_readDoc(__pyx_v_file_context, __pyx_v_pctxt, __pyx_v_self->_parse_options);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1020
 * 
 *             return context._handleParseResultDoc(
 *                 self, result, filename)             # <<<<<<<<<<<<<<
 *         finally:
 *             context.cleanup()
 */
    __pyx_t_6 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->_handleParseResultDoc(__pyx_v_context, __pyx_v_self, __pyx_v_result, __pyx_v_filename); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1019; __pyx_clineno = __LINE__; goto __pyx_L5;}
    __pyx_r = __pyx_t_6;
    goto __pyx_L4;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1022
 *                 self, result, filename)
 *         finally:
 *             context.cleanup()             # <<<<<<<<<<<<<<
 * 
 * ############################################################
 */
  /*finally:*/ {
    int __pyx_why;
    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
    int __pyx_exc_lineno;
    __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 0; goto __pyx_L6;
    __pyx_L4: __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 3; goto __pyx_L6;
    __pyx_L5: {
      __pyx_why = 4;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
      __pyx_exc_lineno = __pyx_lineno;
      goto __pyx_L6;
    }
    __pyx_L6:;
    __pyx_t_4 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->cleanup(__pyx_v_context); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
    goto __pyx_L8;
    __pyx_L7_error:;
    if (__pyx_why == 4) {
      Py_XDECREF(__pyx_exc_type);
      Py_XDECREF(__pyx_exc_value);
      Py_XDECREF(__pyx_exc_tb);
    }
    goto __pyx_L1_error;
    __pyx_L8:;
    switch (__pyx_why) {
      case 3: goto __pyx_L0;
      case 4: {
        __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
        __pyx_lineno = __pyx_exc_lineno;
        __pyx_exc_type = 0;
        __pyx_exc_value = 0;
        __pyx_exc_tb = 0;
        goto __pyx_L1_error;
      }
    }
  }

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._BaseParser._parseDocFromFilelike");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_context);
  __Pyx_DECREF((PyObject *)__pyx_v_file_context);
  __Pyx_DECREF(__pyx_v_filename);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":708
 *     cdef XMLSchema _schema
 *     cdef object _filename
 *     cdef readonly object target             # <<<<<<<<<<<<<<
 *     cdef object _default_encoding
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_11_BaseParser_6target___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_11_BaseParser_6target___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self)->target);
  __pyx_r = ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self)->target;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1037
 *         different from what the ``error_log`` property returns.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef _ParserContext context
 *             context = self._getPushParserContext()
 */

static PyObject *__pyx_pf_4lxml_5etree_11_FeedParser_14feed_error_log___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_11_FeedParser_14feed_error_log___get__(PyObject *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_context;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1039
 *         def __get__(self):
 *             cdef _ParserContext context
 *             context = self._getPushParserContext()             # <<<<<<<<<<<<<<
 *             return context._error_log.copy()
 * 
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__FeedParser *)((struct __pyx_obj_4lxml_5etree__FeedParser *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base._getPushParserContext(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_context));
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1040
 *             cdef _ParserContext context
 *             context = self._getPushParserContext()
 *             return context._error_log.copy()             # <<<<<<<<<<<<<<
 * 
 *     def feed(self, data):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_context->_error_log), __pyx_n_s__copy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._FeedParser.feed_error_log.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_context);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1042
 *             return context._error_log.copy()
 * 
 *     def feed(self, data):             # <<<<<<<<<<<<<<
 *         u"""feed(self, data)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_11_FeedParser_feed(PyObject *__pyx_v_self, PyObject *__pyx_v_data); /*proto*/
static char __pyx_doc_4lxml_5etree_11_FeedParser_feed[] = "feed(self, data)\n\n        Feeds data to the parser.  The argument should be an 8-bit string\n        buffer containing encoded data, although Unicode is supported as long\n        as both string types are not mixed.\n\n        This is the main entry point to the consumer interface of a\n        parser.  The parser will parse as much of the XML stream as it\n        can on each call.  To finish parsing or to reset the parser,\n        call the ``close()`` method.  Both methods may raise\n        ParseError if errors occur in the input data.  If an error is\n        raised, there is no longer a need to call ``close()``.\n\n        The feed parser interface is independent of the normal parser\n        usage.  You can use the same parser as a feed parser and in\n        the ``parse()`` function concurrently.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_11_FeedParser_feed(PyObject *__pyx_v_self, PyObject *__pyx_v_data) {
  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_context;
  xmlParserCtxt *__pyx_v_pctxt;
  Py_ssize_t __pyx_v_py_buffer_len;
  char *__pyx_v_c_data;
  char *__pyx_v_c_encoding;
  int __pyx_v_buffer_len;
  int __pyx_v_error;
  int __pyx_v_recover;
  PyObject *__pyx_v_entry;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  char *__pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  __Pyx_RefNannySetupContext("feed");
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_entry = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1067
 *         cdef int buffer_len
 *         cdef int error
 *         cdef bint recover = self._parse_options & xmlparser.XML_PARSE_RECOVER             # <<<<<<<<<<<<<<
 *         if python.PyBytes_Check(data):
 *             if self._default_encoding is None:
 */
  __pyx_v_recover = (((struct __pyx_obj_4lxml_5etree__FeedParser *)__pyx_v_self)->__pyx_base._parse_options & XML_PARSE_RECOVER);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1068
 *         cdef int error
 *         cdef bint recover = self._parse_options & xmlparser.XML_PARSE_RECOVER
 *         if python.PyBytes_Check(data):             # <<<<<<<<<<<<<<
 *             if self._default_encoding is None:
 *                 c_encoding = NULL
 */
  __pyx_t_1 = PyBytes_Check(__pyx_v_data);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1069
 *         cdef bint recover = self._parse_options & xmlparser.XML_PARSE_RECOVER
 *         if python.PyBytes_Check(data):
 *             if self._default_encoding is None:             # <<<<<<<<<<<<<<
 *                 c_encoding = NULL
 *             else:
 */
    __pyx_t_1 = (((struct __pyx_obj_4lxml_5etree__FeedParser *)__pyx_v_self)->__pyx_base._default_encoding == Py_None);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1070
 *         if python.PyBytes_Check(data):
 *             if self._default_encoding is None:
 *                 c_encoding = NULL             # <<<<<<<<<<<<<<
 *             else:
 *                 c_encoding = self._default_encoding
 */
      __pyx_v_c_encoding = NULL;
      goto __pyx_L6;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1072
 *                 c_encoding = NULL
 *             else:
 *                 c_encoding = self._default_encoding             # <<<<<<<<<<<<<<
 *             c_data = _cstr(data)
 *             py_buffer_len = python.PyBytes_GET_SIZE(data)
 */
      __pyx_t_2 = PyBytes_AsString(((struct __pyx_obj_4lxml_5etree__FeedParser *)__pyx_v_self)->__pyx_base._default_encoding); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_c_encoding = __pyx_t_2;
    }
    __pyx_L6:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1073
 *             else:
 *                 c_encoding = self._default_encoding
 *             c_data = _cstr(data)             # <<<<<<<<<<<<<<
 *             py_buffer_len = python.PyBytes_GET_SIZE(data)
 *         elif python.PyUnicode_Check(data):
 */
    __pyx_v_c_data = PyBytes_AS_STRING(__pyx_v_data);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1074
 *                 c_encoding = self._default_encoding
 *             c_data = _cstr(data)
 *             py_buffer_len = python.PyBytes_GET_SIZE(data)             # <<<<<<<<<<<<<<
 *         elif python.PyUnicode_Check(data):
 *             if _UNICODE_ENCODING is NULL:
 */
    __pyx_v_py_buffer_len = PyBytes_GET_SIZE(__pyx_v_data);
    goto __pyx_L5;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1075
 *             c_data = _cstr(data)
 *             py_buffer_len = python.PyBytes_GET_SIZE(data)
 *         elif python.PyUnicode_Check(data):             # <<<<<<<<<<<<<<
 *             if _UNICODE_ENCODING is NULL:
 *                 raise ParserError, \
 */
  __pyx_t_1 = PyUnicode_Check(__pyx_v_data);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1076
 *             py_buffer_len = python.PyBytes_GET_SIZE(data)
 *         elif python.PyUnicode_Check(data):
 *             if _UNICODE_ENCODING is NULL:             # <<<<<<<<<<<<<<
 *                 raise ParserError, \
 *                     u"Unicode parsing is not supported on this platform"
 */
    __pyx_t_1 = (__pyx_v_4lxml_5etree__UNICODE_ENCODING == NULL);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1077
 *         elif python.PyUnicode_Check(data):
 *             if _UNICODE_ENCODING is NULL:
 *                 raise ParserError, \             # <<<<<<<<<<<<<<
 *                     u"Unicode parsing is not supported on this platform"
 *             c_encoding = _UNICODE_ENCODING
 */
      __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__ParserError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_Raise(__pyx_t_3, ((PyObject *)__pyx_kp_u_188), 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1079
 *                 raise ParserError, \
 *                     u"Unicode parsing is not supported on this platform"
 *             c_encoding = _UNICODE_ENCODING             # <<<<<<<<<<<<<<
 *             c_data = python.PyUnicode_AS_DATA(data)
 *             py_buffer_len = python.PyUnicode_GET_DATA_SIZE(data)
 */
    __pyx_v_c_encoding = __pyx_v_4lxml_5etree__UNICODE_ENCODING;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1080
 *                     u"Unicode parsing is not supported on this platform"
 *             c_encoding = _UNICODE_ENCODING
 *             c_data = python.PyUnicode_AS_DATA(data)             # <<<<<<<<<<<<<<
 *             py_buffer_len = python.PyUnicode_GET_DATA_SIZE(data)
 *         else:
 */
    __pyx_v_c_data = PyUnicode_AS_DATA(__pyx_v_data);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1081
 *             c_encoding = _UNICODE_ENCODING
 *             c_data = python.PyUnicode_AS_DATA(data)
 *             py_buffer_len = python.PyUnicode_GET_DATA_SIZE(data)             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError, u"Parsing requires string data"
 */
    __pyx_v_py_buffer_len = PyUnicode_GET_DATA_SIZE(__pyx_v_data);
    goto __pyx_L5;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1083
 *             py_buffer_len = python.PyUnicode_GET_DATA_SIZE(data)
 *         else:
 *             raise TypeError, u"Parsing requires string data"             # <<<<<<<<<<<<<<
 * 
 *         context = self._getPushParserContext()
 */
    __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_u_189), 0);
    {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1085
 *             raise TypeError, u"Parsing requires string data"
 * 
 *         context = self._getPushParserContext()             # <<<<<<<<<<<<<<
 *         pctxt = context._c_ctxt
 *         error = 0
 */
  __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__FeedParser *)((struct __pyx_obj_4lxml_5etree__FeedParser *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base._getPushParserContext(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_v_context));
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1086
 * 
 *         context = self._getPushParserContext()
 *         pctxt = context._c_ctxt             # <<<<<<<<<<<<<<
 *         error = 0
 *         if not self._feed_parser_running:
 */
  __pyx_v_pctxt = __pyx_v_context->_c_ctxt;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1087
 *         context = self._getPushParserContext()
 *         pctxt = context._c_ctxt
 *         error = 0             # <<<<<<<<<<<<<<
 *         if not self._feed_parser_running:
 *             context.prepare()
 */
  __pyx_v_error = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1088
 *         pctxt = context._c_ctxt
 *         error = 0
 *         if not self._feed_parser_running:             # <<<<<<<<<<<<<<
 *             context.prepare()
 *             self._feed_parser_running = 1
 */
  __pyx_t_1 = (!((struct __pyx_obj_4lxml_5etree__FeedParser *)__pyx_v_self)->_feed_parser_running);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1089
 *         error = 0
 *         if not self._feed_parser_running:
 *             context.prepare()             # <<<<<<<<<<<<<<
 *             self._feed_parser_running = 1
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 */
    __pyx_t_4 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->prepare(__pyx_v_context); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1090
 *         if not self._feed_parser_running:
 *             context.prepare()
 *             self._feed_parser_running = 1             # <<<<<<<<<<<<<<
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 * 
 */
    ((struct __pyx_obj_4lxml_5etree__FeedParser *)__pyx_v_self)->_feed_parser_running = 1;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1091
 *             context.prepare()
 *             self._feed_parser_running = 1
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)             # <<<<<<<<<<<<<<
 * 
 *             if py_buffer_len > python.INT_MAX:
 */
    ((struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext *)__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT->__pyx_vtab)->initParserDict(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, __pyx_v_pctxt);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1093
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 * 
 *             if py_buffer_len > python.INT_MAX:             # <<<<<<<<<<<<<<
 *                 buffer_len = python.INT_MAX
 *             else:
 */
    __pyx_t_1 = (__pyx_v_py_buffer_len > INT_MAX);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1094
 * 
 *             if py_buffer_len > python.INT_MAX:
 *                 buffer_len = python.INT_MAX             # <<<<<<<<<<<<<<
 *             else:
 *                 buffer_len = <int>py_buffer_len
 */
      __pyx_v_buffer_len = INT_MAX;
      goto __pyx_L9;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1096
 *                 buffer_len = python.INT_MAX
 *             else:
 *                 buffer_len = <int>py_buffer_len             # <<<<<<<<<<<<<<
 *             if self._for_html:
 *                 error = _htmlCtxtResetPush(pctxt, c_data, buffer_len,
 */
      __pyx_v_buffer_len = ((int)__pyx_v_py_buffer_len);
    }
    __pyx_L9:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1097
 *             else:
 *                 buffer_len = <int>py_buffer_len
 *             if self._for_html:             # <<<<<<<<<<<<<<
 *                 error = _htmlCtxtResetPush(pctxt, c_data, buffer_len,
 *                                            c_encoding, self._parse_options)
 */
    if (((struct __pyx_obj_4lxml_5etree__FeedParser *)__pyx_v_self)->__pyx_base._for_html) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1099
 *             if self._for_html:
 *                 error = _htmlCtxtResetPush(pctxt, c_data, buffer_len,
 *                                            c_encoding, self._parse_options)             # <<<<<<<<<<<<<<
 *             else:
 *                 xmlparser.xmlCtxtUseOptions(pctxt, self._parse_options)
 */
      __pyx_t_4 = __pyx_f_4lxml_5etree__htmlCtxtResetPush(__pyx_v_pctxt, __pyx_v_c_data, __pyx_v_buffer_len, __pyx_v_c_encoding, ((struct __pyx_obj_4lxml_5etree__FeedParser *)__pyx_v_self)->__pyx_base._parse_options); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_error = __pyx_t_4;
      goto __pyx_L10;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1101
 *                                            c_encoding, self._parse_options)
 *             else:
 *                 xmlparser.xmlCtxtUseOptions(pctxt, self._parse_options)             # <<<<<<<<<<<<<<
 *                 error = xmlparser.xmlCtxtResetPush(
 *                     pctxt, c_data, buffer_len, NULL, c_encoding)
 */
      xmlCtxtUseOptions(__pyx_v_pctxt, ((struct __pyx_obj_4lxml_5etree__FeedParser *)__pyx_v_self)->__pyx_base._parse_options);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1103
 *                 xmlparser.xmlCtxtUseOptions(pctxt, self._parse_options)
 *                 error = xmlparser.xmlCtxtResetPush(
 *                     pctxt, c_data, buffer_len, NULL, c_encoding)             # <<<<<<<<<<<<<<
 *             py_buffer_len -= buffer_len
 *             c_data += buffer_len
 */
      __pyx_v_error = xmlCtxtResetPush(__pyx_v_pctxt, __pyx_v_c_data, __pyx_v_buffer_len, NULL, __pyx_v_c_encoding);
    }
    __pyx_L10:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1104
 *                 error = xmlparser.xmlCtxtResetPush(
 *                     pctxt, c_data, buffer_len, NULL, c_encoding)
 *             py_buffer_len -= buffer_len             # <<<<<<<<<<<<<<
 *             c_data += buffer_len
 * 
 */
    __pyx_v_py_buffer_len = (__pyx_v_py_buffer_len - __pyx_v_buffer_len);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1105
 *                     pctxt, c_data, buffer_len, NULL, c_encoding)
 *             py_buffer_len -= buffer_len
 *             c_data += buffer_len             # <<<<<<<<<<<<<<
 * 
 *         #print pctxt.charset, 'NONE' if c_encoding is NULL else c_encoding
 */
    __pyx_v_c_data = (__pyx_v_c_data + __pyx_v_buffer_len);
    goto __pyx_L8;
  }
  __pyx_L8:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1109
 *         #print pctxt.charset, 'NONE' if c_encoding is NULL else c_encoding
 * 
 *         while py_buffer_len > 0 and (error == 0 or recover):             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 if py_buffer_len > python.INT_MAX:
 */
  while (1) {
    __pyx_t_1 = (__pyx_v_py_buffer_len > 0);
    if (__pyx_t_1) {
      __pyx_t_5 = (__pyx_v_error == 0);
      if (!__pyx_t_5) {
        __pyx_t_6 = __pyx_v_recover;
      } else {
        __pyx_t_6 = __pyx_t_5;
      }
      __pyx_t_5 = __pyx_t_6;
    } else {
      __pyx_t_5 = __pyx_t_1;
    }
    if (!__pyx_t_5) break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1110
 * 
 *         while py_buffer_len > 0 and (error == 0 or recover):
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 if py_buffer_len > python.INT_MAX:
 *                     buffer_len = python.INT_MAX
 */
    {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      #endif
      Py_UNBLOCK_THREADS
      /*try:*/ {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1111
 *         while py_buffer_len > 0 and (error == 0 or recover):
 *             with nogil:
 *                 if py_buffer_len > python.INT_MAX:             # <<<<<<<<<<<<<<
 *                     buffer_len = python.INT_MAX
 *                 else:
 */
        __pyx_t_5 = (__pyx_v_py_buffer_len > INT_MAX);
        if (__pyx_t_5) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1112
 *             with nogil:
 *                 if py_buffer_len > python.INT_MAX:
 *                     buffer_len = python.INT_MAX             # <<<<<<<<<<<<<<
 *                 else:
 *                     buffer_len = <int>py_buffer_len
 */
          __pyx_v_buffer_len = INT_MAX;
          goto __pyx_L18;
        }
        /*else*/ {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1114
 *                     buffer_len = python.INT_MAX
 *                 else:
 *                     buffer_len = <int>py_buffer_len             # <<<<<<<<<<<<<<
 *                 if self._for_html:
 *                     error = htmlparser.htmlParseChunk(pctxt, c_data, buffer_len, 0)
 */
          __pyx_v_buffer_len = ((int)__pyx_v_py_buffer_len);
        }
        __pyx_L18:;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1115
 *                 else:
 *                     buffer_len = <int>py_buffer_len
 *                 if self._for_html:             # <<<<<<<<<<<<<<
 *                     error = htmlparser.htmlParseChunk(pctxt, c_data, buffer_len, 0)
 *                 else:
 */
        if (((struct __pyx_obj_4lxml_5etree__FeedParser *)__pyx_v_self)->__pyx_base._for_html) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1116
 *                     buffer_len = <int>py_buffer_len
 *                 if self._for_html:
 *                     error = htmlparser.htmlParseChunk(pctxt, c_data, buffer_len, 0)             # <<<<<<<<<<<<<<
 *                 else:
 *                     error = xmlparser.xmlParseChunk(pctxt, c_data, buffer_len, 0)
 */
          __pyx_v_error = htmlParseChunk(__pyx_v_pctxt, __pyx_v_c_data, __pyx_v_buffer_len, 0);
          goto __pyx_L19;
        }
        /*else*/ {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1118
 *                     error = htmlparser.htmlParseChunk(pctxt, c_data, buffer_len, 0)
 *                 else:
 *                     error = xmlparser.xmlParseChunk(pctxt, c_data, buffer_len, 0)             # <<<<<<<<<<<<<<
 *                 py_buffer_len -= buffer_len
 *                 c_data += buffer_len
 */
          __pyx_v_error = xmlParseChunk(__pyx_v_pctxt, __pyx_v_c_data, __pyx_v_buffer_len, 0);
        }
        __pyx_L19:;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1119
 *                 else:
 *                     error = xmlparser.xmlParseChunk(pctxt, c_data, buffer_len, 0)
 *                 py_buffer_len -= buffer_len             # <<<<<<<<<<<<<<
 *                 c_data += buffer_len
 * 
 */
        __pyx_v_py_buffer_len = (__pyx_v_py_buffer_len - __pyx_v_buffer_len);

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1120
 *                     error = xmlparser.xmlParseChunk(pctxt, c_data, buffer_len, 0)
 *                 py_buffer_len -= buffer_len
 *                 c_data += buffer_len             # <<<<<<<<<<<<<<
 * 
 *             if error and not pctxt.replaceEntities and not pctxt.validate:
 */
        __pyx_v_c_data = (__pyx_v_c_data + __pyx_v_buffer_len);
      }

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1110
 * 
 *         while py_buffer_len > 0 and (error == 0 or recover):
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 if py_buffer_len > python.INT_MAX:
 *                     buffer_len = python.INT_MAX
 */
      /*finally:*/ {
        Py_BLOCK_THREADS
      }
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1122
 *                 c_data += buffer_len
 * 
 *             if error and not pctxt.replaceEntities and not pctxt.validate:             # <<<<<<<<<<<<<<
 *                 # in this mode, we ignore errors about undefined entities
 *                 for entry in context._error_log.filter_from_errors():
 */
    if (__pyx_v_error) {
      __pyx_t_5 = (!__pyx_v_pctxt->replaceEntities);
      if (__pyx_t_5) {
        __pyx_t_1 = (!__pyx_v_pctxt->validate);
        __pyx_t_6 = __pyx_t_1;
      } else {
        __pyx_t_6 = __pyx_t_5;
      }
      __pyx_t_5 = __pyx_t_6;
    } else {
      __pyx_t_5 = __pyx_v_error;
    }
    if (__pyx_t_5) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1124
 *             if error and not pctxt.replaceEntities and not pctxt.validate:
 *                 # in this mode, we ignore errors about undefined entities
 *                 for entry in context._error_log.filter_from_errors():             # <<<<<<<<<<<<<<
 *                     if entry.type != ErrorTypes.WAR_UNDECLARED_ENTITY and \
 *                            entry.type != ErrorTypes.ERR_UNDECLARED_ENTITY:
 */
      __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_context->_error_log), __pyx_n_s__filter_from_errors); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_8 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (PyList_CheckExact(__pyx_t_8) || PyTuple_CheckExact(__pyx_t_8)) {
        __pyx_t_7 = 0; __pyx_t_3 = __pyx_t_8; __Pyx_INCREF(__pyx_t_3);
      } else {
        __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
      }
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      for (;;) {
        if (likely(PyList_CheckExact(__pyx_t_3))) {
          if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break;
          __pyx_t_8 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_8); __pyx_t_7++;
        } else if (likely(PyTuple_CheckExact(__pyx_t_3))) {
          if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
          __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_8); __pyx_t_7++;
        } else {
          __pyx_t_8 = PyIter_Next(__pyx_t_3);
          if (!__pyx_t_8) {
            if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            break;
          }
          __Pyx_GOTREF(__pyx_t_8);
        }
        __Pyx_DECREF(__pyx_v_entry);
        __pyx_v_entry = __pyx_t_8;
        __pyx_t_8 = 0;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1125
 *                 # in this mode, we ignore errors about undefined entities
 *                 for entry in context._error_log.filter_from_errors():
 *                     if entry.type != ErrorTypes.WAR_UNDECLARED_ENTITY and \             # <<<<<<<<<<<<<<
 *                            entry.type != ErrorTypes.ERR_UNDECLARED_ENTITY:
 *                         break
 */
        __pyx_t_8 = PyObject_GetAttr(__pyx_v_entry, __pyx_n_s__type); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__ErrorTypes); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_10 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s_175); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_9 = PyObject_RichCompare(__pyx_t_8, __pyx_t_10, Py_NE); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (__pyx_t_5) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1126
 *                 for entry in context._error_log.filter_from_errors():
 *                     if entry.type != ErrorTypes.WAR_UNDECLARED_ENTITY and \
 *                            entry.type != ErrorTypes.ERR_UNDECLARED_ENTITY:             # <<<<<<<<<<<<<<
 *                         break
 *                 else:
 */
          __pyx_t_9 = PyObject_GetAttr(__pyx_v_entry, __pyx_n_s__type); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__ErrorTypes); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_10);
          __pyx_t_8 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s_176); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __pyx_t_10 = PyObject_RichCompare(__pyx_t_9, __pyx_t_8, Py_NE); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __pyx_t_1 = __pyx_t_6;
        } else {
          __pyx_t_1 = __pyx_t_5;
        }
        if (__pyx_t_1) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1127
 *                     if entry.type != ErrorTypes.WAR_UNDECLARED_ENTITY and \
 *                            entry.type != ErrorTypes.ERR_UNDECLARED_ENTITY:
 *                         break             # <<<<<<<<<<<<<<
 *                 else:
 *                     error = 0
 */
          goto __pyx_L22_break;
          goto __pyx_L23;
        }
        __pyx_L23:;
      }
      /*else*/ {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1129
 *                         break
 *                 else:
 *                     error = 0             # <<<<<<<<<<<<<<
 * 
 *         if not recover and (error or not pctxt.wellFormed):
 */
        __pyx_v_error = 0;
      }
      __pyx_L22_break:;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L20;
    }
    __pyx_L20:;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1131
 *                     error = 0
 * 
 *         if not recover and (error or not pctxt.wellFormed):             # <<<<<<<<<<<<<<
 *             self._feed_parser_running = 0
 *             try:
 */
  __pyx_t_1 = (!__pyx_v_recover);
  if (__pyx_t_1) {
    if (!__pyx_v_error) {
      __pyx_t_5 = (!__pyx_v_pctxt->wellFormed);
      __pyx_t_6 = __pyx_t_5;
    } else {
      __pyx_t_6 = __pyx_v_error;
    }
    __pyx_t_5 = __pyx_t_6;
  } else {
    __pyx_t_5 = __pyx_t_1;
  }
  if (__pyx_t_5) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1132
 * 
 *         if not recover and (error or not pctxt.wellFormed):
 *             self._feed_parser_running = 0             # <<<<<<<<<<<<<<
 *             try:
 *                 context._handleParseResult(self, NULL, None)
 */
    ((struct __pyx_obj_4lxml_5etree__FeedParser *)__pyx_v_self)->_feed_parser_running = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1133
 *         if not recover and (error or not pctxt.wellFormed):
 *             self._feed_parser_running = 0
 *             try:             # <<<<<<<<<<<<<<
 *                 context._handleParseResult(self, NULL, None)
 *             finally:
 */
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1134
 *             self._feed_parser_running = 0
 *             try:
 *                 context._handleParseResult(self, NULL, None)             # <<<<<<<<<<<<<<
 *             finally:
 *                 context.cleanup()
 */
      __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->_handleParseResult(__pyx_v_context, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self), NULL, Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1134; __pyx_clineno = __LINE__; goto __pyx_L27;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1136
 *                 context._handleParseResult(self, NULL, None)
 *             finally:
 *                 context.cleanup()             # <<<<<<<<<<<<<<
 * 
 *     def close(self):
 */
    /*finally:*/ {
      int __pyx_why;
      PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
      int __pyx_exc_lineno;
      __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
      __pyx_why = 0; goto __pyx_L28;
      __pyx_L27: {
        __pyx_why = 4;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
        __pyx_exc_lineno = __pyx_lineno;
        goto __pyx_L28;
      }
      __pyx_L28:;
      __pyx_t_4 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->cleanup(__pyx_v_context); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L29_error;}
      goto __pyx_L30;
      __pyx_L29_error:;
      if (__pyx_why == 4) {
        Py_XDECREF(__pyx_exc_type);
        Py_XDECREF(__pyx_exc_value);
        Py_XDECREF(__pyx_exc_tb);
      }
      goto __pyx_L1_error;
      __pyx_L30:;
      switch (__pyx_why) {
        case 4: {
          __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
          __pyx_lineno = __pyx_exc_lineno;
          __pyx_exc_type = 0;
          __pyx_exc_value = 0;
          __pyx_exc_tb = 0;
          goto __pyx_L1_error;
        }
      }
    }
    goto __pyx_L25;
  }
  __pyx_L25:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("lxml.etree._FeedParser.feed");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_context);
  __Pyx_DECREF(__pyx_v_entry);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1138
 *                 context.cleanup()
 * 
 *     def close(self):             # <<<<<<<<<<<<<<
 *         u"""close(self)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_11_FeedParser_1close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_11_FeedParser_1close[] = "close(self)\n\n        Terminates feeding data to this parser.  This tells the parser to\n        process any remaining data in the feed buffer, and then returns the\n        root Element of the tree that was parsed.\n\n        This method must be called after passing the last chunk of data into\n        the ``feed()`` method.  It should only be called when using the feed\n        parser interface, all other usage is undefined.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_11_FeedParser_1close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_context;
  xmlParserCtxt *__pyx_v_pctxt;
  PyObject *__pyx_v_result;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("close");
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_result = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1153
 *         cdef xmlDoc* c_doc
 *         cdef _Document doc
 *         if not self._feed_parser_running:             # <<<<<<<<<<<<<<
 *             raise XMLSyntaxError(u"no element found",
 *                                  xmlerror.XML_ERR_INTERNAL_ERROR, 0, 0)
 */
  __pyx_t_1 = (!((struct __pyx_obj_4lxml_5etree__FeedParser *)__pyx_v_self)->_feed_parser_running);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1154
 *         cdef _Document doc
 *         if not self._feed_parser_running:
 *             raise XMLSyntaxError(u"no element found",             # <<<<<<<<<<<<<<
 *                                  xmlerror.XML_ERR_INTERNAL_ERROR, 0, 0)
 * 
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__XMLSyntaxError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1155
 *         if not self._feed_parser_running:
 *             raise XMLSyntaxError(u"no element found",
 *                                  xmlerror.XML_ERR_INTERNAL_ERROR, 0, 0)             # <<<<<<<<<<<<<<
 * 
 *         context = self._getPushParserContext()
 */
    __pyx_t_3 = PyInt_FromLong(XML_ERR_INTERNAL_ERROR); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_INCREF(((PyObject *)__pyx_kp_u_191));
    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_191));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_191));
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_int_0);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    __Pyx_INCREF(__pyx_int_0);
    PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1157
 *                                  xmlerror.XML_ERR_INTERNAL_ERROR, 0, 0)
 * 
 *         context = self._getPushParserContext()             # <<<<<<<<<<<<<<
 *         pctxt = context._c_ctxt
 * 
 */
  __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__FeedParser *)((struct __pyx_obj_4lxml_5etree__FeedParser *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base._getPushParserContext(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_v_context));
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1158
 * 
 *         context = self._getPushParserContext()
 *         pctxt = context._c_ctxt             # <<<<<<<<<<<<<<
 * 
 *         self._feed_parser_running = 0
 */
  __pyx_v_pctxt = __pyx_v_context->_c_ctxt;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1160
 *         pctxt = context._c_ctxt
 * 
 *         self._feed_parser_running = 0             # <<<<<<<<<<<<<<
 *         if self._for_html:
 *             htmlparser.htmlParseChunk(pctxt, NULL, 0, 1)
 */
  ((struct __pyx_obj_4lxml_5etree__FeedParser *)__pyx_v_self)->_feed_parser_running = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1161
 * 
 *         self._feed_parser_running = 0
 *         if self._for_html:             # <<<<<<<<<<<<<<
 *             htmlparser.htmlParseChunk(pctxt, NULL, 0, 1)
 *         else:
 */
  if (((struct __pyx_obj_4lxml_5etree__FeedParser *)__pyx_v_self)->__pyx_base._for_html) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1162
 *         self._feed_parser_running = 0
 *         if self._for_html:
 *             htmlparser.htmlParseChunk(pctxt, NULL, 0, 1)             # <<<<<<<<<<<<<<
 *         else:
 *             xmlparser.xmlParseChunk(pctxt, NULL, 0, 1)
 */
    htmlParseChunk(__pyx_v_pctxt, NULL, 0, 1);
    goto __pyx_L6;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1164
 *             htmlparser.htmlParseChunk(pctxt, NULL, 0, 1)
 *         else:
 *             xmlparser.xmlParseChunk(pctxt, NULL, 0, 1)             # <<<<<<<<<<<<<<
 *         try:
 *             result = context._handleParseResult(self, pctxt.myDoc, None)
 */
    xmlParseChunk(__pyx_v_pctxt, NULL, 0, 1);
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1165
 *         else:
 *             xmlparser.xmlParseChunk(pctxt, NULL, 0, 1)
 *         try:             # <<<<<<<<<<<<<<
 *             result = context._handleParseResult(self, pctxt.myDoc, None)
 *         finally:
 */
  /*try:*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1166
 *             xmlparser.xmlParseChunk(pctxt, NULL, 0, 1)
 *         try:
 *             result = context._handleParseResult(self, pctxt.myDoc, None)             # <<<<<<<<<<<<<<
 *         finally:
 *             context.cleanup()
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->_handleParseResult(__pyx_v_context, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self), __pyx_v_pctxt->myDoc, Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1166; __pyx_clineno = __LINE__; goto __pyx_L8;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_v_result);
    __pyx_v_result = __pyx_t_3;
    __pyx_t_3 = 0;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1168
 *             result = context._handleParseResult(self, pctxt.myDoc, None)
 *         finally:
 *             context.cleanup()             # <<<<<<<<<<<<<<
 * 
 *         if isinstance(result, _Document):
 */
  /*finally:*/ {
    int __pyx_why;
    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
    int __pyx_exc_lineno;
    __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 0; goto __pyx_L9;
    __pyx_L8: {
      __pyx_why = 4;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
      __pyx_exc_lineno = __pyx_lineno;
      goto __pyx_L9;
    }
    __pyx_L9:;
    __pyx_t_5 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->cleanup(__pyx_v_context); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
    goto __pyx_L11;
    __pyx_L10_error:;
    if (__pyx_why == 4) {
      Py_XDECREF(__pyx_exc_type);
      Py_XDECREF(__pyx_exc_value);
      Py_XDECREF(__pyx_exc_tb);
    }
    goto __pyx_L1_error;
    __pyx_L11:;
    switch (__pyx_why) {
      case 4: {
        __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
        __pyx_lineno = __pyx_exc_lineno;
        __pyx_exc_type = 0;
        __pyx_exc_value = 0;
        __pyx_exc_tb = 0;
        goto __pyx_L1_error;
      }
    }
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1170
 *             context.cleanup()
 * 
 *         if isinstance(result, _Document):             # <<<<<<<<<<<<<<
 *             return (<_Document>result).getroot()
 *         else:
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_result, ((PyObject*)__pyx_ptype_4lxml_5etree__Document)); 
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1171
 * 
 *         if isinstance(result, _Document):
 *             return (<_Document>result).getroot()             # <<<<<<<<<<<<<<
 *         else:
 *             return result
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree__Document *)((struct LxmlDocument *)__pyx_v_result)->__pyx_vtab)->getroot(((struct LxmlDocument *)__pyx_v_result)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
    goto __pyx_L12;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1173
 *             return (<_Document>result).getroot()
 *         else:
 *             return result             # <<<<<<<<<<<<<<
 * 
 * cdef int _htmlCtxtResetPush(xmlparser.xmlParserCtxt* c_ctxt,
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_result);
    __pyx_r = __pyx_v_result;
    goto __pyx_L0;
  }
  __pyx_L12:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._FeedParser.close");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_context);
  __Pyx_DECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1175
 *             return result
 * 
 * cdef int _htmlCtxtResetPush(xmlparser.xmlParserCtxt* c_ctxt,             # <<<<<<<<<<<<<<
 *                              char* c_data, int buffer_len,
 *                              char* c_encoding, int parse_options) except -1:
 */

static  int __pyx_f_4lxml_5etree__htmlCtxtResetPush(xmlParserCtxt *__pyx_v_c_ctxt, char *__pyx_v_c_data, int __pyx_v_buffer_len, char *__pyx_v_c_encoding, int __pyx_v_parse_options) {
  int __pyx_v_error;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("_htmlCtxtResetPush");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1180
 *     cdef xmlparser.xmlParserInput* c_input_stream
 *     # libxml2 crashes if spaceTab is not initialised
 *     if _LIBXML_VERSION_INT < 20629 and c_ctxt.spaceTab is NULL:             # <<<<<<<<<<<<<<
 *         c_ctxt.spaceTab = <int*>tree.xmlMalloc(10 * sizeof(int))
 *         c_ctxt.spaceMax = 10
 */
  __pyx_t_1 = (__pyx_v_4lxml_5etree__LIBXML_VERSION_INT < 20629);
  if (__pyx_t_1) {
    __pyx_t_2 = (__pyx_v_c_ctxt->spaceTab == NULL);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1181
 *     # libxml2 crashes if spaceTab is not initialised
 *     if _LIBXML_VERSION_INT < 20629 and c_ctxt.spaceTab is NULL:
 *         c_ctxt.spaceTab = <int*>tree.xmlMalloc(10 * sizeof(int))             # <<<<<<<<<<<<<<
 *         c_ctxt.spaceMax = 10
 * 
 */
    __pyx_v_c_ctxt->spaceTab = ((int *)xmlMalloc((10 * (sizeof(int)))));

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1182
 *     if _LIBXML_VERSION_INT < 20629 and c_ctxt.spaceTab is NULL:
 *         c_ctxt.spaceTab = <int*>tree.xmlMalloc(10 * sizeof(int))
 *         c_ctxt.spaceMax = 10             # <<<<<<<<<<<<<<
 * 
 *     # libxml2 lacks an HTML push parser setup function
 */
    __pyx_v_c_ctxt->spaceMax = 10;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1185
 * 
 *     # libxml2 lacks an HTML push parser setup function
 *     error = xmlparser.xmlCtxtResetPush(c_ctxt, NULL, 0, NULL, c_encoding)             # <<<<<<<<<<<<<<
 *     if error:
 *         return error
 */
  __pyx_v_error = xmlCtxtResetPush(__pyx_v_c_ctxt, NULL, 0, NULL, __pyx_v_c_encoding);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1186
 *     # libxml2 lacks an HTML push parser setup function
 *     error = xmlparser.xmlCtxtResetPush(c_ctxt, NULL, 0, NULL, c_encoding)
 *     if error:             # <<<<<<<<<<<<<<
 *         return error
 * 
 */
  if (__pyx_v_error) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1187
 *     error = xmlparser.xmlCtxtResetPush(c_ctxt, NULL, 0, NULL, c_encoding)
 *     if error:
 *         return error             # <<<<<<<<<<<<<<
 * 
 *     # fix libxml2 setup for HTML
 */
    __pyx_r = __pyx_v_error;
    goto __pyx_L0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1190
 * 
 *     # fix libxml2 setup for HTML
 *     c_ctxt.progressive = 1             # <<<<<<<<<<<<<<
 *     c_ctxt.html = 1
 *     htmlparser.htmlCtxtUseOptions(c_ctxt, parse_options)
 */
  __pyx_v_c_ctxt->progressive = 1;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1191
 *     # fix libxml2 setup for HTML
 *     c_ctxt.progressive = 1
 *     c_ctxt.html = 1             # <<<<<<<<<<<<<<
 *     htmlparser.htmlCtxtUseOptions(c_ctxt, parse_options)
 * 
 */
  __pyx_v_c_ctxt->html = 1;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1192
 *     c_ctxt.progressive = 1
 *     c_ctxt.html = 1
 *     htmlparser.htmlCtxtUseOptions(c_ctxt, parse_options)             # <<<<<<<<<<<<<<
 * 
 *     if c_data is not NULL and buffer_len > 0:
 */
  htmlCtxtUseOptions(__pyx_v_c_ctxt, __pyx_v_parse_options);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1194
 *     htmlparser.htmlCtxtUseOptions(c_ctxt, parse_options)
 * 
 *     if c_data is not NULL and buffer_len > 0:             # <<<<<<<<<<<<<<
 *         return htmlparser.htmlParseChunk(c_ctxt, c_data, buffer_len, 0)
 *     return 0
 */
  __pyx_t_3 = (__pyx_v_c_data != NULL);
  if (__pyx_t_3) {
    __pyx_t_1 = (__pyx_v_buffer_len > 0);
    __pyx_t_2 = __pyx_t_1;
  } else {
    __pyx_t_2 = __pyx_t_3;
  }
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1195
 * 
 *     if c_data is not NULL and buffer_len > 0:
 *         return htmlparser.htmlParseChunk(c_ctxt, c_data, buffer_len, 0)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    __pyx_r = htmlParseChunk(__pyx_v_c_ctxt, __pyx_v_c_data, __pyx_v_buffer_len, 0);
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1196
 *     if c_data is not NULL and buffer_len > 0:
 *         return htmlparser.htmlParseChunk(c_ctxt, c_data, buffer_len, 0)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * ############################################################
 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1254
 *     apply to the default parser.
 *     """
 *     def __init__(self, *, encoding=None, attribute_defaults=False,             # <<<<<<<<<<<<<<
 *                  dtd_validation=False, load_dtd=False, no_network=True,
 *                  ns_clean=False, recover=False, XMLSchema schema=None,
 */

static int __pyx_pf_4lxml_5etree_9XMLParser___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_9XMLParser___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_encoding = 0;
  PyObject *__pyx_v_attribute_defaults = 0;
  PyObject *__pyx_v_dtd_validation = 0;
  PyObject *__pyx_v_load_dtd = 0;
  PyObject *__pyx_v_no_network = 0;
  PyObject *__pyx_v_ns_clean = 0;
  PyObject *__pyx_v_recover = 0;
  struct __pyx_obj_4lxml_5etree_XMLSchema *__pyx_v_schema = 0;
  PyObject *__pyx_v_huge_tree = 0;
  PyObject *__pyx_v_remove_blank_text = 0;
  PyObject *__pyx_v_resolve_entities = 0;
  PyObject *__pyx_v_remove_comments = 0;
  PyObject *__pyx_v_remove_pis = 0;
  PyObject *__pyx_v_strip_cdata = 0;
  PyObject *__pyx_v_target = 0;
  PyObject *__pyx_v_compact = 0;
  int __pyx_v_parse_options;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__encoding,&__pyx_n_s__attribute_defaults,&__pyx_n_s__dtd_validation,&__pyx_n_s__load_dtd,&__pyx_n_s__no_network,&__pyx_n_s__ns_clean,&__pyx_n_s__recover,&__pyx_n_s__schema,&__pyx_n_s__huge_tree,&__pyx_n_s__remove_blank_text,&__pyx_n_s__resolve_entities,&__pyx_n_s__remove_comments,&__pyx_n_s__remove_pis,&__pyx_n_s__strip_cdata,&__pyx_n_s__target,&__pyx_n_s__compact,0};
  __Pyx_RefNannySetupContext("__init__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = __pyx_k_192;
    values[2] = __pyx_k_193;
    values[3] = __pyx_k_194;
    values[4] = __pyx_k_195;
    values[5] = __pyx_k_196;
    values[6] = __pyx_k_197;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1256
 *     def __init__(self, *, encoding=None, attribute_defaults=False,
 *                  dtd_validation=False, load_dtd=False, no_network=True,
 *                  ns_clean=False, recover=False, XMLSchema schema=None,             # <<<<<<<<<<<<<<
 *                  huge_tree=False, remove_blank_text=False, resolve_entities=True,
 *                  remove_comments=False, remove_pis=False, strip_cdata=True,
 */
    values[7] = (PyObject *)((struct __pyx_obj_4lxml_5etree_XMLSchema *)Py_None);
    values[8] = __pyx_k_198;
    values[9] = __pyx_k_199;
    values[10] = __pyx_k_200;
    values[11] = __pyx_k_201;
    values[12] = __pyx_k_202;
    values[13] = __pyx_k_203;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1259
 *                  huge_tree=False, remove_blank_text=False, resolve_entities=True,
 *                  remove_comments=False, remove_pis=False, strip_cdata=True,
 *                  target=None, compact=True):             # <<<<<<<<<<<<<<
 *         cdef int parse_options
 *         parse_options = _XML_DEFAULT_PARSE_OPTIONS
 */
    values[14] = ((PyObject *)Py_None);
    values[15] = __pyx_k_204;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    while (kw_args > 0) {
      PyObject* value;
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__encoding);
      if (value) { values[0] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__attribute_defaults);
      if (value) { values[1] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dtd_validation);
      if (value) { values[2] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__load_dtd);
      if (value) { values[3] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__no_network);
      if (value) { values[4] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ns_clean);
      if (value) { values[5] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__recover);
      if (value) { values[6] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__schema);
      if (value) { values[7] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__huge_tree);
      if (value) { values[8] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__remove_blank_text);
      if (value) { values[9] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__resolve_entities);
      if (value) { values[10] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__remove_comments);
      if (value) { values[11] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__remove_pis);
      if (value) { values[12] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__strip_cdata);
      if (value) { values[13] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__target);
      if (value) { values[14] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__compact);
      if (value) { values[15] = value; if (!(--kw_args)) break; }
      break;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, 0, "__init__") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1254; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_encoding = values[0];
    __pyx_v_attribute_defaults = values[1];
    __pyx_v_dtd_validation = values[2];
    __pyx_v_load_dtd = values[3];
    __pyx_v_no_network = values[4];
    __pyx_v_ns_clean = values[5];
    __pyx_v_recover = values[6];
    __pyx_v_schema = ((struct __pyx_obj_4lxml_5etree_XMLSchema *)values[7]);
    __pyx_v_huge_tree = values[8];
    __pyx_v_remove_blank_text = values[9];
    __pyx_v_resolve_entities = values[10];
    __pyx_v_remove_comments = values[11];
    __pyx_v_remove_pis = values[12];
    __pyx_v_strip_cdata = values[13];
    __pyx_v_target = values[14];
    __pyx_v_compact = values[15];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 0) {
    goto __pyx_L5_argtuple_error;
  } else {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1254
 *     apply to the default parser.
 *     """
 *     def __init__(self, *, encoding=None, attribute_defaults=False,             # <<<<<<<<<<<<<<
 *                  dtd_validation=False, load_dtd=False, no_network=True,
 *                  ns_clean=False, recover=False, XMLSchema schema=None,
 */
    __pyx_v_encoding = ((PyObject *)Py_None);
    __pyx_v_attribute_defaults = __pyx_k_192;
    __pyx_v_dtd_validation = __pyx_k_193;
    __pyx_v_load_dtd = __pyx_k_194;
    __pyx_v_no_network = __pyx_k_195;
    __pyx_v_ns_clean = __pyx_k_196;
    __pyx_v_recover = __pyx_k_197;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1256
 *     def __init__(self, *, encoding=None, attribute_defaults=False,
 *                  dtd_validation=False, load_dtd=False, no_network=True,
 *                  ns_clean=False, recover=False, XMLSchema schema=None,             # <<<<<<<<<<<<<<
 *                  huge_tree=False, remove_blank_text=False, resolve_entities=True,
 *                  remove_comments=False, remove_pis=False, strip_cdata=True,
 */
    __pyx_v_schema = ((struct __pyx_obj_4lxml_5etree_XMLSchema *)Py_None);
    __pyx_v_huge_tree = __pyx_k_198;
    __pyx_v_remove_blank_text = __pyx_k_199;
    __pyx_v_resolve_entities = __pyx_k_200;
    __pyx_v_remove_comments = __pyx_k_201;
    __pyx_v_remove_pis = __pyx_k_202;
    __pyx_v_strip_cdata = __pyx_k_203;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1259
 *                  huge_tree=False, remove_blank_text=False, resolve_entities=True,
 *                  remove_comments=False, remove_pis=False, strip_cdata=True,
 *                  target=None, compact=True):             # <<<<<<<<<<<<<<
 *         cdef int parse_options
 *         parse_options = _XML_DEFAULT_PARSE_OPTIONS
 */
    __pyx_v_target = ((PyObject *)Py_None);
    __pyx_v_compact = __pyx_k_204;
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1254; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.XMLParser.__init__");
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_schema), __pyx_ptype_4lxml_5etree_XMLSchema, 1, "schema", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1261
 *                  target=None, compact=True):
 *         cdef int parse_options
 *         parse_options = _XML_DEFAULT_PARSE_OPTIONS             # <<<<<<<<<<<<<<
 *         if load_dtd:
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDLOAD
 */
  __pyx_v_parse_options = __pyx_v_4lxml_5etree__XML_DEFAULT_PARSE_OPTIONS;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1262
 *         cdef int parse_options
 *         parse_options = _XML_DEFAULT_PARSE_OPTIONS
 *         if load_dtd:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDLOAD
 *         if dtd_validation:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_load_dtd); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1263
 *         parse_options = _XML_DEFAULT_PARSE_OPTIONS
 *         if load_dtd:
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDLOAD             # <<<<<<<<<<<<<<
 *         if dtd_validation:
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDVALID | \
 */
    __pyx_v_parse_options = (__pyx_v_parse_options | XML_PARSE_DTDLOAD);
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1264
 *         if load_dtd:
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDLOAD
 *         if dtd_validation:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDVALID | \
 *                             xmlparser.XML_PARSE_DTDLOAD
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_dtd_validation); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1266
 *         if dtd_validation:
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDVALID | \
 *                             xmlparser.XML_PARSE_DTDLOAD             # <<<<<<<<<<<<<<
 *         if attribute_defaults:
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDATTR
 */
    __pyx_v_parse_options = ((__pyx_v_parse_options | XML_PARSE_DTDVALID) | XML_PARSE_DTDLOAD);
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1267
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDVALID | \
 *                             xmlparser.XML_PARSE_DTDLOAD
 *         if attribute_defaults:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDATTR
 *             if schema is None:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_attribute_defaults); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1268
 *                             xmlparser.XML_PARSE_DTDLOAD
 *         if attribute_defaults:
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDATTR             # <<<<<<<<<<<<<<
 *             if schema is None:
 *                 parse_options = parse_options | xmlparser.XML_PARSE_DTDLOAD
 */
    __pyx_v_parse_options = (__pyx_v_parse_options | XML_PARSE_DTDATTR);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1269
 *         if attribute_defaults:
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDATTR
 *             if schema is None:             # <<<<<<<<<<<<<<
 *                 parse_options = parse_options | xmlparser.XML_PARSE_DTDLOAD
 *         if ns_clean:
 */
    __pyx_t_1 = (((PyObject *)__pyx_v_schema) == Py_None);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1270
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDATTR
 *             if schema is None:
 *                 parse_options = parse_options | xmlparser.XML_PARSE_DTDLOAD             # <<<<<<<<<<<<<<
 *         if ns_clean:
 *             parse_options = parse_options | xmlparser.XML_PARSE_NSCLEAN
 */
      __pyx_v_parse_options = (__pyx_v_parse_options | XML_PARSE_DTDLOAD);
      goto __pyx_L9;
    }
    __pyx_L9:;
    goto __pyx_L8;
  }
  __pyx_L8:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1271
 *             if schema is None:
 *                 parse_options = parse_options | xmlparser.XML_PARSE_DTDLOAD
 *         if ns_clean:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options | xmlparser.XML_PARSE_NSCLEAN
 *         if recover:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_ns_clean); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1272
 *                 parse_options = parse_options | xmlparser.XML_PARSE_DTDLOAD
 *         if ns_clean:
 *             parse_options = parse_options | xmlparser.XML_PARSE_NSCLEAN             # <<<<<<<<<<<<<<
 *         if recover:
 *             parse_options = parse_options | xmlparser.XML_PARSE_RECOVER
 */
    __pyx_v_parse_options = (__pyx_v_parse_options | XML_PARSE_NSCLEAN);
    goto __pyx_L10;
  }
  __pyx_L10:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1273
 *         if ns_clean:
 *             parse_options = parse_options | xmlparser.XML_PARSE_NSCLEAN
 *         if recover:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options | xmlparser.XML_PARSE_RECOVER
 *         if remove_blank_text:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_recover); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1274
 *             parse_options = parse_options | xmlparser.XML_PARSE_NSCLEAN
 *         if recover:
 *             parse_options = parse_options | xmlparser.XML_PARSE_RECOVER             # <<<<<<<<<<<<<<
 *         if remove_blank_text:
 *             parse_options = parse_options | xmlparser.XML_PARSE_NOBLANKS
 */
    __pyx_v_parse_options = (__pyx_v_parse_options | XML_PARSE_RECOVER);
    goto __pyx_L11;
  }
  __pyx_L11:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1275
 *         if recover:
 *             parse_options = parse_options | xmlparser.XML_PARSE_RECOVER
 *         if remove_blank_text:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options | xmlparser.XML_PARSE_NOBLANKS
 *         if huge_tree:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_remove_blank_text); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1276
 *             parse_options = parse_options | xmlparser.XML_PARSE_RECOVER
 *         if remove_blank_text:
 *             parse_options = parse_options | xmlparser.XML_PARSE_NOBLANKS             # <<<<<<<<<<<<<<
 *         if huge_tree:
 *             parse_options = parse_options | xmlparser.XML_PARSE_HUGE
 */
    __pyx_v_parse_options = (__pyx_v_parse_options | XML_PARSE_NOBLANKS);
    goto __pyx_L12;
  }
  __pyx_L12:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1277
 *         if remove_blank_text:
 *             parse_options = parse_options | xmlparser.XML_PARSE_NOBLANKS
 *         if huge_tree:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options | xmlparser.XML_PARSE_HUGE
 *         if not no_network:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_huge_tree); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1278
 *             parse_options = parse_options | xmlparser.XML_PARSE_NOBLANKS
 *         if huge_tree:
 *             parse_options = parse_options | xmlparser.XML_PARSE_HUGE             # <<<<<<<<<<<<<<
 *         if not no_network:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NONET
 */
    __pyx_v_parse_options = (__pyx_v_parse_options | XML_PARSE_HUGE);
    goto __pyx_L13;
  }
  __pyx_L13:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1279
 *         if huge_tree:
 *             parse_options = parse_options | xmlparser.XML_PARSE_HUGE
 *         if not no_network:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NONET
 *         if not compact:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_no_network); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = (!__pyx_t_1);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1280
 *             parse_options = parse_options | xmlparser.XML_PARSE_HUGE
 *         if not no_network:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NONET             # <<<<<<<<<<<<<<
 *         if not compact:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_COMPACT
 */
    __pyx_v_parse_options = (__pyx_v_parse_options ^ XML_PARSE_NONET);
    goto __pyx_L14;
  }
  __pyx_L14:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1281
 *         if not no_network:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NONET
 *         if not compact:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_COMPACT
 *         if not resolve_entities:
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_compact); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = (!__pyx_t_2);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1282
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NONET
 *         if not compact:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_COMPACT             # <<<<<<<<<<<<<<
 *         if not resolve_entities:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NOENT
 */
    __pyx_v_parse_options = (__pyx_v_parse_options ^ XML_PARSE_COMPACT);
    goto __pyx_L15;
  }
  __pyx_L15:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1283
 *         if not compact:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_COMPACT
 *         if not resolve_entities:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NOENT
 *         if not strip_cdata:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_resolve_entities); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = (!__pyx_t_1);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1284
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_COMPACT
 *         if not resolve_entities:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NOENT             # <<<<<<<<<<<<<<
 *         if not strip_cdata:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NOCDATA
 */
    __pyx_v_parse_options = (__pyx_v_parse_options ^ XML_PARSE_NOENT);
    goto __pyx_L16;
  }
  __pyx_L16:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1285
 *         if not resolve_entities:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NOENT
 *         if not strip_cdata:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NOCDATA
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_strip_cdata); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = (!__pyx_t_2);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1286
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NOENT
 *         if not strip_cdata:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NOCDATA             # <<<<<<<<<<<<<<
 * 
 *         _BaseParser.__init__(self, parse_options, 0, schema,
 */
    __pyx_v_parse_options = (__pyx_v_parse_options ^ XML_PARSE_NOCDATA);
    goto __pyx_L17;
  }
  __pyx_L17:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1288
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NOCDATA
 * 
 *         _BaseParser.__init__(self, parse_options, 0, schema,             # <<<<<<<<<<<<<<
 *                              remove_comments, remove_pis, strip_cdata,
 *                              target, None, encoding)
 */
  __pyx_t_3 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__BaseParser)), __pyx_n_s____init__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyInt_FromLong(__pyx_v_parse_options); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1290
 *         _BaseParser.__init__(self, parse_options, 0, schema,
 *                              remove_comments, remove_pis, strip_cdata,
 *                              target, None, encoding)             # <<<<<<<<<<<<<<
 * 
 * cdef class ETCompatXMLParser(XMLParser):
 */
  __pyx_t_5 = PyTuple_New(10); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __Pyx_INCREF(((PyObject *)__pyx_v_schema));
  PyTuple_SET_ITEM(__pyx_t_5, 3, ((PyObject *)__pyx_v_schema));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_schema));
  __Pyx_INCREF(__pyx_v_remove_comments);
  PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_v_remove_comments);
  __Pyx_GIVEREF(__pyx_v_remove_comments);
  __Pyx_INCREF(__pyx_v_remove_pis);
  PyTuple_SET_ITEM(__pyx_t_5, 5, __pyx_v_remove_pis);
  __Pyx_GIVEREF(__pyx_v_remove_pis);
  __Pyx_INCREF(__pyx_v_strip_cdata);
  PyTuple_SET_ITEM(__pyx_t_5, 6, __pyx_v_strip_cdata);
  __Pyx_GIVEREF(__pyx_v_strip_cdata);
  __Pyx_INCREF(__pyx_v_target);
  PyTuple_SET_ITEM(__pyx_t_5, 7, __pyx_v_target);
  __Pyx_GIVEREF(__pyx_v_target);
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_5, 8, Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_INCREF(__pyx_v_encoding);
  PyTuple_SET_ITEM(__pyx_t_5, 9, __pyx_v_encoding);
  __Pyx_GIVEREF(__pyx_v_encoding);
  __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.XMLParser.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1307
 *     and thus ignores comments and processing instructions.
 *     """
 *     def __init__(self, *, encoding=None, attribute_defaults=False,             # <<<<<<<<<<<<<<
 *                  dtd_validation=False, load_dtd=False, no_network=True,
 *                  ns_clean=False, recover=False, schema=None,
 */

static int __pyx_pf_4lxml_5etree_17ETCompatXMLParser___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_17ETCompatXMLParser___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_encoding = 0;
  PyObject *__pyx_v_attribute_defaults = 0;
  PyObject *__pyx_v_dtd_validation = 0;
  PyObject *__pyx_v_load_dtd = 0;
  PyObject *__pyx_v_no_network = 0;
  PyObject *__pyx_v_ns_clean = 0;
  PyObject *__pyx_v_recover = 0;
  PyObject *__pyx_v_schema = 0;
  PyObject *__pyx_v_huge_tree = 0;
  PyObject *__pyx_v_remove_blank_text = 0;
  PyObject *__pyx_v_resolve_entities = 0;
  PyObject *__pyx_v_remove_comments = 0;
  PyObject *__pyx_v_remove_pis = 0;
  PyObject *__pyx_v_strip_cdata = 0;
  PyObject *__pyx_v_target = 0;
  PyObject *__pyx_v_compact = 0;
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__encoding,&__pyx_n_s__attribute_defaults,&__pyx_n_s__dtd_validation,&__pyx_n_s__load_dtd,&__pyx_n_s__no_network,&__pyx_n_s__ns_clean,&__pyx_n_s__recover,&__pyx_n_s__schema,&__pyx_n_s__huge_tree,&__pyx_n_s__remove_blank_text,&__pyx_n_s__resolve_entities,&__pyx_n_s__remove_comments,&__pyx_n_s__remove_pis,&__pyx_n_s__strip_cdata,&__pyx_n_s__target,&__pyx_n_s__compact,0};
  __Pyx_RefNannySetupContext("__init__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = __pyx_k_205;
    values[2] = __pyx_k_206;
    values[3] = __pyx_k_207;
    values[4] = __pyx_k_208;
    values[5] = __pyx_k_209;
    values[6] = __pyx_k_210;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1309
 *     def __init__(self, *, encoding=None, attribute_defaults=False,
 *                  dtd_validation=False, load_dtd=False, no_network=True,
 *                  ns_clean=False, recover=False, schema=None,             # <<<<<<<<<<<<<<
 *                  huge_tree=False, remove_blank_text=False, resolve_entities=True,
 *                  remove_comments=True, remove_pis=True, strip_cdata=True,
 */
    values[7] = ((PyObject *)Py_None);
    values[8] = __pyx_k_211;
    values[9] = __pyx_k_212;
    values[10] = __pyx_k_213;
    values[11] = __pyx_k_214;
    values[12] = __pyx_k_215;
    values[13] = __pyx_k_216;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1312
 *                  huge_tree=False, remove_blank_text=False, resolve_entities=True,
 *                  remove_comments=True, remove_pis=True, strip_cdata=True,
 *                  target=None, compact=True):             # <<<<<<<<<<<<<<
 *         XMLParser.__init__(self,
 *                            attribute_defaults=attribute_defaults,
 */
    values[14] = ((PyObject *)Py_None);
    values[15] = __pyx_k_217;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    while (kw_args > 0) {
      PyObject* value;
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__encoding);
      if (value) { values[0] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__attribute_defaults);
      if (value) { values[1] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dtd_validation);
      if (value) { values[2] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__load_dtd);
      if (value) { values[3] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__no_network);
      if (value) { values[4] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ns_clean);
      if (value) { values[5] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__recover);
      if (value) { values[6] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__schema);
      if (value) { values[7] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__huge_tree);
      if (value) { values[8] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__remove_blank_text);
      if (value) { values[9] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__resolve_entities);
      if (value) { values[10] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__remove_comments);
      if (value) { values[11] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__remove_pis);
      if (value) { values[12] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__strip_cdata);
      if (value) { values[13] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__target);
      if (value) { values[14] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__compact);
      if (value) { values[15] = value; if (!(--kw_args)) break; }
      break;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, 0, "__init__") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1307; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_encoding = values[0];
    __pyx_v_attribute_defaults = values[1];
    __pyx_v_dtd_validation = values[2];
    __pyx_v_load_dtd = values[3];
    __pyx_v_no_network = values[4];
    __pyx_v_ns_clean = values[5];
    __pyx_v_recover = values[6];
    __pyx_v_schema = values[7];
    __pyx_v_huge_tree = values[8];
    __pyx_v_remove_blank_text = values[9];
    __pyx_v_resolve_entities = values[10];
    __pyx_v_remove_comments = values[11];
    __pyx_v_remove_pis = values[12];
    __pyx_v_strip_cdata = values[13];
    __pyx_v_target = values[14];
    __pyx_v_compact = values[15];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 0) {
    goto __pyx_L5_argtuple_error;
  } else {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1307
 *     and thus ignores comments and processing instructions.
 *     """
 *     def __init__(self, *, encoding=None, attribute_defaults=False,             # <<<<<<<<<<<<<<
 *                  dtd_validation=False, load_dtd=False, no_network=True,
 *                  ns_clean=False, recover=False, schema=None,
 */
    __pyx_v_encoding = ((PyObject *)Py_None);
    __pyx_v_attribute_defaults = __pyx_k_205;
    __pyx_v_dtd_validation = __pyx_k_206;
    __pyx_v_load_dtd = __pyx_k_207;
    __pyx_v_no_network = __pyx_k_208;
    __pyx_v_ns_clean = __pyx_k_209;
    __pyx_v_recover = __pyx_k_210;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1309
 *     def __init__(self, *, encoding=None, attribute_defaults=False,
 *                  dtd_validation=False, load_dtd=False, no_network=True,
 *                  ns_clean=False, recover=False, schema=None,             # <<<<<<<<<<<<<<
 *                  huge_tree=False, remove_blank_text=False, resolve_entities=True,
 *                  remove_comments=True, remove_pis=True, strip_cdata=True,
 */
    __pyx_v_schema = ((PyObject *)Py_None);
    __pyx_v_huge_tree = __pyx_k_211;
    __pyx_v_remove_blank_text = __pyx_k_212;
    __pyx_v_resolve_entities = __pyx_k_213;
    __pyx_v_remove_comments = __pyx_k_214;
    __pyx_v_remove_pis = __pyx_k_215;
    __pyx_v_strip_cdata = __pyx_k_216;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1312
 *                  huge_tree=False, remove_blank_text=False, resolve_entities=True,
 *                  remove_comments=True, remove_pis=True, strip_cdata=True,
 *                  target=None, compact=True):             # <<<<<<<<<<<<<<
 *         XMLParser.__init__(self,
 *                            attribute_defaults=attribute_defaults,
 */
    __pyx_v_target = ((PyObject *)Py_None);
    __pyx_v_compact = __pyx_k_217;
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1307; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.ETCompatXMLParser.__init__");
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1313
 *                  remove_comments=True, remove_pis=True, strip_cdata=True,
 *                  target=None, compact=True):
 *         XMLParser.__init__(self,             # <<<<<<<<<<<<<<
 *                            attribute_defaults=attribute_defaults,
 *                            dtd_validation=dtd_validation,
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_XMLParser)), __pyx_n_s____init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1314
 *                  target=None, compact=True):
 *         XMLParser.__init__(self,
 *                            attribute_defaults=attribute_defaults,             # <<<<<<<<<<<<<<
 *                            dtd_validation=dtd_validation,
 *                            load_dtd=load_dtd,
 */
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__attribute_defaults), __pyx_v_attribute_defaults) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1315
 *         XMLParser.__init__(self,
 *                            attribute_defaults=attribute_defaults,
 *                            dtd_validation=dtd_validation,             # <<<<<<<<<<<<<<
 *                            load_dtd=load_dtd,
 *                            no_network=no_network,
 */
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtd_validation), __pyx_v_dtd_validation) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1316
 *                            attribute_defaults=attribute_defaults,
 *                            dtd_validation=dtd_validation,
 *                            load_dtd=load_dtd,             # <<<<<<<<<<<<<<
 *                            no_network=no_network,
 *                            ns_clean=ns_clean,
 */
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__load_dtd), __pyx_v_load_dtd) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1317
 *                            dtd_validation=dtd_validation,
 *                            load_dtd=load_dtd,
 *                            no_network=no_network,             # <<<<<<<<<<<<<<
 *                            ns_clean=ns_clean,
 *                            recover=recover,
 */
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__no_network), __pyx_v_no_network) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1318
 *                            load_dtd=load_dtd,
 *                            no_network=no_network,
 *                            ns_clean=ns_clean,             # <<<<<<<<<<<<<<
 *                            recover=recover,
 *                            remove_blank_text=remove_blank_text,
 */
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__ns_clean), __pyx_v_ns_clean) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1319
 *                            no_network=no_network,
 *                            ns_clean=ns_clean,
 *                            recover=recover,             # <<<<<<<<<<<<<<
 *                            remove_blank_text=remove_blank_text,
 *                            huge_tree=huge_tree,
 */
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__recover), __pyx_v_recover) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1320
 *                            ns_clean=ns_clean,
 *                            recover=recover,
 *                            remove_blank_text=remove_blank_text,             # <<<<<<<<<<<<<<
 *                            huge_tree=huge_tree,
 *                            compact=compact,
 */
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__remove_blank_text), __pyx_v_remove_blank_text) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1321
 *                            recover=recover,
 *                            remove_blank_text=remove_blank_text,
 *                            huge_tree=huge_tree,             # <<<<<<<<<<<<<<
 *                            compact=compact,
 *                            resolve_entities=resolve_entities,
 */
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__huge_tree), __pyx_v_huge_tree) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1322
 *                            remove_blank_text=remove_blank_text,
 *                            huge_tree=huge_tree,
 *                            compact=compact,             # <<<<<<<<<<<<<<
 *                            resolve_entities=resolve_entities,
 *                            remove_comments=remove_comments,
 */
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__compact), __pyx_v_compact) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1323
 *                            huge_tree=huge_tree,
 *                            compact=compact,
 *                            resolve_entities=resolve_entities,             # <<<<<<<<<<<<<<
 *                            remove_comments=remove_comments,
 *                            remove_pis=remove_pis,
 */
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__resolve_entities), __pyx_v_resolve_entities) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1324
 *                            compact=compact,
 *                            resolve_entities=resolve_entities,
 *                            remove_comments=remove_comments,             # <<<<<<<<<<<<<<
 *                            remove_pis=remove_pis,
 *                            strip_cdata=strip_cdata,
 */
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__remove_comments), __pyx_v_remove_comments) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1325
 *                            resolve_entities=resolve_entities,
 *                            remove_comments=remove_comments,
 *                            remove_pis=remove_pis,             # <<<<<<<<<<<<<<
 *                            strip_cdata=strip_cdata,
 *                            target=target,
 */
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__remove_pis), __pyx_v_remove_pis) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1326
 *                            remove_comments=remove_comments,
 *                            remove_pis=remove_pis,
 *                            strip_cdata=strip_cdata,             # <<<<<<<<<<<<<<
 *                            target=target,
 *                            encoding=encoding,
 */
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__strip_cdata), __pyx_v_strip_cdata) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1327
 *                            remove_pis=remove_pis,
 *                            strip_cdata=strip_cdata,
 *                            target=target,             # <<<<<<<<<<<<<<
 *                            encoding=encoding,
 *                            schema=schema)
 */
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__target), __pyx_v_target) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1328
 *                            strip_cdata=strip_cdata,
 *                            target=target,
 *                            encoding=encoding,             # <<<<<<<<<<<<<<
 *                            schema=schema)
 * 
 */
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__encoding), __pyx_v_encoding) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1329
 *                            target=target,
 *                            encoding=encoding,
 *                            schema=schema)             # <<<<<<<<<<<<<<
 * 
 * # ET 1.2 compatible name
 */
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__schema), __pyx_v_schema) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.ETCompatXMLParser.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1340
 * __GLOBAL_PARSER_CONTEXT.setDefaultParser(__DEFAULT_XML_PARSER)
 * 
 * def set_default_parser(_BaseParser parser=None):             # <<<<<<<<<<<<<<
 *     u"""set_default_parser(parser=None)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_21set_default_parser(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_21set_default_parser[] = "set_default_parser(parser=None)\n\n    Set a default parser for the current thread.  This parser is used\n    globally whenever no parser is supplied to the various parse functions of\n    the lxml API.  If this function is called without a parser (or if it is\n    None), the default parser is reset to the original configuration.\n\n    Note that the pre-installed default parser is not thread-safe.  Avoid the\n    default parser in multi-threaded environments.  You can create a separate\n    parser for each thread explicitly or use a parser pool.\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_21set_default_parser = {__Pyx_NAMESTR("set_default_parser"), (PyCFunction)__pyx_pf_4lxml_5etree_21set_default_parser, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_21set_default_parser)};
static PyObject *__pyx_pf_4lxml_5etree_21set_default_parser(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser = 0;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__parser,0};
  __Pyx_RefNannySetupContext("set_default_parser");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[1] = {0};
    values[0] = (PyObject *)((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parser);
        if (value) { values[0] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "set_default_parser") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1340; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)values[0]);
  } else {
    __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)PyTuple_GET_ITEM(__pyx_args, 0));
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_default_parser", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1340; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.set_default_parser");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF((PyObject *)__pyx_v_parser);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parser), __pyx_ptype_4lxml_5etree__BaseParser, 1, "parser", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1352
 *     parser for each thread explicitly or use a parser pool.
 *     """
 *     if parser is None:             # <<<<<<<<<<<<<<
 *         parser = __DEFAULT_XML_PARSER
 *     __GLOBAL_PARSER_CONTEXT.setDefaultParser(parser)
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_parser) == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1353
 *     """
 *     if parser is None:
 *         parser = __DEFAULT_XML_PARSER             # <<<<<<<<<<<<<<
 *     __GLOBAL_PARSER_CONTEXT.setDefaultParser(parser)
 * 
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_4lxml_5etree___DEFAULT_XML_PARSER));
    __Pyx_DECREF(((PyObject *)__pyx_v_parser));
    __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_4lxml_5etree___DEFAULT_XML_PARSER);
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1354
 *     if parser is None:
 *         parser = __DEFAULT_XML_PARSER
 *     __GLOBAL_PARSER_CONTEXT.setDefaultParser(parser)             # <<<<<<<<<<<<<<
 * 
 * def get_default_parser():
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext *)__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT->__pyx_vtab)->setDefaultParser(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, __pyx_v_parser);

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.set_default_parser");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_parser);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1356
 *     __GLOBAL_PARSER_CONTEXT.setDefaultParser(parser)
 * 
 * def get_default_parser():             # <<<<<<<<<<<<<<
 *     u"get_default_parser()"
 *     return __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 */

static PyObject *__pyx_pf_4lxml_5etree_22get_default_parser(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_22get_default_parser[] = "get_default_parser()";
static PyMethodDef __pyx_mdef_4lxml_5etree_22get_default_parser = {__Pyx_NAMESTR("get_default_parser"), (PyCFunction)__pyx_pf_4lxml_5etree_22get_default_parser, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_22get_default_parser)};
static PyObject *__pyx_pf_4lxml_5etree_22get_default_parser(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("get_default_parser");
  __pyx_self = __pyx_self;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1358
 * def get_default_parser():
 *     u"get_default_parser()"
 *     return __GLOBAL_PARSER_CONTEXT.getDefaultParser()             # <<<<<<<<<<<<<<
 * 
 * ############################################################
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext *)__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT->__pyx_vtab)->getDefaultParser(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.get_default_parser");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1403
 *     reasons.
 *     """
 *     def __init__(self, *, encoding=None, remove_blank_text=False,             # <<<<<<<<<<<<<<
 *                  remove_comments=False, remove_pis=False, strip_cdata=True,
 *                  no_network=True, target=None, XMLSchema schema=None,
 */

static int __pyx_pf_4lxml_5etree_10HTMLParser___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_10HTMLParser___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_encoding = 0;
  PyObject *__pyx_v_remove_blank_text = 0;
  PyObject *__pyx_v_remove_comments = 0;
  PyObject *__pyx_v_remove_pis = 0;
  PyObject *__pyx_v_strip_cdata = 0;
  PyObject *__pyx_v_no_network = 0;
  PyObject *__pyx_v_target = 0;
  struct __pyx_obj_4lxml_5etree_XMLSchema *__pyx_v_schema = 0;
  PyObject *__pyx_v_recover = 0;
  PyObject *__pyx_v_compact = 0;
  int __pyx_v_parse_options;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__encoding,&__pyx_n_s__remove_blank_text,&__pyx_n_s__remove_comments,&__pyx_n_s__remove_pis,&__pyx_n_s__strip_cdata,&__pyx_n_s__no_network,&__pyx_n_s__target,&__pyx_n_s__schema,&__pyx_n_s__recover,&__pyx_n_s__compact,0};
  __Pyx_RefNannySetupContext("__init__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = __pyx_k_218;
    values[2] = __pyx_k_219;
    values[3] = __pyx_k_220;
    values[4] = __pyx_k_221;
    values[5] = __pyx_k_222;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1405
 *     def __init__(self, *, encoding=None, remove_blank_text=False,
 *                  remove_comments=False, remove_pis=False, strip_cdata=True,
 *                  no_network=True, target=None, XMLSchema schema=None,             # <<<<<<<<<<<<<<
 *                  recover=True, compact=True):
 *         cdef int parse_options
 */
    values[6] = ((PyObject *)Py_None);
    values[7] = (PyObject *)((struct __pyx_obj_4lxml_5etree_XMLSchema *)Py_None);
    values[8] = __pyx_k_223;
    values[9] = __pyx_k_224;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    while (kw_args > 0) {
      PyObject* value;
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__encoding);
      if (value) { values[0] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__remove_blank_text);
      if (value) { values[1] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__remove_comments);
      if (value) { values[2] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__remove_pis);
      if (value) { values[3] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__strip_cdata);
      if (value) { values[4] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__no_network);
      if (value) { values[5] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__target);
      if (value) { values[6] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__schema);
      if (value) { values[7] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__recover);
      if (value) { values[8] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__compact);
      if (value) { values[9] = value; if (!(--kw_args)) break; }
      break;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, 0, "__init__") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1403; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_encoding = values[0];
    __pyx_v_remove_blank_text = values[1];
    __pyx_v_remove_comments = values[2];
    __pyx_v_remove_pis = values[3];
    __pyx_v_strip_cdata = values[4];
    __pyx_v_no_network = values[5];
    __pyx_v_target = values[6];
    __pyx_v_schema = ((struct __pyx_obj_4lxml_5etree_XMLSchema *)values[7]);
    __pyx_v_recover = values[8];
    __pyx_v_compact = values[9];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 0) {
    goto __pyx_L5_argtuple_error;
  } else {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1403
 *     reasons.
 *     """
 *     def __init__(self, *, encoding=None, remove_blank_text=False,             # <<<<<<<<<<<<<<
 *                  remove_comments=False, remove_pis=False, strip_cdata=True,
 *                  no_network=True, target=None, XMLSchema schema=None,
 */
    __pyx_v_encoding = ((PyObject *)Py_None);
    __pyx_v_remove_blank_text = __pyx_k_218;
    __pyx_v_remove_comments = __pyx_k_219;
    __pyx_v_remove_pis = __pyx_k_220;
    __pyx_v_strip_cdata = __pyx_k_221;
    __pyx_v_no_network = __pyx_k_222;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1405
 *     def __init__(self, *, encoding=None, remove_blank_text=False,
 *                  remove_comments=False, remove_pis=False, strip_cdata=True,
 *                  no_network=True, target=None, XMLSchema schema=None,             # <<<<<<<<<<<<<<
 *                  recover=True, compact=True):
 *         cdef int parse_options
 */
    __pyx_v_target = ((PyObject *)Py_None);
    __pyx_v_schema = ((struct __pyx_obj_4lxml_5etree_XMLSchema *)Py_None);
    __pyx_v_recover = __pyx_k_223;
    __pyx_v_compact = __pyx_k_224;
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1403; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.HTMLParser.__init__");
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_schema), __pyx_ptype_4lxml_5etree_XMLSchema, 1, "schema", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1408
 *                  recover=True, compact=True):
 *         cdef int parse_options
 *         parse_options = _HTML_DEFAULT_PARSE_OPTIONS             # <<<<<<<<<<<<<<
 *         if remove_blank_text:
 *             parse_options = parse_options | htmlparser.HTML_PARSE_NOBLANKS
 */
  __pyx_v_parse_options = __pyx_v_4lxml_5etree__HTML_DEFAULT_PARSE_OPTIONS;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1409
 *         cdef int parse_options
 *         parse_options = _HTML_DEFAULT_PARSE_OPTIONS
 *         if remove_blank_text:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options | htmlparser.HTML_PARSE_NOBLANKS
 *         if not recover:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_remove_blank_text); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1410
 *         parse_options = _HTML_DEFAULT_PARSE_OPTIONS
 *         if remove_blank_text:
 *             parse_options = parse_options | htmlparser.HTML_PARSE_NOBLANKS             # <<<<<<<<<<<<<<
 *         if not recover:
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_RECOVER
 */
    __pyx_v_parse_options = (__pyx_v_parse_options | HTML_PARSE_NOBLANKS);
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1411
 *         if remove_blank_text:
 *             parse_options = parse_options | htmlparser.HTML_PARSE_NOBLANKS
 *         if not recover:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_RECOVER
 *         if not no_network:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_recover); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1411; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = (!__pyx_t_1);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1412
 *             parse_options = parse_options | htmlparser.HTML_PARSE_NOBLANKS
 *         if not recover:
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_RECOVER             # <<<<<<<<<<<<<<
 *         if not no_network:
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_NONET
 */
    __pyx_v_parse_options = (__pyx_v_parse_options ^ HTML_PARSE_RECOVER);
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1413
 *         if not recover:
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_RECOVER
 *         if not no_network:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_NONET
 *         if not compact:
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_no_network); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = (!__pyx_t_2);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1414
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_RECOVER
 *         if not no_network:
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_NONET             # <<<<<<<<<<<<<<
 *         if not compact:
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_COMPACT
 */
    __pyx_v_parse_options = (__pyx_v_parse_options ^ HTML_PARSE_NONET);
    goto __pyx_L8;
  }
  __pyx_L8:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1415
 *         if not no_network:
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_NONET
 *         if not compact:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_COMPACT
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_compact); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = (!__pyx_t_1);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1416
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_NONET
 *         if not compact:
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_COMPACT             # <<<<<<<<<<<<<<
 * 
 *         _BaseParser.__init__(self, parse_options, 1, schema,
 */
    __pyx_v_parse_options = (__pyx_v_parse_options ^ HTML_PARSE_COMPACT);
    goto __pyx_L9;
  }
  __pyx_L9:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1418
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_COMPACT
 * 
 *         _BaseParser.__init__(self, parse_options, 1, schema,             # <<<<<<<<<<<<<<
 *                              remove_comments, remove_pis, strip_cdata,
 *                              target, None, encoding)
 */
  __pyx_t_3 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__BaseParser)), __pyx_n_s____init__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyInt_FromLong(__pyx_v_parse_options); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1420
 *         _BaseParser.__init__(self, parse_options, 1, schema,
 *                              remove_comments, remove_pis, strip_cdata,
 *                              target, None, encoding)             # <<<<<<<<<<<<<<
 * 
 * cdef HTMLParser __DEFAULT_HTML_PARSER
 */
  __pyx_t_5 = PyTuple_New(10); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_int_1);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_schema));
  PyTuple_SET_ITEM(__pyx_t_5, 3, ((PyObject *)__pyx_v_schema));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_schema));
  __Pyx_INCREF(__pyx_v_remove_comments);
  PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_v_remove_comments);
  __Pyx_GIVEREF(__pyx_v_remove_comments);
  __Pyx_INCREF(__pyx_v_remove_pis);
  PyTuple_SET_ITEM(__pyx_t_5, 5, __pyx_v_remove_pis);
  __Pyx_GIVEREF(__pyx_v_remove_pis);
  __Pyx_INCREF(__pyx_v_strip_cdata);
  PyTuple_SET_ITEM(__pyx_t_5, 6, __pyx_v_strip_cdata);
  __Pyx_GIVEREF(__pyx_v_strip_cdata);
  __Pyx_INCREF(__pyx_v_target);
  PyTuple_SET_ITEM(__pyx_t_5, 7, __pyx_v_target);
  __Pyx_GIVEREF(__pyx_v_target);
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_5, 8, Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_INCREF(__pyx_v_encoding);
  PyTuple_SET_ITEM(__pyx_t_5, 9, __pyx_v_encoding);
  __Pyx_GIVEREF(__pyx_v_encoding);
  __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.HTMLParser.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1429
 * ############################################################
 * 
 * cdef xmlDoc* _parseDoc(text, filename, _BaseParser parser) except NULL:             # <<<<<<<<<<<<<<
 *     cdef char* c_filename
 *     cdef char* c_text
 */

static  xmlDoc *__pyx_f_4lxml_5etree__parseDoc(PyObject *__pyx_v_text, PyObject *__pyx_v_filename, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser) {
  char *__pyx_v_c_filename;
  char *__pyx_v_c_text;
  Py_ssize_t __pyx_v_c_len;
  PyObject *__pyx_v_filename_utf;
  xmlDoc *__pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  xmlDoc *__pyx_t_5;
  xmlDoc *__pyx_t_6;
  xmlDoc *__pyx_t_7;
  __Pyx_RefNannySetupContext("_parseDoc");
  __Pyx_INCREF((PyObject *)__pyx_v_parser);
  __pyx_v_filename_utf = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1433
 *     cdef char* c_text
 *     cdef Py_ssize_t c_len
 *     if parser is None:             # <<<<<<<<<<<<<<
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     if not filename:
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_parser) == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1434
 *     cdef Py_ssize_t c_len
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()             # <<<<<<<<<<<<<<
 *     if not filename:
 *         c_filename = NULL
 */
    __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext *)__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT->__pyx_vtab)->getDefaultParser(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_v_parser));
    __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1435
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     if not filename:             # <<<<<<<<<<<<<<
 *         c_filename = NULL
 *     else:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_filename); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = (!__pyx_t_1);
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1436
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     if not filename:
 *         c_filename = NULL             # <<<<<<<<<<<<<<
 *     else:
 *         filename_utf = _encodeFilenameUTF8(filename)
 */
    __pyx_v_c_filename = NULL;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1438
 *         c_filename = NULL
 *     else:
 *         filename_utf = _encodeFilenameUTF8(filename)             # <<<<<<<<<<<<<<
 *         c_filename = _cstr(filename_utf)
 *     if python.PyUnicode_Check(text):
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree__encodeFilenameUTF8(__pyx_v_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_v_filename_utf);
    __pyx_v_filename_utf = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1439
 *     else:
 *         filename_utf = _encodeFilenameUTF8(filename)
 *         c_filename = _cstr(filename_utf)             # <<<<<<<<<<<<<<
 *     if python.PyUnicode_Check(text):
 *         c_len = python.PyUnicode_GET_DATA_SIZE(text)
 */
    __pyx_v_c_filename = PyBytes_AS_STRING(__pyx_v_filename_utf);
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1440
 *         filename_utf = _encodeFilenameUTF8(filename)
 *         c_filename = _cstr(filename_utf)
 *     if python.PyUnicode_Check(text):             # <<<<<<<<<<<<<<
 *         c_len = python.PyUnicode_GET_DATA_SIZE(text)
 *         if c_len > python.INT_MAX:
 */
  __pyx_t_3 = PyUnicode_Check(__pyx_v_text);
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1441
 *         c_filename = _cstr(filename_utf)
 *     if python.PyUnicode_Check(text):
 *         c_len = python.PyUnicode_GET_DATA_SIZE(text)             # <<<<<<<<<<<<<<
 *         if c_len > python.INT_MAX:
 *             return (<_BaseParser>parser)._parseDocFromFilelike(
 */
    __pyx_v_c_len = PyUnicode_GET_DATA_SIZE(__pyx_v_text);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1442
 *     if python.PyUnicode_Check(text):
 *         c_len = python.PyUnicode_GET_DATA_SIZE(text)
 *         if c_len > python.INT_MAX:             # <<<<<<<<<<<<<<
 *             return (<_BaseParser>parser)._parseDocFromFilelike(
 *                 StringIO(text), filename)
 */
    __pyx_t_3 = (__pyx_v_c_len > INT_MAX);
    if (__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1444
 *         if c_len > python.INT_MAX:
 *             return (<_BaseParser>parser)._parseDocFromFilelike(
 *                 StringIO(text), filename)             # <<<<<<<<<<<<<<
 *         return (<_BaseParser>parser)._parseUnicodeDoc(text, c_filename)
 *     else:
 */
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __Pyx_INCREF(__pyx_v_text);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_text);
      __Pyx_GIVEREF(__pyx_v_text);
      __pyx_t_4 = PyObject_Call(__pyx_v_4lxml_5etree_StringIO, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      __pyx_t_5 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_parser)->__pyx_vtab)->_parseDocFromFilelike(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_parser), __pyx_t_4, __pyx_v_filename); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_r = __pyx_t_5;
      goto __pyx_L0;
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1445
 *             return (<_BaseParser>parser)._parseDocFromFilelike(
 *                 StringIO(text), filename)
 *         return (<_BaseParser>parser)._parseUnicodeDoc(text, c_filename)             # <<<<<<<<<<<<<<
 *     else:
 *         c_len = python.PyBytes_GET_SIZE(text)
 */
    __pyx_t_6 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_parser)->__pyx_vtab)->_parseUnicodeDoc(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_parser), __pyx_v_text, __pyx_v_c_filename); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_r = __pyx_t_6;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1447
 *         return (<_BaseParser>parser)._parseUnicodeDoc(text, c_filename)
 *     else:
 *         c_len = python.PyBytes_GET_SIZE(text)             # <<<<<<<<<<<<<<
 *         if c_len > python.INT_MAX:
 *             return (<_BaseParser>parser)._parseDocFromFilelike(
 */
    __pyx_v_c_len = PyBytes_GET_SIZE(__pyx_v_text);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1448
 *     else:
 *         c_len = python.PyBytes_GET_SIZE(text)
 *         if c_len > python.INT_MAX:             # <<<<<<<<<<<<<<
 *             return (<_BaseParser>parser)._parseDocFromFilelike(
 *                 BytesIO(text), filename)
 */
    __pyx_t_3 = (__pyx_v_c_len > INT_MAX);
    if (__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1450
 *         if c_len > python.INT_MAX:
 *             return (<_BaseParser>parser)._parseDocFromFilelike(
 *                 BytesIO(text), filename)             # <<<<<<<<<<<<<<
 *         c_text = _cstr(text)
 *         return (<_BaseParser>parser)._parseDoc(c_text, c_len, c_filename)
 */
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      __Pyx_INCREF(__pyx_v_text);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_text);
      __Pyx_GIVEREF(__pyx_v_text);
      __pyx_t_2 = PyObject_Call(__pyx_v_4lxml_5etree_BytesIO, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __pyx_t_5 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_parser)->__pyx_vtab)->_parseDocFromFilelike(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_parser), __pyx_t_2, __pyx_v_filename); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_5;
      goto __pyx_L0;
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1451
 *             return (<_BaseParser>parser)._parseDocFromFilelike(
 *                 BytesIO(text), filename)
 *         c_text = _cstr(text)             # <<<<<<<<<<<<<<
 *         return (<_BaseParser>parser)._parseDoc(c_text, c_len, c_filename)
 * 
 */
    __pyx_v_c_text = PyBytes_AS_STRING(__pyx_v_text);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1452
 *                 BytesIO(text), filename)
 *         c_text = _cstr(text)
 *         return (<_BaseParser>parser)._parseDoc(c_text, c_len, c_filename)             # <<<<<<<<<<<<<<
 * 
 * cdef xmlDoc* _parseDocFromFile(filename8, _BaseParser parser) except NULL:
 */
    __pyx_t_7 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_parser)->__pyx_vtab)->_parseDoc(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_parser), __pyx_v_c_text, __pyx_v_c_len, __pyx_v_c_filename); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_r = __pyx_t_7;
    goto __pyx_L0;
  }
  __pyx_L5:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._parseDoc");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_filename_utf);
  __Pyx_DECREF((PyObject *)__pyx_v_parser);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1454
 *         return (<_BaseParser>parser)._parseDoc(c_text, c_len, c_filename)
 * 
 * cdef xmlDoc* _parseDocFromFile(filename8, _BaseParser parser) except NULL:             # <<<<<<<<<<<<<<
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 */

static  xmlDoc *__pyx_f_4lxml_5etree__parseDocFromFile(PyObject *__pyx_v_filename8, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser) {
  xmlDoc *__pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  xmlDoc *__pyx_t_3;
  __Pyx_RefNannySetupContext("_parseDocFromFile");
  __Pyx_INCREF((PyObject *)__pyx_v_parser);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1455
 * 
 * cdef xmlDoc* _parseDocFromFile(filename8, _BaseParser parser) except NULL:
 *     if parser is None:             # <<<<<<<<<<<<<<
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     return (<_BaseParser>parser)._parseDocFromFile(_cstr(filename8))
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_parser) == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1456
 * cdef xmlDoc* _parseDocFromFile(filename8, _BaseParser parser) except NULL:
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()             # <<<<<<<<<<<<<<
 *     return (<_BaseParser>parser)._parseDocFromFile(_cstr(filename8))
 * 
 */
    __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext *)__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT->__pyx_vtab)->getDefaultParser(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_v_parser));
    __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1457
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     return (<_BaseParser>parser)._parseDocFromFile(_cstr(filename8))             # <<<<<<<<<<<<<<
 * 
 * cdef xmlDoc* _parseDocFromFilelike(source, filename,
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_parser)->__pyx_vtab)->_parseDocFromFile(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_parser), PyBytes_AS_STRING(__pyx_v_filename8)); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_t_3;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._parseDocFromFile");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_parser);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1459
 *     return (<_BaseParser>parser)._parseDocFromFile(_cstr(filename8))
 * 
 * cdef xmlDoc* _parseDocFromFilelike(source, filename,             # <<<<<<<<<<<<<<
 *                                    _BaseParser parser) except NULL:
 *     if parser is None:
 */

static  xmlDoc *__pyx_f_4lxml_5etree__parseDocFromFilelike(PyObject *__pyx_v_source, PyObject *__pyx_v_filename, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser) {
  xmlDoc *__pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  xmlDoc *__pyx_t_3;
  __Pyx_RefNannySetupContext("_parseDocFromFilelike");
  __Pyx_INCREF((PyObject *)__pyx_v_parser);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1461
 * cdef xmlDoc* _parseDocFromFilelike(source, filename,
 *                                    _BaseParser parser) except NULL:
 *     if parser is None:             # <<<<<<<<<<<<<<
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     return (<_BaseParser>parser)._parseDocFromFilelike(source, filename)
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_parser) == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1462
 *                                    _BaseParser parser) except NULL:
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()             # <<<<<<<<<<<<<<
 *     return (<_BaseParser>parser)._parseDocFromFilelike(source, filename)
 * 
 */
    __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext *)__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT->__pyx_vtab)->getDefaultParser(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_v_parser));
    __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1463
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     return (<_BaseParser>parser)._parseDocFromFilelike(source, filename)             # <<<<<<<<<<<<<<
 * 
 * cdef xmlDoc* _newXMLDoc() except NULL:
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_parser)->__pyx_vtab)->_parseDocFromFilelike(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_parser), __pyx_v_source, __pyx_v_filename); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1463; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_t_3;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._parseDocFromFilelike");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_parser);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1465
 *     return (<_BaseParser>parser)._parseDocFromFilelike(source, filename)
 * 
 * cdef xmlDoc* _newXMLDoc() except NULL:             # <<<<<<<<<<<<<<
 *     cdef xmlDoc* result
 *     result = tree.xmlNewDoc(NULL)
 */

static  xmlDoc *__pyx_f_4lxml_5etree__newXMLDoc(void) {
  xmlDoc *__pyx_v_result;
  xmlDoc *__pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_newXMLDoc");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1467
 * cdef xmlDoc* _newXMLDoc() except NULL:
 *     cdef xmlDoc* result
 *     result = tree.xmlNewDoc(NULL)             # <<<<<<<<<<<<<<
 *     if result is NULL:
 *         python.PyErr_NoMemory()
 */
  __pyx_v_result = xmlNewDoc(NULL);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1468
 *     cdef xmlDoc* result
 *     result = tree.xmlNewDoc(NULL)
 *     if result is NULL:             # <<<<<<<<<<<<<<
 *         python.PyErr_NoMemory()
 *     if result.encoding is NULL:
 */
  __pyx_t_1 = (__pyx_v_result == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1469
 *     result = tree.xmlNewDoc(NULL)
 *     if result is NULL:
 *         python.PyErr_NoMemory()             # <<<<<<<<<<<<<<
 *     if result.encoding is NULL:
 *         result.encoding = tree.xmlStrdup("UTF-8")
 */
    __pyx_t_2 = PyErr_NoMemory(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1470
 *     if result is NULL:
 *         python.PyErr_NoMemory()
 *     if result.encoding is NULL:             # <<<<<<<<<<<<<<
 *         result.encoding = tree.xmlStrdup("UTF-8")
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)
 */
  __pyx_t_1 = (__pyx_v_result->encoding == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1471
 *         python.PyErr_NoMemory()
 *     if result.encoding is NULL:
 *         result.encoding = tree.xmlStrdup("UTF-8")             # <<<<<<<<<<<<<<
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)
 *     return result
 */
    __pyx_v_result->encoding = xmlStrdup(__pyx_k_31);
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1472
 *     if result.encoding is NULL:
 *         result.encoding = tree.xmlStrdup("UTF-8")
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext *)__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT->__pyx_vtab)->initDocDict(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, __pyx_v_result);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1473
 *         result.encoding = tree.xmlStrdup("UTF-8")
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)
 *     return result             # <<<<<<<<<<<<<<
 * 
 * cdef xmlDoc* _newHTMLDoc() except NULL:
 */
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._newXMLDoc");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1475
 *     return result
 * 
 * cdef xmlDoc* _newHTMLDoc() except NULL:             # <<<<<<<<<<<<<<
 *     cdef xmlDoc* result
 *     result = tree.htmlNewDoc(NULL, NULL)
 */

static  xmlDoc *__pyx_f_4lxml_5etree__newHTMLDoc(void) {
  xmlDoc *__pyx_v_result;
  xmlDoc *__pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_newHTMLDoc");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1477
 * cdef xmlDoc* _newHTMLDoc() except NULL:
 *     cdef xmlDoc* result
 *     result = tree.htmlNewDoc(NULL, NULL)             # <<<<<<<<<<<<<<
 *     if result is NULL:
 *         python.PyErr_NoMemory()
 */
  __pyx_v_result = htmlNewDoc(NULL, NULL);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1478
 *     cdef xmlDoc* result
 *     result = tree.htmlNewDoc(NULL, NULL)
 *     if result is NULL:             # <<<<<<<<<<<<<<
 *         python.PyErr_NoMemory()
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)
 */
  __pyx_t_1 = (__pyx_v_result == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1479
 *     result = tree.htmlNewDoc(NULL, NULL)
 *     if result is NULL:
 *         python.PyErr_NoMemory()             # <<<<<<<<<<<<<<
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)
 *     return result
 */
    __pyx_t_2 = PyErr_NoMemory(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1480
 *     if result is NULL:
 *         python.PyErr_NoMemory()
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext *)__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT->__pyx_vtab)->initDocDict(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, __pyx_v_result);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1481
 *         python.PyErr_NoMemory()
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)
 *     return result             # <<<<<<<<<<<<<<
 * 
 * cdef xmlDoc* _copyDoc(xmlDoc* c_doc, int recursive) except NULL:
 */
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._newHTMLDoc");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1483
 *     return result
 * 
 * cdef xmlDoc* _copyDoc(xmlDoc* c_doc, int recursive) except NULL:             # <<<<<<<<<<<<<<
 *     cdef xmlDoc* result
 *     if recursive:
 */

static  xmlDoc *__pyx_f_4lxml_5etree__copyDoc(xmlDoc *__pyx_v_c_doc, int __pyx_v_recursive) {
  xmlDoc *__pyx_v_result;
  xmlDoc *__pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_copyDoc");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1485
 * cdef xmlDoc* _copyDoc(xmlDoc* c_doc, int recursive) except NULL:
 *     cdef xmlDoc* result
 *     if recursive:             # <<<<<<<<<<<<<<
 *         with nogil:
 *             result = tree.xmlCopyDoc(c_doc, recursive)
 */
  if (__pyx_v_recursive) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1486
 *     cdef xmlDoc* result
 *     if recursive:
 *         with nogil:             # <<<<<<<<<<<<<<
 *             result = tree.xmlCopyDoc(c_doc, recursive)
 *     else:
 */
    {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      #endif
      Py_UNBLOCK_THREADS
      /*try:*/ {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1487
 *     if recursive:
 *         with nogil:
 *             result = tree.xmlCopyDoc(c_doc, recursive)             # <<<<<<<<<<<<<<
 *     else:
 *         result = tree.xmlCopyDoc(c_doc, 0)
 */
        __pyx_v_result = xmlCopyDoc(__pyx_v_c_doc, __pyx_v_recursive);
      }

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1486
 *     cdef xmlDoc* result
 *     if recursive:
 *         with nogil:             # <<<<<<<<<<<<<<
 *             result = tree.xmlCopyDoc(c_doc, recursive)
 *     else:
 */
      /*finally:*/ {
        Py_BLOCK_THREADS
      }
    }
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1489
 *             result = tree.xmlCopyDoc(c_doc, recursive)
 *     else:
 *         result = tree.xmlCopyDoc(c_doc, 0)             # <<<<<<<<<<<<<<
 *     if result is NULL:
 *         python.PyErr_NoMemory()
 */
    __pyx_v_result = xmlCopyDoc(__pyx_v_c_doc, 0);
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1490
 *     else:
 *         result = tree.xmlCopyDoc(c_doc, 0)
 *     if result is NULL:             # <<<<<<<<<<<<<<
 *         python.PyErr_NoMemory()
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)
 */
  __pyx_t_1 = (__pyx_v_result == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1491
 *         result = tree.xmlCopyDoc(c_doc, 0)
 *     if result is NULL:
 *         python.PyErr_NoMemory()             # <<<<<<<<<<<<<<
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)
 *     return result
 */
    __pyx_t_2 = PyErr_NoMemory(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1492
 *     if result is NULL:
 *         python.PyErr_NoMemory()
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext *)__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT->__pyx_vtab)->initDocDict(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, __pyx_v_result);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1493
 *         python.PyErr_NoMemory()
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)
 *     return result             # <<<<<<<<<<<<<<
 * 
 * cdef xmlDoc* _copyDocRoot(xmlDoc* c_doc, xmlNode* c_new_root) except NULL:
 */
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._copyDoc");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1495
 *     return result
 * 
 * cdef xmlDoc* _copyDocRoot(xmlDoc* c_doc, xmlNode* c_new_root) except NULL:             # <<<<<<<<<<<<<<
 *     u"Recursively copy the document and make c_new_root the new root node."
 *     cdef xmlDoc* result
 */

static  xmlDoc *__pyx_f_4lxml_5etree__copyDocRoot(xmlDoc *__pyx_v_c_doc, xmlNode *__pyx_v_c_new_root) {
  xmlDoc *__pyx_v_result;
  xmlNode *__pyx_v_c_node;
  xmlDoc *__pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("_copyDocRoot");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1499
 *     cdef xmlDoc* result
 *     cdef xmlNode* c_node
 *     result = tree.xmlCopyDoc(c_doc, 0) # non recursive             # <<<<<<<<<<<<<<
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)
 *     with nogil:
 */
  __pyx_v_result = xmlCopyDoc(__pyx_v_c_doc, 0);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1500
 *     cdef xmlNode* c_node
 *     result = tree.xmlCopyDoc(c_doc, 0) # non recursive
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)             # <<<<<<<<<<<<<<
 *     with nogil:
 *         c_node = tree.xmlDocCopyNode(c_new_root, result, 1) # recursive
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext *)__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT->__pyx_vtab)->initDocDict(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, __pyx_v_result);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1501
 *     result = tree.xmlCopyDoc(c_doc, 0) # non recursive
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)
 *     with nogil:             # <<<<<<<<<<<<<<
 *         c_node = tree.xmlDocCopyNode(c_new_root, result, 1) # recursive
 *     if c_node is NULL:
 */
  {
    #ifdef WITH_THREAD
    PyThreadState *_save;
    #endif
    Py_UNBLOCK_THREADS
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1502
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)
 *     with nogil:
 *         c_node = tree.xmlDocCopyNode(c_new_root, result, 1) # recursive             # <<<<<<<<<<<<<<
 *     if c_node is NULL:
 *         python.PyErr_NoMemory()
 */
      __pyx_v_c_node = xmlDocCopyNode(__pyx_v_c_new_root, __pyx_v_result, 1);
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1501
 *     result = tree.xmlCopyDoc(c_doc, 0) # non recursive
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)
 *     with nogil:             # <<<<<<<<<<<<<<
 *         c_node = tree.xmlDocCopyNode(c_new_root, result, 1) # recursive
 *     if c_node is NULL:
 */
    /*finally:*/ {
      Py_BLOCK_THREADS
    }
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1503
 *     with nogil:
 *         c_node = tree.xmlDocCopyNode(c_new_root, result, 1) # recursive
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         python.PyErr_NoMemory()
 *     tree.xmlDocSetRootElement(result, c_node)
 */
  __pyx_t_1 = (__pyx_v_c_node == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1504
 *         c_node = tree.xmlDocCopyNode(c_new_root, result, 1) # recursive
 *     if c_node is NULL:
 *         python.PyErr_NoMemory()             # <<<<<<<<<<<<<<
 *     tree.xmlDocSetRootElement(result, c_node)
 *     _copyTail(c_new_root.next, c_node)
 */
    __pyx_t_2 = PyErr_NoMemory(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1505
 *     if c_node is NULL:
 *         python.PyErr_NoMemory()
 *     tree.xmlDocSetRootElement(result, c_node)             # <<<<<<<<<<<<<<
 *     _copyTail(c_new_root.next, c_node)
 *     return result
 */
  xmlDocSetRootElement(__pyx_v_result, __pyx_v_c_node);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1506
 *         python.PyErr_NoMemory()
 *     tree.xmlDocSetRootElement(result, c_node)
 *     _copyTail(c_new_root.next, c_node)             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree__copyTail(__pyx_v_c_new_root->next, __pyx_v_c_node); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1507
 *     tree.xmlDocSetRootElement(result, c_node)
 *     _copyTail(c_new_root.next, c_node)
 *     return result             # <<<<<<<<<<<<<<
 * 
 * cdef xmlNode* _copyNodeToDoc(xmlNode* c_node, xmlDoc* c_doc) except NULL:
 */
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._copyDocRoot");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1509
 *     return result
 * 
 * cdef xmlNode* _copyNodeToDoc(xmlNode* c_node, xmlDoc* c_doc) except NULL:             # <<<<<<<<<<<<<<
 *     u"Recursively copy the element into the document. c_doc is not modified."
 *     cdef xmlNode* c_root
 */

static  xmlNode *__pyx_f_4lxml_5etree__copyNodeToDoc(xmlNode *__pyx_v_c_node, xmlDoc *__pyx_v_c_doc) {
  xmlNode *__pyx_v_c_root;
  xmlNode *__pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("_copyNodeToDoc");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1512
 *     u"Recursively copy the element into the document. c_doc is not modified."
 *     cdef xmlNode* c_root
 *     c_root = tree.xmlDocCopyNode(c_node, c_doc, 1) # recursive             # <<<<<<<<<<<<<<
 *     if c_root is NULL:
 *         python.PyErr_NoMemory()
 */
  __pyx_v_c_root = xmlDocCopyNode(__pyx_v_c_node, __pyx_v_c_doc, 1);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1513
 *     cdef xmlNode* c_root
 *     c_root = tree.xmlDocCopyNode(c_node, c_doc, 1) # recursive
 *     if c_root is NULL:             # <<<<<<<<<<<<<<
 *         python.PyErr_NoMemory()
 *     _copyTail(c_node.next, c_root)
 */
  __pyx_t_1 = (__pyx_v_c_root == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1514
 *     c_root = tree.xmlDocCopyNode(c_node, c_doc, 1) # recursive
 *     if c_root is NULL:
 *         python.PyErr_NoMemory()             # <<<<<<<<<<<<<<
 *     _copyTail(c_node.next, c_root)
 *     return c_root
 */
    __pyx_t_2 = PyErr_NoMemory(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1515
 *     if c_root is NULL:
 *         python.PyErr_NoMemory()
 *     _copyTail(c_node.next, c_root)             # <<<<<<<<<<<<<<
 *     return c_root
 * 
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree__copyTail(__pyx_v_c_node->next, __pyx_v_c_root); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1516
 *         python.PyErr_NoMemory()
 *     _copyTail(c_node.next, c_root)
 *     return c_root             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_c_root;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._copyNodeToDoc");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1524
 * ############################################################
 * 
 * cdef _Document _parseDocument(source, _BaseParser parser, base_url):             # <<<<<<<<<<<<<<
 *     cdef _Document doc
 *     if _isString(source):
 */

static  struct LxmlDocument *__pyx_f_4lxml_5etree__parseDocument(PyObject *__pyx_v_source, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser, PyObject *__pyx_v_base_url) {
  struct LxmlDocument *__pyx_v_doc;
  PyObject *__pyx_v_url;
  struct LxmlDocument *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("_parseDocument");
  __Pyx_INCREF(__pyx_v_base_url);
  __pyx_v_doc = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_url = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1526
 * cdef _Document _parseDocument(source, _BaseParser parser, base_url):
 *     cdef _Document doc
 *     if _isString(source):             # <<<<<<<<<<<<<<
 *         # parse the file directly from the filesystem
 *         doc = _parseDocumentFromURL(_encodeFilename(source), parser)
 */
  __pyx_t_1 = _isString(__pyx_v_source);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1528
 *     if _isString(source):
 *         # parse the file directly from the filesystem
 *         doc = _parseDocumentFromURL(_encodeFilename(source), parser)             # <<<<<<<<<<<<<<
 *         # fix base URL if requested
 *         if base_url is not None:
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_source); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__parseDocumentFromURL(__pyx_t_2, __pyx_v_parser)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_v_doc));
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1530
 *         doc = _parseDocumentFromURL(_encodeFilename(source), parser)
 *         # fix base URL if requested
 *         if base_url is not None:             # <<<<<<<<<<<<<<
 *             base_url = _encodeFilenameUTF8(base_url)
 *             if doc._c_doc.URL is not NULL:
 */
    __pyx_t_1 = (__pyx_v_base_url != Py_None);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1531
 *         # fix base URL if requested
 *         if base_url is not None:
 *             base_url = _encodeFilenameUTF8(base_url)             # <<<<<<<<<<<<<<
 *             if doc._c_doc.URL is not NULL:
 *                 tree.xmlFree(doc._c_doc.URL)
 */
      __pyx_t_3 = __pyx_f_4lxml_5etree__encodeFilenameUTF8(__pyx_v_base_url); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_v_base_url);
      __pyx_v_base_url = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1532
 *         if base_url is not None:
 *             base_url = _encodeFilenameUTF8(base_url)
 *             if doc._c_doc.URL is not NULL:             # <<<<<<<<<<<<<<
 *                 tree.xmlFree(doc._c_doc.URL)
 *             doc._c_doc.URL = tree.xmlStrdup(_cstr(base_url))
 */
      __pyx_t_1 = (__pyx_v_doc->_c_doc->URL != NULL);
      if (__pyx_t_1) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1533
 *             base_url = _encodeFilenameUTF8(base_url)
 *             if doc._c_doc.URL is not NULL:
 *                 tree.xmlFree(doc._c_doc.URL)             # <<<<<<<<<<<<<<
 *             doc._c_doc.URL = tree.xmlStrdup(_cstr(base_url))
 *         return doc
 */
        xmlFree(__pyx_v_doc->_c_doc->URL);
        goto __pyx_L5;
      }
      __pyx_L5:;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1534
 *             if doc._c_doc.URL is not NULL:
 *                 tree.xmlFree(doc._c_doc.URL)
 *             doc._c_doc.URL = tree.xmlStrdup(_cstr(base_url))             # <<<<<<<<<<<<<<
 *         return doc
 * 
 */
      __pyx_v_doc->_c_doc->URL = xmlStrdup(PyBytes_AS_STRING(__pyx_v_base_url));
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1535
 *                 tree.xmlFree(doc._c_doc.URL)
 *             doc._c_doc.URL = tree.xmlStrdup(_cstr(base_url))
 *         return doc             # <<<<<<<<<<<<<<
 * 
 *     if base_url is not None:
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __Pyx_INCREF(((PyObject *)__pyx_v_doc));
    __pyx_r = __pyx_v_doc;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1537
 *         return doc
 * 
 *     if base_url is not None:             # <<<<<<<<<<<<<<
 *         url = base_url
 *     else:
 */
  __pyx_t_1 = (__pyx_v_base_url != Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1538
 * 
 *     if base_url is not None:
 *         url = base_url             # <<<<<<<<<<<<<<
 *     else:
 *         url = _getFilenameForFile(source)
 */
    __Pyx_INCREF(__pyx_v_base_url);
    __Pyx_DECREF(__pyx_v_url);
    __pyx_v_url = __pyx_v_base_url;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1540
 *         url = base_url
 *     else:
 *         url = _getFilenameForFile(source)             # <<<<<<<<<<<<<<
 * 
 *     if hasattr(source, u'getvalue') and hasattr(source, u'tell'):
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree__getFilenameForFile(__pyx_v_source); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_v_url);
    __pyx_v_url = __pyx_t_3;
    __pyx_t_3 = 0;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1542
 *         url = _getFilenameForFile(source)
 * 
 *     if hasattr(source, u'getvalue') and hasattr(source, u'tell'):             # <<<<<<<<<<<<<<
 *         # StringIO - reading from start?
 *         if source.tell() == 0:
 */
  __pyx_t_1 = PyObject_HasAttr(__pyx_v_source, ((PyObject *)__pyx_n_u__getvalue)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {
    __pyx_t_4 = PyObject_HasAttr(__pyx_v_source, ((PyObject *)__pyx_n_u__tell)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = __pyx_t_4;
  } else {
    __pyx_t_5 = __pyx_t_1;
  }
  if (__pyx_t_5) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1544
 *     if hasattr(source, u'getvalue') and hasattr(source, u'tell'):
 *         # StringIO - reading from start?
 *         if source.tell() == 0:             # <<<<<<<<<<<<<<
 *             return _parseMemoryDocument(
 *                 source.getvalue(), _encodeFilenameUTF8(url), parser)
 */
    __pyx_t_3 = PyObject_GetAttr(__pyx_v_source, __pyx_n_s__tell); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_5) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1545
 *         # StringIO - reading from start?
 *         if source.tell() == 0:
 *             return _parseMemoryDocument(             # <<<<<<<<<<<<<<
 *                 source.getvalue(), _encodeFilenameUTF8(url), parser)
 * 
 */
      __Pyx_XDECREF(((PyObject *)__pyx_r));

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1546
 *         if source.tell() == 0:
 *             return _parseMemoryDocument(
 *                 source.getvalue(), _encodeFilenameUTF8(url), parser)             # <<<<<<<<<<<<<<
 * 
 *     # Support for file-like objects (urlgrabber.urlopen, ...)
 */
      __pyx_t_3 = PyObject_GetAttr(__pyx_v_source, __pyx_n_s__getvalue); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1546; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1546; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __pyx_f_4lxml_5etree__encodeFilenameUTF8(__pyx_v_url); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1546; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = ((PyObject *)__pyx_f_4lxml_5etree__parseMemoryDocument(__pyx_t_2, __pyx_t_3, __pyx_v_parser)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = ((struct LxmlDocument *)__pyx_t_6);
      __pyx_t_6 = 0;
      goto __pyx_L0;
      goto __pyx_L8;
    }
    __pyx_L8:;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1549
 * 
 *     # Support for file-like objects (urlgrabber.urlopen, ...)
 *     if hasattr(source, u'read'):             # <<<<<<<<<<<<<<
 *         return _parseFilelikeDocument(
 *             source, _encodeFilenameUTF8(url), parser)
 */
  __pyx_t_5 = PyObject_HasAttr(__pyx_v_source, ((PyObject *)__pyx_n_u__read)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_5) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1550
 *     # Support for file-like objects (urlgrabber.urlopen, ...)
 *     if hasattr(source, u'read'):
 *         return _parseFilelikeDocument(             # <<<<<<<<<<<<<<
 *             source, _encodeFilenameUTF8(url), parser)
 * 
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1551
 *     if hasattr(source, u'read'):
 *         return _parseFilelikeDocument(
 *             source, _encodeFilenameUTF8(url), parser)             # <<<<<<<<<<<<<<
 * 
 *     raise TypeError, u"cannot parse from '%s'" % funicode(python._fqtypename(source))
 */
    __pyx_t_6 = __pyx_f_4lxml_5etree__encodeFilenameUTF8(__pyx_v_url); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__parseFilelikeDocument(__pyx_v_source, __pyx_t_6, __pyx_v_parser)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_r = ((struct LxmlDocument *)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L0;
    goto __pyx_L9;
  }
  __pyx_L9:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1553
 *             source, _encodeFilenameUTF8(url), parser)
 * 
 *     raise TypeError, u"cannot parse from '%s'" % funicode(python._fqtypename(source))             # <<<<<<<<<<<<<<
 * 
 * cdef _Document _parseDocumentFromURL(url, _BaseParser parser):
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(_fqtypename(__pyx_v_source)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_226), __pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_6));
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_6), 0);
  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
  {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._parseDocument");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_doc);
  __Pyx_DECREF(__pyx_v_url);
  __Pyx_DECREF(__pyx_v_base_url);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1555
 *     raise TypeError, u"cannot parse from '%s'" % funicode(python._fqtypename(source))
 * 
 * cdef _Document _parseDocumentFromURL(url, _BaseParser parser):             # <<<<<<<<<<<<<<
 *     cdef xmlDoc* c_doc
 *     c_doc = _parseDocFromFile(url, parser)
 */

static  struct LxmlDocument *__pyx_f_4lxml_5etree__parseDocumentFromURL(PyObject *__pyx_v_url, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser) {
  xmlDoc *__pyx_v_c_doc;
  struct LxmlDocument *__pyx_r = NULL;
  xmlDoc *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_parseDocumentFromURL");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1557
 * cdef _Document _parseDocumentFromURL(url, _BaseParser parser):
 *     cdef xmlDoc* c_doc
 *     c_doc = _parseDocFromFile(url, parser)             # <<<<<<<<<<<<<<
 *     return _documentFactory(c_doc, parser)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__parseDocFromFile(__pyx_v_url, __pyx_v_parser); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_doc = __pyx_t_1;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1558
 *     cdef xmlDoc* c_doc
 *     c_doc = _parseDocFromFile(url, parser)
 *     return _documentFactory(c_doc, parser)             # <<<<<<<<<<<<<<
 * 
 * cdef _Document _parseMemoryDocument(text, url, _BaseParser parser):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, __pyx_v_parser)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = ((struct LxmlDocument *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._parseDocumentFromURL");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1560
 *     return _documentFactory(c_doc, parser)
 * 
 * cdef _Document _parseMemoryDocument(text, url, _BaseParser parser):             # <<<<<<<<<<<<<<
 *     cdef xmlDoc* c_doc
 *     if python.PyUnicode_Check(text):
 */

static  struct LxmlDocument *__pyx_f_4lxml_5etree__parseMemoryDocument(PyObject *__pyx_v_text, PyObject *__pyx_v_url, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser) {
  xmlDoc *__pyx_v_c_doc;
  struct LxmlDocument *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  xmlDoc *__pyx_t_3;
  __Pyx_RefNannySetupContext("_parseMemoryDocument");
  __Pyx_INCREF(__pyx_v_text);
  __Pyx_INCREF(__pyx_v_url);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1562
 * cdef _Document _parseMemoryDocument(text, url, _BaseParser parser):
 *     cdef xmlDoc* c_doc
 *     if python.PyUnicode_Check(text):             # <<<<<<<<<<<<<<
 *         if _hasEncodingDeclaration(text):
 *             raise ValueError, \
 */
  __pyx_t_1 = PyUnicode_Check(__pyx_v_text);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1563
 *     cdef xmlDoc* c_doc
 *     if python.PyUnicode_Check(text):
 *         if _hasEncodingDeclaration(text):             # <<<<<<<<<<<<<<
 *             raise ValueError, \
 *                 u"Unicode strings with encoding declaration are not supported."
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree__hasEncodingDeclaration(__pyx_v_text);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1564
 *     if python.PyUnicode_Check(text):
 *         if _hasEncodingDeclaration(text):
 *             raise ValueError, \             # <<<<<<<<<<<<<<
 *                 u"Unicode strings with encoding declaration are not supported."
 *         # pass native unicode only if libxml2 can handle it
 */
      __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_u_227), 0);
      {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1567
 *                 u"Unicode strings with encoding declaration are not supported."
 *         # pass native unicode only if libxml2 can handle it
 *         if _UNICODE_ENCODING is NULL:             # <<<<<<<<<<<<<<
 *             text = python.PyUnicode_AsUTF8String(text)
 *     elif not python.PyBytes_Check(text):
 */
    __pyx_t_1 = (__pyx_v_4lxml_5etree__UNICODE_ENCODING == NULL);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1568
 *         # pass native unicode only if libxml2 can handle it
 *         if _UNICODE_ENCODING is NULL:
 *             text = python.PyUnicode_AsUTF8String(text)             # <<<<<<<<<<<<<<
 *     elif not python.PyBytes_Check(text):
 *         raise ValueError, u"can only parse strings"
 */
      __pyx_t_2 = ((PyObject *)PyUnicode_AsUTF8String(__pyx_v_text)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1568; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_v_text);
      __pyx_v_text = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L5;
    }
    __pyx_L5:;
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1569
 *         if _UNICODE_ENCODING is NULL:
 *             text = python.PyUnicode_AsUTF8String(text)
 *     elif not python.PyBytes_Check(text):             # <<<<<<<<<<<<<<
 *         raise ValueError, u"can only parse strings"
 *     if python.PyUnicode_Check(url):
 */
  __pyx_t_1 = (!PyBytes_Check(__pyx_v_text));
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1570
 *             text = python.PyUnicode_AsUTF8String(text)
 *     elif not python.PyBytes_Check(text):
 *         raise ValueError, u"can only parse strings"             # <<<<<<<<<<<<<<
 *     if python.PyUnicode_Check(url):
 *         url = python.PyUnicode_AsUTF8String(url)
 */
    __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_u_228), 0);
    {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1571
 *     elif not python.PyBytes_Check(text):
 *         raise ValueError, u"can only parse strings"
 *     if python.PyUnicode_Check(url):             # <<<<<<<<<<<<<<
 *         url = python.PyUnicode_AsUTF8String(url)
 *     c_doc = _parseDoc(text, url, parser)
 */
  __pyx_t_1 = PyUnicode_Check(__pyx_v_url);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1572
 *         raise ValueError, u"can only parse strings"
 *     if python.PyUnicode_Check(url):
 *         url = python.PyUnicode_AsUTF8String(url)             # <<<<<<<<<<<<<<
 *     c_doc = _parseDoc(text, url, parser)
 *     return _documentFactory(c_doc, parser)
 */
    __pyx_t_2 = ((PyObject *)PyUnicode_AsUTF8String(__pyx_v_url)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1572; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_v_url);
    __pyx_v_url = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1573
 *     if python.PyUnicode_Check(url):
 *         url = python.PyUnicode_AsUTF8String(url)
 *     c_doc = _parseDoc(text, url, parser)             # <<<<<<<<<<<<<<
 *     return _documentFactory(c_doc, parser)
 * 
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree__parseDoc(__pyx_v_text, __pyx_v_url, __pyx_v_parser); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_doc = __pyx_t_3;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1574
 *         url = python.PyUnicode_AsUTF8String(url)
 *     c_doc = _parseDoc(text, url, parser)
 *     return _documentFactory(c_doc, parser)             # <<<<<<<<<<<<<<
 * 
 * cdef _Document _parseFilelikeDocument(source, url, _BaseParser parser):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, __pyx_v_parser)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = ((struct LxmlDocument *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._parseMemoryDocument");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_text);
  __Pyx_DECREF(__pyx_v_url);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1576
 *     return _documentFactory(c_doc, parser)
 * 
 * cdef _Document _parseFilelikeDocument(source, url, _BaseParser parser):             # <<<<<<<<<<<<<<
 *     cdef xmlDoc* c_doc
 *     if python.PyUnicode_Check(url):
 */

static  struct LxmlDocument *__pyx_f_4lxml_5etree__parseFilelikeDocument(PyObject *__pyx_v_source, PyObject *__pyx_v_url, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser) {
  xmlDoc *__pyx_v_c_doc;
  struct LxmlDocument *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  xmlDoc *__pyx_t_3;
  __Pyx_RefNannySetupContext("_parseFilelikeDocument");
  __Pyx_INCREF(__pyx_v_url);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1578
 * cdef _Document _parseFilelikeDocument(source, url, _BaseParser parser):
 *     cdef xmlDoc* c_doc
 *     if python.PyUnicode_Check(url):             # <<<<<<<<<<<<<<
 *         url = python.PyUnicode_AsUTF8String(url)
 *     c_doc = _parseDocFromFilelike(source, url, parser)
 */
  __pyx_t_1 = PyUnicode_Check(__pyx_v_url);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1579
 *     cdef xmlDoc* c_doc
 *     if python.PyUnicode_Check(url):
 *         url = python.PyUnicode_AsUTF8String(url)             # <<<<<<<<<<<<<<
 *     c_doc = _parseDocFromFilelike(source, url, parser)
 *     return _documentFactory(c_doc, parser)
 */
    __pyx_t_2 = ((PyObject *)PyUnicode_AsUTF8String(__pyx_v_url)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_v_url);
    __pyx_v_url = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1580
 *     if python.PyUnicode_Check(url):
 *         url = python.PyUnicode_AsUTF8String(url)
 *     c_doc = _parseDocFromFilelike(source, url, parser)             # <<<<<<<<<<<<<<
 *     return _documentFactory(c_doc, parser)
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree__parseDocFromFilelike(__pyx_v_source, __pyx_v_url, __pyx_v_parser); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1580; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_doc = __pyx_t_3;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1581
 *         url = python.PyUnicode_AsUTF8String(url)
 *     c_doc = _parseDocFromFilelike(source, url, parser)
 *     return _documentFactory(c_doc, parser)             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, __pyx_v_parser)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = ((struct LxmlDocument *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._parseFilelikeDocument");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_url);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":14
 *     cdef int _sax_event_filter
 *     cdef int _sax_event_propagate
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._sax_event_filter = 0
 *         self._sax_event_propagate = 0
 */

static int __pyx_pf_4lxml_5etree_16_SaxParserTarget___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_16_SaxParserTarget___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("__cinit__");
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":15
 *     cdef int _sax_event_propagate
 *     def __cinit__(self):
 *         self._sax_event_filter = 0             # <<<<<<<<<<<<<<
 *         self._sax_event_propagate = 0
 * 
 */
  ((struct __pyx_obj_4lxml_5etree__SaxParserTarget *)__pyx_v_self)->_sax_event_filter = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":16
 *     def __cinit__(self):
 *         self._sax_event_filter = 0
 *         self._sax_event_propagate = 0             # <<<<<<<<<<<<<<
 * 
 *     cdef _handleSaxStart(self, tag, attrib, nsmap):
 */
  ((struct __pyx_obj_4lxml_5etree__SaxParserTarget *)__pyx_v_self)->_sax_event_propagate = 0;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":18
 *         self._sax_event_propagate = 0
 * 
 *     cdef _handleSaxStart(self, tag, attrib, nsmap):             # <<<<<<<<<<<<<<
 *         return None
 *     cdef _handleSaxEnd(self, tag):
 */

static  PyObject *__pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxStart(struct __pyx_obj_4lxml_5etree__SaxParserTarget *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("_handleSaxStart");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":19
 * 
 *     cdef _handleSaxStart(self, tag, attrib, nsmap):
 *         return None             # <<<<<<<<<<<<<<
 *     cdef _handleSaxEnd(self, tag):
 *         return None
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_None);
  __pyx_r = Py_None;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":20
 *     cdef _handleSaxStart(self, tag, attrib, nsmap):
 *         return None
 *     cdef _handleSaxEnd(self, tag):             # <<<<<<<<<<<<<<
 *         return None
 *     cdef int _handleSaxData(self, data) except -1:
 */

static  PyObject *__pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxEnd(struct __pyx_obj_4lxml_5etree__SaxParserTarget *__pyx_v_self, PyObject *__pyx_v_tag) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("_handleSaxEnd");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":21
 *         return None
 *     cdef _handleSaxEnd(self, tag):
 *         return None             # <<<<<<<<<<<<<<
 *     cdef int _handleSaxData(self, data) except -1:
 *         return 0
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_None);
  __pyx_r = Py_None;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":22
 *     cdef _handleSaxEnd(self, tag):
 *         return None
 *     cdef int _handleSaxData(self, data) except -1:             # <<<<<<<<<<<<<<
 *         return 0
 *     cdef int _handleSaxDoctype(self, root_tag, public_id, system_id) except -1:
 */

static  int __pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxData(struct __pyx_obj_4lxml_5etree__SaxParserTarget *__pyx_v_self, PyObject *__pyx_v_data) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("_handleSaxData");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":23
 *         return None
 *     cdef int _handleSaxData(self, data) except -1:
 *         return 0             # <<<<<<<<<<<<<<
 *     cdef int _handleSaxDoctype(self, root_tag, public_id, system_id) except -1:
 *         return 0
 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":24
 *     cdef int _handleSaxData(self, data) except -1:
 *         return 0
 *     cdef int _handleSaxDoctype(self, root_tag, public_id, system_id) except -1:             # <<<<<<<<<<<<<<
 *         return 0
 *     cdef _handleSaxPi(self, target, data):
 */

static  int __pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxDoctype(struct __pyx_obj_4lxml_5etree__SaxParserTarget *__pyx_v_self, PyObject *__pyx_v_root_tag, PyObject *__pyx_v_public_id, PyObject *__pyx_v_system_id) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("_handleSaxDoctype");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":25
 *         return 0
 *     cdef int _handleSaxDoctype(self, root_tag, public_id, system_id) except -1:
 *         return 0             # <<<<<<<<<<<<<<
 *     cdef _handleSaxPi(self, target, data):
 *         return None
 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":26
 *     cdef int _handleSaxDoctype(self, root_tag, public_id, system_id) except -1:
 *         return 0
 *     cdef _handleSaxPi(self, target, data):             # <<<<<<<<<<<<<<
 *         return None
 *     cdef _handleSaxComment(self, comment):
 */

static  PyObject *__pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxPi(struct __pyx_obj_4lxml_5etree__SaxParserTarget *__pyx_v_self, PyObject *__pyx_v_target, PyObject *__pyx_v_data) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("_handleSaxPi");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":27
 *         return 0
 *     cdef _handleSaxPi(self, target, data):
 *         return None             # <<<<<<<<<<<<<<
 *     cdef _handleSaxComment(self, comment):
 *         return None
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_None);
  __pyx_r = Py_None;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":28
 *     cdef _handleSaxPi(self, target, data):
 *         return None
 *     cdef _handleSaxComment(self, comment):             # <<<<<<<<<<<<<<
 *         return None
 * 
 */

static  PyObject *__pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxComment(struct __pyx_obj_4lxml_5etree__SaxParserTarget *__pyx_v_self, PyObject *__pyx_v_comment) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("_handleSaxComment");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":29
 *         return None
 *     cdef _handleSaxComment(self, comment):
 *         return None             # <<<<<<<<<<<<<<
 * 
 * cdef class _SaxParserContext(_ParserContext):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_None);
  __pyx_r = Py_None;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":45
 *     cdef xmlparser.processingInstructionSAXFunc    _origSaxPi
 * 
 *     cdef void _setSaxParserTarget(self, _SaxParserTarget target):             # <<<<<<<<<<<<<<
 *         self._target = target
 * 
 */

static  void __pyx_f_4lxml_5etree_17_SaxParserContext__setSaxParserTarget(struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_self, struct __pyx_obj_4lxml_5etree__SaxParserTarget *__pyx_v_target) {
  __Pyx_RefNannySetupContext("_setSaxParserTarget");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":46
 * 
 *     cdef void _setSaxParserTarget(self, _SaxParserTarget target):
 *         self._target = target             # <<<<<<<<<<<<<<
 * 
 *     cdef void _initParserContext(self, xmlparser.xmlParserCtxt* c_ctxt):
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_target));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_target));
  __Pyx_GOTREF(__pyx_v_self->_target);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_target));
  __pyx_v_self->_target = __pyx_v_target;

  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":48
 *         self._target = target
 * 
 *     cdef void _initParserContext(self, xmlparser.xmlParserCtxt* c_ctxt):             # <<<<<<<<<<<<<<
 *         u"wrap original SAX2 callbacks"
 *         cdef xmlparser.xmlSAXHandler* sax
 */

static  void __pyx_f_4lxml_5etree_17_SaxParserContext__initParserContext(struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_self, xmlParserCtxt *__pyx_v_c_ctxt) {
  xmlSAXHandler *__pyx_v_sax;
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("_initParserContext");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":51
 *         u"wrap original SAX2 callbacks"
 *         cdef xmlparser.xmlSAXHandler* sax
 *         _ParserContext._initParserContext(self, c_ctxt)             # <<<<<<<<<<<<<<
 *         sax = c_ctxt.sax
 *         if self._target._sax_event_propagate & SAX_EVENT_START:
 */
  __pyx_vtabptr_4lxml_5etree__ParserContext->_initParserContext(((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_v_self), __pyx_v_c_ctxt);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":52
 *         cdef xmlparser.xmlSAXHandler* sax
 *         _ParserContext._initParserContext(self, c_ctxt)
 *         sax = c_ctxt.sax             # <<<<<<<<<<<<<<
 *         if self._target._sax_event_propagate & SAX_EVENT_START:
 *             # propagate => keep orig callback
 */
  __pyx_v_sax = __pyx_v_c_ctxt->sax;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":53
 *         _ParserContext._initParserContext(self, c_ctxt)
 *         sax = c_ctxt.sax
 *         if self._target._sax_event_propagate & SAX_EVENT_START:             # <<<<<<<<<<<<<<
 *             # propagate => keep orig callback
 *             self._origSaxStart = sax.startElementNs
 */
  __pyx_t_1 = (__pyx_v_self->_target->_sax_event_propagate & __pyx_e_4lxml_5etree_SAX_EVENT_START);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":55
 *         if self._target._sax_event_propagate & SAX_EVENT_START:
 *             # propagate => keep orig callback
 *             self._origSaxStart = sax.startElementNs             # <<<<<<<<<<<<<<
 *             self._origSaxStartNoNs = sax.startElement
 *         else:
 */
    __pyx_v_self->_origSaxStart = __pyx_v_sax->startElementNs;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":56
 *             # propagate => keep orig callback
 *             self._origSaxStart = sax.startElementNs
 *             self._origSaxStartNoNs = sax.startElement             # <<<<<<<<<<<<<<
 *         else:
 *             # otherwise: never call orig callback
 */
    __pyx_v_self->_origSaxStartNoNs = __pyx_v_sax->startElement;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":59
 *         else:
 *             # otherwise: never call orig callback
 *             self._origSaxStart = sax.startElementNs = NULL             # <<<<<<<<<<<<<<
 *             self._origSaxStartNoNs = sax.startElement = NULL
 *         if self._target._sax_event_filter & SAX_EVENT_START:
 */
    __pyx_v_self->_origSaxStart = NULL;
    __pyx_v_sax->startElementNs = NULL;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":60
 *             # otherwise: never call orig callback
 *             self._origSaxStart = sax.startElementNs = NULL
 *             self._origSaxStartNoNs = sax.startElement = NULL             # <<<<<<<<<<<<<<
 *         if self._target._sax_event_filter & SAX_EVENT_START:
 *             # intercept => overwrite orig callback
 */
    __pyx_v_self->_origSaxStartNoNs = NULL;
    __pyx_v_sax->startElement = NULL;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":61
 *             self._origSaxStart = sax.startElementNs = NULL
 *             self._origSaxStartNoNs = sax.startElement = NULL
 *         if self._target._sax_event_filter & SAX_EVENT_START:             # <<<<<<<<<<<<<<
 *             # intercept => overwrite orig callback
 *             if sax.initialized == xmlparser.XML_SAX2_MAGIC:
 */
  __pyx_t_1 = (__pyx_v_self->_target->_sax_event_filter & __pyx_e_4lxml_5etree_SAX_EVENT_START);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":63
 *         if self._target._sax_event_filter & SAX_EVENT_START:
 *             # intercept => overwrite orig callback
 *             if sax.initialized == xmlparser.XML_SAX2_MAGIC:             # <<<<<<<<<<<<<<
 *                 sax.startElementNs = _handleSaxStart
 *             sax.startElement = _handleSaxStartNoNs
 */
    __pyx_t_2 = (__pyx_v_sax->initialized == XML_SAX2_MAGIC);
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":64
 *             # intercept => overwrite orig callback
 *             if sax.initialized == xmlparser.XML_SAX2_MAGIC:
 *                 sax.startElementNs = _handleSaxStart             # <<<<<<<<<<<<<<
 *             sax.startElement = _handleSaxStartNoNs
 * 
 */
      __pyx_v_sax->startElementNs = __pyx_f_4lxml_5etree__handleSaxStart;
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":65
 *             if sax.initialized == xmlparser.XML_SAX2_MAGIC:
 *                 sax.startElementNs = _handleSaxStart
 *             sax.startElement = _handleSaxStartNoNs             # <<<<<<<<<<<<<<
 * 
 *         if self._target._sax_event_propagate & SAX_EVENT_END:
 */
    __pyx_v_sax->startElement = __pyx_f_4lxml_5etree__handleSaxStartNoNs;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":67
 *             sax.startElement = _handleSaxStartNoNs
 * 
 *         if self._target._sax_event_propagate & SAX_EVENT_END:             # <<<<<<<<<<<<<<
 *             self._origSaxEnd = sax.endElementNs
 *             self._origSaxEndNoNs = sax.endElement
 */
  __pyx_t_1 = (__pyx_v_self->_target->_sax_event_propagate & __pyx_e_4lxml_5etree_SAX_EVENT_END);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":68
 * 
 *         if self._target._sax_event_propagate & SAX_EVENT_END:
 *             self._origSaxEnd = sax.endElementNs             # <<<<<<<<<<<<<<
 *             self._origSaxEndNoNs = sax.endElement
 *         else:
 */
    __pyx_v_self->_origSaxEnd = __pyx_v_sax->endElementNs;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":69
 *         if self._target._sax_event_propagate & SAX_EVENT_END:
 *             self._origSaxEnd = sax.endElementNs
 *             self._origSaxEndNoNs = sax.endElement             # <<<<<<<<<<<<<<
 *         else:
 *             self._origSaxEnd = sax.endElementNs = NULL
 */
    __pyx_v_self->_origSaxEndNoNs = __pyx_v_sax->endElement;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":71
 *             self._origSaxEndNoNs = sax.endElement
 *         else:
 *             self._origSaxEnd = sax.endElementNs = NULL             # <<<<<<<<<<<<<<
 *             self._origSaxEndNoNs = sax.endElement = NULL
 *         if self._target._sax_event_filter & SAX_EVENT_END:
 */
    __pyx_v_self->_origSaxEnd = NULL;
    __pyx_v_sax->endElementNs = NULL;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":72
 *         else:
 *             self._origSaxEnd = sax.endElementNs = NULL
 *             self._origSaxEndNoNs = sax.endElement = NULL             # <<<<<<<<<<<<<<
 *         if self._target._sax_event_filter & SAX_EVENT_END:
 *             if sax.initialized == xmlparser.XML_SAX2_MAGIC:
 */
    __pyx_v_self->_origSaxEndNoNs = NULL;
    __pyx_v_sax->endElement = NULL;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":73
 *             self._origSaxEnd = sax.endElementNs = NULL
 *             self._origSaxEndNoNs = sax.endElement = NULL
 *         if self._target._sax_event_filter & SAX_EVENT_END:             # <<<<<<<<<<<<<<
 *             if sax.initialized == xmlparser.XML_SAX2_MAGIC:
 *                 sax.endElementNs = _handleSaxEnd
 */
  __pyx_t_1 = (__pyx_v_self->_target->_sax_event_filter & __pyx_e_4lxml_5etree_SAX_EVENT_END);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":74
 *             self._origSaxEndNoNs = sax.endElement = NULL
 *         if self._target._sax_event_filter & SAX_EVENT_END:
 *             if sax.initialized == xmlparser.XML_SAX2_MAGIC:             # <<<<<<<<<<<<<<
 *                 sax.endElementNs = _handleSaxEnd
 *             sax.endElement = _handleSaxEndNoNs
 */
    __pyx_t_2 = (__pyx_v_sax->initialized == XML_SAX2_MAGIC);
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":75
 *         if self._target._sax_event_filter & SAX_EVENT_END:
 *             if sax.initialized == xmlparser.XML_SAX2_MAGIC:
 *                 sax.endElementNs = _handleSaxEnd             # <<<<<<<<<<<<<<
 *             sax.endElement = _handleSaxEndNoNs
 * 
 */
      __pyx_v_sax->endElementNs = __pyx_f_4lxml_5etree__handleSaxEnd;
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":76
 *             if sax.initialized == xmlparser.XML_SAX2_MAGIC:
 *                 sax.endElementNs = _handleSaxEnd
 *             sax.endElement = _handleSaxEndNoNs             # <<<<<<<<<<<<<<
 * 
 *         if self._target._sax_event_propagate & SAX_EVENT_DATA:
 */
    __pyx_v_sax->endElement = __pyx_f_4lxml_5etree__handleSaxEndNoNs;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":78
 *             sax.endElement = _handleSaxEndNoNs
 * 
 *         if self._target._sax_event_propagate & SAX_EVENT_DATA:             # <<<<<<<<<<<<<<
 *             self._origSaxData = sax.characters
 *             self._origSaxCData = sax.cdataBlock
 */
  __pyx_t_1 = (__pyx_v_self->_target->_sax_event_propagate & __pyx_e_4lxml_5etree_SAX_EVENT_DATA);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":79
 * 
 *         if self._target._sax_event_propagate & SAX_EVENT_DATA:
 *             self._origSaxData = sax.characters             # <<<<<<<<<<<<<<
 *             self._origSaxCData = sax.cdataBlock
 *         else:
 */
    __pyx_v_self->_origSaxData = __pyx_v_sax->characters;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":80
 *         if self._target._sax_event_propagate & SAX_EVENT_DATA:
 *             self._origSaxData = sax.characters
 *             self._origSaxCData = sax.cdataBlock             # <<<<<<<<<<<<<<
 *         else:
 *             self._origSaxData = sax.characters = sax.cdataBlock = NULL
 */
    __pyx_v_self->_origSaxCData = __pyx_v_sax->cdataBlock;
    goto __pyx_L9;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":82
 *             self._origSaxCData = sax.cdataBlock
 *         else:
 *             self._origSaxData = sax.characters = sax.cdataBlock = NULL             # <<<<<<<<<<<<<<
 *         if self._target._sax_event_filter & SAX_EVENT_DATA:
 *             sax.characters = _handleSaxData
 */
    __pyx_v_self->_origSaxData = NULL;
    __pyx_v_sax->characters = NULL;
    __pyx_v_sax->cdataBlock = NULL;
  }
  __pyx_L9:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":83
 *         else:
 *             self._origSaxData = sax.characters = sax.cdataBlock = NULL
 *         if self._target._sax_event_filter & SAX_EVENT_DATA:             # <<<<<<<<<<<<<<
 *             sax.characters = _handleSaxData
 *             sax.cdataBlock = _handleSaxCData
 */
  __pyx_t_1 = (__pyx_v_self->_target->_sax_event_filter & __pyx_e_4lxml_5etree_SAX_EVENT_DATA);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":84
 *             self._origSaxData = sax.characters = sax.cdataBlock = NULL
 *         if self._target._sax_event_filter & SAX_EVENT_DATA:
 *             sax.characters = _handleSaxData             # <<<<<<<<<<<<<<
 *             sax.cdataBlock = _handleSaxCData
 * 
 */
    __pyx_v_sax->characters = __pyx_f_4lxml_5etree__handleSaxData;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":85
 *         if self._target._sax_event_filter & SAX_EVENT_DATA:
 *             sax.characters = _handleSaxData
 *             sax.cdataBlock = _handleSaxCData             # <<<<<<<<<<<<<<
 * 
 *         # doctype propagation is always required for entity replacement
 */
    __pyx_v_sax->cdataBlock = __pyx_f_4lxml_5etree__handleSaxCData;
    goto __pyx_L10;
  }
  __pyx_L10:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":88
 * 
 *         # doctype propagation is always required for entity replacement
 *         self._origSaxDoctype = sax.internalSubset             # <<<<<<<<<<<<<<
 *         if self._target._sax_event_filter & SAX_EVENT_DOCTYPE:
 *             sax.internalSubset = _handleSaxDoctype
 */
  __pyx_v_self->_origSaxDoctype = __pyx_v_sax->internalSubset;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":89
 *         # doctype propagation is always required for entity replacement
 *         self._origSaxDoctype = sax.internalSubset
 *         if self._target._sax_event_filter & SAX_EVENT_DOCTYPE:             # <<<<<<<<<<<<<<
 *             sax.internalSubset = _handleSaxDoctype
 * 
 */
  __pyx_t_1 = (__pyx_v_self->_target->_sax_event_filter & __pyx_e_4lxml_5etree_SAX_EVENT_DOCTYPE);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":90
 *         self._origSaxDoctype = sax.internalSubset
 *         if self._target._sax_event_filter & SAX_EVENT_DOCTYPE:
 *             sax.internalSubset = _handleSaxDoctype             # <<<<<<<<<<<<<<
 * 
 *         if self._target._sax_event_propagate & SAX_EVENT_PI:
 */
    __pyx_v_sax->internalSubset = __pyx_f_4lxml_5etree__handleSaxDoctype;
    goto __pyx_L11;
  }
  __pyx_L11:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":92
 *             sax.internalSubset = _handleSaxDoctype
 * 
 *         if self._target._sax_event_propagate & SAX_EVENT_PI:             # <<<<<<<<<<<<<<
 *             self._origSaxPi = sax.processingInstruction
 *         else:
 */
  __pyx_t_1 = (__pyx_v_self->_target->_sax_event_propagate & __pyx_e_4lxml_5etree_SAX_EVENT_PI);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":93
 * 
 *         if self._target._sax_event_propagate & SAX_EVENT_PI:
 *             self._origSaxPi = sax.processingInstruction             # <<<<<<<<<<<<<<
 *         else:
 *             self._origSaxPi = sax.processingInstruction = NULL
 */
    __pyx_v_self->_origSaxPi = __pyx_v_sax->processingInstruction;
    goto __pyx_L12;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":95
 *             self._origSaxPi = sax.processingInstruction
 *         else:
 *             self._origSaxPi = sax.processingInstruction = NULL             # <<<<<<<<<<<<<<
 *         if self._target._sax_event_filter & SAX_EVENT_PI:
 *             sax.processingInstruction = _handleSaxPI
 */
    __pyx_v_self->_origSaxPi = NULL;
    __pyx_v_sax->processingInstruction = NULL;
  }
  __pyx_L12:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":96
 *         else:
 *             self._origSaxPi = sax.processingInstruction = NULL
 *         if self._target._sax_event_filter & SAX_EVENT_PI:             # <<<<<<<<<<<<<<
 *             sax.processingInstruction = _handleSaxPI
 * 
 */
  __pyx_t_1 = (__pyx_v_self->_target->_sax_event_filter & __pyx_e_4lxml_5etree_SAX_EVENT_PI);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":97
 *             self._origSaxPi = sax.processingInstruction = NULL
 *         if self._target._sax_event_filter & SAX_EVENT_PI:
 *             sax.processingInstruction = _handleSaxPI             # <<<<<<<<<<<<<<
 * 
 *         if self._target._sax_event_propagate & SAX_EVENT_COMMENT:
 */
    __pyx_v_sax->processingInstruction = __pyx_f_4lxml_5etree__handleSaxPI;
    goto __pyx_L13;
  }
  __pyx_L13:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":99
 *             sax.processingInstruction = _handleSaxPI
 * 
 *         if self._target._sax_event_propagate & SAX_EVENT_COMMENT:             # <<<<<<<<<<<<<<
 *             self._origSaxComment = sax.comment
 *         else:
 */
  __pyx_t_1 = (__pyx_v_self->_target->_sax_event_propagate & __pyx_e_4lxml_5etree_SAX_EVENT_COMMENT);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":100
 * 
 *         if self._target._sax_event_propagate & SAX_EVENT_COMMENT:
 *             self._origSaxComment = sax.comment             # <<<<<<<<<<<<<<
 *         else:
 *             self._origSaxComment = sax.comment = NULL
 */
    __pyx_v_self->_origSaxComment = __pyx_v_sax->comment;
    goto __pyx_L14;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":102
 *             self._origSaxComment = sax.comment
 *         else:
 *             self._origSaxComment = sax.comment = NULL             # <<<<<<<<<<<<<<
 *         if self._target._sax_event_filter & SAX_EVENT_COMMENT:
 *             sax.comment = _handleSaxComment
 */
    __pyx_v_self->_origSaxComment = NULL;
    __pyx_v_sax->comment = NULL;
  }
  __pyx_L14:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":103
 *         else:
 *             self._origSaxComment = sax.comment = NULL
 *         if self._target._sax_event_filter & SAX_EVENT_COMMENT:             # <<<<<<<<<<<<<<
 *             sax.comment = _handleSaxComment
 * 
 */
  __pyx_t_1 = (__pyx_v_self->_target->_sax_event_filter & __pyx_e_4lxml_5etree_SAX_EVENT_COMMENT);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":104
 *             self._origSaxComment = sax.comment = NULL
 *         if self._target._sax_event_filter & SAX_EVENT_COMMENT:
 *             sax.comment = _handleSaxComment             # <<<<<<<<<<<<<<
 * 
 *         # enforce entity replacement
 */
    __pyx_v_sax->comment = __pyx_f_4lxml_5etree__handleSaxComment;
    goto __pyx_L15;
  }
  __pyx_L15:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":107
 * 
 *         # enforce entity replacement
 *         sax.reference = NULL             # <<<<<<<<<<<<<<
 *         c_ctxt.replaceEntities = 1
 * 
 */
  __pyx_v_sax->reference = NULL;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":108
 *         # enforce entity replacement
 *         sax.reference = NULL
 *         c_ctxt.replaceEntities = 1             # <<<<<<<<<<<<<<
 * 
 *     cdef void _handleSaxException(self, xmlparser.xmlParserCtxt* c_ctxt):
 */
  __pyx_v_c_ctxt->replaceEntities = 1;

  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":110
 *         c_ctxt.replaceEntities = 1
 * 
 *     cdef void _handleSaxException(self, xmlparser.xmlParserCtxt* c_ctxt):             # <<<<<<<<<<<<<<
 *         if c_ctxt.errNo == xmlerror.XML_ERR_OK:
 *             c_ctxt.errNo = xmlerror.XML_ERR_INTERNAL_ERROR
 */

static  void __pyx_f_4lxml_5etree_17_SaxParserContext__handleSaxException(struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_self, xmlParserCtxt *__pyx_v_c_ctxt) {
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_handleSaxException");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":111
 * 
 *     cdef void _handleSaxException(self, xmlparser.xmlParserCtxt* c_ctxt):
 *         if c_ctxt.errNo == xmlerror.XML_ERR_OK:             # <<<<<<<<<<<<<<
 *             c_ctxt.errNo = xmlerror.XML_ERR_INTERNAL_ERROR
 *         # stop parsing immediately
 */
  __pyx_t_1 = (__pyx_v_c_ctxt->errNo == XML_ERR_OK);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":112
 *     cdef void _handleSaxException(self, xmlparser.xmlParserCtxt* c_ctxt):
 *         if c_ctxt.errNo == xmlerror.XML_ERR_OK:
 *             c_ctxt.errNo = xmlerror.XML_ERR_INTERNAL_ERROR             # <<<<<<<<<<<<<<
 *         # stop parsing immediately
 *         c_ctxt.wellFormed = 0
 */
    __pyx_v_c_ctxt->errNo = XML_ERR_INTERNAL_ERROR;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":114
 *             c_ctxt.errNo = xmlerror.XML_ERR_INTERNAL_ERROR
 *         # stop parsing immediately
 *         c_ctxt.wellFormed = 0             # <<<<<<<<<<<<<<
 *         c_ctxt.disableSAX = 1
 *         self._store_raised()
 */
  __pyx_v_c_ctxt->wellFormed = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":115
 *         # stop parsing immediately
 *         c_ctxt.wellFormed = 0
 *         c_ctxt.disableSAX = 1             # <<<<<<<<<<<<<<
 *         self._store_raised()
 * 
 */
  __pyx_v_c_ctxt->disableSAX = 1;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":116
 *         c_ctxt.wellFormed = 0
 *         c_ctxt.disableSAX = 1
 *         self._store_raised()             # <<<<<<<<<<<<<<
 * 
 * cdef void _handleSaxStart(void* ctxt, char* c_localname, char* c_prefix,
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.__pyx_base._store_raised(((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_v_self));

  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":118
 *         self._store_raised()
 * 
 * cdef void _handleSaxStart(void* ctxt, char* c_localname, char* c_prefix,             # <<<<<<<<<<<<<<
 *                           char* c_namespace, int c_nb_namespaces,
 *                           char** c_namespaces,
 */

static  void __pyx_f_4lxml_5etree__handleSaxStart(void *__pyx_v_ctxt, char *__pyx_v_c_localname, char *__pyx_v_c_prefix, char *__pyx_v_c_namespace, int __pyx_v_c_nb_namespaces, char **__pyx_v_c_namespaces, int __pyx_v_c_nb_attributes, int __pyx_v_c_nb_defaulted, char **__pyx_v_c_attributes) {
  struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_context;
  xmlParserCtxt *__pyx_v_c_ctxt;
  struct LxmlElement *__pyx_v_element;
  int __pyx_v_i;
  PyObject *__pyx_v_tag;
  PyObject *__pyx_v_attrib;
  PyObject *__pyx_v_name;
  PyObject *__pyx_v_value;
  PyObject *__pyx_v_nsmap;
  PyObject *__pyx_v_prefix;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  #ifdef WITH_THREAD
  PyGILState_STATE _save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_handleSaxStart");
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_element = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_tag = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_attrib = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_name = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_value = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_nsmap = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_prefix = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":127
 *     cdef _Element element
 *     cdef int i
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt             # <<<<<<<<<<<<<<
 *     if c_ctxt._private is NULL:
 *         return
 */
  __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":128
 *     cdef int i
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL:             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 */
  __pyx_t_1 = (__pyx_v_c_ctxt->_private == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":129
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL:
 *         return             # <<<<<<<<<<<<<<
 *     context = <_SaxParserContext>c_ctxt._private
 *     if context._origSaxStart is not NULL:
 */
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":130
 *     if c_ctxt._private is NULL:
 *         return
 *     context = <_SaxParserContext>c_ctxt._private             # <<<<<<<<<<<<<<
 *     if context._origSaxStart is not NULL:
 *         context._origSaxStart(c_ctxt, c_localname, c_prefix, c_namespace,
 */
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_v_c_ctxt->_private)));
  __Pyx_DECREF(((PyObject *)__pyx_v_context));
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_v_c_ctxt->_private);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":131
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     if context._origSaxStart is not NULL:             # <<<<<<<<<<<<<<
 *         context._origSaxStart(c_ctxt, c_localname, c_prefix, c_namespace,
 *                               c_nb_namespaces, c_namespaces, c_nb_attributes,
 */
  __pyx_t_1 = (__pyx_v_context->_origSaxStart != NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":134
 *         context._origSaxStart(c_ctxt, c_localname, c_prefix, c_namespace,
 *                               c_nb_namespaces, c_namespaces, c_nb_attributes,
 *                               c_nb_defaulted, c_attributes)             # <<<<<<<<<<<<<<
 *     try:
 *         tag = _namespacedNameFromNsName(c_namespace, c_localname)
 */
    __pyx_v_context->_origSaxStart(__pyx_v_c_ctxt, __pyx_v_c_localname, __pyx_v_c_prefix, __pyx_v_c_namespace, __pyx_v_c_nb_namespaces, __pyx_v_c_namespaces, __pyx_v_c_nb_attributes, __pyx_v_c_nb_defaulted, __pyx_v_c_attributes);
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":135
 *                               c_nb_namespaces, c_namespaces, c_nb_attributes,
 *                               c_nb_defaulted, c_attributes)
 *     try:             # <<<<<<<<<<<<<<
 *         tag = _namespacedNameFromNsName(c_namespace, c_localname)
 *         if c_nb_defaulted > 0:
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":136
 *                               c_nb_defaulted, c_attributes)
 *     try:
 *         tag = _namespacedNameFromNsName(c_namespace, c_localname)             # <<<<<<<<<<<<<<
 *         if c_nb_defaulted > 0:
 *             # only add default attributes if we asked for them
 */
      __pyx_t_2 = __pyx_f_4lxml_5etree__namespacedNameFromNsName(__pyx_v_c_namespace, __pyx_v_c_localname); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_v_tag);
      __pyx_v_tag = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":137
 *     try:
 *         tag = _namespacedNameFromNsName(c_namespace, c_localname)
 *         if c_nb_defaulted > 0:             # <<<<<<<<<<<<<<
 *             # only add default attributes if we asked for them
 *             if c_ctxt.loadsubset & xmlparser.XML_COMPLETE_ATTRS == 0:
 */
      __pyx_t_1 = (__pyx_v_c_nb_defaulted > 0);
      if (__pyx_t_1) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":139
 *         if c_nb_defaulted > 0:
 *             # only add default attributes if we asked for them
 *             if c_ctxt.loadsubset & xmlparser.XML_COMPLETE_ATTRS == 0:             # <<<<<<<<<<<<<<
 *                 c_nb_attributes = c_nb_attributes - c_nb_defaulted
 *         if c_nb_attributes == 0:
 */
        __pyx_t_1 = ((__pyx_v_c_ctxt->loadsubset & XML_COMPLETE_ATTRS) == 0);
        if (__pyx_t_1) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":140
 *             # only add default attributes if we asked for them
 *             if c_ctxt.loadsubset & xmlparser.XML_COMPLETE_ATTRS == 0:
 *                 c_nb_attributes = c_nb_attributes - c_nb_defaulted             # <<<<<<<<<<<<<<
 *         if c_nb_attributes == 0:
 *             attrib = EMPTY_READ_ONLY_DICT
 */
          __pyx_v_c_nb_attributes = (__pyx_v_c_nb_attributes - __pyx_v_c_nb_defaulted);
          goto __pyx_L14;
        }
        __pyx_L14:;
        goto __pyx_L13;
      }
      __pyx_L13:;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":141
 *             if c_ctxt.loadsubset & xmlparser.XML_COMPLETE_ATTRS == 0:
 *                 c_nb_attributes = c_nb_attributes - c_nb_defaulted
 *         if c_nb_attributes == 0:             # <<<<<<<<<<<<<<
 *             attrib = EMPTY_READ_ONLY_DICT
 *         else:
 */
      __pyx_t_1 = (__pyx_v_c_nb_attributes == 0);
      if (__pyx_t_1) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":142
 *                 c_nb_attributes = c_nb_attributes - c_nb_defaulted
 *         if c_nb_attributes == 0:
 *             attrib = EMPTY_READ_ONLY_DICT             # <<<<<<<<<<<<<<
 *         else:
 *             attrib = {}
 */
        __Pyx_INCREF(__pyx_v_4lxml_5etree_EMPTY_READ_ONLY_DICT);
        __Pyx_DECREF(__pyx_v_attrib);
        __pyx_v_attrib = __pyx_v_4lxml_5etree_EMPTY_READ_ONLY_DICT;
        goto __pyx_L15;
      }
      /*else*/ {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":144
 *             attrib = EMPTY_READ_ONLY_DICT
 *         else:
 *             attrib = {}             # <<<<<<<<<<<<<<
 *             for i from 0 <= i < c_nb_attributes:
 *                 name = _namespacedNameFromNsName(
 */
        __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_2));
        __Pyx_DECREF(__pyx_v_attrib);
        __pyx_v_attrib = ((PyObject *)__pyx_t_2);
        __pyx_t_2 = 0;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":145
 *         else:
 *             attrib = {}
 *             for i from 0 <= i < c_nb_attributes:             # <<<<<<<<<<<<<<
 *                 name = _namespacedNameFromNsName(
 *                     c_attributes[2], c_attributes[0])
 */
        __pyx_t_3 = __pyx_v_c_nb_attributes;
        for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":147
 *             for i from 0 <= i < c_nb_attributes:
 *                 name = _namespacedNameFromNsName(
 *                     c_attributes[2], c_attributes[0])             # <<<<<<<<<<<<<<
 *                 if c_attributes[3] is NULL:
 *                     if python.IS_PYTHON3:
 */
          __pyx_t_2 = __pyx_f_4lxml_5etree__namespacedNameFromNsName((__pyx_v_c_attributes[2]), (__pyx_v_c_attributes[0])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_v_name);
          __pyx_v_name = __pyx_t_2;
          __pyx_t_2 = 0;

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":148
 *                 name = _namespacedNameFromNsName(
 *                     c_attributes[2], c_attributes[0])
 *                 if c_attributes[3] is NULL:             # <<<<<<<<<<<<<<
 *                     if python.IS_PYTHON3:
 *                         value = u''
 */
          __pyx_t_1 = ((__pyx_v_c_attributes[3]) == NULL);
          if (__pyx_t_1) {

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":149
 *                     c_attributes[2], c_attributes[0])
 *                 if c_attributes[3] is NULL:
 *                     if python.IS_PYTHON3:             # <<<<<<<<<<<<<<
 *                         value = u''
 *                     else:
 */
            if (IS_PYTHON3) {

              /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":150
 *                 if c_attributes[3] is NULL:
 *                     if python.IS_PYTHON3:
 *                         value = u''             # <<<<<<<<<<<<<<
 *                     else:
 *                         value = ''
 */
              __Pyx_INCREF(((PyObject *)__pyx_kp_u_25));
              __Pyx_DECREF(__pyx_v_value);
              __pyx_v_value = ((PyObject *)__pyx_kp_u_25);
              goto __pyx_L19;
            }
            /*else*/ {

              /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":152
 *                         value = u''
 *                     else:
 *                         value = ''             # <<<<<<<<<<<<<<
 *                 else:
 *                     value = python.PyUnicode_DecodeUTF8(
 */
              __Pyx_INCREF(((PyObject *)__pyx_kp_s_25));
              __Pyx_DECREF(__pyx_v_value);
              __pyx_v_value = ((PyObject *)__pyx_kp_s_25);
            }
            __pyx_L19:;
            goto __pyx_L18;
          }
          /*else*/ {

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":155
 *                 else:
 *                     value = python.PyUnicode_DecodeUTF8(
 *                         c_attributes[3], c_attributes[4] - c_attributes[3],             # <<<<<<<<<<<<<<
 *                         "strict")
 *                 attrib[name] = value
 */
            __pyx_t_2 = ((PyObject *)PyUnicode_DecodeUTF8((__pyx_v_c_attributes[3]), ((__pyx_v_c_attributes[4]) - (__pyx_v_c_attributes[3])), __pyx_k__strict)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_DECREF(__pyx_v_value);
            __pyx_v_value = __pyx_t_2;
            __pyx_t_2 = 0;
          }
          __pyx_L18:;

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":157
 *                         c_attributes[3], c_attributes[4] - c_attributes[3],
 *                         "strict")
 *                 attrib[name] = value             # <<<<<<<<<<<<<<
 *                 c_attributes += 5
 *         if c_nb_namespaces == 0:
 */
          if (PyObject_SetItem(__pyx_v_attrib, __pyx_v_name, __pyx_v_value) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L5_error;}

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":158
 *                         "strict")
 *                 attrib[name] = value
 *                 c_attributes += 5             # <<<<<<<<<<<<<<
 *         if c_nb_namespaces == 0:
 *             nsmap = EMPTY_READ_ONLY_DICT
 */
          __pyx_v_c_attributes = (__pyx_v_c_attributes + 5);
        }
      }
      __pyx_L15:;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":159
 *                 attrib[name] = value
 *                 c_attributes += 5
 *         if c_nb_namespaces == 0:             # <<<<<<<<<<<<<<
 *             nsmap = EMPTY_READ_ONLY_DICT
 *         else:
 */
      __pyx_t_1 = (__pyx_v_c_nb_namespaces == 0);
      if (__pyx_t_1) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":160
 *                 c_attributes += 5
 *         if c_nb_namespaces == 0:
 *             nsmap = EMPTY_READ_ONLY_DICT             # <<<<<<<<<<<<<<
 *         else:
 *             nsmap = {}
 */
        __Pyx_INCREF(__pyx_v_4lxml_5etree_EMPTY_READ_ONLY_DICT);
        __Pyx_DECREF(__pyx_v_nsmap);
        __pyx_v_nsmap = __pyx_v_4lxml_5etree_EMPTY_READ_ONLY_DICT;
        goto __pyx_L20;
      }
      /*else*/ {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":162
 *             nsmap = EMPTY_READ_ONLY_DICT
 *         else:
 *             nsmap = {}             # <<<<<<<<<<<<<<
 *             for i from 0 <= i < c_nb_namespaces:
 *                 if c_namespaces[0] is NULL:
 */
        __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_2));
        __Pyx_DECREF(__pyx_v_nsmap);
        __pyx_v_nsmap = ((PyObject *)__pyx_t_2);
        __pyx_t_2 = 0;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":163
 *         else:
 *             nsmap = {}
 *             for i from 0 <= i < c_nb_namespaces:             # <<<<<<<<<<<<<<
 *                 if c_namespaces[0] is NULL:
 *                     prefix = None
 */
        __pyx_t_3 = __pyx_v_c_nb_namespaces;
        for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":164
 *             nsmap = {}
 *             for i from 0 <= i < c_nb_namespaces:
 *                 if c_namespaces[0] is NULL:             # <<<<<<<<<<<<<<
 *                     prefix = None
 *                 else:
 */
          __pyx_t_1 = ((__pyx_v_c_namespaces[0]) == NULL);
          if (__pyx_t_1) {

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":165
 *             for i from 0 <= i < c_nb_namespaces:
 *                 if c_namespaces[0] is NULL:
 *                     prefix = None             # <<<<<<<<<<<<<<
 *                 else:
 *                     prefix = funicode(c_namespaces[0])
 */
            __Pyx_INCREF(Py_None);
            __Pyx_DECREF(__pyx_v_prefix);
            __pyx_v_prefix = Py_None;
            goto __pyx_L23;
          }
          /*else*/ {

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":167
 *                     prefix = None
 *                 else:
 *                     prefix = funicode(c_namespaces[0])             # <<<<<<<<<<<<<<
 *                 nsmap[prefix] = funicode(c_namespaces[1])
 *                 c_namespaces += 2
 */
            __pyx_t_2 = __pyx_f_4lxml_5etree_funicode((__pyx_v_c_namespaces[0])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_DECREF(__pyx_v_prefix);
            __pyx_v_prefix = __pyx_t_2;
            __pyx_t_2 = 0;
          }
          __pyx_L23:;

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":168
 *                 else:
 *                     prefix = funicode(c_namespaces[0])
 *                 nsmap[prefix] = funicode(c_namespaces[1])             # <<<<<<<<<<<<<<
 *                 c_namespaces += 2
 *         element = context._target._handleSaxStart(tag, attrib, nsmap)
 */
          __pyx_t_2 = __pyx_f_4lxml_5etree_funicode((__pyx_v_c_namespaces[1])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
          __Pyx_GOTREF(__pyx_t_2);
          if (PyObject_SetItem(__pyx_v_nsmap, __pyx_v_prefix, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":169
 *                     prefix = funicode(c_namespaces[0])
 *                 nsmap[prefix] = funicode(c_namespaces[1])
 *                 c_namespaces += 2             # <<<<<<<<<<<<<<
 *         element = context._target._handleSaxStart(tag, attrib, nsmap)
 *         if element is not None and c_ctxt.input is not NULL:
 */
          __pyx_v_c_namespaces = (__pyx_v_c_namespaces + 2);
        }
      }
      __pyx_L20:;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":170
 *                 nsmap[prefix] = funicode(c_namespaces[1])
 *                 c_namespaces += 2
 *         element = context._target._handleSaxStart(tag, attrib, nsmap)             # <<<<<<<<<<<<<<
 *         if element is not None and c_ctxt.input is not NULL:
 *             if c_ctxt.input.line < 65535:
 */
      __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget *)__pyx_v_context->_target->__pyx_vtab)->_handleSaxStart(__pyx_v_context->_target, __pyx_v_tag, __pyx_v_attrib, __pyx_v_nsmap); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_DECREF(((PyObject *)__pyx_v_element));
      __pyx_v_element = ((struct LxmlElement *)__pyx_t_2);
      __pyx_t_2 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":171
 *                 c_namespaces += 2
 *         element = context._target._handleSaxStart(tag, attrib, nsmap)
 *         if element is not None and c_ctxt.input is not NULL:             # <<<<<<<<<<<<<<
 *             if c_ctxt.input.line < 65535:
 *                 element._c_node.line = <short>c_ctxt.input.line
 */
      __pyx_t_1 = (((PyObject *)__pyx_v_element) != Py_None);
      if (__pyx_t_1) {
        __pyx_t_4 = (__pyx_v_c_ctxt->input != NULL);
        __pyx_t_5 = __pyx_t_4;
      } else {
        __pyx_t_5 = __pyx_t_1;
      }
      if (__pyx_t_5) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":172
 *         element = context._target._handleSaxStart(tag, attrib, nsmap)
 *         if element is not None and c_ctxt.input is not NULL:
 *             if c_ctxt.input.line < 65535:             # <<<<<<<<<<<<<<
 *                 element._c_node.line = <short>c_ctxt.input.line
 *             else:
 */
        __pyx_t_5 = (__pyx_v_c_ctxt->input->line < 65535);
        if (__pyx_t_5) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":173
 *         if element is not None and c_ctxt.input is not NULL:
 *             if c_ctxt.input.line < 65535:
 *                 element._c_node.line = <short>c_ctxt.input.line             # <<<<<<<<<<<<<<
 *             else:
 *                 element._c_node.line = 65535
 */
          __pyx_v_element->_c_node->line = ((short)__pyx_v_c_ctxt->input->line);
          goto __pyx_L25;
        }
        /*else*/ {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":175
 *                 element._c_node.line = <short>c_ctxt.input.line
 *             else:
 *                 element._c_node.line = 65535             # <<<<<<<<<<<<<<
 *     except:
 *         context._handleSaxException(c_ctxt)
 */
          __pyx_v_element->_c_node->line = 65535;
        }
        __pyx_L25:;
        goto __pyx_L24;
      }
      __pyx_L24:;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L12_try_end;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":176
 *             else:
 *                 element._c_node.line = 65535
 *     except:             # <<<<<<<<<<<<<<
 *         context._handleSaxException(c_ctxt)
 * 
 */
    /*except:*/ {
      __Pyx_AddTraceback("lxml.etree._handleSaxStart");
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_6, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":177
 *                 element._c_node.line = 65535
 *     except:
 *         context._handleSaxException(c_ctxt)             # <<<<<<<<<<<<<<
 * 
 * cdef void _handleSaxStartNoNs(void* ctxt, char* c_name,
 */
      ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->_handleSaxException(__pyx_v_context, __pyx_v_c_ctxt);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L6_exception_handled;
    }
    __pyx_L7_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L6_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L12_try_end:;
  }

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_WriteUnraisable("lxml.etree._handleSaxStart");
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_context);
  __Pyx_DECREF((PyObject *)__pyx_v_element);
  __Pyx_DECREF(__pyx_v_tag);
  __Pyx_DECREF(__pyx_v_attrib);
  __Pyx_DECREF(__pyx_v_name);
  __Pyx_DECREF(__pyx_v_value);
  __Pyx_DECREF(__pyx_v_nsmap);
  __Pyx_DECREF(__pyx_v_prefix);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(_save);
  #endif
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":179
 *         context._handleSaxException(c_ctxt)
 * 
 * cdef void _handleSaxStartNoNs(void* ctxt, char* c_name,             # <<<<<<<<<<<<<<
 *                               char** c_attributes) with gil:
 *     cdef _SaxParserContext context
 */

static  void __pyx_f_4lxml_5etree__handleSaxStartNoNs(void *__pyx_v_ctxt, char *__pyx_v_c_name, char **__pyx_v_c_attributes) {
  struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_context;
  xmlParserCtxt *__pyx_v_c_ctxt;
  struct LxmlElement *__pyx_v_element;
  PyObject *__pyx_v_tag;
  PyObject *__pyx_v_attrib;
  PyObject *__pyx_v_name;
  PyObject *__pyx_v_value;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  #ifdef WITH_THREAD
  PyGILState_STATE _save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_handleSaxStartNoNs");
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_element = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_tag = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_attrib = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_name = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_value = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":184
 *     cdef xmlparser.xmlParserCtxt* c_ctxt
 *     cdef _Element element
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt             # <<<<<<<<<<<<<<
 *     if c_ctxt._private is NULL:
 *         return
 */
  __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":185
 *     cdef _Element element
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL:             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 */
  __pyx_t_1 = (__pyx_v_c_ctxt->_private == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":186
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL:
 *         return             # <<<<<<<<<<<<<<
 *     context = <_SaxParserContext>c_ctxt._private
 *     if context._origSaxStartNoNs is not NULL:
 */
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":187
 *     if c_ctxt._private is NULL:
 *         return
 *     context = <_SaxParserContext>c_ctxt._private             # <<<<<<<<<<<<<<
 *     if context._origSaxStartNoNs is not NULL:
 *         context._origSaxStartNoNs(c_ctxt, c_name, c_attributes)
 */
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_v_c_ctxt->_private)));
  __Pyx_DECREF(((PyObject *)__pyx_v_context));
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_v_c_ctxt->_private);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":188
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     if context._origSaxStartNoNs is not NULL:             # <<<<<<<<<<<<<<
 *         context._origSaxStartNoNs(c_ctxt, c_name, c_attributes)
 *     try:
 */
  __pyx_t_1 = (__pyx_v_context->_origSaxStartNoNs != NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":189
 *     context = <_SaxParserContext>c_ctxt._private
 *     if context._origSaxStartNoNs is not NULL:
 *         context._origSaxStartNoNs(c_ctxt, c_name, c_attributes)             # <<<<<<<<<<<<<<
 *     try:
 *         tag = funicode(c_name)
 */
    __pyx_v_context->_origSaxStartNoNs(__pyx_v_c_ctxt, __pyx_v_c_name, __pyx_v_c_attributes);
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":190
 *     if context._origSaxStartNoNs is not NULL:
 *         context._origSaxStartNoNs(c_ctxt, c_name, c_attributes)
 *     try:             # <<<<<<<<<<<<<<
 *         tag = funicode(c_name)
 *         if c_attributes is NULL:
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":191
 *         context._origSaxStartNoNs(c_ctxt, c_name, c_attributes)
 *     try:
 *         tag = funicode(c_name)             # <<<<<<<<<<<<<<
 *         if c_attributes is NULL:
 *             attrib = EMPTY_READ_ONLY_DICT
 */
      __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_v_tag);
      __pyx_v_tag = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":192
 *     try:
 *         tag = funicode(c_name)
 *         if c_attributes is NULL:             # <<<<<<<<<<<<<<
 *             attrib = EMPTY_READ_ONLY_DICT
 *         else:
 */
      __pyx_t_1 = (__pyx_v_c_attributes == NULL);
      if (__pyx_t_1) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":193
 *         tag = funicode(c_name)
 *         if c_attributes is NULL:
 *             attrib = EMPTY_READ_ONLY_DICT             # <<<<<<<<<<<<<<
 *         else:
 *             attrib = {}
 */
        __Pyx_INCREF(__pyx_v_4lxml_5etree_EMPTY_READ_ONLY_DICT);
        __Pyx_DECREF(__pyx_v_attrib);
        __pyx_v_attrib = __pyx_v_4lxml_5etree_EMPTY_READ_ONLY_DICT;
        goto __pyx_L13;
      }
      /*else*/ {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":195
 *             attrib = EMPTY_READ_ONLY_DICT
 *         else:
 *             attrib = {}             # <<<<<<<<<<<<<<
 *             while c_attributes[0] is not NULL:
 *                 name = funicode(c_attributes[0])
 */
        __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_2));
        __Pyx_DECREF(__pyx_v_attrib);
        __pyx_v_attrib = ((PyObject *)__pyx_t_2);
        __pyx_t_2 = 0;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":196
 *         else:
 *             attrib = {}
 *             while c_attributes[0] is not NULL:             # <<<<<<<<<<<<<<
 *                 name = funicode(c_attributes[0])
 *                 if c_attributes[1] is NULL:
 */
        while (1) {
          __pyx_t_1 = ((__pyx_v_c_attributes[0]) != NULL);
          if (!__pyx_t_1) break;

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":197
 *             attrib = {}
 *             while c_attributes[0] is not NULL:
 *                 name = funicode(c_attributes[0])             # <<<<<<<<<<<<<<
 *                 if c_attributes[1] is NULL:
 *                     if python.IS_PYTHON3:
 */
          __pyx_t_2 = __pyx_f_4lxml_5etree_funicode((__pyx_v_c_attributes[0])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_v_name);
          __pyx_v_name = __pyx_t_2;
          __pyx_t_2 = 0;

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":198
 *             while c_attributes[0] is not NULL:
 *                 name = funicode(c_attributes[0])
 *                 if c_attributes[1] is NULL:             # <<<<<<<<<<<<<<
 *                     if python.IS_PYTHON3:
 *                         value = u''
 */
          __pyx_t_1 = ((__pyx_v_c_attributes[1]) == NULL);
          if (__pyx_t_1) {

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":199
 *                 name = funicode(c_attributes[0])
 *                 if c_attributes[1] is NULL:
 *                     if python.IS_PYTHON3:             # <<<<<<<<<<<<<<
 *                         value = u''
 *                     else:
 */
            if (IS_PYTHON3) {

              /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":200
 *                 if c_attributes[1] is NULL:
 *                     if python.IS_PYTHON3:
 *                         value = u''             # <<<<<<<<<<<<<<
 *                     else:
 *                         value = ''
 */
              __Pyx_INCREF(((PyObject *)__pyx_kp_u_25));
              __Pyx_DECREF(__pyx_v_value);
              __pyx_v_value = ((PyObject *)__pyx_kp_u_25);
              goto __pyx_L17;
            }
            /*else*/ {

              /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":202
 *                         value = u''
 *                     else:
 *                         value = ''             # <<<<<<<<<<<<<<
 *                 else:
 *                     value = funicode(c_attributes[1])
 */
              __Pyx_INCREF(((PyObject *)__pyx_kp_s_25));
              __Pyx_DECREF(__pyx_v_value);
              __pyx_v_value = ((PyObject *)__pyx_kp_s_25);
            }
            __pyx_L17:;
            goto __pyx_L16;
          }
          /*else*/ {

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":204
 *                         value = ''
 *                 else:
 *                     value = funicode(c_attributes[1])             # <<<<<<<<<<<<<<
 *                 c_attributes = c_attributes + 2
 *                 attrib[name] = value
 */
            __pyx_t_2 = __pyx_f_4lxml_5etree_funicode((__pyx_v_c_attributes[1])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_DECREF(__pyx_v_value);
            __pyx_v_value = __pyx_t_2;
            __pyx_t_2 = 0;
          }
          __pyx_L16:;

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":205
 *                 else:
 *                     value = funicode(c_attributes[1])
 *                 c_attributes = c_attributes + 2             # <<<<<<<<<<<<<<
 *                 attrib[name] = value
 *         element = context._target._handleSaxStart(
 */
          __pyx_v_c_attributes = (__pyx_v_c_attributes + 2);

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":206
 *                     value = funicode(c_attributes[1])
 *                 c_attributes = c_attributes + 2
 *                 attrib[name] = value             # <<<<<<<<<<<<<<
 *         element = context._target._handleSaxStart(
 *             tag, attrib, EMPTY_READ_ONLY_DICT)
 */
          if (PyObject_SetItem(__pyx_v_attrib, __pyx_v_name, __pyx_v_value) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
        }
      }
      __pyx_L13:;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":208
 *                 attrib[name] = value
 *         element = context._target._handleSaxStart(
 *             tag, attrib, EMPTY_READ_ONLY_DICT)             # <<<<<<<<<<<<<<
 *         if element is not None and c_ctxt.input is not NULL:
 *             if c_ctxt.input.line < 65535:
 */
      __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget *)__pyx_v_context->_target->__pyx_vtab)->_handleSaxStart(__pyx_v_context->_target, __pyx_v_tag, __pyx_v_attrib, __pyx_v_4lxml_5etree_EMPTY_READ_ONLY_DICT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_DECREF(((PyObject *)__pyx_v_element));
      __pyx_v_element = ((struct LxmlElement *)__pyx_t_2);
      __pyx_t_2 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":209
 *         element = context._target._handleSaxStart(
 *             tag, attrib, EMPTY_READ_ONLY_DICT)
 *         if element is not None and c_ctxt.input is not NULL:             # <<<<<<<<<<<<<<
 *             if c_ctxt.input.line < 65535:
 *                 element._c_node.line = <short>c_ctxt.input.line
 */
      __pyx_t_1 = (((PyObject *)__pyx_v_element) != Py_None);
      if (__pyx_t_1) {
        __pyx_t_3 = (__pyx_v_c_ctxt->input != NULL);
        __pyx_t_4 = __pyx_t_3;
      } else {
        __pyx_t_4 = __pyx_t_1;
      }
      if (__pyx_t_4) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":210
 *             tag, attrib, EMPTY_READ_ONLY_DICT)
 *         if element is not None and c_ctxt.input is not NULL:
 *             if c_ctxt.input.line < 65535:             # <<<<<<<<<<<<<<
 *                 element._c_node.line = <short>c_ctxt.input.line
 *             else:
 */
        __pyx_t_4 = (__pyx_v_c_ctxt->input->line < 65535);
        if (__pyx_t_4) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":211
 *         if element is not None and c_ctxt.input is not NULL:
 *             if c_ctxt.input.line < 65535:
 *                 element._c_node.line = <short>c_ctxt.input.line             # <<<<<<<<<<<<<<
 *             else:
 *                 element._c_node.line = 65535
 */
          __pyx_v_element->_c_node->line = ((short)__pyx_v_c_ctxt->input->line);
          goto __pyx_L19;
        }
        /*else*/ {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":213
 *                 element._c_node.line = <short>c_ctxt.input.line
 *             else:
 *                 element._c_node.line = 65535             # <<<<<<<<<<<<<<
 *     except:
 *         context._handleSaxException(c_ctxt)
 */
          __pyx_v_element->_c_node->line = 65535;
        }
        __pyx_L19:;
        goto __pyx_L18;
      }
      __pyx_L18:;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L12_try_end;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":214
 *             else:
 *                 element._c_node.line = 65535
 *     except:             # <<<<<<<<<<<<<<
 *         context._handleSaxException(c_ctxt)
 * 
 */
    /*except:*/ {
      __Pyx_AddTraceback("lxml.etree._handleSaxStartNoNs");
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_5, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_6);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":215
 *                 element._c_node.line = 65535
 *     except:
 *         context._handleSaxException(c_ctxt)             # <<<<<<<<<<<<<<
 * 
 * cdef void _handleSaxEnd(void* ctxt, char* c_localname, char* c_prefix,
 */
      ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->_handleSaxException(__pyx_v_context, __pyx_v_c_ctxt);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L6_exception_handled;
    }
    __pyx_L7_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L6_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L12_try_end:;
  }

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_WriteUnraisable("lxml.etree._handleSaxStartNoNs");
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_context);
  __Pyx_DECREF((PyObject *)__pyx_v_element);
  __Pyx_DECREF(__pyx_v_tag);
  __Pyx_DECREF(__pyx_v_attrib);
  __Pyx_DECREF(__pyx_v_name);
  __Pyx_DECREF(__pyx_v_value);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(_save);
  #endif
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":217
 *         context._handleSaxException(c_ctxt)
 * 
 * cdef void _handleSaxEnd(void* ctxt, char* c_localname, char* c_prefix,             # <<<<<<<<<<<<<<
 *                         char* c_namespace) with gil:
 *     cdef _SaxParserContext context
 */

static  void __pyx_f_4lxml_5etree__handleSaxEnd(void *__pyx_v_ctxt, char *__pyx_v_c_localname, char *__pyx_v_c_prefix, char *__pyx_v_c_namespace) {
  struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_context;
  xmlParserCtxt *__pyx_v_c_ctxt;
  PyObject *__pyx_v_tag;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  #ifdef WITH_THREAD
  PyGILState_STATE _save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_handleSaxEnd");
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_tag = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":221
 *     cdef _SaxParserContext context
 *     cdef xmlparser.xmlParserCtxt* c_ctxt
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt             # <<<<<<<<<<<<<<
 *     if c_ctxt._private is NULL:
 *         return
 */
  __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":222
 *     cdef xmlparser.xmlParserCtxt* c_ctxt
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL:             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 */
  __pyx_t_1 = (__pyx_v_c_ctxt->_private == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":223
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL:
 *         return             # <<<<<<<<<<<<<<
 *     context = <_SaxParserContext>c_ctxt._private
 *     if context._origSaxEnd is not NULL:
 */
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":224
 *     if c_ctxt._private is NULL:
 *         return
 *     context = <_SaxParserContext>c_ctxt._private             # <<<<<<<<<<<<<<
 *     if context._origSaxEnd is not NULL:
 *         context._origSaxEnd(c_ctxt, c_localname, c_prefix, c_namespace)
 */
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_v_c_ctxt->_private)));
  __Pyx_DECREF(((PyObject *)__pyx_v_context));
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_v_c_ctxt->_private);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":225
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     if context._origSaxEnd is not NULL:             # <<<<<<<<<<<<<<
 *         context._origSaxEnd(c_ctxt, c_localname, c_prefix, c_namespace)
 *     try:
 */
  __pyx_t_1 = (__pyx_v_context->_origSaxEnd != NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":226
 *     context = <_SaxParserContext>c_ctxt._private
 *     if context._origSaxEnd is not NULL:
 *         context._origSaxEnd(c_ctxt, c_localname, c_prefix, c_namespace)             # <<<<<<<<<<<<<<
 *     try:
 *         tag = _namespacedNameFromNsName(c_namespace, c_localname)
 */
    __pyx_v_context->_origSaxEnd(__pyx_v_c_ctxt, __pyx_v_c_localname, __pyx_v_c_prefix, __pyx_v_c_namespace);
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":227
 *     if context._origSaxEnd is not NULL:
 *         context._origSaxEnd(c_ctxt, c_localname, c_prefix, c_namespace)
 *     try:             # <<<<<<<<<<<<<<
 *         tag = _namespacedNameFromNsName(c_namespace, c_localname)
 *         context._target._handleSaxEnd(tag)
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":228
 *         context._origSaxEnd(c_ctxt, c_localname, c_prefix, c_namespace)
 *     try:
 *         tag = _namespacedNameFromNsName(c_namespace, c_localname)             # <<<<<<<<<<<<<<
 *         context._target._handleSaxEnd(tag)
 *     except:
 */
      __pyx_t_2 = __pyx_f_4lxml_5etree__namespacedNameFromNsName(__pyx_v_c_namespace, __pyx_v_c_localname); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_v_tag);
      __pyx_v_tag = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":229
 *     try:
 *         tag = _namespacedNameFromNsName(c_namespace, c_localname)
 *         context._target._handleSaxEnd(tag)             # <<<<<<<<<<<<<<
 *     except:
 *         context._handleSaxException(c_ctxt)
 */
      __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget *)__pyx_v_context->_target->__pyx_vtab)->_handleSaxEnd(__pyx_v_context->_target, __pyx_v_tag); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L12_try_end;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":230
 *         tag = _namespacedNameFromNsName(c_namespace, c_localname)
 *         context._target._handleSaxEnd(tag)
 *     except:             # <<<<<<<<<<<<<<
 *         context._handleSaxException(c_ctxt)
 * 
 */
    /*except:*/ {
      __Pyx_AddTraceback("lxml.etree._handleSaxEnd");
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_4);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":231
 *         context._target._handleSaxEnd(tag)
 *     except:
 *         context._handleSaxException(c_ctxt)             # <<<<<<<<<<<<<<
 * 
 * cdef void _handleSaxEndNoNs(void* ctxt, char* c_name) with gil:
 */
      ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->_handleSaxException(__pyx_v_context, __pyx_v_c_ctxt);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L6_exception_handled;
    }
    __pyx_L7_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L6_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L12_try_end:;
  }

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_WriteUnraisable("lxml.etree._handleSaxEnd");
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_context);
  __Pyx_DECREF(__pyx_v_tag);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(_save);
  #endif
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":233
 *         context._handleSaxException(c_ctxt)
 * 
 * cdef void _handleSaxEndNoNs(void* ctxt, char* c_name) with gil:             # <<<<<<<<<<<<<<
 *     cdef _SaxParserContext context
 *     cdef xmlparser.xmlParserCtxt* c_ctxt
 */

static  void __pyx_f_4lxml_5etree__handleSaxEndNoNs(void *__pyx_v_ctxt, char *__pyx_v_c_name) {
  struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_context;
  xmlParserCtxt *__pyx_v_c_ctxt;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  #ifdef WITH_THREAD
  PyGILState_STATE _save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_handleSaxEndNoNs");
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":236
 *     cdef _SaxParserContext context
 *     cdef xmlparser.xmlParserCtxt* c_ctxt
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt             # <<<<<<<<<<<<<<
 *     if c_ctxt._private is NULL:
 *         return
 */
  __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":237
 *     cdef xmlparser.xmlParserCtxt* c_ctxt
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL:             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 */
  __pyx_t_1 = (__pyx_v_c_ctxt->_private == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":238
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL:
 *         return             # <<<<<<<<<<<<<<
 *     context = <_SaxParserContext>c_ctxt._private
 *     if context._origSaxEndNoNs is not NULL:
 */
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":239
 *     if c_ctxt._private is NULL:
 *         return
 *     context = <_SaxParserContext>c_ctxt._private             # <<<<<<<<<<<<<<
 *     if context._origSaxEndNoNs is not NULL:
 *         context._origSaxEndNoNs(c_ctxt, c_name)
 */
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_v_c_ctxt->_private)));
  __Pyx_DECREF(((PyObject *)__pyx_v_context));
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_v_c_ctxt->_private);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":240
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     if context._origSaxEndNoNs is not NULL:             # <<<<<<<<<<<<<<
 *         context._origSaxEndNoNs(c_ctxt, c_name)
 *     try:
 */
  __pyx_t_1 = (__pyx_v_context->_origSaxEndNoNs != NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":241
 *     context = <_SaxParserContext>c_ctxt._private
 *     if context._origSaxEndNoNs is not NULL:
 *         context._origSaxEndNoNs(c_ctxt, c_name)             # <<<<<<<<<<<<<<
 *     try:
 *         context._target._handleSaxEnd(funicode(c_name))
 */
    __pyx_v_context->_origSaxEndNoNs(__pyx_v_c_ctxt, __pyx_v_c_name);
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":242
 *     if context._origSaxEndNoNs is not NULL:
 *         context._origSaxEndNoNs(c_ctxt, c_name)
 *     try:             # <<<<<<<<<<<<<<
 *         context._target._handleSaxEnd(funicode(c_name))
 *     except:
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":243
 *         context._origSaxEndNoNs(c_ctxt, c_name)
 *     try:
 *         context._target._handleSaxEnd(funicode(c_name))             # <<<<<<<<<<<<<<
 *     except:
 *         context._handleSaxException(c_ctxt)
 */
      __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget *)__pyx_v_context->_target->__pyx_vtab)->_handleSaxEnd(__pyx_v_context->_target, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L12_try_end;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":244
 *     try:
 *         context._target._handleSaxEnd(funicode(c_name))
 *     except:             # <<<<<<<<<<<<<<
 *         context._handleSaxException(c_ctxt)
 * 
 */
    /*except:*/ {
      __Pyx_AddTraceback("lxml.etree._handleSaxEndNoNs");
      if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_4);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":245
 *         context._target._handleSaxEnd(funicode(c_name))
 *     except:
 *         context._handleSaxException(c_ctxt)             # <<<<<<<<<<<<<<
 * 
 * cdef void _handleSaxData(void* ctxt, char* c_data, int data_len) with gil:
 */
      ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->_handleSaxException(__pyx_v_context, __pyx_v_c_ctxt);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L6_exception_handled;
    }
    __pyx_L7_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L6_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L12_try_end:;
  }

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_WriteUnraisable("lxml.etree._handleSaxEndNoNs");
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(_save);
  #endif
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":247
 *         context._handleSaxException(c_ctxt)
 * 
 * cdef void _handleSaxData(void* ctxt, char* c_data, int data_len) with gil:             # <<<<<<<<<<<<<<
 *     cdef _SaxParserContext context
 *     cdef xmlparser.xmlParserCtxt* c_ctxt
 */

static  void __pyx_f_4lxml_5etree__handleSaxData(void *__pyx_v_ctxt, char *__pyx_v_c_data, int __pyx_v_data_len) {
  struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_context;
  xmlParserCtxt *__pyx_v_c_ctxt;
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  #ifdef WITH_THREAD
  PyGILState_STATE _save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_handleSaxData");
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":250
 *     cdef _SaxParserContext context
 *     cdef xmlparser.xmlParserCtxt* c_ctxt
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt             # <<<<<<<<<<<<<<
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:
 *         return
 */
  __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":251
 *     cdef xmlparser.xmlParserCtxt* c_ctxt
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 */
  __pyx_t_1 = (__pyx_v_c_ctxt->_private == NULL);
  if (!__pyx_t_1) {
    __pyx_t_2 = __pyx_v_c_ctxt->disableSAX;
  } else {
    __pyx_t_2 = __pyx_t_1;
  }
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":252
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:
 *         return             # <<<<<<<<<<<<<<
 *     context = <_SaxParserContext>c_ctxt._private
 *     if context._origSaxData is not NULL:
 */
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":253
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:
 *         return
 *     context = <_SaxParserContext>c_ctxt._private             # <<<<<<<<<<<<<<
 *     if context._origSaxData is not NULL:
 *         context._origSaxData(c_ctxt, c_data, data_len)
 */
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_v_c_ctxt->_private)));
  __Pyx_DECREF(((PyObject *)__pyx_v_context));
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_v_c_ctxt->_private);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":254
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     if context._origSaxData is not NULL:             # <<<<<<<<<<<<<<
 *         context._origSaxData(c_ctxt, c_data, data_len)
 *     try:
 */
  __pyx_t_2 = (__pyx_v_context->_origSaxData != NULL);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":255
 *     context = <_SaxParserContext>c_ctxt._private
 *     if context._origSaxData is not NULL:
 *         context._origSaxData(c_ctxt, c_data, data_len)             # <<<<<<<<<<<<<<
 *     try:
 *         context._target._handleSaxData(
 */
    __pyx_v_context->_origSaxData(__pyx_v_c_ctxt, __pyx_v_c_data, __pyx_v_data_len);
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":256
 *     if context._origSaxData is not NULL:
 *         context._origSaxData(c_ctxt, c_data, data_len)
 *     try:             # <<<<<<<<<<<<<<
 *         context._target._handleSaxData(
 *             python.PyUnicode_DecodeUTF8(c_data, data_len, NULL))
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":258
 *     try:
 *         context._target._handleSaxData(
 *             python.PyUnicode_DecodeUTF8(c_data, data_len, NULL))             # <<<<<<<<<<<<<<
 *     except:
 *         context._handleSaxException(c_ctxt)
 */
      __pyx_t_3 = ((PyObject *)PyUnicode_DecodeUTF8(__pyx_v_c_data, __pyx_v_data_len, NULL)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget *)__pyx_v_context->_target->__pyx_vtab)->_handleSaxData(__pyx_v_context->_target, __pyx_t_3); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L12_try_end;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":259
 *         context._target._handleSaxData(
 *             python.PyUnicode_DecodeUTF8(c_data, data_len, NULL))
 *     except:             # <<<<<<<<<<<<<<
 *         context._handleSaxException(c_ctxt)
 * 
 */
    /*except:*/ {
      __Pyx_AddTraceback("lxml.etree._handleSaxData");
      if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_5, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_6);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":260
 *             python.PyUnicode_DecodeUTF8(c_data, data_len, NULL))
 *     except:
 *         context._handleSaxException(c_ctxt)             # <<<<<<<<<<<<<<
 * 
 * cdef void _handleSaxCData(void* ctxt, char* c_data, int data_len) with gil:
 */
      ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->_handleSaxException(__pyx_v_context, __pyx_v_c_ctxt);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L6_exception_handled;
    }
    __pyx_L7_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L6_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L12_try_end:;
  }

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_WriteUnraisable("lxml.etree._handleSaxData");
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(_save);
  #endif
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":262
 *         context._handleSaxException(c_ctxt)
 * 
 * cdef void _handleSaxCData(void* ctxt, char* c_data, int data_len) with gil:             # <<<<<<<<<<<<<<
 *     cdef _SaxParserContext context
 *     cdef xmlparser.xmlParserCtxt* c_ctxt
 */

static  void __pyx_f_4lxml_5etree__handleSaxCData(void *__pyx_v_ctxt, char *__pyx_v_c_data, int __pyx_v_data_len) {
  struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_context;
  xmlParserCtxt *__pyx_v_c_ctxt;
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  #ifdef WITH_THREAD
  PyGILState_STATE _save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_handleSaxCData");
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":265
 *     cdef _SaxParserContext context
 *     cdef xmlparser.xmlParserCtxt* c_ctxt
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt             # <<<<<<<<<<<<<<
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:
 *         return
 */
  __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":266
 *     cdef xmlparser.xmlParserCtxt* c_ctxt
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 */
  __pyx_t_1 = (__pyx_v_c_ctxt->_private == NULL);
  if (!__pyx_t_1) {
    __pyx_t_2 = __pyx_v_c_ctxt->disableSAX;
  } else {
    __pyx_t_2 = __pyx_t_1;
  }
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":267
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:
 *         return             # <<<<<<<<<<<<<<
 *     context = <_SaxParserContext>c_ctxt._private
 *     if context._origSaxCData is not NULL:
 */
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":268
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:
 *         return
 *     context = <_SaxParserContext>c_ctxt._private             # <<<<<<<<<<<<<<
 *     if context._origSaxCData is not NULL:
 *         context._origSaxCData(c_ctxt, c_data, data_len)
 */
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_v_c_ctxt->_private)));
  __Pyx_DECREF(((PyObject *)__pyx_v_context));
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_v_c_ctxt->_private);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":269
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     if context._origSaxCData is not NULL:             # <<<<<<<<<<<<<<
 *         context._origSaxCData(c_ctxt, c_data, data_len)
 *     try:
 */
  __pyx_t_2 = (__pyx_v_context->_origSaxCData != NULL);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":270
 *     context = <_SaxParserContext>c_ctxt._private
 *     if context._origSaxCData is not NULL:
 *         context._origSaxCData(c_ctxt, c_data, data_len)             # <<<<<<<<<<<<<<
 *     try:
 *         context._target._handleSaxData(
 */
    __pyx_v_context->_origSaxCData(__pyx_v_c_ctxt, __pyx_v_c_data, __pyx_v_data_len);
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":271
 *     if context._origSaxCData is not NULL:
 *         context._origSaxCData(c_ctxt, c_data, data_len)
 *     try:             # <<<<<<<<<<<<<<
 *         context._target._handleSaxData(
 *             python.PyUnicode_DecodeUTF8(c_data, data_len, NULL))
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":273
 *     try:
 *         context._target._handleSaxData(
 *             python.PyUnicode_DecodeUTF8(c_data, data_len, NULL))             # <<<<<<<<<<<<<<
 *     except:
 *         context._handleSaxException(c_ctxt)
 */
      __pyx_t_3 = ((PyObject *)PyUnicode_DecodeUTF8(__pyx_v_c_data, __pyx_v_data_len, NULL)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget *)__pyx_v_context->_target->__pyx_vtab)->_handleSaxData(__pyx_v_context->_target, __pyx_t_3); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L12_try_end;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":274
 *         context._target._handleSaxData(
 *             python.PyUnicode_DecodeUTF8(c_data, data_len, NULL))
 *     except:             # <<<<<<<<<<<<<<
 *         context._handleSaxException(c_ctxt)
 * 
 */
    /*except:*/ {
      __Pyx_AddTraceback("lxml.etree._handleSaxCData");
      if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_5, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_6);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":275
 *             python.PyUnicode_DecodeUTF8(c_data, data_len, NULL))
 *     except:
 *         context._handleSaxException(c_ctxt)             # <<<<<<<<<<<<<<
 * 
 * cdef void _handleSaxDoctype(void* ctxt, char* c_name, char* c_public,
 */
      ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->_handleSaxException(__pyx_v_context, __pyx_v_c_ctxt);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L6_exception_handled;
    }
    __pyx_L7_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L6_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L12_try_end:;
  }

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_WriteUnraisable("lxml.etree._handleSaxCData");
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(_save);
  #endif
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":277
 *         context._handleSaxException(c_ctxt)
 * 
 * cdef void _handleSaxDoctype(void* ctxt, char* c_name, char* c_public,             # <<<<<<<<<<<<<<
 *                             char* c_system) with gil:
 *     cdef _SaxParserContext context
 */

static  void __pyx_f_4lxml_5etree__handleSaxDoctype(void *__pyx_v_ctxt, char *__pyx_v_c_name, char *__pyx_v_c_public, char *__pyx_v_c_system) {
  struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_context;
  xmlParserCtxt *__pyx_v_c_ctxt;
  PyObject *__pyx_v_public_id;
  PyObject *__pyx_v_system_id;
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  #ifdef WITH_THREAD
  PyGILState_STATE _save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_handleSaxDoctype");
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_public_id = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_system_id = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":281
 *     cdef _SaxParserContext context
 *     cdef xmlparser.xmlParserCtxt* c_ctxt
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt             # <<<<<<<<<<<<<<
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:
 *         return
 */
  __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":282
 *     cdef xmlparser.xmlParserCtxt* c_ctxt
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 */
  __pyx_t_1 = (__pyx_v_c_ctxt->_private == NULL);
  if (!__pyx_t_1) {
    __pyx_t_2 = __pyx_v_c_ctxt->disableSAX;
  } else {
    __pyx_t_2 = __pyx_t_1;
  }
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":283
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:
 *         return             # <<<<<<<<<<<<<<
 *     context = <_SaxParserContext>c_ctxt._private
 *     if context._origSaxDoctype is not NULL:
 */
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":284
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:
 *         return
 *     context = <_SaxParserContext>c_ctxt._private             # <<<<<<<<<<<<<<
 *     if context._origSaxDoctype is not NULL:
 *         context._origSaxDoctype(c_ctxt, c_name, c_public, c_system)
 */
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_v_c_ctxt->_private)));
  __Pyx_DECREF(((PyObject *)__pyx_v_context));
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_v_c_ctxt->_private);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":285
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     if context._origSaxDoctype is not NULL:             # <<<<<<<<<<<<<<
 *         context._origSaxDoctype(c_ctxt, c_name, c_public, c_system)
 *     try:
 */
  __pyx_t_2 = (__pyx_v_context->_origSaxDoctype != NULL);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":286
 *     context = <_SaxParserContext>c_ctxt._private
 *     if context._origSaxDoctype is not NULL:
 *         context._origSaxDoctype(c_ctxt, c_name, c_public, c_system)             # <<<<<<<<<<<<<<
 *     try:
 *         if c_public is not NULL:
 */
    __pyx_v_context->_origSaxDoctype(__pyx_v_c_ctxt, __pyx_v_c_name, __pyx_v_c_public, __pyx_v_c_system);
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":287
 *     if context._origSaxDoctype is not NULL:
 *         context._origSaxDoctype(c_ctxt, c_name, c_public, c_system)
 *     try:             # <<<<<<<<<<<<<<
 *         if c_public is not NULL:
 *             public_id = funicode(c_public)
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":288
 *         context._origSaxDoctype(c_ctxt, c_name, c_public, c_system)
 *     try:
 *         if c_public is not NULL:             # <<<<<<<<<<<<<<
 *             public_id = funicode(c_public)
 *         if c_system is not NULL:
 */
      __pyx_t_2 = (__pyx_v_c_public != NULL);
      if (__pyx_t_2) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":289
 *     try:
 *         if c_public is not NULL:
 *             public_id = funicode(c_public)             # <<<<<<<<<<<<<<
 *         if c_system is not NULL:
 *             system_id = funicode(c_system)
 */
        __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_public); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_v_public_id);
        __pyx_v_public_id = __pyx_t_3;
        __pyx_t_3 = 0;
        goto __pyx_L13;
      }
      __pyx_L13:;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":290
 *         if c_public is not NULL:
 *             public_id = funicode(c_public)
 *         if c_system is not NULL:             # <<<<<<<<<<<<<<
 *             system_id = funicode(c_system)
 *         context._target._handleSaxDoctype(
 */
      __pyx_t_2 = (__pyx_v_c_system != NULL);
      if (__pyx_t_2) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":291
 *             public_id = funicode(c_public)
 *         if c_system is not NULL:
 *             system_id = funicode(c_system)             # <<<<<<<<<<<<<<
 *         context._target._handleSaxDoctype(
 *             funicode(c_name), public_id, system_id)
 */
        __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_system); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_v_system_id);
        __pyx_v_system_id = __pyx_t_3;
        __pyx_t_3 = 0;
        goto __pyx_L14;
      }
      __pyx_L14:;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":293
 *             system_id = funicode(c_system)
 *         context._target._handleSaxDoctype(
 *             funicode(c_name), public_id, system_id)             # <<<<<<<<<<<<<<
 *     except:
 *         context._handleSaxException(c_ctxt)
 */
      __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_name); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget *)__pyx_v_context->_target->__pyx_vtab)->_handleSaxDoctype(__pyx_v_context->_target, __pyx_t_3, __pyx_v_public_id, __pyx_v_system_id); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L12_try_end;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":294
 *         context._target._handleSaxDoctype(
 *             funicode(c_name), public_id, system_id)
 *     except:             # <<<<<<<<<<<<<<
 *         context._handleSaxException(c_ctxt)
 * 
 */
    /*except:*/ {
      __Pyx_AddTraceback("lxml.etree._handleSaxDoctype");
      if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_5, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_6);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":295
 *             funicode(c_name), public_id, system_id)
 *     except:
 *         context._handleSaxException(c_ctxt)             # <<<<<<<<<<<<<<
 * 
 * cdef void _handleSaxPI(void* ctxt, char* c_target, char* c_data) with gil:
 */
      ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->_handleSaxException(__pyx_v_context, __pyx_v_c_ctxt);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L6_exception_handled;
    }
    __pyx_L7_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L6_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L12_try_end:;
  }

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_WriteUnraisable("lxml.etree._handleSaxDoctype");
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_context);
  __Pyx_DECREF(__pyx_v_public_id);
  __Pyx_DECREF(__pyx_v_system_id);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(_save);
  #endif
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":297
 *         context._handleSaxException(c_ctxt)
 * 
 * cdef void _handleSaxPI(void* ctxt, char* c_target, char* c_data) with gil:             # <<<<<<<<<<<<<<
 *     cdef _SaxParserContext context
 *     cdef xmlparser.xmlParserCtxt* c_ctxt
 */

static  void __pyx_f_4lxml_5etree__handleSaxPI(void *__pyx_v_ctxt, char *__pyx_v_c_target, char *__pyx_v_c_data) {
  struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_context;
  xmlParserCtxt *__pyx_v_c_ctxt;
  PyObject *__pyx_v_data;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  #ifdef WITH_THREAD
  PyGILState_STATE _save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_handleSaxPI");
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_data = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":300
 *     cdef _SaxParserContext context
 *     cdef xmlparser.xmlParserCtxt* c_ctxt
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt             # <<<<<<<<<<<<<<
 *     if c_ctxt._private is NULL:
 *         return
 */
  __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":301
 *     cdef xmlparser.xmlParserCtxt* c_ctxt
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL:             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 */
  __pyx_t_1 = (__pyx_v_c_ctxt->_private == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":302
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL:
 *         return             # <<<<<<<<<<<<<<
 *     context = <_SaxParserContext>c_ctxt._private
 *     if context._origSaxPi is not NULL:
 */
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":303
 *     if c_ctxt._private is NULL:
 *         return
 *     context = <_SaxParserContext>c_ctxt._private             # <<<<<<<<<<<<<<
 *     if context._origSaxPi is not NULL:
 *         context._origSaxPi(c_ctxt, c_target, c_data)
 */
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_v_c_ctxt->_private)));
  __Pyx_DECREF(((PyObject *)__pyx_v_context));
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_v_c_ctxt->_private);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":304
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     if context._origSaxPi is not NULL:             # <<<<<<<<<<<<<<
 *         context._origSaxPi(c_ctxt, c_target, c_data)
 *     try:
 */
  __pyx_t_1 = (__pyx_v_context->_origSaxPi != NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":305
 *     context = <_SaxParserContext>c_ctxt._private
 *     if context._origSaxPi is not NULL:
 *         context._origSaxPi(c_ctxt, c_target, c_data)             # <<<<<<<<<<<<<<
 *     try:
 *         if c_data is not NULL:
 */
    __pyx_v_context->_origSaxPi(__pyx_v_c_ctxt, __pyx_v_c_target, __pyx_v_c_data);
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":306
 *     if context._origSaxPi is not NULL:
 *         context._origSaxPi(c_ctxt, c_target, c_data)
 *     try:             # <<<<<<<<<<<<<<
 *         if c_data is not NULL:
 *             data = funicode(c_data)
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":307
 *         context._origSaxPi(c_ctxt, c_target, c_data)
 *     try:
 *         if c_data is not NULL:             # <<<<<<<<<<<<<<
 *             data = funicode(c_data)
 *         context._target._handleSaxPi(funicode(c_target), data)
 */
      __pyx_t_1 = (__pyx_v_c_data != NULL);
      if (__pyx_t_1) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":308
 *     try:
 *         if c_data is not NULL:
 *             data = funicode(c_data)             # <<<<<<<<<<<<<<
 *         context._target._handleSaxPi(funicode(c_target), data)
 *     except:
 */
        __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_data); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_v_data);
        __pyx_v_data = __pyx_t_2;
        __pyx_t_2 = 0;
        goto __pyx_L13;
      }
      __pyx_L13:;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":309
 *         if c_data is not NULL:
 *             data = funicode(c_data)
 *         context._target._handleSaxPi(funicode(c_target), data)             # <<<<<<<<<<<<<<
 *     except:
 *         context._handleSaxException(c_ctxt)
 */
      __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_target); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget *)__pyx_v_context->_target->__pyx_vtab)->_handleSaxPi(__pyx_v_context->_target, __pyx_t_2, __pyx_v_data); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L12_try_end;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":310
 *             data = funicode(c_data)
 *         context._target._handleSaxPi(funicode(c_target), data)
 *     except:             # <<<<<<<<<<<<<<
 *         context._handleSaxException(c_ctxt)
 * 
 */
    /*except:*/ {
      __Pyx_AddTraceback("lxml.etree._handleSaxPI");
      if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_4);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":311
 *         context._target._handleSaxPi(funicode(c_target), data)
 *     except:
 *         context._handleSaxException(c_ctxt)             # <<<<<<<<<<<<<<
 * 
 * cdef void _handleSaxComment(void* ctxt, char* c_data) with gil:
 */
      ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->_handleSaxException(__pyx_v_context, __pyx_v_c_ctxt);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L6_exception_handled;
    }
    __pyx_L7_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L6_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L12_try_end:;
  }

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_WriteUnraisable("lxml.etree._handleSaxPI");
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_context);
  __Pyx_DECREF(__pyx_v_data);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(_save);
  #endif
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":313
 *         context._handleSaxException(c_ctxt)
 * 
 * cdef void _handleSaxComment(void* ctxt, char* c_data) with gil:             # <<<<<<<<<<<<<<
 *     cdef _SaxParserContext context
 *     cdef xmlparser.xmlParserCtxt* c_ctxt
 */

static  void __pyx_f_4lxml_5etree__handleSaxComment(void *__pyx_v_ctxt, char *__pyx_v_c_data) {
  struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_context;
  xmlParserCtxt *__pyx_v_c_ctxt;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  #ifdef WITH_THREAD
  PyGILState_STATE _save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_handleSaxComment");
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":316
 *     cdef _SaxParserContext context
 *     cdef xmlparser.xmlParserCtxt* c_ctxt
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt             # <<<<<<<<<<<<<<
 *     if c_ctxt._private is NULL:
 *         return
 */
  __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":317
 *     cdef xmlparser.xmlParserCtxt* c_ctxt
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL:             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 */
  __pyx_t_1 = (__pyx_v_c_ctxt->_private == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":318
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL:
 *         return             # <<<<<<<<<<<<<<
 *     context = <_SaxParserContext>c_ctxt._private
 *     if context._origSaxComment is not NULL:
 */
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":319
 *     if c_ctxt._private is NULL:
 *         return
 *     context = <_SaxParserContext>c_ctxt._private             # <<<<<<<<<<<<<<
 *     if context._origSaxComment is not NULL:
 *         context._origSaxComment(c_ctxt, c_data)
 */
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_v_c_ctxt->_private)));
  __Pyx_DECREF(((PyObject *)__pyx_v_context));
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_v_c_ctxt->_private);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":320
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     if context._origSaxComment is not NULL:             # <<<<<<<<<<<<<<
 *         context._origSaxComment(c_ctxt, c_data)
 *     try:
 */
  __pyx_t_1 = (__pyx_v_context->_origSaxComment != NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":321
 *     context = <_SaxParserContext>c_ctxt._private
 *     if context._origSaxComment is not NULL:
 *         context._origSaxComment(c_ctxt, c_data)             # <<<<<<<<<<<<<<
 *     try:
 *         context._target._handleSaxComment(funicode(c_data))
 */
    __pyx_v_context->_origSaxComment(__pyx_v_c_ctxt, __pyx_v_c_data);
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":322
 *     if context._origSaxComment is not NULL:
 *         context._origSaxComment(c_ctxt, c_data)
 *     try:             # <<<<<<<<<<<<<<
 *         context._target._handleSaxComment(funicode(c_data))
 *     except:
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":323
 *         context._origSaxComment(c_ctxt, c_data)
 *     try:
 *         context._target._handleSaxComment(funicode(c_data))             # <<<<<<<<<<<<<<
 *     except:
 *         context._handleSaxException(c_ctxt)
 */
      __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_data); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget *)__pyx_v_context->_target->__pyx_vtab)->_handleSaxComment(__pyx_v_context->_target, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L12_try_end;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":324
 *     try:
 *         context._target._handleSaxComment(funicode(c_data))
 *     except:             # <<<<<<<<<<<<<<
 *         context._handleSaxException(c_ctxt)
 * 
 */
    /*except:*/ {
      __Pyx_AddTraceback("lxml.etree._handleSaxComment");
      if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_4);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":325
 *         context._target._handleSaxComment(funicode(c_data))
 *     except:
 *         context._handleSaxException(c_ctxt)             # <<<<<<<<<<<<<<
 * 
 * 
 */
      ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->_handleSaxException(__pyx_v_context, __pyx_v_c_ctxt);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L6_exception_handled;
    }
    __pyx_L7_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L6_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L12_try_end:;
  }

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_WriteUnraisable("lxml.etree._handleSaxComment");
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(_save);
  #endif
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":346
 *     cdef bint _in_tail
 * 
 *     def __init__(self, *, element_factory=None, parser=None):             # <<<<<<<<<<<<<<
 *         self._sax_event_filter = \
 *             SAX_EVENT_START | SAX_EVENT_END | SAX_EVENT_DATA | \
 */

static int __pyx_pf_4lxml_5etree_11TreeBuilder___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_11TreeBuilder___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_element_factory = 0;
  PyObject *__pyx_v_parser = 0;
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__element_factory,&__pyx_n_s__parser,0};
  __Pyx_RefNannySetupContext("__init__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    while (kw_args > 0) {
      PyObject* value;
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__element_factory);
      if (value) { values[0] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parser);
      if (value) { values[1] = value; if (!(--kw_args)) break; }
      break;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, 0, "__init__") < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_element_factory = values[0];
    __pyx_v_parser = values[1];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 0) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_element_factory = ((PyObject *)Py_None);
    __pyx_v_parser = ((PyObject *)Py_None);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[12]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.TreeBuilder.__init__");
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":347
 * 
 *     def __init__(self, *, element_factory=None, parser=None):
 *         self._sax_event_filter = \             # <<<<<<<<<<<<<<
 *             SAX_EVENT_START | SAX_EVENT_END | SAX_EVENT_DATA | \
 *             SAX_EVENT_PI | SAX_EVENT_COMMENT
 */
  ((struct __pyx_obj_4lxml_5etree_TreeBuilder *)__pyx_v_self)->__pyx_base._sax_event_filter = ((((__pyx_e_4lxml_5etree_SAX_EVENT_START | __pyx_e_4lxml_5etree_SAX_EVENT_END) | __pyx_e_4lxml_5etree_SAX_EVENT_DATA) | __pyx_e_4lxml_5etree_SAX_EVENT_PI) | __pyx_e_4lxml_5etree_SAX_EVENT_COMMENT);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":350
 *             SAX_EVENT_START | SAX_EVENT_END | SAX_EVENT_DATA | \
 *             SAX_EVENT_PI | SAX_EVENT_COMMENT
 *         self._data = [] # data collector             # <<<<<<<<<<<<<<
 *         self._element_stack = [] # element stack
 *         self._element_stack_pop = self._element_stack.pop
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree_TreeBuilder *)__pyx_v_self)->_data);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_TreeBuilder *)__pyx_v_self)->_data));
  ((struct __pyx_obj_4lxml_5etree_TreeBuilder *)__pyx_v_self)->_data = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":351
 *             SAX_EVENT_PI | SAX_EVENT_COMMENT
 *         self._data = [] # data collector
 *         self._element_stack = [] # element stack             # <<<<<<<<<<<<<<
 *         self._element_stack_pop = self._element_stack.pop
 *         self._last = None # last element
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree_TreeBuilder *)__pyx_v_self)->_element_stack);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_TreeBuilder *)__pyx_v_self)->_element_stack));
  ((struct __pyx_obj_4lxml_5etree_TreeBuilder *)__pyx_v_self)->_element_stack = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":352
 *         self._data = [] # data collector
 *         self._element_stack = [] # element stack
 *         self._element_stack_pop = self._element_stack.pop             # <<<<<<<<<<<<<<
 *         self._last = None # last element
 *         self._in_tail = 0 # true if we're after an end tag
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_4lxml_5etree_TreeBuilder *)__pyx_v_self)->_element_stack), __pyx_n_s__pop); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree_TreeBuilder *)__pyx_v_self)->_element_stack_pop);
  __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree_TreeBuilder *)__pyx_v_self)->_element_stack_pop);
  ((struct __pyx_obj_4lxml_5etree_TreeBuilder *)__pyx_v_self)->_element_stack_pop = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":353
 *         self._element_stack = [] # element stack
 *         self._element_stack_pop = self._element_stack.pop
 *         self._last = None # last element             # <<<<<<<<<<<<<<
 *         self._in_tail = 0 # true if we're after an end tag
 *         self._factory = element_factory
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree_TreeBuilder *)__pyx_v_self)->_last);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_TreeBuilder *)__pyx_v_self)->_last));
  ((struct __pyx_obj_4lxml_5etree_TreeBuilder *)__pyx_v_self)->_last = ((struct LxmlElement *)Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":354
 *         self._element_stack_pop = self._element_stack.pop
 *         self._last = None # last element
 *         self._in_tail = 0 # true if we're after an end tag             # <<<<<<<<<<<<<<
 *         self._factory = element_factory
 *         self._parser = parser
 */
  ((struct __pyx_obj_4lxml_5etree_TreeBuilder *)__pyx_v_self)->_in_tail = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":355
 *         self._last = None # last element
 *         self._in_tail = 0 # true if we're after an end tag
 *         self._factory = element_factory             # <<<<<<<<<<<<<<
 *         self._parser = parser
 * 
 */
  __Pyx_INCREF(__pyx_v_element_factory);
  __Pyx_GIVEREF(__pyx_v_element_factory);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree_TreeBuilder *)__pyx_v_self)->_factory);
  __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree_TreeBuilder *)__pyx_v_self)->_factory);
  ((struct __pyx_obj_4lxml_5etree_TreeBuilder *)__pyx_v_self)->_factory = __pyx_v_element_factory;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":356
 *         self._in_tail = 0 # true if we're after an end tag
 *         self._factory = element_factory
 *         self._parser = parser             # <<<<<<<<<<<<<<
 * 
 *     cdef int _flush(self) except -1:
 */
  if (!(likely(((__pyx_v_parser) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_parser, __pyx_ptype_4lxml_5etree__BaseParser))))) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_parser);
  __Pyx_GIVEREF(__pyx_v_parser);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree_TreeBuilder *)__pyx_v_self)->_parser);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_TreeBuilder *)__pyx_v_self)->_parser));
  ((struct __pyx_obj_4lxml_5etree_TreeBuilder *)__pyx_v_self)->_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_parser);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.TreeBuilder.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":358
 *         self._parser = parser
 * 
 *     cdef int _flush(self) except -1:             # <<<<<<<<<<<<<<
 *         if python.PyList_GET_SIZE(self._data) > 0:
 *             if self._last is not None:
 */

static  int __pyx_f_4lxml_5etree_11TreeBuilder__flush(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self) {
  PyObject *__pyx_v_text;
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("_flush");
  __pyx_v_text = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":359
 * 
 *     cdef int _flush(self) except -1:
 *         if python.PyList_GET_SIZE(self._data) > 0:             # <<<<<<<<<<<<<<
 *             if self._last is not None:
 *                 text = u"".join(self._data)
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_data);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = (PyList_GET_SIZE(__pyx_t_1) > 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":360
 *     cdef int _flush(self) except -1:
 *         if python.PyList_GET_SIZE(self._data) > 0:
 *             if self._last is not None:             # <<<<<<<<<<<<<<
 *                 text = u"".join(self._data)
 *                 if self._in_tail:
 */
    __pyx_t_2 = (((PyObject *)__pyx_v_self->_last) != Py_None);
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":361
 *         if python.PyList_GET_SIZE(self._data) > 0:
 *             if self._last is not None:
 *                 text = u"".join(self._data)             # <<<<<<<<<<<<<<
 *                 if self._in_tail:
 *                     assert self._last.tail is None, u"internal error (tail)"
 */
      __pyx_t_1 = ((PyObject *)__pyx_v_self->_data);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = ((PyObject *)PyUnicode_Join(__pyx_kp_u_25, __pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_v_text);
      __pyx_v_text = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":362
 *             if self._last is not None:
 *                 text = u"".join(self._data)
 *                 if self._in_tail:             # <<<<<<<<<<<<<<
 *                     assert self._last.tail is None, u"internal error (tail)"
 *                     self._last.tail = text
 */
      if (__pyx_v_self->_in_tail) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":363
 *                 text = u"".join(self._data)
 *                 if self._in_tail:
 *                     assert self._last.tail is None, u"internal error (tail)"             # <<<<<<<<<<<<<<
 *                     self._last.tail = text
 *                 else:
 */
        #ifndef CYTHON_WITHOUT_ASSERTIONS
        __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_self->_last), __pyx_n_s__tail); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_2 = (__pyx_t_3 == Py_None);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_2)) {
          PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_u_230));
          {__pyx_filename = __pyx_f[12]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        #endif

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":364
 *                 if self._in_tail:
 *                     assert self._last.tail is None, u"internal error (tail)"
 *                     self._last.tail = text             # <<<<<<<<<<<<<<
 *                 else:
 *                     assert self._last.text is None, u"internal error (text)"
 */
        if (PyObject_SetAttr(((PyObject *)__pyx_v_self->_last), __pyx_n_s__tail, __pyx_v_text) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L5;
      }
      /*else*/ {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":366
 *                     self._last.tail = text
 *                 else:
 *                     assert self._last.text is None, u"internal error (text)"             # <<<<<<<<<<<<<<
 *                     self._last.text = text
 *             del self._data[:]
 */
        #ifndef CYTHON_WITHOUT_ASSERTIONS
        __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_self->_last), __pyx_n_s__text); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_2 = (__pyx_t_3 == Py_None);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_2)) {
          PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_u_231));
          {__pyx_filename = __pyx_f[12]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        #endif

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":367
 *                 else:
 *                     assert self._last.text is None, u"internal error (text)"
 *                     self._last.text = text             # <<<<<<<<<<<<<<
 *             del self._data[:]
 *         return 0
 */
        if (PyObject_SetAttr(((PyObject *)__pyx_v_self->_last), __pyx_n_s__text, __pyx_v_text) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_L5:;
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":368
 *                     assert self._last.text is None, u"internal error (text)"
 *                     self._last.text = text
 *             del self._data[:]             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
    if (__Pyx_PySequence_DelSlice(((PyObject *)__pyx_v_self->_data), 0, PY_SSIZE_T_MAX) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":369
 *                     self._last.text = text
 *             del self._data[:]
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     # Python level event handlers
 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.TreeBuilder._flush");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_text);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":373
 *     # Python level event handlers
 * 
 *     def close(self):             # <<<<<<<<<<<<<<
 *         u"""close(self)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_11TreeBuilder_1close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_11TreeBuilder_1close[] = "close(self)\n\n        Flushes the builder buffers, and returns the toplevel document\n        element.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_11TreeBuilder_1close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("close");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":379
 *         element.
 *         """
 *         assert python.PyList_GET_SIZE(self._element_stack) == 0, u"missing end tags"             # <<<<<<<<<<<<<<
 *         assert self._last is not None, u"missing toplevel element"
 *         return self._last
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  __pyx_t_1 = ((PyObject *)((struct __pyx_obj_4lxml_5etree_TreeBuilder *)__pyx_v_self)->_element_stack);
  __Pyx_INCREF(__pyx_t_1);
  if (unlikely(!(PyList_GET_SIZE(__pyx_t_1) == 0))) {
    PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_u_232));
    {__pyx_filename = __pyx_f[12]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  #endif

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":380
 *         """
 *         assert python.PyList_GET_SIZE(self._element_stack) == 0, u"missing end tags"
 *         assert self._last is not None, u"missing toplevel element"             # <<<<<<<<<<<<<<
 *         return self._last
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  __pyx_t_2 = (((PyObject *)((struct __pyx_obj_4lxml_5etree_TreeBuilder *)__pyx_v_self)->_last) != Py_None);
  if (unlikely(!__pyx_t_2)) {
    PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_u_233));
    {__pyx_filename = __pyx_f[12]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":381
 *         assert python.PyList_GET_SIZE(self._element_stack) == 0, u"missing end tags"
 *         assert self._last is not None, u"missing toplevel element"
 *         return self._last             # <<<<<<<<<<<<<<
 * 
 *     def data(self, data):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_TreeBuilder *)__pyx_v_self)->_last));
  __pyx_r = ((PyObject *)((struct __pyx_obj_4lxml_5etree_TreeBuilder *)__pyx_v_self)->_last);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.TreeBuilder.close");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":383
 *         return self._last
 * 
 *     def data(self, data):             # <<<<<<<<<<<<<<
 *         u"""data(self, data)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_11TreeBuilder_2data(PyObject *__pyx_v_self, PyObject *__pyx_v_data); /*proto*/
static char __pyx_doc_4lxml_5etree_11TreeBuilder_2data[] = "data(self, data)\n\n        Adds text to the current element.  The value should be either an\n        8-bit string containing ASCII text, or a Unicode string.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_11TreeBuilder_2data(PyObject *__pyx_v_self, PyObject *__pyx_v_data) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("data");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":389
 *         8-bit string containing ASCII text, or a Unicode string.
 *         """
 *         self._handleSaxData(data)             # <<<<<<<<<<<<<<
 * 
 *     def start(self, tag, attrs, nsmap=None):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree_TreeBuilder *)((struct __pyx_obj_4lxml_5etree_TreeBuilder *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base._handleSaxData(((struct __pyx_obj_4lxml_5etree__SaxParserTarget *)__pyx_v_self), __pyx_v_data); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.TreeBuilder.data");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":391
 *         self._handleSaxData(data)
 * 
 *     def start(self, tag, attrs, nsmap=None):             # <<<<<<<<<<<<<<
 *         u"""start(self, tag, attrs, nsmap=None)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_11TreeBuilder_3start(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_11TreeBuilder_3start[] = "start(self, tag, attrs, nsmap=None)\n\n        Opens a new element.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_11TreeBuilder_3start(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_attrs = 0;
  PyObject *__pyx_v_nsmap = 0;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__tag,&__pyx_n_s__attrs,&__pyx_n_s__nsmap,0};
  __Pyx_RefNannySetupContext("start");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    values[2] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tag);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__attrs);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("start", 0, 2, 3, 1); {__pyx_filename = __pyx_f[12]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nsmap);
        if (value) { values[2] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "start") < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_tag = values[0];
    __pyx_v_attrs = values[1];
    __pyx_v_nsmap = values[2];
  } else {
    __pyx_v_nsmap = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3:
      __pyx_v_nsmap = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2:
      __pyx_v_attrs = PyTuple_GET_ITEM(__pyx_args, 1);
      __pyx_v_tag = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("start", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[12]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.TreeBuilder.start");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF(__pyx_v_nsmap);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":396
 *         Opens a new element.
 *         """
 *         if nsmap is None:             # <<<<<<<<<<<<<<
 *             nsmap = EMPTY_READ_ONLY_DICT
 *         return self._handleSaxStart(tag, attrs, nsmap)
 */
  __pyx_t_1 = (__pyx_v_nsmap == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":397
 *         """
 *         if nsmap is None:
 *             nsmap = EMPTY_READ_ONLY_DICT             # <<<<<<<<<<<<<<
 *         return self._handleSaxStart(tag, attrs, nsmap)
 * 
 */
    __Pyx_INCREF(__pyx_v_4lxml_5etree_EMPTY_READ_ONLY_DICT);
    __Pyx_DECREF(__pyx_v_nsmap);
    __pyx_v_nsmap = __pyx_v_4lxml_5etree_EMPTY_READ_ONLY_DICT;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":398
 *         if nsmap is None:
 *             nsmap = EMPTY_READ_ONLY_DICT
 *         return self._handleSaxStart(tag, attrs, nsmap)             # <<<<<<<<<<<<<<
 * 
 *     def end(self, tag):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree_TreeBuilder *)((struct __pyx_obj_4lxml_5etree_TreeBuilder *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base._handleSaxStart(((struct __pyx_obj_4lxml_5etree__SaxParserTarget *)__pyx_v_self), __pyx_v_tag, __pyx_v_attrs, __pyx_v_nsmap); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.TreeBuilder.start");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_nsmap);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":400
 *         return self._handleSaxStart(tag, attrs, nsmap)
 * 
 *     def end(self, tag):             # <<<<<<<<<<<<<<
 *         u"""end(self, tag)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_11TreeBuilder_4end(PyObject *__pyx_v_self, PyObject *__pyx_v_tag); /*proto*/
static char __pyx_doc_4lxml_5etree_11TreeBuilder_4end[] = "end(self, tag)\n\n        Closes the current element.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_11TreeBuilder_4end(PyObject *__pyx_v_self, PyObject *__pyx_v_tag) {
  PyObject *__pyx_v_element;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("end");
  __pyx_v_element = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":405
 *         Closes the current element.
 *         """
 *         element = self._handleSaxEnd(tag)             # <<<<<<<<<<<<<<
 *         assert self._last.tag == tag,\
 *                u"end tag mismatch (expected %s, got %s)" % (
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree_TreeBuilder *)((struct __pyx_obj_4lxml_5etree_TreeBuilder *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base._handleSaxEnd(((struct __pyx_obj_4lxml_5etree__SaxParserTarget *)__pyx_v_self), __pyx_v_tag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_v_element);
  __pyx_v_element = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":406
 *         """
 *         element = self._handleSaxEnd(tag)
 *         assert self._last.tag == tag,\             # <<<<<<<<<<<<<<
 *                u"end tag mismatch (expected %s, got %s)" % (
 *                    self._last.tag, tag)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_4lxml_5etree_TreeBuilder *)__pyx_v_self)->_last), __pyx_n_s__tag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_v_tag, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_3)) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":408
 *         assert self._last.tag == tag,\
 *                u"end tag mismatch (expected %s, got %s)" % (
 *                    self._last.tag, tag)             # <<<<<<<<<<<<<<
 *         return element
 * 
 */
    __pyx_t_2 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_4lxml_5etree_TreeBuilder *)__pyx_v_self)->_last), __pyx_n_s__tag); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_tag);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_tag);
    __Pyx_GIVEREF(__pyx_v_tag);
    __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_234), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_t_2));
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[12]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":409
 *                u"end tag mismatch (expected %s, got %s)" % (
 *                    self._last.tag, tag)
 *         return element             # <<<<<<<<<<<<<<
 * 
 *     def pi(self, target, data):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_element);
  __pyx_r = __pyx_v_element;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.TreeBuilder.end");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_element);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":411
 *         return element
 * 
 *     def pi(self, target, data):             # <<<<<<<<<<<<<<
 *         u"""pi(self, target, data)
 *         """
 */

static PyObject *__pyx_pf_4lxml_5etree_11TreeBuilder_5pi(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_11TreeBuilder_5pi[] = "pi(self, target, data)\n        ";
static PyObject *__pyx_pf_4lxml_5etree_11TreeBuilder_5pi(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_target = 0;
  PyObject *__pyx_v_data = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__target,&__pyx_n_s__data,0};
  __Pyx_RefNannySetupContext("pi");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__target);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__data);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("pi", 1, 2, 2, 1); {__pyx_filename = __pyx_f[12]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "pi") < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_target = values[0];
    __pyx_v_data = values[1];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_target = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_data = PyTuple_GET_ITEM(__pyx_args, 1);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pi", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[12]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.TreeBuilder.pi");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":414
 *         u"""pi(self, target, data)
 *         """
 *         return self._handleSaxPi(target, data)             # <<<<<<<<<<<<<<
 * 
 *     def comment(self, comment):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree_TreeBuilder *)((struct __pyx_obj_4lxml_5etree_TreeBuilder *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base._handleSaxPi(((struct __pyx_obj_4lxml_5etree__SaxParserTarget *)__pyx_v_self), __pyx_v_target, __pyx_v_data); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.TreeBuilder.pi");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":416
 *         return self._handleSaxPi(target, data)
 * 
 *     def comment(self, comment):             # <<<<<<<<<<<<<<
 *         u"""comment(self, comment)
 *         """
 */

static PyObject *__pyx_pf_4lxml_5etree_11TreeBuilder_6comment(PyObject *__pyx_v_self, PyObject *__pyx_v_comment); /*proto*/
static char __pyx_doc_4lxml_5etree_11TreeBuilder_6comment[] = "comment(self, comment)\n        ";
static PyObject *__pyx_pf_4lxml_5etree_11TreeBuilder_6comment(PyObject *__pyx_v_self, PyObject *__pyx_v_comment) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("comment");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":419
 *         u"""comment(self, comment)
 *         """
 *         return self._handleSaxComment(comment)             # <<<<<<<<<<<<<<
 * 
 *     # internal SAX event handlers
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree_TreeBuilder *)((struct __pyx_obj_4lxml_5etree_TreeBuilder *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base._handleSaxComment(((struct __pyx_obj_4lxml_5etree__SaxParserTarget *)__pyx_v_self), __pyx_v_comment); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.TreeBuilder.comment");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":423
 *     # internal SAX event handlers
 * 
 *     cdef _handleSaxStart(self, tag, attrib, nsmap):             # <<<<<<<<<<<<<<
 *         self._flush()
 *         if self._factory is not None:
 */

static  PyObject *__pyx_f_4lxml_5etree_11TreeBuilder__handleSaxStart(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("_handleSaxStart");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":424
 * 
 *     cdef _handleSaxStart(self, tag, attrib, nsmap):
 *         self._flush()             # <<<<<<<<<<<<<<
 *         if self._factory is not None:
 *             self._last = self._factory(tag, attrib)
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree_TreeBuilder *)__pyx_v_self->__pyx_base.__pyx_vtab)->_flush(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":425
 *     cdef _handleSaxStart(self, tag, attrib, nsmap):
 *         self._flush()
 *         if self._factory is not None:             # <<<<<<<<<<<<<<
 *             self._last = self._factory(tag, attrib)
 *             if python.PyList_GET_SIZE(self._element_stack) > 0:
 */
  __pyx_t_2 = (__pyx_v_self->_factory != Py_None);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":426
 *         self._flush()
 *         if self._factory is not None:
 *             self._last = self._factory(tag, attrib)             # <<<<<<<<<<<<<<
 *             if python.PyList_GET_SIZE(self._element_stack) > 0:
 *                 _appendChild(self._element_stack[-1], self._last)
 */
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_INCREF(__pyx_v_tag);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_tag);
    __Pyx_GIVEREF(__pyx_v_tag);
    __Pyx_INCREF(__pyx_v_attrib);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_attrib);
    __Pyx_GIVEREF(__pyx_v_attrib);
    __pyx_t_4 = PyObject_Call(__pyx_v_self->_factory, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GIVEREF(__pyx_t_4);
    __Pyx_GOTREF(__pyx_v_self->_last);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->_last));
    __pyx_v_self->_last = ((struct LxmlElement *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":427
 *         if self._factory is not None:
 *             self._last = self._factory(tag, attrib)
 *             if python.PyList_GET_SIZE(self._element_stack) > 0:             # <<<<<<<<<<<<<<
 *                 _appendChild(self._element_stack[-1], self._last)
 *         elif python.PyList_GET_SIZE(self._element_stack) > 0:
 */
    __pyx_t_4 = ((PyObject *)__pyx_v_self->_element_stack);
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_2 = (PyList_GET_SIZE(__pyx_t_4) > 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":428
 *             self._last = self._factory(tag, attrib)
 *             if python.PyList_GET_SIZE(self._element_stack) > 0:
 *                 _appendChild(self._element_stack[-1], self._last)             # <<<<<<<<<<<<<<
 *         elif python.PyList_GET_SIZE(self._element_stack) > 0:
 *             self._last = _makeSubElement(
 */
      __pyx_t_4 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_self->_element_stack), -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_3 = ((PyObject *)__pyx_v_self->_last);
      __Pyx_INCREF(__pyx_t_3);
      __pyx_t_1 = __pyx_f_4lxml_5etree__appendChild(((struct LxmlElement *)__pyx_t_4), ((struct LxmlElement *)__pyx_t_3)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":429
 *             if python.PyList_GET_SIZE(self._element_stack) > 0:
 *                 _appendChild(self._element_stack[-1], self._last)
 *         elif python.PyList_GET_SIZE(self._element_stack) > 0:             # <<<<<<<<<<<<<<
 *             self._last = _makeSubElement(
 *                 self._element_stack[-1], tag, None, None, attrib, nsmap, None)
 */
  __pyx_t_3 = ((PyObject *)__pyx_v_self->_element_stack);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_2 = (PyList_GET_SIZE(__pyx_t_3) > 0);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":431
 *         elif python.PyList_GET_SIZE(self._element_stack) > 0:
 *             self._last = _makeSubElement(
 *                 self._element_stack[-1], tag, None, None, attrib, nsmap, None)             # <<<<<<<<<<<<<<
 *         else:
 *             self._last = _makeElement(
 */
    __pyx_t_3 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_self->_element_stack), -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__makeSubElement(((struct LxmlElement *)__pyx_t_3), __pyx_v_tag, Py_None, Py_None, __pyx_v_attrib, __pyx_v_nsmap, Py_None)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":430
 *                 _appendChild(self._element_stack[-1], self._last)
 *         elif python.PyList_GET_SIZE(self._element_stack) > 0:
 *             self._last = _makeSubElement(             # <<<<<<<<<<<<<<
 *                 self._element_stack[-1], tag, None, None, attrib, nsmap, None)
 *         else:
 */
    __Pyx_GIVEREF(__pyx_t_4);
    __Pyx_GOTREF(__pyx_v_self->_last);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->_last));
    __pyx_v_self->_last = ((struct LxmlElement *)__pyx_t_4);
    __pyx_t_4 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":434
 *         else:
 *             self._last = _makeElement(
 *                 tag, NULL, None, self._parser, None, None, attrib, nsmap, None)             # <<<<<<<<<<<<<<
 *         self._element_stack.append(self._last)
 *         self._in_tail = 0
 */
    __pyx_t_4 = ((PyObject *)__pyx_v_self->_parser);
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__makeElement(__pyx_v_tag, NULL, ((struct LxmlDocument *)Py_None), ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_4), Py_None, Py_None, __pyx_v_attrib, __pyx_v_nsmap, Py_None)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":433
 *                 self._element_stack[-1], tag, None, None, attrib, nsmap, None)
 *         else:
 *             self._last = _makeElement(             # <<<<<<<<<<<<<<
 *                 tag, NULL, None, self._parser, None, None, attrib, nsmap, None)
 *         self._element_stack.append(self._last)
 */
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF(__pyx_v_self->_last);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->_last));
    __pyx_v_self->_last = ((struct LxmlElement *)__pyx_t_3);
    __pyx_t_3 = 0;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":435
 *             self._last = _makeElement(
 *                 tag, NULL, None, self._parser, None, None, attrib, nsmap, None)
 *         self._element_stack.append(self._last)             # <<<<<<<<<<<<<<
 *         self._in_tail = 0
 *         return self._last
 */
  if (unlikely(__pyx_v_self->_element_stack == Py_None)) {
    PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[12]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_3 = ((PyObject *)__pyx_v_self->_last);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_1 = PyList_Append(__pyx_v_self->_element_stack, __pyx_t_3); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":436
 *                 tag, NULL, None, self._parser, None, None, attrib, nsmap, None)
 *         self._element_stack.append(self._last)
 *         self._in_tail = 0             # <<<<<<<<<<<<<<
 *         return self._last
 * 
 */
  __pyx_v_self->_in_tail = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":437
 *         self._element_stack.append(self._last)
 *         self._in_tail = 0
 *         return self._last             # <<<<<<<<<<<<<<
 * 
 *     cdef _handleSaxEnd(self, tag):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_last));
  __pyx_r = ((PyObject *)__pyx_v_self->_last);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.TreeBuilder._handleSaxStart");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":439
 *         return self._last
 * 
 *     cdef _handleSaxEnd(self, tag):             # <<<<<<<<<<<<<<
 *         self._flush()
 *         self._last = self._element_stack_pop()
 */

static  PyObject *__pyx_f_4lxml_5etree_11TreeBuilder__handleSaxEnd(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self, PyObject *__pyx_v_tag) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_handleSaxEnd");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":440
 * 
 *     cdef _handleSaxEnd(self, tag):
 *         self._flush()             # <<<<<<<<<<<<<<
 *         self._last = self._element_stack_pop()
 *         self._in_tail = 1
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree_TreeBuilder *)__pyx_v_self->__pyx_base.__pyx_vtab)->_flush(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":441
 *     cdef _handleSaxEnd(self, tag):
 *         self._flush()
 *         self._last = self._element_stack_pop()             # <<<<<<<<<<<<<<
 *         self._in_tail = 1
 *         return self._last
 */
  __pyx_t_2 = PyObject_Call(__pyx_v_self->_element_stack_pop, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_self->_last);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_last));
  __pyx_v_self->_last = ((struct LxmlElement *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":442
 *         self._flush()
 *         self._last = self._element_stack_pop()
 *         self._in_tail = 1             # <<<<<<<<<<<<<<
 *         return self._last
 * 
 */
  __pyx_v_self->_in_tail = 1;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":443
 *         self._last = self._element_stack_pop()
 *         self._in_tail = 1
 *         return self._last             # <<<<<<<<<<<<<<
 * 
 *     cdef int _handleSaxData(self, data) except -1:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_last));
  __pyx_r = ((PyObject *)__pyx_v_self->_last);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.TreeBuilder._handleSaxEnd");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":445
 *         return self._last
 * 
 *     cdef int _handleSaxData(self, data) except -1:             # <<<<<<<<<<<<<<
 *         self._data.append(data)
 * 
 */

static  int __pyx_f_4lxml_5etree_11TreeBuilder__handleSaxData(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self, PyObject *__pyx_v_data) {
  int __pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_handleSaxData");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":446
 * 
 *     cdef int _handleSaxData(self, data) except -1:
 *         self._data.append(data)             # <<<<<<<<<<<<<<
 * 
 *     cdef _handleSaxPi(self, target, data):
 */
  if (unlikely(__pyx_v_self->_data == Py_None)) {
    PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[12]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_1 = PyList_Append(__pyx_v_self->_data, __pyx_v_data); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.TreeBuilder._handleSaxData");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":448
 *         self._data.append(data)
 * 
 *     cdef _handleSaxPi(self, target, data):             # <<<<<<<<<<<<<<
 *         self._flush()
 *         self._last = ProcessingInstruction(target, data)
 */

static  PyObject *__pyx_f_4lxml_5etree_11TreeBuilder__handleSaxPi(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self, PyObject *__pyx_v_target, PyObject *__pyx_v_data) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("_handleSaxPi");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":449
 * 
 *     cdef _handleSaxPi(self, target, data):
 *         self._flush()             # <<<<<<<<<<<<<<
 *         self._last = ProcessingInstruction(target, data)
 *         if python.PyList_GET_SIZE(self._element_stack) > 0:
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree_TreeBuilder *)__pyx_v_self->__pyx_base.__pyx_vtab)->_flush(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":450
 *     cdef _handleSaxPi(self, target, data):
 *         self._flush()
 *         self._last = ProcessingInstruction(target, data)             # <<<<<<<<<<<<<<
 *         if python.PyList_GET_SIZE(self._element_stack) > 0:
 *             _appendChild(self._element_stack[-1], self._last)
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s_79); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(__pyx_v_target);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_target);
  __Pyx_GIVEREF(__pyx_v_target);
  __Pyx_INCREF(__pyx_v_data);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_data);
  __Pyx_GIVEREF(__pyx_v_data);
  __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_GOTREF(__pyx_v_self->_last);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_last));
  __pyx_v_self->_last = ((struct LxmlElement *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":451
 *         self._flush()
 *         self._last = ProcessingInstruction(target, data)
 *         if python.PyList_GET_SIZE(self._element_stack) > 0:             # <<<<<<<<<<<<<<
 *             _appendChild(self._element_stack[-1], self._last)
 *         self._in_tail = 1
 */
  __pyx_t_4 = ((PyObject *)__pyx_v_self->_element_stack);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_5 = (PyList_GET_SIZE(__pyx_t_4) > 0);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_5) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":452
 *         self._last = ProcessingInstruction(target, data)
 *         if python.PyList_GET_SIZE(self._element_stack) > 0:
 *             _appendChild(self._element_stack[-1], self._last)             # <<<<<<<<<<<<<<
 *         self._in_tail = 1
 *         return self._last
 */
    __pyx_t_4 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_self->_element_stack), -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = ((PyObject *)__pyx_v_self->_last);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_1 = __pyx_f_4lxml_5etree__appendChild(((struct LxmlElement *)__pyx_t_4), ((struct LxmlElement *)__pyx_t_3)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":453
 *         if python.PyList_GET_SIZE(self._element_stack) > 0:
 *             _appendChild(self._element_stack[-1], self._last)
 *         self._in_tail = 1             # <<<<<<<<<<<<<<
 *         return self._last
 * 
 */
  __pyx_v_self->_in_tail = 1;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":454
 *             _appendChild(self._element_stack[-1], self._last)
 *         self._in_tail = 1
 *         return self._last             # <<<<<<<<<<<<<<
 * 
 *     cdef _handleSaxComment(self, comment):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_last));
  __pyx_r = ((PyObject *)__pyx_v_self->_last);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.TreeBuilder._handleSaxPi");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":456
 *         return self._last
 * 
 *     cdef _handleSaxComment(self, comment):             # <<<<<<<<<<<<<<
 *         self._flush()
 *         self._last = Comment(comment)
 */

static  PyObject *__pyx_f_4lxml_5etree_11TreeBuilder__handleSaxComment(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self, PyObject *__pyx_v_comment) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("_handleSaxComment");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":457
 * 
 *     cdef _handleSaxComment(self, comment):
 *         self._flush()             # <<<<<<<<<<<<<<
 *         self._last = Comment(comment)
 *         if python.PyList_GET_SIZE(self._element_stack) > 0:
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree_TreeBuilder *)__pyx_v_self->__pyx_base.__pyx_vtab)->_flush(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":458
 *     cdef _handleSaxComment(self, comment):
 *         self._flush()
 *         self._last = Comment(comment)             # <<<<<<<<<<<<<<
 *         if python.PyList_GET_SIZE(self._element_stack) > 0:
 *             _appendChild(self._element_stack[-1], self._last)
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__Comment); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(__pyx_v_comment);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_comment);
  __Pyx_GIVEREF(__pyx_v_comment);
  __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_GOTREF(__pyx_v_self->_last);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_last));
  __pyx_v_self->_last = ((struct LxmlElement *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":459
 *         self._flush()
 *         self._last = Comment(comment)
 *         if python.PyList_GET_SIZE(self._element_stack) > 0:             # <<<<<<<<<<<<<<
 *             _appendChild(self._element_stack[-1], self._last)
 *         self._in_tail = 1
 */
  __pyx_t_4 = ((PyObject *)__pyx_v_self->_element_stack);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_5 = (PyList_GET_SIZE(__pyx_t_4) > 0);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_5) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":460
 *         self._last = Comment(comment)
 *         if python.PyList_GET_SIZE(self._element_stack) > 0:
 *             _appendChild(self._element_stack[-1], self._last)             # <<<<<<<<<<<<<<
 *         self._in_tail = 1
 *         return self._last
 */
    __pyx_t_4 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_self->_element_stack), -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = ((PyObject *)__pyx_v_self->_last);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_1 = __pyx_f_4lxml_5etree__appendChild(((struct LxmlElement *)__pyx_t_4), ((struct LxmlElement *)__pyx_t_3)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":461
 *         if python.PyList_GET_SIZE(self._element_stack) > 0:
 *             _appendChild(self._element_stack[-1], self._last)
 *         self._in_tail = 1             # <<<<<<<<<<<<<<
 *         return self._last
 */
  __pyx_v_self->_in_tail = 1;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/saxparser.pxi":462
 *             _appendChild(self._element_stack[-1], self._last)
 *         self._in_tail = 1
 *         return self._last             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_last));
  __pyx_r = ((PyObject *)__pyx_v_self->_last);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.TreeBuilder._handleSaxComment");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":10
 *     # to push the Python level parser result through the parser
 *     # machinery towards the API level functions
 *     def __init__(self, result):             # <<<<<<<<<<<<<<
 *         self.result = result
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_19_TargetParserResult___init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_19_TargetParserResult___init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pf_4lxml_5etree_19_TargetParserResult___init__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pf_4lxml_5etree_19_TargetParserResult___init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_result = 0;
  PyObject *__pyx_r = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__result,0};
  __Pyx_RefNannySetupContext("__init__");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__result);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[13]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_self = values[0];
    __pyx_v_result = values[1];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_result = PyTuple_GET_ITEM(__pyx_args, 1);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[13]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._TargetParserResult.__init__");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":11
 *     # machinery towards the API level functions
 *     def __init__(self, result):
 *         self.result = result             # <<<<<<<<<<<<<<
 * 
 * cdef class _PythonSaxParserTarget(_SaxParserTarget):
 */
  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__result, __pyx_v_result) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._TargetParserResult.__init__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":22
 *     cdef bint _start_takes_nsmap
 * 
 *     def __cinit__(self, target):             # <<<<<<<<<<<<<<
 *         cdef int event_filter
 *         event_filter = 0
 */

static int __pyx_pf_4lxml_5etree_22_PythonSaxParserTarget___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_22_PythonSaxParserTarget___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_target = 0;
  int __pyx_v_event_filter;
  PyObject *__pyx_v_arguments;
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__target,0};
  __Pyx_RefNannySetupContext("__cinit__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[1] = {0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__target);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_target = values[0];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_target = PyTuple_GET_ITEM(__pyx_args, 0);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[13]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._PythonSaxParserTarget.__cinit__");
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_arguments = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":24
 *     def __cinit__(self, target):
 *         cdef int event_filter
 *         event_filter = 0             # <<<<<<<<<<<<<<
 *         self._start_takes_nsmap = 0
 *         try:
 */
  __pyx_v_event_filter = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":25
 *         cdef int event_filter
 *         event_filter = 0
 *         self._start_takes_nsmap = 0             # <<<<<<<<<<<<<<
 *         try:
 *             self._target_start = target.start
 */
  ((struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *)__pyx_v_self)->_start_takes_nsmap = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":26
 *         event_filter = 0
 *         self._start_takes_nsmap = 0
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_start = target.start
 *             if self._target_start is not None:
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":27
 *         self._start_takes_nsmap = 0
 *         try:
 *             self._target_start = target.start             # <<<<<<<<<<<<<<
 *             if self._target_start is not None:
 *                 event_filter = event_filter | SAX_EVENT_START
 */
      __pyx_t_1 = PyObject_GetAttr(__pyx_v_target, __pyx_n_s__start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *)__pyx_v_self)->_target_start);
      __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *)__pyx_v_self)->_target_start);
      ((struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *)__pyx_v_self)->_target_start = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":28
 *         try:
 *             self._target_start = target.start
 *             if self._target_start is not None:             # <<<<<<<<<<<<<<
 *                 event_filter = event_filter | SAX_EVENT_START
 *         except AttributeError:
 */
      __pyx_t_2 = (((struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *)__pyx_v_self)->_target_start != Py_None);
      if (__pyx_t_2) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":29
 *             self._target_start = target.start
 *             if self._target_start is not None:
 *                 event_filter = event_filter | SAX_EVENT_START             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             pass
 */
        __pyx_v_event_filter = (__pyx_v_event_filter | __pyx_e_4lxml_5etree_SAX_EVENT_START);
        goto __pyx_L14;
      }
      __pyx_L14:;
    }
    /*else:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":33
 *             pass
 *         else:
 *             try:             # <<<<<<<<<<<<<<
 *                 arguments = inspect_getargspec(self._target_start)
 *                 if len(arguments[0]) > 3 or arguments[1] is not None:
 */
      {
        PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
        __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
        __Pyx_XGOTREF(__pyx_save_exc_type);
        __Pyx_XGOTREF(__pyx_save_exc_value);
        __Pyx_XGOTREF(__pyx_save_exc_tb);
        /*try:*/ {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":34
 *         else:
 *             try:
 *                 arguments = inspect_getargspec(self._target_start)             # <<<<<<<<<<<<<<
 *                 if len(arguments[0]) > 3 or arguments[1] is not None:
 *                     self._start_takes_nsmap = 1
 */
          __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
          __Pyx_GOTREF(((PyObject *)__pyx_t_1));
          __Pyx_INCREF(((struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *)__pyx_v_self)->_target_start);
          PyTuple_SET_ITEM(__pyx_t_1, 0, ((struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *)__pyx_v_self)->_target_start);
          __Pyx_GIVEREF(((struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *)__pyx_v_self)->_target_start);
          __pyx_t_3 = PyObject_Call(__pyx_v_4lxml_5etree_inspect_getargspec, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_v_arguments);
          __pyx_v_arguments = __pyx_t_3;
          __pyx_t_3 = 0;

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":35
 *             try:
 *                 arguments = inspect_getargspec(self._target_start)
 *                 if len(arguments[0]) > 3 or arguments[1] is not None:             # <<<<<<<<<<<<<<
 *                     self._start_takes_nsmap = 1
 *             except TypeError:
 */
          __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_arguments, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_4 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_2 = (__pyx_t_4 > 3);
          if (!__pyx_t_2) {
            __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_arguments, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
            __Pyx_GOTREF(__pyx_t_3);
            __pyx_t_5 = (__pyx_t_3 != Py_None);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            __pyx_t_6 = __pyx_t_5;
          } else {
            __pyx_t_6 = __pyx_t_2;
          }
          if (__pyx_t_6) {

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":36
 *                 arguments = inspect_getargspec(self._target_start)
 *                 if len(arguments[0]) > 3 or arguments[1] is not None:
 *                     self._start_takes_nsmap = 1             # <<<<<<<<<<<<<<
 *             except TypeError:
 *                 pass
 */
            ((struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *)__pyx_v_self)->_start_takes_nsmap = 1;
            goto __pyx_L23;
          }
          __pyx_L23:;
        }
        __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
        __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
        __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
        goto __pyx_L22_try_end;
        __pyx_L15_error:;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":37
 *                 if len(arguments[0]) > 3 or arguments[1] is not None:
 *                     self._start_takes_nsmap = 1
 *             except TypeError:             # <<<<<<<<<<<<<<
 *                 pass
 *         try:
 */
        __pyx_t_7 = PyErr_ExceptionMatches(__pyx_builtin_TypeError);
        if (__pyx_t_7) {
          PyErr_Restore(0,0,0);
          goto __pyx_L16_exception_handled;
        }
        __Pyx_XGIVEREF(__pyx_save_exc_type);
        __Pyx_XGIVEREF(__pyx_save_exc_value);
        __Pyx_XGIVEREF(__pyx_save_exc_tb);
        __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
        goto __pyx_L8_except_error;
        __pyx_L16_exception_handled:;
        __Pyx_XGIVEREF(__pyx_save_exc_type);
        __Pyx_XGIVEREF(__pyx_save_exc_value);
        __Pyx_XGIVEREF(__pyx_save_exc_tb);
        __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
        __pyx_L22_try_end:;
      }
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L13_try_end;
    __pyx_L6_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":30
 *             if self._target_start is not None:
 *                 event_filter = event_filter | SAX_EVENT_START
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             pass
 *         else:
 */
    __pyx_t_7 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
    if (__pyx_t_7) {
      PyErr_Restore(0,0,0);
      goto __pyx_L7_exception_handled;
    }
    __pyx_L8_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L7_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L13_try_end:;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":39
 *             except TypeError:
 *                 pass
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_end = target.end
 *             if self._target_end is not None:
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":40
 *                 pass
 *         try:
 *             self._target_end = target.end             # <<<<<<<<<<<<<<
 *             if self._target_end is not None:
 *                 event_filter = event_filter | SAX_EVENT_END
 */
      __pyx_t_3 = PyObject_GetAttr(__pyx_v_target, __pyx_n_s__end); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L24_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *)__pyx_v_self)->_target_end);
      __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *)__pyx_v_self)->_target_end);
      ((struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *)__pyx_v_self)->_target_end = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":41
 *         try:
 *             self._target_end = target.end
 *             if self._target_end is not None:             # <<<<<<<<<<<<<<
 *                 event_filter = event_filter | SAX_EVENT_END
 *         except AttributeError:
 */
      __pyx_t_6 = (((struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *)__pyx_v_self)->_target_end != Py_None);
      if (__pyx_t_6) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":42
 *             self._target_end = target.end
 *             if self._target_end is not None:
 *                 event_filter = event_filter | SAX_EVENT_END             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             pass
 */
        __pyx_v_event_filter = (__pyx_v_event_filter | __pyx_e_4lxml_5etree_SAX_EVENT_END);
        goto __pyx_L32;
      }
      __pyx_L32:;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L31_try_end;
    __pyx_L24_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":43
 *             if self._target_end is not None:
 *                 event_filter = event_filter | SAX_EVENT_END
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             pass
 *         try:
 */
    __pyx_t_7 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
    if (__pyx_t_7) {
      PyErr_Restore(0,0,0);
      goto __pyx_L25_exception_handled;
    }
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L25_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L31_try_end:;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":45
 *         except AttributeError:
 *             pass
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_data = target.data
 *             if self._target_data is not None:
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":46
 *             pass
 *         try:
 *             self._target_data = target.data             # <<<<<<<<<<<<<<
 *             if self._target_data is not None:
 *                 event_filter = event_filter | SAX_EVENT_DATA
 */
      __pyx_t_3 = PyObject_GetAttr(__pyx_v_target, __pyx_n_s__data); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L33_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *)__pyx_v_self)->_target_data);
      __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *)__pyx_v_self)->_target_data);
      ((struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *)__pyx_v_self)->_target_data = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":47
 *         try:
 *             self._target_data = target.data
 *             if self._target_data is not None:             # <<<<<<<<<<<<<<
 *                 event_filter = event_filter | SAX_EVENT_DATA
 *         except AttributeError:
 */
      __pyx_t_6 = (((struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *)__pyx_v_self)->_target_data != Py_None);
      if (__pyx_t_6) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":48
 *             self._target_data = target.data
 *             if self._target_data is not None:
 *                 event_filter = event_filter | SAX_EVENT_DATA             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             pass
 */
        __pyx_v_event_filter = (__pyx_v_event_filter | __pyx_e_4lxml_5etree_SAX_EVENT_DATA);
        goto __pyx_L41;
      }
      __pyx_L41:;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L40_try_end;
    __pyx_L33_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":49
 *             if self._target_data is not None:
 *                 event_filter = event_filter | SAX_EVENT_DATA
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             pass
 *         try:
 */
    __pyx_t_7 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
    if (__pyx_t_7) {
      PyErr_Restore(0,0,0);
      goto __pyx_L34_exception_handled;
    }
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L34_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L40_try_end:;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":51
 *         except AttributeError:
 *             pass
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_doctype = target.doctype
 *             if self._target_doctype is not None:
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":52
 *             pass
 *         try:
 *             self._target_doctype = target.doctype             # <<<<<<<<<<<<<<
 *             if self._target_doctype is not None:
 *                 event_filter = event_filter | SAX_EVENT_DOCTYPE
 */
      __pyx_t_3 = PyObject_GetAttr(__pyx_v_target, __pyx_n_s__doctype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L42_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *)__pyx_v_self)->_target_doctype);
      __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *)__pyx_v_self)->_target_doctype);
      ((struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *)__pyx_v_self)->_target_doctype = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":53
 *         try:
 *             self._target_doctype = target.doctype
 *             if self._target_doctype is not None:             # <<<<<<<<<<<<<<
 *                 event_filter = event_filter | SAX_EVENT_DOCTYPE
 *         except AttributeError:
 */
      __pyx_t_6 = (((struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *)__pyx_v_self)->_target_doctype != Py_None);
      if (__pyx_t_6) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":54
 *             self._target_doctype = target.doctype
 *             if self._target_doctype is not None:
 *                 event_filter = event_filter | SAX_EVENT_DOCTYPE             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             pass
 */
        __pyx_v_event_filter = (__pyx_v_event_filter | __pyx_e_4lxml_5etree_SAX_EVENT_DOCTYPE);
        goto __pyx_L50;
      }
      __pyx_L50:;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L49_try_end;
    __pyx_L42_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":55
 *             if self._target_doctype is not None:
 *                 event_filter = event_filter | SAX_EVENT_DOCTYPE
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             pass
 *         try:
 */
    __pyx_t_7 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
    if (__pyx_t_7) {
      PyErr_Restore(0,0,0);
      goto __pyx_L43_exception_handled;
    }
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L43_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L49_try_end:;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":57
 *         except AttributeError:
 *             pass
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_pi = target.pi
 *             if self._target_pi is not None:
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":58
 *             pass
 *         try:
 *             self._target_pi = target.pi             # <<<<<<<<<<<<<<
 *             if self._target_pi is not None:
 *                 event_filter = event_filter | SAX_EVENT_PI
 */
      __pyx_t_3 = PyObject_GetAttr(__pyx_v_target, __pyx_n_s__pi); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L51_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *)__pyx_v_self)->_target_pi);
      __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *)__pyx_v_self)->_target_pi);
      ((struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *)__pyx_v_self)->_target_pi = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":59
 *         try:
 *             self._target_pi = target.pi
 *             if self._target_pi is not None:             # <<<<<<<<<<<<<<
 *                 event_filter = event_filter | SAX_EVENT_PI
 *         except AttributeError:
 */
      __pyx_t_6 = (((struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *)__pyx_v_self)->_target_pi != Py_None);
      if (__pyx_t_6) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":60
 *             self._target_pi = target.pi
 *             if self._target_pi is not None:
 *                 event_filter = event_filter | SAX_EVENT_PI             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             pass
 */
        __pyx_v_event_filter = (__pyx_v_event_filter | __pyx_e_4lxml_5etree_SAX_EVENT_PI);
        goto __pyx_L59;
      }
      __pyx_L59:;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L58_try_end;
    __pyx_L51_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":61
 *             if self._target_pi is not None:
 *                 event_filter = event_filter | SAX_EVENT_PI
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             pass
 *         try:
 */
    __pyx_t_7 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
    if (__pyx_t_7) {
      PyErr_Restore(0,0,0);
      goto __pyx_L52_exception_handled;
    }
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L52_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L58_try_end:;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":63
 *         except AttributeError:
 *             pass
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_comment = target.comment
 *             if self._target_comment is not None:
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":64
 *             pass
 *         try:
 *             self._target_comment = target.comment             # <<<<<<<<<<<<<<
 *             if self._target_comment is not None:
 *                 event_filter = event_filter | SAX_EVENT_COMMENT
 */
      __pyx_t_3 = PyObject_GetAttr(__pyx_v_target, __pyx_n_s__comment); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L60_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *)__pyx_v_self)->_target_comment);
      __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *)__pyx_v_self)->_target_comment);
      ((struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *)__pyx_v_self)->_target_comment = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":65
 *         try:
 *             self._target_comment = target.comment
 *             if self._target_comment is not None:             # <<<<<<<<<<<<<<
 *                 event_filter = event_filter | SAX_EVENT_COMMENT
 *         except AttributeError:
 */
      __pyx_t_6 = (((struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *)__pyx_v_self)->_target_comment != Py_None);
      if (__pyx_t_6) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":66
 *             self._target_comment = target.comment
 *             if self._target_comment is not None:
 *                 event_filter = event_filter | SAX_EVENT_COMMENT             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             pass
 */
        __pyx_v_event_filter = (__pyx_v_event_filter | __pyx_e_4lxml_5etree_SAX_EVENT_COMMENT);
        goto __pyx_L68;
      }
      __pyx_L68:;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L67_try_end;
    __pyx_L60_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":67
 *             if self._target_comment is not None:
 *                 event_filter = event_filter | SAX_EVENT_COMMENT
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             pass
 *         self._sax_event_filter = event_filter
 */
    __pyx_t_7 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
    if (__pyx_t_7) {
      PyErr_Restore(0,0,0);
      goto __pyx_L61_exception_handled;
    }
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L61_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L67_try_end:;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":69
 *         except AttributeError:
 *             pass
 *         self._sax_event_filter = event_filter             # <<<<<<<<<<<<<<
 * 
 *     cdef _handleSaxStart(self, tag, attrib, nsmap):
 */
  ((struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *)__pyx_v_self)->__pyx_base._sax_event_filter = __pyx_v_event_filter;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._PythonSaxParserTarget.__cinit__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_arguments);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":71
 *         self._sax_event_filter = event_filter
 * 
 *     cdef _handleSaxStart(self, tag, attrib, nsmap):             # <<<<<<<<<<<<<<
 *         if self._start_takes_nsmap:
 *             return self._target_start(tag, attrib, nsmap)
 */

static  PyObject *__pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxStart(struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_handleSaxStart");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":72
 * 
 *     cdef _handleSaxStart(self, tag, attrib, nsmap):
 *         if self._start_takes_nsmap:             # <<<<<<<<<<<<<<
 *             return self._target_start(tag, attrib, nsmap)
 *         else:
 */
  if (__pyx_v_self->_start_takes_nsmap) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":73
 *     cdef _handleSaxStart(self, tag, attrib, nsmap):
 *         if self._start_takes_nsmap:
 *             return self._target_start(tag, attrib, nsmap)             # <<<<<<<<<<<<<<
 *         else:
 *             return self._target_start(tag, attrib)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __Pyx_INCREF(__pyx_v_tag);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_tag);
    __Pyx_GIVEREF(__pyx_v_tag);
    __Pyx_INCREF(__pyx_v_attrib);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_attrib);
    __Pyx_GIVEREF(__pyx_v_attrib);
    __Pyx_INCREF(__pyx_v_nsmap);
    PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_nsmap);
    __Pyx_GIVEREF(__pyx_v_nsmap);
    __pyx_t_2 = PyObject_Call(__pyx_v_self->_target_start, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":75
 *             return self._target_start(tag, attrib, nsmap)
 *         else:
 *             return self._target_start(tag, attrib)             # <<<<<<<<<<<<<<
 * 
 *     cdef _handleSaxEnd(self, tag):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __Pyx_INCREF(__pyx_v_tag);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_tag);
    __Pyx_GIVEREF(__pyx_v_tag);
    __Pyx_INCREF(__pyx_v_attrib);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_attrib);
    __Pyx_GIVEREF(__pyx_v_attrib);
    __pyx_t_1 = PyObject_Call(__pyx_v_self->_target_start, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._PythonSaxParserTarget._handleSaxStart");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":77
 *             return self._target_start(tag, attrib)
 * 
 *     cdef _handleSaxEnd(self, tag):             # <<<<<<<<<<<<<<
 *         return self._target_end(tag)
 * 
 */

static  PyObject *__pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxEnd(struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *__pyx_v_self, PyObject *__pyx_v_tag) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_handleSaxEnd");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":78
 * 
 *     cdef _handleSaxEnd(self, tag):
 *         return self._target_end(tag)             # <<<<<<<<<<<<<<
 * 
 *     cdef int _handleSaxData(self, data) except -1:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_tag);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_tag);
  __Pyx_GIVEREF(__pyx_v_tag);
  __pyx_t_2 = PyObject_Call(__pyx_v_self->_target_end, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._PythonSaxParserTarget._handleSaxEnd");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":80
 *         return self._target_end(tag)
 * 
 *     cdef int _handleSaxData(self, data) except -1:             # <<<<<<<<<<<<<<
 *         self._target_data(data)
 * 
 */

static  int __pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxData(struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *__pyx_v_self, PyObject *__pyx_v_data) {
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_handleSaxData");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":81
 * 
 *     cdef int _handleSaxData(self, data) except -1:
 *         self._target_data(data)             # <<<<<<<<<<<<<<
 * 
 *     cdef int _handleSaxDoctype(self, root_tag, public_id, system_id) except -1:
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_data);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_data);
  __Pyx_GIVEREF(__pyx_v_data);
  __pyx_t_2 = PyObject_Call(__pyx_v_self->_target_data, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._PythonSaxParserTarget._handleSaxData");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":83
 *         self._target_data(data)
 * 
 *     cdef int _handleSaxDoctype(self, root_tag, public_id, system_id) except -1:             # <<<<<<<<<<<<<<
 *         self._target_doctype(root_tag, public_id, system_id)
 * 
 */

static  int __pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxDoctype(struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *__pyx_v_self, PyObject *__pyx_v_root_tag, PyObject *__pyx_v_public_id, PyObject *__pyx_v_system_id) {
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_handleSaxDoctype");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":84
 * 
 *     cdef int _handleSaxDoctype(self, root_tag, public_id, system_id) except -1:
 *         self._target_doctype(root_tag, public_id, system_id)             # <<<<<<<<<<<<<<
 * 
 *     cdef _handleSaxPi(self, target, data):
 */
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_root_tag);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_root_tag);
  __Pyx_GIVEREF(__pyx_v_root_tag);
  __Pyx_INCREF(__pyx_v_public_id);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_public_id);
  __Pyx_GIVEREF(__pyx_v_public_id);
  __Pyx_INCREF(__pyx_v_system_id);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_system_id);
  __Pyx_GIVEREF(__pyx_v_system_id);
  __pyx_t_2 = PyObject_Call(__pyx_v_self->_target_doctype, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._PythonSaxParserTarget._handleSaxDoctype");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":86
 *         self._target_doctype(root_tag, public_id, system_id)
 * 
 *     cdef _handleSaxPi(self, target, data):             # <<<<<<<<<<<<<<
 *         return self._target_pi(target, data)
 * 
 */

static  PyObject *__pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxPi(struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *__pyx_v_self, PyObject *__pyx_v_target, PyObject *__pyx_v_data) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_handleSaxPi");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":87
 * 
 *     cdef _handleSaxPi(self, target, data):
 *         return self._target_pi(target, data)             # <<<<<<<<<<<<<<
 * 
 *     cdef _handleSaxComment(self, comment):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_target);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_target);
  __Pyx_GIVEREF(__pyx_v_target);
  __Pyx_INCREF(__pyx_v_data);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_data);
  __Pyx_GIVEREF(__pyx_v_data);
  __pyx_t_2 = PyObject_Call(__pyx_v_self->_target_pi, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._PythonSaxParserTarget._handleSaxPi");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":89
 *         return self._target_pi(target, data)
 * 
 *     cdef _handleSaxComment(self, comment):             # <<<<<<<<<<<<<<
 *         return self._target_comment(comment)
 * 
 */

static  PyObject *__pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxComment(struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *__pyx_v_self, PyObject *__pyx_v_comment) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_handleSaxComment");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":90
 * 
 *     cdef _handleSaxComment(self, comment):
 *         return self._target_comment(comment)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_comment);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_comment);
  __Pyx_GIVEREF(__pyx_v_comment);
  __pyx_t_2 = PyObject_Call(__pyx_v_self->_target_comment, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._PythonSaxParserTarget._handleSaxComment");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":97
 *     """
 *     cdef object _python_target
 *     cdef int _setTarget(self, target) except -1:             # <<<<<<<<<<<<<<
 *         self._python_target = target
 *         if not isinstance(target, _SaxParserTarget) or \
 */

static  int __pyx_f_4lxml_5etree_20_TargetParserContext__setTarget(struct __pyx_obj_4lxml_5etree__TargetParserContext *__pyx_v_self, PyObject *__pyx_v_target) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("_setTarget");
  __Pyx_INCREF(__pyx_v_target);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":98
 *     cdef object _python_target
 *     cdef int _setTarget(self, target) except -1:
 *         self._python_target = target             # <<<<<<<<<<<<<<
 *         if not isinstance(target, _SaxParserTarget) or \
 *                 hasattr(target, u'__dict__'):
 */
  __Pyx_INCREF(__pyx_v_target);
  __Pyx_GIVEREF(__pyx_v_target);
  __Pyx_GOTREF(__pyx_v_self->_python_target);
  __Pyx_DECREF(__pyx_v_self->_python_target);
  __pyx_v_self->_python_target = __pyx_v_target;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":99
 *     cdef int _setTarget(self, target) except -1:
 *         self._python_target = target
 *         if not isinstance(target, _SaxParserTarget) or \             # <<<<<<<<<<<<<<
 *                 hasattr(target, u'__dict__'):
 *             target = _PythonSaxParserTarget(target)
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_target, ((PyObject*)__pyx_ptype_4lxml_5etree__SaxParserTarget)); 
  __pyx_t_2 = (!__pyx_t_1);
  if (!__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":100
 *         self._python_target = target
 *         if not isinstance(target, _SaxParserTarget) or \
 *                 hasattr(target, u'__dict__'):             # <<<<<<<<<<<<<<
 *             target = _PythonSaxParserTarget(target)
 *         self._setSaxParserTarget(target)
 */
    __pyx_t_1 = PyObject_HasAttr(__pyx_v_target, ((PyObject *)__pyx_n_u____dict__)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = __pyx_t_1;
  } else {
    __pyx_t_3 = __pyx_t_2;
  }
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":101
 *         if not isinstance(target, _SaxParserTarget) or \
 *                 hasattr(target, u'__dict__'):
 *             target = _PythonSaxParserTarget(target)             # <<<<<<<<<<<<<<
 *         self._setSaxParserTarget(target)
 *         return 0
 */
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_INCREF(__pyx_v_target);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_target);
    __Pyx_GIVEREF(__pyx_v_target);
    __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__PythonSaxParserTarget)), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_v_target);
    __pyx_v_target = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":102
 *                 hasattr(target, u'__dict__'):
 *             target = _PythonSaxParserTarget(target)
 *         self._setSaxParserTarget(target)             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  if (!(likely(((__pyx_v_target) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_target, __pyx_ptype_4lxml_5etree__SaxParserTarget))))) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_vtabstruct_4lxml_5etree__TargetParserContext *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base._setSaxParserTarget(((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_v_self), ((struct __pyx_obj_4lxml_5etree__SaxParserTarget *)__pyx_v_target));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":103
 *             target = _PythonSaxParserTarget(target)
 *         self._setSaxParserTarget(target)
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cdef _ParserContext _copy(self):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._TargetParserContext._setTarget");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_target);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":105
 *         return 0
 * 
 *     cdef _ParserContext _copy(self):             # <<<<<<<<<<<<<<
 *         cdef _TargetParserContext context
 *         context = _ParserContext._copy(self)
 */

static  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_f_4lxml_5etree_20_TargetParserContext__copy(struct __pyx_obj_4lxml_5etree__TargetParserContext *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree__TargetParserContext *__pyx_v_context;
  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("_copy");
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__TargetParserContext *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":107
 *     cdef _ParserContext _copy(self):
 *         cdef _TargetParserContext context
 *         context = _ParserContext._copy(self)             # <<<<<<<<<<<<<<
 *         context._setTarget(self._python_target)
 *         return context
 */
  __pyx_t_1 = ((PyObject *)__pyx_vtabptr_4lxml_5etree__ParserContext->_copy(((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_v_self))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__TargetParserContext))))) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_v_context));
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__TargetParserContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":108
 *         cdef _TargetParserContext context
 *         context = _ParserContext._copy(self)
 *         context._setTarget(self._python_target)             # <<<<<<<<<<<<<<
 *         return context
 * 
 */
  __pyx_t_1 = __pyx_v_self->_python_target;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__TargetParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->_setTarget(__pyx_v_context, __pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":109
 *         context = _ParserContext._copy(self)
 *         context._setTarget(self._python_target)
 *         return context             # <<<<<<<<<<<<<<
 * 
 *     cdef void _cleanupTargetParserContext(self, xmlDoc* result):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_context));
  __pyx_r = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_v_context);
  goto __pyx_L0;

  __pyx_r = ((struct __pyx_obj_4lxml_5etree__ParserContext *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._TargetParserContext._copy");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_context);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":111
 *         return context
 * 
 *     cdef void _cleanupTargetParserContext(self, xmlDoc* result):             # <<<<<<<<<<<<<<
 *         if self._c_ctxt.myDoc is not NULL:
 *             if self._c_ctxt.myDoc is not result and \
 */

static  void __pyx_f_4lxml_5etree_20_TargetParserContext__cleanupTargetParserContext(struct __pyx_obj_4lxml_5etree__TargetParserContext *__pyx_v_self, xmlDoc *__pyx_v_result) {
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("_cleanupTargetParserContext");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":112
 * 
 *     cdef void _cleanupTargetParserContext(self, xmlDoc* result):
 *         if self._c_ctxt.myDoc is not NULL:             # <<<<<<<<<<<<<<
 *             if self._c_ctxt.myDoc is not result and \
 *                     self._c_ctxt.myDoc._private is NULL:
 */
  __pyx_t_1 = (__pyx_v_self->__pyx_base.__pyx_base._c_ctxt->myDoc != NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":113
 *     cdef void _cleanupTargetParserContext(self, xmlDoc* result):
 *         if self._c_ctxt.myDoc is not NULL:
 *             if self._c_ctxt.myDoc is not result and \             # <<<<<<<<<<<<<<
 *                     self._c_ctxt.myDoc._private is NULL:
 *                 # no _Document proxy => orphen
 */
    __pyx_t_1 = (__pyx_v_self->__pyx_base.__pyx_base._c_ctxt->myDoc != __pyx_v_result);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":114
 *         if self._c_ctxt.myDoc is not NULL:
 *             if self._c_ctxt.myDoc is not result and \
 *                     self._c_ctxt.myDoc._private is NULL:             # <<<<<<<<<<<<<<
 *                 # no _Document proxy => orphen
 *                 tree.xmlFreeDoc(self._c_ctxt.myDoc)
 */
      __pyx_t_2 = (__pyx_v_self->__pyx_base.__pyx_base._c_ctxt->myDoc->_private == NULL);
      __pyx_t_3 = __pyx_t_2;
    } else {
      __pyx_t_3 = __pyx_t_1;
    }
    if (__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":116
 *                     self._c_ctxt.myDoc._private is NULL:
 *                 # no _Document proxy => orphen
 *                 tree.xmlFreeDoc(self._c_ctxt.myDoc)             # <<<<<<<<<<<<<<
 *             self._c_ctxt.myDoc = NULL
 * 
 */
      xmlFreeDoc(__pyx_v_self->__pyx_base.__pyx_base._c_ctxt->myDoc);
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":117
 *                 # no _Document proxy => orphen
 *                 tree.xmlFreeDoc(self._c_ctxt.myDoc)
 *             self._c_ctxt.myDoc = NULL             # <<<<<<<<<<<<<<
 * 
 *     cdef object _handleParseResult(self, _BaseParser parser, xmlDoc* result,
 */
    __pyx_v_self->__pyx_base.__pyx_base._c_ctxt->myDoc = NULL;
    goto __pyx_L3;
  }
  __pyx_L3:;

  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":119
 *             self._c_ctxt.myDoc = NULL
 * 
 *     cdef object _handleParseResult(self, _BaseParser parser, xmlDoc* result,             # <<<<<<<<<<<<<<
 *                                    filename):
 *         cdef bint recover
 */

static  PyObject *__pyx_f_4lxml_5etree_20_TargetParserContext__handleParseResult(struct __pyx_obj_4lxml_5etree__TargetParserContext *__pyx_v_self, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser, xmlDoc *__pyx_v_result, PyObject *__pyx_v_filename) {
  int __pyx_v_recover;
  PyObject *__pyx_v_parse_result;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("_handleParseResult");
  __pyx_v_parse_result = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":122
 *                                    filename):
 *         cdef bint recover
 *         recover = parser._parse_options & xmlparser.XML_PARSE_RECOVER             # <<<<<<<<<<<<<<
 *         try:
 *             if self._has_raised():
 */
  __pyx_v_recover = (__pyx_v_parser->_parse_options & XML_PARSE_RECOVER);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":123
 *         cdef bint recover
 *         recover = parser._parse_options & xmlparser.XML_PARSE_RECOVER
 *         try:             # <<<<<<<<<<<<<<
 *             if self._has_raised():
 *                 self._cleanupTargetParserContext(result)
 */
  /*try:*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":124
 *         recover = parser._parse_options & xmlparser.XML_PARSE_RECOVER
 *         try:
 *             if self._has_raised():             # <<<<<<<<<<<<<<
 *                 self._cleanupTargetParserContext(result)
 *                 self._raise_if_stored()
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__TargetParserContext *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.__pyx_base.__pyx_base._has_raised(((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_v_self));
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":125
 *         try:
 *             if self._has_raised():
 *                 self._cleanupTargetParserContext(result)             # <<<<<<<<<<<<<<
 *                 self._raise_if_stored()
 *             if not self._c_ctxt.wellFormed and not recover:
 */
      ((struct __pyx_vtabstruct_4lxml_5etree__TargetParserContext *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->_cleanupTargetParserContext(__pyx_v_self, __pyx_v_result);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":126
 *             if self._has_raised():
 *                 self._cleanupTargetParserContext(result)
 *                 self._raise_if_stored()             # <<<<<<<<<<<<<<
 *             if not self._c_ctxt.wellFormed and not recover:
 *                 _raiseParseError(self._c_ctxt, filename, self._error_log)
 */
      __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__TargetParserContext *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.__pyx_base.__pyx_base._raise_if_stored(((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_v_self)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L4;}
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":127
 *                 self._cleanupTargetParserContext(result)
 *                 self._raise_if_stored()
 *             if not self._c_ctxt.wellFormed and not recover:             # <<<<<<<<<<<<<<
 *                 _raiseParseError(self._c_ctxt, filename, self._error_log)
 *         finally:
 */
    __pyx_t_1 = (!__pyx_v_self->__pyx_base.__pyx_base._c_ctxt->wellFormed);
    if (__pyx_t_1) {
      __pyx_t_3 = (!__pyx_v_recover);
      __pyx_t_4 = __pyx_t_3;
    } else {
      __pyx_t_4 = __pyx_t_1;
    }
    if (__pyx_t_4) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":128
 *                 self._raise_if_stored()
 *             if not self._c_ctxt.wellFormed and not recover:
 *                 _raiseParseError(self._c_ctxt, filename, self._error_log)             # <<<<<<<<<<<<<<
 *         finally:
 *             if python.IS_PYTHON3:
 */
      __pyx_t_5 = ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base._error_log);
      __Pyx_INCREF(__pyx_t_5);
      __pyx_t_2 = __pyx_f_4lxml_5etree__raiseParseError(__pyx_v_self->__pyx_base.__pyx_base._c_ctxt, __pyx_v_filename, ((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_t_5)); if (unlikely(__pyx_t_2 == 0)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L4;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L7;
    }
    __pyx_L7:;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":130
 *                 _raiseParseError(self._c_ctxt, filename, self._error_log)
 *         finally:
 *             if python.IS_PYTHON3:             # <<<<<<<<<<<<<<
 *                 parse_result = self._python_target.close()
 *             else:
 */
  /*finally:*/ {
    int __pyx_why;
    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
    int __pyx_exc_lineno;
    __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 0; goto __pyx_L5;
    __pyx_L4: {
      __pyx_why = 4;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
      __pyx_exc_lineno = __pyx_lineno;
      goto __pyx_L5;
    }
    __pyx_L5:;
    if (IS_PYTHON3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":131
 *         finally:
 *             if python.IS_PYTHON3:
 *                 parse_result = self._python_target.close()             # <<<<<<<<<<<<<<
 *             else:
 *                 # Python 2 can't chain exceptions
 */
      __pyx_t_5 = PyObject_GetAttr(__pyx_v_self->_python_target, __pyx_n_s__close); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_v_parse_result);
      __pyx_v_parse_result = __pyx_t_6;
      __pyx_t_6 = 0;
      goto __pyx_L9;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":134
 *             else:
 *                 # Python 2 can't chain exceptions
 *                 try: parse_result = self._python_target.close()             # <<<<<<<<<<<<<<
 *                 except: pass
 *         return parse_result
 */
      {
        PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
        __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
        __Pyx_XGOTREF(__pyx_save_exc_type);
        __Pyx_XGOTREF(__pyx_save_exc_value);
        __Pyx_XGOTREF(__pyx_save_exc_tb);
        /*try:*/ {
          __pyx_t_6 = PyObject_GetAttr(__pyx_v_self->_python_target, __pyx_n_s__close); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_5 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_v_parse_result);
          __pyx_v_parse_result = __pyx_t_5;
          __pyx_t_5 = 0;
        }
        __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
        __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
        __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
        goto __pyx_L17_try_end;
        __pyx_L10_error:;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":135
 *                 # Python 2 can't chain exceptions
 *                 try: parse_result = self._python_target.close()
 *                 except: pass             # <<<<<<<<<<<<<<
 *         return parse_result
 * 
 */
        /*except:*/ {
          PyErr_Restore(0,0,0);
          goto __pyx_L11_exception_handled;
        }
        __pyx_L11_exception_handled:;
        __Pyx_XGIVEREF(__pyx_save_exc_type);
        __Pyx_XGIVEREF(__pyx_save_exc_value);
        __Pyx_XGIVEREF(__pyx_save_exc_tb);
        __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
        __pyx_L17_try_end:;
      }
    }
    __pyx_L9:;
    goto __pyx_L18;
    __pyx_L8_error:;
    if (__pyx_why == 4) {
      Py_XDECREF(__pyx_exc_type);
      Py_XDECREF(__pyx_exc_value);
      Py_XDECREF(__pyx_exc_tb);
    }
    goto __pyx_L1_error;
    __pyx_L18:;
    switch (__pyx_why) {
      case 4: {
        __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
        __pyx_lineno = __pyx_exc_lineno;
        __pyx_exc_type = 0;
        __pyx_exc_value = 0;
        __pyx_exc_tb = 0;
        goto __pyx_L1_error;
      }
    }
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":136
 *                 try: parse_result = self._python_target.close()
 *                 except: pass
 *         return parse_result             # <<<<<<<<<<<<<<
 * 
 *     cdef xmlDoc* _handleParseResultDoc(self, _BaseParser parser,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_parse_result);
  __pyx_r = __pyx_v_parse_result;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._TargetParserContext._handleParseResult");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_parse_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":138
 *         return parse_result
 * 
 *     cdef xmlDoc* _handleParseResultDoc(self, _BaseParser parser,             # <<<<<<<<<<<<<<
 *                                        xmlDoc* result, filename) except NULL:
 *         cdef bint recover
 */

static  xmlDoc *__pyx_f_4lxml_5etree_20_TargetParserContext__handleParseResultDoc(struct __pyx_obj_4lxml_5etree__TargetParserContext *__pyx_v_self, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser, xmlDoc *__pyx_v_result, PyObject *__pyx_v_filename) {
  int __pyx_v_recover;
  PyObject *__pyx_v_parse_result;
  xmlDoc *__pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("_handleParseResultDoc");
  __pyx_v_parse_result = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":141
 *                                        xmlDoc* result, filename) except NULL:
 *         cdef bint recover
 *         recover = parser._parse_options & xmlparser.XML_PARSE_RECOVER             # <<<<<<<<<<<<<<
 *         if result is not NULL and result._private is NULL:
 *             # no _Document proxy => orphen
 */
  __pyx_v_recover = (__pyx_v_parser->_parse_options & XML_PARSE_RECOVER);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":142
 *         cdef bint recover
 *         recover = parser._parse_options & xmlparser.XML_PARSE_RECOVER
 *         if result is not NULL and result._private is NULL:             # <<<<<<<<<<<<<<
 *             # no _Document proxy => orphen
 *             tree.xmlFreeDoc(result)
 */
  __pyx_t_1 = (__pyx_v_result != NULL);
  if (__pyx_t_1) {
    __pyx_t_2 = (__pyx_v_result->_private == NULL);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":144
 *         if result is not NULL and result._private is NULL:
 *             # no _Document proxy => orphen
 *             tree.xmlFreeDoc(result)             # <<<<<<<<<<<<<<
 *         try:
 *             self._cleanupTargetParserContext(result)
 */
    xmlFreeDoc(__pyx_v_result);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":145
 *             # no _Document proxy => orphen
 *             tree.xmlFreeDoc(result)
 *         try:             # <<<<<<<<<<<<<<
 *             self._cleanupTargetParserContext(result)
 *             self._raise_if_stored()
 */
  /*try:*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":146
 *             tree.xmlFreeDoc(result)
 *         try:
 *             self._cleanupTargetParserContext(result)             # <<<<<<<<<<<<<<
 *             self._raise_if_stored()
 *             if not self._c_ctxt.wellFormed and not recover:
 */
    ((struct __pyx_vtabstruct_4lxml_5etree__TargetParserContext *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->_cleanupTargetParserContext(__pyx_v_self, __pyx_v_result);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":147
 *         try:
 *             self._cleanupTargetParserContext(result)
 *             self._raise_if_stored()             # <<<<<<<<<<<<<<
 *             if not self._c_ctxt.wellFormed and not recover:
 *                 _raiseParseError(self._c_ctxt, filename, self._error_log)
 */
    __pyx_t_4 = ((struct __pyx_vtabstruct_4lxml_5etree__TargetParserContext *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.__pyx_base.__pyx_base._raise_if_stored(((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_v_self)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L5;}

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":148
 *             self._cleanupTargetParserContext(result)
 *             self._raise_if_stored()
 *             if not self._c_ctxt.wellFormed and not recover:             # <<<<<<<<<<<<<<
 *                 _raiseParseError(self._c_ctxt, filename, self._error_log)
 *         finally:
 */
    __pyx_t_3 = (!__pyx_v_self->__pyx_base.__pyx_base._c_ctxt->wellFormed);
    if (__pyx_t_3) {
      __pyx_t_1 = (!__pyx_v_recover);
      __pyx_t_2 = __pyx_t_1;
    } else {
      __pyx_t_2 = __pyx_t_3;
    }
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":149
 *             self._raise_if_stored()
 *             if not self._c_ctxt.wellFormed and not recover:
 *                 _raiseParseError(self._c_ctxt, filename, self._error_log)             # <<<<<<<<<<<<<<
 *         finally:
 *             if python.IS_PYTHON3:
 */
      __pyx_t_5 = ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base._error_log);
      __Pyx_INCREF(__pyx_t_5);
      __pyx_t_4 = __pyx_f_4lxml_5etree__raiseParseError(__pyx_v_self->__pyx_base.__pyx_base._c_ctxt, __pyx_v_filename, ((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_t_5)); if (unlikely(__pyx_t_4 == 0)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L5;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L7;
    }
    __pyx_L7:;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":151
 *                 _raiseParseError(self._c_ctxt, filename, self._error_log)
 *         finally:
 *             if python.IS_PYTHON3:             # <<<<<<<<<<<<<<
 *                 parse_result = self._python_target.close()
 *             else:
 */
  /*finally:*/ {
    int __pyx_why;
    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
    int __pyx_exc_lineno;
    __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 0; goto __pyx_L6;
    __pyx_L5: {
      __pyx_why = 4;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
      __pyx_exc_lineno = __pyx_lineno;
      goto __pyx_L6;
    }
    __pyx_L6:;
    if (IS_PYTHON3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":152
 *         finally:
 *             if python.IS_PYTHON3:
 *                 parse_result = self._python_target.close()             # <<<<<<<<<<<<<<
 *             else:
 *                 # Python 2 can't chain exceptions
 */
      __pyx_t_5 = PyObject_GetAttr(__pyx_v_self->_python_target, __pyx_n_s__close); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_v_parse_result);
      __pyx_v_parse_result = __pyx_t_6;
      __pyx_t_6 = 0;
      goto __pyx_L9;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":155
 *             else:
 *                 # Python 2 can't chain exceptions
 *                 try: parse_result = self._python_target.close()             # <<<<<<<<<<<<<<
 *                 except: pass
 *         raise _TargetParserResult(parse_result)
 */
      {
        PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
        __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
        __Pyx_XGOTREF(__pyx_save_exc_type);
        __Pyx_XGOTREF(__pyx_save_exc_value);
        __Pyx_XGOTREF(__pyx_save_exc_tb);
        /*try:*/ {
          __pyx_t_6 = PyObject_GetAttr(__pyx_v_self->_python_target, __pyx_n_s__close); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_5 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_v_parse_result);
          __pyx_v_parse_result = __pyx_t_5;
          __pyx_t_5 = 0;
        }
        __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
        __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
        __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
        goto __pyx_L17_try_end;
        __pyx_L10_error:;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":156
 *                 # Python 2 can't chain exceptions
 *                 try: parse_result = self._python_target.close()
 *                 except: pass             # <<<<<<<<<<<<<<
 *         raise _TargetParserResult(parse_result)
 */
        /*except:*/ {
          PyErr_Restore(0,0,0);
          goto __pyx_L11_exception_handled;
        }
        __pyx_L11_exception_handled:;
        __Pyx_XGIVEREF(__pyx_save_exc_type);
        __Pyx_XGIVEREF(__pyx_save_exc_value);
        __Pyx_XGIVEREF(__pyx_save_exc_tb);
        __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
        __pyx_L17_try_end:;
      }
    }
    __pyx_L9:;
    goto __pyx_L18;
    __pyx_L8_error:;
    if (__pyx_why == 4) {
      Py_XDECREF(__pyx_exc_type);
      Py_XDECREF(__pyx_exc_value);
      Py_XDECREF(__pyx_exc_tb);
    }
    goto __pyx_L1_error;
    __pyx_L18:;
    switch (__pyx_why) {
      case 4: {
        __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
        __pyx_lineno = __pyx_exc_lineno;
        __pyx_exc_type = 0;
        __pyx_exc_value = 0;
        __pyx_exc_tb = 0;
        goto __pyx_L1_error;
      }
    }
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":157
 *                 try: parse_result = self._python_target.close()
 *                 except: pass
 *         raise _TargetParserResult(parse_result)             # <<<<<<<<<<<<<<
 */
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s___TargetParserResult); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_6));
  __Pyx_INCREF(__pyx_v_parse_result);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_parse_result);
  __Pyx_GIVEREF(__pyx_v_parse_result);
  __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
  __Pyx_Raise(__pyx_t_7, 0, 0);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  {__pyx_filename = __pyx_f[13]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree._TargetParserContext._handleParseResultDoc");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_parse_result);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":12
 *     OUTPUT_METHOD_TEXT
 * 
 * cdef int _findOutputMethod(method) except -1:             # <<<<<<<<<<<<<<
 *     if method is None:
 *         return OUTPUT_METHOD_XML
 */

static  int __pyx_f_4lxml_5etree__findOutputMethod(PyObject *__pyx_v_method) {
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("_findOutputMethod");
  __Pyx_INCREF(__pyx_v_method);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":13
 * 
 * cdef int _findOutputMethod(method) except -1:
 *     if method is None:             # <<<<<<<<<<<<<<
 *         return OUTPUT_METHOD_XML
 *     method = method.lower()
 */
  __pyx_t_1 = (__pyx_v_method == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":14
 * cdef int _findOutputMethod(method) except -1:
 *     if method is None:
 *         return OUTPUT_METHOD_XML             # <<<<<<<<<<<<<<
 *     method = method.lower()
 *     if method == u"xml":
 */
    __pyx_r = __pyx_e_4lxml_5etree_OUTPUT_METHOD_XML;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":15
 *     if method is None:
 *         return OUTPUT_METHOD_XML
 *     method = method.lower()             # <<<<<<<<<<<<<<
 *     if method == u"xml":
 *         return OUTPUT_METHOD_XML
 */
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_method, __pyx_n_s__lower); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_v_method);
  __pyx_v_method = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":16
 *         return OUTPUT_METHOD_XML
 *     method = method.lower()
 *     if method == u"xml":             # <<<<<<<<<<<<<<
 *         return OUTPUT_METHOD_XML
 *     if method == u"html":
 */
  __pyx_t_1 = __Pyx_PyUnicode_Equals(__pyx_v_method, ((PyObject *)__pyx_n_u__xml), Py_EQ); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":17
 *     method = method.lower()
 *     if method == u"xml":
 *         return OUTPUT_METHOD_XML             # <<<<<<<<<<<<<<
 *     if method == u"html":
 *         return OUTPUT_METHOD_HTML
 */
    __pyx_r = __pyx_e_4lxml_5etree_OUTPUT_METHOD_XML;
    goto __pyx_L0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":18
 *     if method == u"xml":
 *         return OUTPUT_METHOD_XML
 *     if method == u"html":             # <<<<<<<<<<<<<<
 *         return OUTPUT_METHOD_HTML
 *     if method == u"text":
 */
  __pyx_t_1 = __Pyx_PyUnicode_Equals(__pyx_v_method, ((PyObject *)__pyx_n_u__html), Py_EQ); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":19
 *         return OUTPUT_METHOD_XML
 *     if method == u"html":
 *         return OUTPUT_METHOD_HTML             # <<<<<<<<<<<<<<
 *     if method == u"text":
 *         return OUTPUT_METHOD_TEXT
 */
    __pyx_r = __pyx_e_4lxml_5etree_OUTPUT_METHOD_HTML;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":20
 *     if method == u"html":
 *         return OUTPUT_METHOD_HTML
 *     if method == u"text":             # <<<<<<<<<<<<<<
 *         return OUTPUT_METHOD_TEXT
 *     raise ValueError, u"unknown output method %r" % method
 */
  __pyx_t_1 = __Pyx_PyUnicode_Equals(__pyx_v_method, ((PyObject *)__pyx_n_u__text), Py_EQ); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":21
 *         return OUTPUT_METHOD_HTML
 *     if method == u"text":
 *         return OUTPUT_METHOD_TEXT             # <<<<<<<<<<<<<<
 *     raise ValueError, u"unknown output method %r" % method
 * 
 */
    __pyx_r = __pyx_e_4lxml_5etree_OUTPUT_METHOD_TEXT;
    goto __pyx_L0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":22
 *     if method == u"text":
 *         return OUTPUT_METHOD_TEXT
 *     raise ValueError, u"unknown output method %r" % method             # <<<<<<<<<<<<<<
 * 
 * cdef _textToString(xmlNode* c_node, encoding, bint with_tail):
 */
  __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_236), __pyx_v_method); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), 0);
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  {__pyx_filename = __pyx_f[4]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._findOutputMethod");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_method);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":24
 *     raise ValueError, u"unknown output method %r" % method
 * 
 * cdef _textToString(xmlNode* c_node, encoding, bint with_tail):             # <<<<<<<<<<<<<<
 *     cdef bint needs_conversion
 *     cdef char* c_text
 */

static  PyObject *__pyx_f_4lxml_5etree__textToString(xmlNode *__pyx_v_c_node, PyObject *__pyx_v_encoding, int __pyx_v_with_tail) {
  int __pyx_v_needs_conversion;
  char *__pyx_v_c_text;
  xmlNode *__pyx_v_c_text_node;
  xmlBuffer *__pyx_v_c_buffer;
  int __pyx_v_error_result;
  PyObject *__pyx_v_text;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  char *__pyx_t_7;
  __Pyx_RefNannySetupContext("_textToString");
  __Pyx_INCREF(__pyx_v_encoding);
  __pyx_v_text = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":31
 *     cdef int error_result
 * 
 *     c_buffer = tree.xmlBufferCreate()             # <<<<<<<<<<<<<<
 *     if c_buffer is NULL:
 *         return python.PyErr_NoMemory()
 */
  __pyx_v_c_buffer = xmlBufferCreate();

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":32
 * 
 *     c_buffer = tree.xmlBufferCreate()
 *     if c_buffer is NULL:             # <<<<<<<<<<<<<<
 *         return python.PyErr_NoMemory()
 * 
 */
  __pyx_t_1 = (__pyx_v_c_buffer == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":33
 *     c_buffer = tree.xmlBufferCreate()
 *     if c_buffer is NULL:
 *         return python.PyErr_NoMemory()             # <<<<<<<<<<<<<<
 * 
 *     with nogil:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyErr_NoMemory(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":35
 *         return python.PyErr_NoMemory()
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         error_result = tree.xmlNodeBufGetContent(c_buffer, c_node)
 *         if with_tail:
 */
  {
    #ifdef WITH_THREAD
    PyThreadState *_save;
    #endif
    Py_UNBLOCK_THREADS
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":36
 * 
 *     with nogil:
 *         error_result = tree.xmlNodeBufGetContent(c_buffer, c_node)             # <<<<<<<<<<<<<<
 *         if with_tail:
 *             c_text_node = _textNodeOrSkip(c_node.next)
 */
      __pyx_v_error_result = xmlNodeBufGetContent(__pyx_v_c_buffer, __pyx_v_c_node);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":37
 *     with nogil:
 *         error_result = tree.xmlNodeBufGetContent(c_buffer, c_node)
 *         if with_tail:             # <<<<<<<<<<<<<<
 *             c_text_node = _textNodeOrSkip(c_node.next)
 *             while c_text_node is not NULL:
 */
      if (__pyx_v_with_tail) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":38
 *         error_result = tree.xmlNodeBufGetContent(c_buffer, c_node)
 *         if with_tail:
 *             c_text_node = _textNodeOrSkip(c_node.next)             # <<<<<<<<<<<<<<
 *             while c_text_node is not NULL:
 *                 tree.xmlBufferWriteChar(c_buffer, c_text_node.content)
 */
        __pyx_v_c_text_node = __pyx_f_4lxml_5etree__textNodeOrSkip(__pyx_v_c_node->next);

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":39
 *         if with_tail:
 *             c_text_node = _textNodeOrSkip(c_node.next)
 *             while c_text_node is not NULL:             # <<<<<<<<<<<<<<
 *                 tree.xmlBufferWriteChar(c_buffer, c_text_node.content)
 *                 c_text_node = _textNodeOrSkip(c_text_node.next)
 */
        while (1) {
          __pyx_t_1 = (__pyx_v_c_text_node != NULL);
          if (!__pyx_t_1) break;

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":40
 *             c_text_node = _textNodeOrSkip(c_node.next)
 *             while c_text_node is not NULL:
 *                 tree.xmlBufferWriteChar(c_buffer, c_text_node.content)             # <<<<<<<<<<<<<<
 *                 c_text_node = _textNodeOrSkip(c_text_node.next)
 *         c_text = tree.xmlBufferContent(c_buffer)
 */
          xmlBufferWriteChar(__pyx_v_c_buffer, __pyx_v_c_text_node->content);

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":41
 *             while c_text_node is not NULL:
 *                 tree.xmlBufferWriteChar(c_buffer, c_text_node.content)
 *                 c_text_node = _textNodeOrSkip(c_text_node.next)             # <<<<<<<<<<<<<<
 *         c_text = tree.xmlBufferContent(c_buffer)
 * 
 */
          __pyx_v_c_text_node = __pyx_f_4lxml_5etree__textNodeOrSkip(__pyx_v_c_text_node->next);
        }
        goto __pyx_L7;
      }
      __pyx_L7:;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":42
 *                 tree.xmlBufferWriteChar(c_buffer, c_text_node.content)
 *                 c_text_node = _textNodeOrSkip(c_text_node.next)
 *         c_text = tree.xmlBufferContent(c_buffer)             # <<<<<<<<<<<<<<
 * 
 *     if error_result < 0 or c_text is NULL:
 */
      __pyx_v_c_text = xmlBufferContent(__pyx_v_c_buffer);
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":35
 *         return python.PyErr_NoMemory()
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         error_result = tree.xmlNodeBufGetContent(c_buffer, c_node)
 *         if with_tail:
 */
    /*finally:*/ {
      Py_BLOCK_THREADS
    }
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":44
 *         c_text = tree.xmlBufferContent(c_buffer)
 * 
 *     if error_result < 0 or c_text is NULL:             # <<<<<<<<<<<<<<
 *         tree.xmlBufferFree(c_buffer)
 *         raise SerialisationError, u"Error during serialisation (out of memory?)"
 */
  __pyx_t_1 = (__pyx_v_error_result < 0);
  if (!__pyx_t_1) {
    __pyx_t_3 = (__pyx_v_c_text == NULL);
    __pyx_t_4 = __pyx_t_3;
  } else {
    __pyx_t_4 = __pyx_t_1;
  }
  if (__pyx_t_4) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":45
 * 
 *     if error_result < 0 or c_text is NULL:
 *         tree.xmlBufferFree(c_buffer)             # <<<<<<<<<<<<<<
 *         raise SerialisationError, u"Error during serialisation (out of memory?)"
 * 
 */
    xmlBufferFree(__pyx_v_c_buffer);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":46
 *     if error_result < 0 or c_text is NULL:
 *         tree.xmlBufferFree(c_buffer)
 *         raise SerialisationError, u"Error during serialisation (out of memory?)"             # <<<<<<<<<<<<<<
 * 
 *     try:
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__SerialisationError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, ((PyObject *)__pyx_kp_u_237), 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[4]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L10;
  }
  __pyx_L10:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":48
 *         raise SerialisationError, u"Error during serialisation (out of memory?)"
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         needs_conversion = 0
 *         if encoding is _unicode:
 */
  /*try:*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":49
 * 
 *     try:
 *         needs_conversion = 0             # <<<<<<<<<<<<<<
 *         if encoding is _unicode:
 *             needs_conversion = 1
 */
    __pyx_v_needs_conversion = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":50
 *     try:
 *         needs_conversion = 0
 *         if encoding is _unicode:             # <<<<<<<<<<<<<<
 *             needs_conversion = 1
 *         elif encoding is not None:
 */
    __pyx_t_4 = (__pyx_v_encoding == __pyx_v_4lxml_5etree__unicode);
    if (__pyx_t_4) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":51
 *         needs_conversion = 0
 *         if encoding is _unicode:
 *             needs_conversion = 1             # <<<<<<<<<<<<<<
 *         elif encoding is not None:
 *             encoding = encoding.upper()
 */
      __pyx_v_needs_conversion = 1;
      goto __pyx_L14;
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":52
 *         if encoding is _unicode:
 *             needs_conversion = 1
 *         elif encoding is not None:             # <<<<<<<<<<<<<<
 *             encoding = encoding.upper()
 *             if encoding != u'UTF-8':
 */
    __pyx_t_4 = (__pyx_v_encoding != Py_None);
    if (__pyx_t_4) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":53
 *             needs_conversion = 1
 *         elif encoding is not None:
 *             encoding = encoding.upper()             # <<<<<<<<<<<<<<
 *             if encoding != u'UTF-8':
 *                 if encoding == u'ASCII':
 */
      __pyx_t_2 = PyObject_GetAttr(__pyx_v_encoding, __pyx_n_s__upper); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L12;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L12;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_v_encoding);
      __pyx_v_encoding = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":54
 *         elif encoding is not None:
 *             encoding = encoding.upper()
 *             if encoding != u'UTF-8':             # <<<<<<<<<<<<<<
 *                 if encoding == u'ASCII':
 *                     if isutf8(c_text):
 */
      __pyx_t_4 = __Pyx_PyUnicode_Equals(__pyx_v_encoding, ((PyObject *)__pyx_kp_u_31), Py_NE); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L12;}
      if (__pyx_t_4) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":55
 *             encoding = encoding.upper()
 *             if encoding != u'UTF-8':
 *                 if encoding == u'ASCII':             # <<<<<<<<<<<<<<
 *                     if isutf8(c_text):
 *                         # will raise a decode error below
 */
        __pyx_t_4 = __Pyx_PyUnicode_Equals(__pyx_v_encoding, ((PyObject *)__pyx_n_u__ASCII), Py_EQ); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L12;}
        if (__pyx_t_4) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":56
 *             if encoding != u'UTF-8':
 *                 if encoding == u'ASCII':
 *                     if isutf8(c_text):             # <<<<<<<<<<<<<<
 *                         # will raise a decode error below
 *                         needs_conversion = 1
 */
          __pyx_t_6 = __pyx_f_4lxml_5etree_isutf8(__pyx_v_c_text);
          if (__pyx_t_6) {

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":58
 *                     if isutf8(c_text):
 *                         # will raise a decode error below
 *                         needs_conversion = 1             # <<<<<<<<<<<<<<
 *                 else:
 *                     needs_conversion = 1
 */
            __pyx_v_needs_conversion = 1;
            goto __pyx_L17;
          }
          __pyx_L17:;
          goto __pyx_L16;
        }
        /*else*/ {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":60
 *                         needs_conversion = 1
 *                 else:
 *                     needs_conversion = 1             # <<<<<<<<<<<<<<
 * 
 *         if needs_conversion:
 */
          __pyx_v_needs_conversion = 1;
        }
        __pyx_L16:;
        goto __pyx_L15;
      }
      __pyx_L15:;
      goto __pyx_L14;
    }
    __pyx_L14:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":62
 *                     needs_conversion = 1
 * 
 *         if needs_conversion:             # <<<<<<<<<<<<<<
 *             text = python.PyUnicode_DecodeUTF8(
 *                 c_text, tree.xmlBufferLength(c_buffer), 'strict')
 */
    if (__pyx_v_needs_conversion) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":64
 *         if needs_conversion:
 *             text = python.PyUnicode_DecodeUTF8(
 *                 c_text, tree.xmlBufferLength(c_buffer), 'strict')             # <<<<<<<<<<<<<<
 *             if encoding is not _unicode:
 *                 encoding = _utf8(encoding)
 */
      __pyx_t_5 = ((PyObject *)PyUnicode_DecodeUTF8(__pyx_v_c_text, xmlBufferLength(__pyx_v_c_buffer), __pyx_k__strict)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L12;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_v_text);
      __pyx_v_text = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":65
 *             text = python.PyUnicode_DecodeUTF8(
 *                 c_text, tree.xmlBufferLength(c_buffer), 'strict')
 *             if encoding is not _unicode:             # <<<<<<<<<<<<<<
 *                 encoding = _utf8(encoding)
 *                 text = python.PyUnicode_AsEncodedString(
 */
      __pyx_t_4 = (__pyx_v_encoding != __pyx_v_4lxml_5etree__unicode);
      if (__pyx_t_4) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":66
 *                 c_text, tree.xmlBufferLength(c_buffer), 'strict')
 *             if encoding is not _unicode:
 *                 encoding = _utf8(encoding)             # <<<<<<<<<<<<<<
 *                 text = python.PyUnicode_AsEncodedString(
 *                     text, encoding, 'strict')
 */
        __pyx_t_5 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_v_encoding)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L12;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_v_encoding);
        __pyx_v_encoding = __pyx_t_5;
        __pyx_t_5 = 0;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":68
 *                 encoding = _utf8(encoding)
 *                 text = python.PyUnicode_AsEncodedString(
 *                     text, encoding, 'strict')             # <<<<<<<<<<<<<<
 *         else:
 *             text = c_text
 */
        __pyx_t_7 = PyBytes_AsString(__pyx_v_encoding); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L12;}
        __pyx_t_5 = ((PyObject *)PyUnicode_AsEncodedString(__pyx_v_text, __pyx_t_7, __pyx_k__strict)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L12;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_v_text);
        __pyx_v_text = __pyx_t_5;
        __pyx_t_5 = 0;
        goto __pyx_L19;
      }
      __pyx_L19:;
      goto __pyx_L18;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":70
 *                     text, encoding, 'strict')
 *         else:
 *             text = c_text             # <<<<<<<<<<<<<<
 *     finally:
 *         tree.xmlBufferFree(c_buffer)
 */
      __pyx_t_5 = PyBytes_FromString(__pyx_v_c_text); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L12;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
      __Pyx_DECREF(__pyx_v_text);
      __pyx_v_text = ((PyObject *)__pyx_t_5);
      __pyx_t_5 = 0;
    }
    __pyx_L18:;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":72
 *             text = c_text
 *     finally:
 *         tree.xmlBufferFree(c_buffer)             # <<<<<<<<<<<<<<
 *     return text
 * 
 */
  /*finally:*/ {
    int __pyx_why;
    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
    int __pyx_exc_lineno;
    __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 0; goto __pyx_L13;
    __pyx_L12: {
      __pyx_why = 4;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
      __pyx_exc_lineno = __pyx_lineno;
      goto __pyx_L13;
    }
    __pyx_L13:;
    xmlBufferFree(__pyx_v_c_buffer);
    switch (__pyx_why) {
      case 4: {
        __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
        __pyx_lineno = __pyx_exc_lineno;
        __pyx_exc_type = 0;
        __pyx_exc_value = 0;
        __pyx_exc_tb = 0;
        goto __pyx_L1_error;
      }
    }
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":73
 *     finally:
 *         tree.xmlBufferFree(c_buffer)
 *     return text             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_text);
  __pyx_r = __pyx_v_text;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._textToString");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_text);
  __Pyx_DECREF(__pyx_v_encoding);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":76
 * 
 * 
 * cdef _tostring(_Element element, encoding, doctype, method,             # <<<<<<<<<<<<<<
 *                bint write_xml_declaration, bint write_complete_document,
 *                bint pretty_print, bint with_tail, int standalone):
 */

static  PyObject *__pyx_f_4lxml_5etree__tostring(struct LxmlElement *__pyx_v_element, PyObject *__pyx_v_encoding, PyObject *__pyx_v_doctype, PyObject *__pyx_v_method, int __pyx_v_write_xml_declaration, int __pyx_v_write_complete_document, int __pyx_v_pretty_print, int __pyx_v_with_tail, int __pyx_v_standalone) {
  xmlOutputBuffer *__pyx_v_c_buffer;
  xmlBuffer *__pyx_v_c_result_buffer;
  xmlCharEncodingHandler *__pyx_v_enchandler;
  char *__pyx_v_c_enc;
  char *__pyx_v_c_doctype;
  int __pyx_v_c_method;
  int __pyx_v_error_result;
  PyObject *__pyx_v_result;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("_tostring");
  __Pyx_INCREF(__pyx_v_encoding);
  __Pyx_INCREF(__pyx_v_doctype);
  __pyx_v_result = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":90
 *     cdef int c_method
 *     cdef int error_result
 *     if element is None:             # <<<<<<<<<<<<<<
 *         return None
 *     _assertValidNode(element)
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_element) == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":91
 *     cdef int error_result
 *     if element is None:
 *         return None             # <<<<<<<<<<<<<<
 *     _assertValidNode(element)
 *     c_method = _findOutputMethod(method)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":92
 *     if element is None:
 *         return None
 *     _assertValidNode(element)             # <<<<<<<<<<<<<<
 *     c_method = _findOutputMethod(method)
 *     if c_method == OUTPUT_METHOD_TEXT:
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":93
 *         return None
 *     _assertValidNode(element)
 *     c_method = _findOutputMethod(method)             # <<<<<<<<<<<<<<
 *     if c_method == OUTPUT_METHOD_TEXT:
 *         return _textToString(element._c_node, encoding, with_tail)
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__findOutputMethod(__pyx_v_method); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_method = __pyx_t_2;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":94
 *     _assertValidNode(element)
 *     c_method = _findOutputMethod(method)
 *     if c_method == OUTPUT_METHOD_TEXT:             # <<<<<<<<<<<<<<
 *         return _textToString(element._c_node, encoding, with_tail)
 *     if encoding is None or encoding is _unicode:
 */
  __pyx_t_1 = (__pyx_v_c_method == __pyx_e_4lxml_5etree_OUTPUT_METHOD_TEXT);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":95
 *     c_method = _findOutputMethod(method)
 *     if c_method == OUTPUT_METHOD_TEXT:
 *         return _textToString(element._c_node, encoding, with_tail)             # <<<<<<<<<<<<<<
 *     if encoding is None or encoding is _unicode:
 *         c_enc = NULL
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __pyx_f_4lxml_5etree__textToString(__pyx_v_element->_c_node, __pyx_v_encoding, __pyx_v_with_tail); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":96
 *     if c_method == OUTPUT_METHOD_TEXT:
 *         return _textToString(element._c_node, encoding, with_tail)
 *     if encoding is None or encoding is _unicode:             # <<<<<<<<<<<<<<
 *         c_enc = NULL
 *     else:
 */
  __pyx_t_1 = (__pyx_v_encoding == Py_None);
  if (!__pyx_t_1) {
    __pyx_t_4 = (__pyx_v_encoding == __pyx_v_4lxml_5etree__unicode);
    __pyx_t_5 = __pyx_t_4;
  } else {
    __pyx_t_5 = __pyx_t_1;
  }
  if (__pyx_t_5) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":97
 *         return _textToString(element._c_node, encoding, with_tail)
 *     if encoding is None or encoding is _unicode:
 *         c_enc = NULL             # <<<<<<<<<<<<<<
 *     else:
 *         encoding = _utf8(encoding)
 */
    __pyx_v_c_enc = NULL;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":99
 *         c_enc = NULL
 *     else:
 *         encoding = _utf8(encoding)             # <<<<<<<<<<<<<<
 *         c_enc = _cstr(encoding)
 *     if doctype is None:
 */
    __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_v_encoding)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_v_encoding);
    __pyx_v_encoding = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":100
 *     else:
 *         encoding = _utf8(encoding)
 *         c_enc = _cstr(encoding)             # <<<<<<<<<<<<<<
 *     if doctype is None:
 *         c_doctype = NULL
 */
    __pyx_v_c_enc = PyBytes_AS_STRING(__pyx_v_encoding);
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":101
 *         encoding = _utf8(encoding)
 *         c_enc = _cstr(encoding)
 *     if doctype is None:             # <<<<<<<<<<<<<<
 *         c_doctype = NULL
 *     else:
 */
  __pyx_t_5 = (__pyx_v_doctype == Py_None);
  if (__pyx_t_5) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":102
 *         c_enc = _cstr(encoding)
 *     if doctype is None:
 *         c_doctype = NULL             # <<<<<<<<<<<<<<
 *     else:
 *         doctype = _utf8(doctype)
 */
    __pyx_v_c_doctype = NULL;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":104
 *         c_doctype = NULL
 *     else:
 *         doctype = _utf8(doctype)             # <<<<<<<<<<<<<<
 *         c_doctype = _cstr(doctype)
 *     # it is necessary to *and* find the encoding handler *and* use
 */
    __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_v_doctype)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_v_doctype);
    __pyx_v_doctype = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":105
 *     else:
 *         doctype = _utf8(doctype)
 *         c_doctype = _cstr(doctype)             # <<<<<<<<<<<<<<
 *     # it is necessary to *and* find the encoding handler *and* use
 *     # encoding during output
 */
    __pyx_v_c_doctype = PyBytes_AS_STRING(__pyx_v_doctype);
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":108
 *     # it is necessary to *and* find the encoding handler *and* use
 *     # encoding during output
 *     enchandler = tree.xmlFindCharEncodingHandler(c_enc)             # <<<<<<<<<<<<<<
 *     if enchandler is NULL and c_enc is not NULL:
 *         if encoding is not None:
 */
  __pyx_v_enchandler = xmlFindCharEncodingHandler(__pyx_v_c_enc);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":109
 *     # encoding during output
 *     enchandler = tree.xmlFindCharEncodingHandler(c_enc)
 *     if enchandler is NULL and c_enc is not NULL:             # <<<<<<<<<<<<<<
 *         if encoding is not None:
 *             encoding = encoding.decode(u'UTF-8')
 */
  __pyx_t_5 = (__pyx_v_enchandler == NULL);
  if (__pyx_t_5) {
    __pyx_t_1 = (__pyx_v_c_enc != NULL);
    __pyx_t_4 = __pyx_t_1;
  } else {
    __pyx_t_4 = __pyx_t_5;
  }
  if (__pyx_t_4) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":110
 *     enchandler = tree.xmlFindCharEncodingHandler(c_enc)
 *     if enchandler is NULL and c_enc is not NULL:
 *         if encoding is not None:             # <<<<<<<<<<<<<<
 *             encoding = encoding.decode(u'UTF-8')
 *         raise LookupError, u"unknown encoding: '%s'" % encoding
 */
    __pyx_t_4 = (__pyx_v_encoding != Py_None);
    if (__pyx_t_4) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":111
 *     if enchandler is NULL and c_enc is not NULL:
 *         if encoding is not None:
 *             encoding = encoding.decode(u'UTF-8')             # <<<<<<<<<<<<<<
 *         raise LookupError, u"unknown encoding: '%s'" % encoding
 *     c_buffer = tree.xmlAllocOutputBuffer(enchandler)
 */
      __pyx_t_3 = PyObject_GetAttr(__pyx_v_encoding, __pyx_n_s__decode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_238), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_v_encoding);
      __pyx_v_encoding = __pyx_t_6;
      __pyx_t_6 = 0;
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":112
 *         if encoding is not None:
 *             encoding = encoding.decode(u'UTF-8')
 *         raise LookupError, u"unknown encoding: '%s'" % encoding             # <<<<<<<<<<<<<<
 *     c_buffer = tree.xmlAllocOutputBuffer(enchandler)
 *     if c_buffer is NULL:
 */
    __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_180), __pyx_v_encoding); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
    __Pyx_Raise(__pyx_builtin_LookupError, ((PyObject *)__pyx_t_6), 0);
    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
    {__pyx_filename = __pyx_f[4]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":113
 *             encoding = encoding.decode(u'UTF-8')
 *         raise LookupError, u"unknown encoding: '%s'" % encoding
 *     c_buffer = tree.xmlAllocOutputBuffer(enchandler)             # <<<<<<<<<<<<<<
 *     if c_buffer is NULL:
 *         tree.xmlCharEncCloseFunc(enchandler)
 */
  __pyx_v_c_buffer = xmlAllocOutputBuffer(__pyx_v_enchandler);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":114
 *         raise LookupError, u"unknown encoding: '%s'" % encoding
 *     c_buffer = tree.xmlAllocOutputBuffer(enchandler)
 *     if c_buffer is NULL:             # <<<<<<<<<<<<<<
 *         tree.xmlCharEncCloseFunc(enchandler)
 *         return python.PyErr_NoMemory()
 */
  __pyx_t_4 = (__pyx_v_c_buffer == NULL);
  if (__pyx_t_4) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":115
 *     c_buffer = tree.xmlAllocOutputBuffer(enchandler)
 *     if c_buffer is NULL:
 *         tree.xmlCharEncCloseFunc(enchandler)             # <<<<<<<<<<<<<<
 *         return python.PyErr_NoMemory()
 * 
 */
    xmlCharEncCloseFunc(__pyx_v_enchandler);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":116
 *     if c_buffer is NULL:
 *         tree.xmlCharEncCloseFunc(enchandler)
 *         return python.PyErr_NoMemory()             # <<<<<<<<<<<<<<
 * 
 *     with nogil:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_6 = PyErr_NoMemory(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L0;
    goto __pyx_L9;
  }
  __pyx_L9:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":118
 *         return python.PyErr_NoMemory()
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         _writeNodeToBuffer(c_buffer, element._c_node, c_enc, c_doctype, c_method,
 *                            write_xml_declaration, write_complete_document,
 */
  {
    #ifdef WITH_THREAD
    PyThreadState *_save;
    #endif
    Py_UNBLOCK_THREADS
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":121
 *         _writeNodeToBuffer(c_buffer, element._c_node, c_enc, c_doctype, c_method,
 *                            write_xml_declaration, write_complete_document,
 *                            pretty_print, with_tail, standalone)             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferFlush(c_buffer)
 *         if c_buffer.conv is not NULL:
 */
      __pyx_f_4lxml_5etree__writeNodeToBuffer(__pyx_v_c_buffer, __pyx_v_element->_c_node, __pyx_v_c_enc, __pyx_v_c_doctype, __pyx_v_c_method, __pyx_v_write_xml_declaration, __pyx_v_write_complete_document, __pyx_v_pretty_print, __pyx_v_with_tail, __pyx_v_standalone);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":122
 *                            write_xml_declaration, write_complete_document,
 *                            pretty_print, with_tail, standalone)
 *         tree.xmlOutputBufferFlush(c_buffer)             # <<<<<<<<<<<<<<
 *         if c_buffer.conv is not NULL:
 *             c_result_buffer = c_buffer.conv
 */
      xmlOutputBufferFlush(__pyx_v_c_buffer);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":123
 *                            pretty_print, with_tail, standalone)
 *         tree.xmlOutputBufferFlush(c_buffer)
 *         if c_buffer.conv is not NULL:             # <<<<<<<<<<<<<<
 *             c_result_buffer = c_buffer.conv
 *         else:
 */
      __pyx_t_4 = (__pyx_v_c_buffer->conv != NULL);
      if (__pyx_t_4) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":124
 *         tree.xmlOutputBufferFlush(c_buffer)
 *         if c_buffer.conv is not NULL:
 *             c_result_buffer = c_buffer.conv             # <<<<<<<<<<<<<<
 *         else:
 *             c_result_buffer = c_buffer.buffer
 */
        __pyx_v_c_result_buffer = __pyx_v_c_buffer->conv;
        goto __pyx_L13;
      }
      /*else*/ {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":126
 *             c_result_buffer = c_buffer.conv
 *         else:
 *             c_result_buffer = c_buffer.buffer             # <<<<<<<<<<<<<<
 * 
 *     error_result = c_buffer.error
 */
        __pyx_v_c_result_buffer = __pyx_v_c_buffer->buffer;
      }
      __pyx_L13:;
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":118
 *         return python.PyErr_NoMemory()
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         _writeNodeToBuffer(c_buffer, element._c_node, c_enc, c_doctype, c_method,
 *                            write_xml_declaration, write_complete_document,
 */
    /*finally:*/ {
      Py_BLOCK_THREADS
    }
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":128
 *             c_result_buffer = c_buffer.buffer
 * 
 *     error_result = c_buffer.error             # <<<<<<<<<<<<<<
 *     if error_result != xmlerror.XML_ERR_OK:
 *         tree.xmlOutputBufferClose(c_buffer)
 */
  __pyx_v_error_result = __pyx_v_c_buffer->error;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":129
 * 
 *     error_result = c_buffer.error
 *     if error_result != xmlerror.XML_ERR_OK:             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferClose(c_buffer)
 *         _raiseSerialisationError(error_result)
 */
  __pyx_t_4 = (__pyx_v_error_result != XML_ERR_OK);
  if (__pyx_t_4) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":130
 *     error_result = c_buffer.error
 *     if error_result != xmlerror.XML_ERR_OK:
 *         tree.xmlOutputBufferClose(c_buffer)             # <<<<<<<<<<<<<<
 *         _raiseSerialisationError(error_result)
 * 
 */
    xmlOutputBufferClose(__pyx_v_c_buffer);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":131
 *     if error_result != xmlerror.XML_ERR_OK:
 *         tree.xmlOutputBufferClose(c_buffer)
 *         _raiseSerialisationError(error_result)             # <<<<<<<<<<<<<<
 * 
 *     try:
 */
    __pyx_t_6 = __pyx_f_4lxml_5etree__raiseSerialisationError(__pyx_v_error_result); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L14;
  }
  __pyx_L14:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":133
 *         _raiseSerialisationError(error_result)
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         if encoding is _unicode:
 *             result = tree.xmlBufferContent(
 */
  /*try:*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":134
 * 
 *     try:
 *         if encoding is _unicode:             # <<<<<<<<<<<<<<
 *             result = tree.xmlBufferContent(
 *                 c_result_buffer)[:tree.xmlBufferLength(c_result_buffer)].decode('UTF-8')
 */
    __pyx_t_4 = (__pyx_v_encoding == __pyx_v_4lxml_5etree__unicode);
    if (__pyx_t_4) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":136
 *         if encoding is _unicode:
 *             result = tree.xmlBufferContent(
 *                 c_result_buffer)[:tree.xmlBufferLength(c_result_buffer)].decode('UTF-8')             # <<<<<<<<<<<<<<
 *         else:
 *             result = <bytes>tree.xmlBufferContent(
 */
      __pyx_t_6 = ((PyObject *)PyUnicode_DecodeUTF8(xmlBufferContent(__pyx_v_c_result_buffer), xmlBufferLength(__pyx_v_c_result_buffer), NULL)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L16;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
      __Pyx_DECREF(__pyx_v_result);
      __pyx_v_result = ((PyObject *)__pyx_t_6);
      __pyx_t_6 = 0;
      goto __pyx_L18;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":139
 *         else:
 *             result = <bytes>tree.xmlBufferContent(
 *                 c_result_buffer)[:tree.xmlBufferLength(c_result_buffer)]             # <<<<<<<<<<<<<<
 *     finally:
 *         error_result = tree.xmlOutputBufferClose(c_buffer)
 */
      __pyx_t_6 = PyBytes_FromStringAndSize(xmlBufferContent(__pyx_v_c_result_buffer) + 0, xmlBufferLength(__pyx_v_c_result_buffer) - 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L16;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
      __Pyx_DECREF(__pyx_v_result);
      __pyx_v_result = ((PyObject *)__pyx_t_6);
      __pyx_t_6 = 0;
    }
    __pyx_L18:;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":141
 *                 c_result_buffer)[:tree.xmlBufferLength(c_result_buffer)]
 *     finally:
 *         error_result = tree.xmlOutputBufferClose(c_buffer)             # <<<<<<<<<<<<<<
 *     if error_result < 0:
 *         _raiseSerialisationError(error_result)
 */
  /*finally:*/ {
    int __pyx_why;
    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
    int __pyx_exc_lineno;
    __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 0; goto __pyx_L17;
    __pyx_L16: {
      __pyx_why = 4;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
      __pyx_exc_lineno = __pyx_lineno;
      goto __pyx_L17;
    }
    __pyx_L17:;
    __pyx_v_error_result = xmlOutputBufferClose(__pyx_v_c_buffer);
    switch (__pyx_why) {
      case 4: {
        __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
        __pyx_lineno = __pyx_exc_lineno;
        __pyx_exc_type = 0;
        __pyx_exc_value = 0;
        __pyx_exc_tb = 0;
        goto __pyx_L1_error;
      }
    }
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":142
 *     finally:
 *         error_result = tree.xmlOutputBufferClose(c_buffer)
 *     if error_result < 0:             # <<<<<<<<<<<<<<
 *         _raiseSerialisationError(error_result)
 *     return result
 */
  __pyx_t_4 = (__pyx_v_error_result < 0);
  if (__pyx_t_4) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":143
 *         error_result = tree.xmlOutputBufferClose(c_buffer)
 *     if error_result < 0:
 *         _raiseSerialisationError(error_result)             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
    __pyx_t_6 = __pyx_f_4lxml_5etree__raiseSerialisationError(__pyx_v_error_result); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L20;
  }
  __pyx_L20:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":144
 *     if error_result < 0:
 *         _raiseSerialisationError(error_result)
 *     return result             # <<<<<<<<<<<<<<
 * 
 * cdef bytes _tostringC14N(element_or_tree, bint exclusive, bint with_comments):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._tostring");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_result);
  __Pyx_DECREF(__pyx_v_encoding);
  __Pyx_DECREF(__pyx_v_doctype);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":146
 *     return result
 * 
 * cdef bytes _tostringC14N(element_or_tree, bint exclusive, bint with_comments):             # <<<<<<<<<<<<<<
 *     cdef xmlDoc* c_doc
 *     cdef char* c_buffer = NULL
 */

static  PyObject *__pyx_f_4lxml_5etree__tostringC14N(PyObject *__pyx_v_element_or_tree, int __pyx_v_exclusive, int __pyx_v_with_comments) {
  xmlDoc *__pyx_v_c_doc;
  char *__pyx_v_c_buffer;
  int __pyx_v_byte_count;
  PyObject *__pyx_v_result;
  struct LxmlDocument *__pyx_v_doc;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  xmlDoc *__pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("_tostringC14N");
  __pyx_v_result = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_doc = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":148
 * cdef bytes _tostringC14N(element_or_tree, bint exclusive, bint with_comments):
 *     cdef xmlDoc* c_doc
 *     cdef char* c_buffer = NULL             # <<<<<<<<<<<<<<
 *     cdef int byte_count = -1
 *     cdef bytes result
 */
  __pyx_v_c_buffer = NULL;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":149
 *     cdef xmlDoc* c_doc
 *     cdef char* c_buffer = NULL
 *     cdef int byte_count = -1             # <<<<<<<<<<<<<<
 *     cdef bytes result
 *     cdef _Document doc
 */
  __pyx_v_byte_count = -1;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":154
 *     cdef _Element element
 * 
 *     if isinstance(element_or_tree, _Element):             # <<<<<<<<<<<<<<
 *         _assertValidNode(<_Element>element_or_tree)
 *         doc = (<_Element>element_or_tree)._doc
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_element_or_tree, ((PyObject*)__pyx_ptype_4lxml_5etree__Element)); 
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":155
 * 
 *     if isinstance(element_or_tree, _Element):
 *         _assertValidNode(<_Element>element_or_tree)             # <<<<<<<<<<<<<<
 *         doc = (<_Element>element_or_tree)._doc
 *         c_doc = _plainFakeRootDoc(doc._c_doc, (<_Element>element_or_tree)._c_node, 0)
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_element_or_tree)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":156
 *     if isinstance(element_or_tree, _Element):
 *         _assertValidNode(<_Element>element_or_tree)
 *         doc = (<_Element>element_or_tree)._doc             # <<<<<<<<<<<<<<
 *         c_doc = _plainFakeRootDoc(doc._c_doc, (<_Element>element_or_tree)._c_node, 0)
 *     else:
 */
    __Pyx_INCREF(((PyObject *)((struct LxmlElement *)__pyx_v_element_or_tree)->_doc));
    __Pyx_DECREF(((PyObject *)__pyx_v_doc));
    __pyx_v_doc = ((struct LxmlElement *)__pyx_v_element_or_tree)->_doc;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":157
 *         _assertValidNode(<_Element>element_or_tree)
 *         doc = (<_Element>element_or_tree)._doc
 *         c_doc = _plainFakeRootDoc(doc._c_doc, (<_Element>element_or_tree)._c_node, 0)             # <<<<<<<<<<<<<<
 *     else:
 *         doc = _documentOrRaise(element_or_tree)
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree__plainFakeRootDoc(__pyx_v_doc->_c_doc, ((struct LxmlElement *)__pyx_v_element_or_tree)->_c_node, 0); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_c_doc = __pyx_t_3;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":159
 *         c_doc = _plainFakeRootDoc(doc._c_doc, (<_Element>element_or_tree)._c_node, 0)
 *     else:
 *         doc = _documentOrRaise(element_or_tree)             # <<<<<<<<<<<<<<
 *         _assertValidDoc(doc)
 *         c_doc = doc._c_doc
 */
    __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v_element_or_tree)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(((PyObject *)__pyx_v_doc));
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":160
 *     else:
 *         doc = _documentOrRaise(element_or_tree)
 *         _assertValidDoc(doc)             # <<<<<<<<<<<<<<
 *         c_doc = doc._c_doc
 * 
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidDoc(__pyx_v_doc); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":161
 *         doc = _documentOrRaise(element_or_tree)
 *         _assertValidDoc(doc)
 *         c_doc = doc._c_doc             # <<<<<<<<<<<<<<
 * 
 *     with nogil:
 */
    __pyx_v_c_doc = __pyx_v_doc->_c_doc;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":163
 *         c_doc = doc._c_doc
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         byte_count = c14n.xmlC14NDocDumpMemory(
 *             c_doc, NULL, exclusive, NULL, with_comments, &c_buffer)
 */
  {
    #ifdef WITH_THREAD
    PyThreadState *_save;
    #endif
    Py_UNBLOCK_THREADS
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":165
 *     with nogil:
 *         byte_count = c14n.xmlC14NDocDumpMemory(
 *             c_doc, NULL, exclusive, NULL, with_comments, &c_buffer)             # <<<<<<<<<<<<<<
 * 
 *     _destroyFakeDoc(doc._c_doc, c_doc)
 */
      __pyx_v_byte_count = xmlC14NDocDumpMemory(__pyx_v_c_doc, NULL, __pyx_v_exclusive, NULL, __pyx_v_with_comments, (&__pyx_v_c_buffer));
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":163
 *         c_doc = doc._c_doc
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         byte_count = c14n.xmlC14NDocDumpMemory(
 *             c_doc, NULL, exclusive, NULL, with_comments, &c_buffer)
 */
    /*finally:*/ {
      Py_BLOCK_THREADS
    }
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":167
 *             c_doc, NULL, exclusive, NULL, with_comments, &c_buffer)
 * 
 *     _destroyFakeDoc(doc._c_doc, c_doc)             # <<<<<<<<<<<<<<
 * 
 *     if byte_count < 0 or c_buffer is NULL:
 */
  __pyx_f_4lxml_5etree__destroyFakeDoc(__pyx_v_doc->_c_doc, __pyx_v_c_doc);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":169
 *     _destroyFakeDoc(doc._c_doc, c_doc)
 * 
 *     if byte_count < 0 or c_buffer is NULL:             # <<<<<<<<<<<<<<
 *         if c_buffer is not NULL:
 *             tree.xmlFree(c_buffer)
 */
  __pyx_t_1 = (__pyx_v_byte_count < 0);
  if (!__pyx_t_1) {
    __pyx_t_5 = (__pyx_v_c_buffer == NULL);
    __pyx_t_6 = __pyx_t_5;
  } else {
    __pyx_t_6 = __pyx_t_1;
  }
  if (__pyx_t_6) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":170
 * 
 *     if byte_count < 0 or c_buffer is NULL:
 *         if c_buffer is not NULL:             # <<<<<<<<<<<<<<
 *             tree.xmlFree(c_buffer)
 *         raise C14NError, u"C14N failed"
 */
    __pyx_t_6 = (__pyx_v_c_buffer != NULL);
    if (__pyx_t_6) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":171
 *     if byte_count < 0 or c_buffer is NULL:
 *         if c_buffer is not NULL:
 *             tree.xmlFree(c_buffer)             # <<<<<<<<<<<<<<
 *         raise C14NError, u"C14N failed"
 *     try:
 */
      xmlFree(__pyx_v_c_buffer);
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":172
 *         if c_buffer is not NULL:
 *             tree.xmlFree(c_buffer)
 *         raise C14NError, u"C14N failed"             # <<<<<<<<<<<<<<
 *     try:
 *         result = c_buffer[:byte_count]
 */
    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__C14NError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_Raise(__pyx_t_4, ((PyObject *)__pyx_kp_u_239), 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[4]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":173
 *             tree.xmlFree(c_buffer)
 *         raise C14NError, u"C14N failed"
 *     try:             # <<<<<<<<<<<<<<
 *         result = c_buffer[:byte_count]
 *     finally:
 */
  /*try:*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":174
 *         raise C14NError, u"C14N failed"
 *     try:
 *         result = c_buffer[:byte_count]             # <<<<<<<<<<<<<<
 *     finally:
 *         tree.xmlFree(c_buffer)
 */
    __pyx_t_4 = PyBytes_FromStringAndSize(__pyx_v_c_buffer + 0, __pyx_v_byte_count - 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L10;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_DECREF(((PyObject *)__pyx_v_result));
    __pyx_v_result = __pyx_t_4;
    __pyx_t_4 = 0;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":176
 *         result = c_buffer[:byte_count]
 *     finally:
 *         tree.xmlFree(c_buffer)             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
  /*finally:*/ {
    int __pyx_why;
    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
    int __pyx_exc_lineno;
    __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 0; goto __pyx_L11;
    __pyx_L10: {
      __pyx_why = 4;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
      __pyx_exc_lineno = __pyx_lineno;
      goto __pyx_L11;
    }
    __pyx_L11:;
    xmlFree(__pyx_v_c_buffer);
    switch (__pyx_why) {
      case 4: {
        __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
        __pyx_lineno = __pyx_exc_lineno;
        __pyx_exc_type = 0;
        __pyx_exc_value = 0;
        __pyx_exc_tb = 0;
        goto __pyx_L1_error;
      }
    }
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":177
 *     finally:
 *         tree.xmlFree(c_buffer)
 *     return result             # <<<<<<<<<<<<<<
 * 
 * cdef _raiseSerialisationError(int error_result):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._tostringC14N");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_result);
  __Pyx_DECREF((PyObject *)__pyx_v_doc);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":179
 *     return result
 * 
 * cdef _raiseSerialisationError(int error_result):             # <<<<<<<<<<<<<<
 *     if error_result == xmlerror.XML_ERR_NO_MEMORY:
 *         return python.PyErr_NoMemory()
 */

static  PyObject *__pyx_f_4lxml_5etree__raiseSerialisationError(int __pyx_v_error_result) {
  PyObject *__pyx_v_message;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("_raiseSerialisationError");
  __pyx_v_message = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":180
 * 
 * cdef _raiseSerialisationError(int error_result):
 *     if error_result == xmlerror.XML_ERR_NO_MEMORY:             # <<<<<<<<<<<<<<
 *         return python.PyErr_NoMemory()
 *     else:
 */
  __pyx_t_1 = (__pyx_v_error_result == XML_ERR_NO_MEMORY);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":181
 * cdef _raiseSerialisationError(int error_result):
 *     if error_result == xmlerror.XML_ERR_NO_MEMORY:
 *         return python.PyErr_NoMemory()             # <<<<<<<<<<<<<<
 *     else:
 *         message = ErrorTypes._getName(error_result)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyErr_NoMemory(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":183
 *         return python.PyErr_NoMemory()
 *     else:
 *         message = ErrorTypes._getName(error_result)             # <<<<<<<<<<<<<<
 *         if message is None:
 *             message = u"unknown error %d" % error_result
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__ErrorTypes); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s___getName); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyInt_FromLong(__pyx_v_error_result); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_v_message);
    __pyx_v_message = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":184
 *     else:
 *         message = ErrorTypes._getName(error_result)
 *         if message is None:             # <<<<<<<<<<<<<<
 *             message = u"unknown error %d" % error_result
 *         raise SerialisationError, message
 */
    __pyx_t_1 = (__pyx_v_message == Py_None);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":185
 *         message = ErrorTypes._getName(error_result)
 *         if message is None:
 *             message = u"unknown error %d" % error_result             # <<<<<<<<<<<<<<
 *         raise SerialisationError, message
 * 
 */
      __pyx_t_2 = PyInt_FromLong(__pyx_v_error_result); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_240), __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_v_message);
      __pyx_v_message = ((PyObject *)__pyx_t_4);
      __pyx_t_4 = 0;
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":186
 *         if message is None:
 *             message = u"unknown error %d" % error_result
 *         raise SerialisationError, message             # <<<<<<<<<<<<<<
 * 
 * ############################################################
 */
    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__SerialisationError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_Raise(__pyx_t_4, __pyx_v_message, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[4]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._raiseSerialisationError");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_message);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":191
 * # low-level serialisation functions
 * 
 * cdef void _writeNodeToBuffer(tree.xmlOutputBuffer* c_buffer,             # <<<<<<<<<<<<<<
 *                              xmlNode* c_node, char* encoding, char* c_doctype,
 *                              int c_method, bint write_xml_declaration,
 */

static  void __pyx_f_4lxml_5etree__writeNodeToBuffer(xmlOutputBuffer *__pyx_v_c_buffer, xmlNode *__pyx_v_c_node, char *__pyx_v_encoding, char *__pyx_v_c_doctype, int __pyx_v_c_method, int __pyx_v_write_xml_declaration, int __pyx_v_write_complete_document, int __pyx_v_pretty_print, int __pyx_v_with_tail, int __pyx_v_standalone) {
  xmlDoc *__pyx_v_c_doc;
  xmlNode *__pyx_v_c_nsdecl_node;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":199
 *     cdef xmlDoc* c_doc
 *     cdef xmlNode* c_nsdecl_node
 *     c_doc = c_node.doc             # <<<<<<<<<<<<<<
 *     if write_xml_declaration and c_method == OUTPUT_METHOD_XML:
 *         _writeDeclarationToBuffer(c_buffer, c_doc.version, encoding, standalone)
 */
  __pyx_v_c_doc = __pyx_v_c_node->doc;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":200
 *     cdef xmlNode* c_nsdecl_node
 *     c_doc = c_node.doc
 *     if write_xml_declaration and c_method == OUTPUT_METHOD_XML:             # <<<<<<<<<<<<<<
 *         _writeDeclarationToBuffer(c_buffer, c_doc.version, encoding, standalone)
 * 
 */
  if (__pyx_v_write_xml_declaration) {
    __pyx_t_1 = (__pyx_v_c_method == __pyx_e_4lxml_5etree_OUTPUT_METHOD_XML);
    __pyx_t_2 = __pyx_t_1;
  } else {
    __pyx_t_2 = __pyx_v_write_xml_declaration;
  }
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":201
 *     c_doc = c_node.doc
 *     if write_xml_declaration and c_method == OUTPUT_METHOD_XML:
 *         _writeDeclarationToBuffer(c_buffer, c_doc.version, encoding, standalone)             # <<<<<<<<<<<<<<
 * 
 *     if c_doctype is not NULL:
 */
    __pyx_f_4lxml_5etree__writeDeclarationToBuffer(__pyx_v_c_buffer, __pyx_v_c_doc->version, __pyx_v_encoding, __pyx_v_standalone);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":203
 *         _writeDeclarationToBuffer(c_buffer, c_doc.version, encoding, standalone)
 * 
 *     if c_doctype is not NULL:             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWrite(c_buffer, cstd.strlen(c_doctype), c_doctype)
 *         tree.xmlOutputBufferWriteString(c_buffer, "\n")
 */
  __pyx_t_2 = (__pyx_v_c_doctype != NULL);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":204
 * 
 *     if c_doctype is not NULL:
 *         tree.xmlOutputBufferWrite(c_buffer, cstd.strlen(c_doctype), c_doctype)             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWriteString(c_buffer, "\n")
 * 
 */
    xmlOutputBufferWrite(__pyx_v_c_buffer, strlen(__pyx_v_c_doctype), __pyx_v_c_doctype);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":205
 *     if c_doctype is not NULL:
 *         tree.xmlOutputBufferWrite(c_buffer, cstd.strlen(c_doctype), c_doctype)
 *         tree.xmlOutputBufferWriteString(c_buffer, "\n")             # <<<<<<<<<<<<<<
 * 
 *     # write internal DTD subset, preceding PIs/comments, etc.
 */
    xmlOutputBufferWriteString(__pyx_v_c_buffer, __pyx_k_47);
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":208
 * 
 *     # write internal DTD subset, preceding PIs/comments, etc.
 *     if write_complete_document:             # <<<<<<<<<<<<<<
 *         if c_doctype is NULL:
 *             _writeDtdToBuffer(c_buffer, c_doc, c_node.name, encoding)
 */
  if (__pyx_v_write_complete_document) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":209
 *     # write internal DTD subset, preceding PIs/comments, etc.
 *     if write_complete_document:
 *         if c_doctype is NULL:             # <<<<<<<<<<<<<<
 *             _writeDtdToBuffer(c_buffer, c_doc, c_node.name, encoding)
 *         _writePrevSiblings(c_buffer, c_node, encoding, pretty_print)
 */
    __pyx_t_2 = (__pyx_v_c_doctype == NULL);
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":210
 *     if write_complete_document:
 *         if c_doctype is NULL:
 *             _writeDtdToBuffer(c_buffer, c_doc, c_node.name, encoding)             # <<<<<<<<<<<<<<
 *         _writePrevSiblings(c_buffer, c_node, encoding, pretty_print)
 * 
 */
      __pyx_f_4lxml_5etree__writeDtdToBuffer(__pyx_v_c_buffer, __pyx_v_c_doc, __pyx_v_c_node->name, __pyx_v_encoding);
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":211
 *         if c_doctype is NULL:
 *             _writeDtdToBuffer(c_buffer, c_doc, c_node.name, encoding)
 *         _writePrevSiblings(c_buffer, c_node, encoding, pretty_print)             # <<<<<<<<<<<<<<
 * 
 *     c_nsdecl_node = c_node
 */
    __pyx_f_4lxml_5etree__writePrevSiblings(__pyx_v_c_buffer, __pyx_v_c_node, __pyx_v_encoding, __pyx_v_pretty_print);
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":213
 *         _writePrevSiblings(c_buffer, c_node, encoding, pretty_print)
 * 
 *     c_nsdecl_node = c_node             # <<<<<<<<<<<<<<
 *     if c_node.parent is NULL or c_node.parent.type != tree.XML_DOCUMENT_NODE:
 *         # copy the node and add namespaces from parents
 */
  __pyx_v_c_nsdecl_node = __pyx_v_c_node;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":214
 * 
 *     c_nsdecl_node = c_node
 *     if c_node.parent is NULL or c_node.parent.type != tree.XML_DOCUMENT_NODE:             # <<<<<<<<<<<<<<
 *         # copy the node and add namespaces from parents
 *         # this is required to make libxml write them
 */
  __pyx_t_2 = (__pyx_v_c_node->parent == NULL);
  if (!__pyx_t_2) {
    __pyx_t_1 = (__pyx_v_c_node->parent->type != XML_DOCUMENT_NODE);
    __pyx_t_3 = __pyx_t_1;
  } else {
    __pyx_t_3 = __pyx_t_2;
  }
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":217
 *         # copy the node and add namespaces from parents
 *         # this is required to make libxml write them
 *         c_nsdecl_node = tree.xmlCopyNode(c_node, 2)             # <<<<<<<<<<<<<<
 *         if c_nsdecl_node is NULL:
 *             c_buffer.error = xmlerror.XML_ERR_NO_MEMORY
 */
    __pyx_v_c_nsdecl_node = xmlCopyNode(__pyx_v_c_node, 2);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":218
 *         # this is required to make libxml write them
 *         c_nsdecl_node = tree.xmlCopyNode(c_node, 2)
 *         if c_nsdecl_node is NULL:             # <<<<<<<<<<<<<<
 *             c_buffer.error = xmlerror.XML_ERR_NO_MEMORY
 *             return
 */
    __pyx_t_3 = (__pyx_v_c_nsdecl_node == NULL);
    if (__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":219
 *         c_nsdecl_node = tree.xmlCopyNode(c_node, 2)
 *         if c_nsdecl_node is NULL:
 *             c_buffer.error = xmlerror.XML_ERR_NO_MEMORY             # <<<<<<<<<<<<<<
 *             return
 *         _copyParentNamespaces(c_node, c_nsdecl_node)
 */
      __pyx_v_c_buffer->error = XML_ERR_NO_MEMORY;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":220
 *         if c_nsdecl_node is NULL:
 *             c_buffer.error = xmlerror.XML_ERR_NO_MEMORY
 *             return             # <<<<<<<<<<<<<<
 *         _copyParentNamespaces(c_node, c_nsdecl_node)
 * 
 */
      goto __pyx_L0;
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":221
 *             c_buffer.error = xmlerror.XML_ERR_NO_MEMORY
 *             return
 *         _copyParentNamespaces(c_node, c_nsdecl_node)             # <<<<<<<<<<<<<<
 * 
 *         c_nsdecl_node.parent = c_node.parent
 */
    __pyx_f_4lxml_5etree__copyParentNamespaces(__pyx_v_c_node, __pyx_v_c_nsdecl_node);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":223
 *         _copyParentNamespaces(c_node, c_nsdecl_node)
 * 
 *         c_nsdecl_node.parent = c_node.parent             # <<<<<<<<<<<<<<
 *         c_nsdecl_node.children = c_node.children
 *         c_nsdecl_node.last = c_node.last
 */
    __pyx_v_c_nsdecl_node->parent = __pyx_v_c_node->parent;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":224
 * 
 *         c_nsdecl_node.parent = c_node.parent
 *         c_nsdecl_node.children = c_node.children             # <<<<<<<<<<<<<<
 *         c_nsdecl_node.last = c_node.last
 * 
 */
    __pyx_v_c_nsdecl_node->children = __pyx_v_c_node->children;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":225
 *         c_nsdecl_node.parent = c_node.parent
 *         c_nsdecl_node.children = c_node.children
 *         c_nsdecl_node.last = c_node.last             # <<<<<<<<<<<<<<
 * 
 *     # write node
 */
    __pyx_v_c_nsdecl_node->last = __pyx_v_c_node->last;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":228
 * 
 *     # write node
 *     if c_method == OUTPUT_METHOD_HTML:             # <<<<<<<<<<<<<<
 *         tree.htmlNodeDumpFormatOutput(
 *             c_buffer, c_doc, c_nsdecl_node, encoding, pretty_print)
 */
  __pyx_t_3 = (__pyx_v_c_method == __pyx_e_4lxml_5etree_OUTPUT_METHOD_HTML);
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":230
 *     if c_method == OUTPUT_METHOD_HTML:
 *         tree.htmlNodeDumpFormatOutput(
 *             c_buffer, c_doc, c_nsdecl_node, encoding, pretty_print)             # <<<<<<<<<<<<<<
 *     else:
 *         tree.xmlNodeDumpOutput(
 */
    htmlNodeDumpFormatOutput(__pyx_v_c_buffer, __pyx_v_c_doc, __pyx_v_c_nsdecl_node, __pyx_v_encoding, __pyx_v_pretty_print);
    goto __pyx_L9;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":233
 *     else:
 *         tree.xmlNodeDumpOutput(
 *             c_buffer, c_doc, c_nsdecl_node, 0, pretty_print, encoding)             # <<<<<<<<<<<<<<
 * 
 *     if c_nsdecl_node is not c_node:
 */
    xmlNodeDumpOutput(__pyx_v_c_buffer, __pyx_v_c_doc, __pyx_v_c_nsdecl_node, 0, __pyx_v_pretty_print, __pyx_v_encoding);
  }
  __pyx_L9:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":235
 *             c_buffer, c_doc, c_nsdecl_node, 0, pretty_print, encoding)
 * 
 *     if c_nsdecl_node is not c_node:             # <<<<<<<<<<<<<<
 *         # clean up
 *         c_nsdecl_node.children = c_nsdecl_node.last = NULL
 */
  __pyx_t_3 = (__pyx_v_c_nsdecl_node != __pyx_v_c_node);
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":237
 *     if c_nsdecl_node is not c_node:
 *         # clean up
 *         c_nsdecl_node.children = c_nsdecl_node.last = NULL             # <<<<<<<<<<<<<<
 *         tree.xmlFreeNode(c_nsdecl_node)
 * 
 */
    __pyx_v_c_nsdecl_node->children = NULL;
    __pyx_v_c_nsdecl_node->last = NULL;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":238
 *         # clean up
 *         c_nsdecl_node.children = c_nsdecl_node.last = NULL
 *         tree.xmlFreeNode(c_nsdecl_node)             # <<<<<<<<<<<<<<
 * 
 *     # write tail, trailing comments, etc.
 */
    xmlFreeNode(__pyx_v_c_nsdecl_node);
    goto __pyx_L10;
  }
  __pyx_L10:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":241
 * 
 *     # write tail, trailing comments, etc.
 *     if with_tail:             # <<<<<<<<<<<<<<
 *         _writeTail(c_buffer, c_node, encoding, pretty_print)
 *     if write_complete_document:
 */
  if (__pyx_v_with_tail) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":242
 *     # write tail, trailing comments, etc.
 *     if with_tail:
 *         _writeTail(c_buffer, c_node, encoding, pretty_print)             # <<<<<<<<<<<<<<
 *     if write_complete_document:
 *         _writeNextSiblings(c_buffer, c_node, encoding, pretty_print)
 */
    __pyx_f_4lxml_5etree__writeTail(__pyx_v_c_buffer, __pyx_v_c_node, __pyx_v_encoding, __pyx_v_pretty_print);
    goto __pyx_L11;
  }
  __pyx_L11:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":243
 *     if with_tail:
 *         _writeTail(c_buffer, c_node, encoding, pretty_print)
 *     if write_complete_document:             # <<<<<<<<<<<<<<
 *         _writeNextSiblings(c_buffer, c_node, encoding, pretty_print)
 *     if pretty_print:
 */
  if (__pyx_v_write_complete_document) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":244
 *         _writeTail(c_buffer, c_node, encoding, pretty_print)
 *     if write_complete_document:
 *         _writeNextSiblings(c_buffer, c_node, encoding, pretty_print)             # <<<<<<<<<<<<<<
 *     if pretty_print:
 *         tree.xmlOutputBufferWrite(c_buffer, 1, "\n")
 */
    __pyx_f_4lxml_5etree__writeNextSiblings(__pyx_v_c_buffer, __pyx_v_c_node, __pyx_v_encoding, __pyx_v_pretty_print);
    goto __pyx_L12;
  }
  __pyx_L12:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":245
 *     if write_complete_document:
 *         _writeNextSiblings(c_buffer, c_node, encoding, pretty_print)
 *     if pretty_print:             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWrite(c_buffer, 1, "\n")
 * 
 */
  if (__pyx_v_pretty_print) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":246
 *         _writeNextSiblings(c_buffer, c_node, encoding, pretty_print)
 *     if pretty_print:
 *         tree.xmlOutputBufferWrite(c_buffer, 1, "\n")             # <<<<<<<<<<<<<<
 * 
 * cdef void _writeDeclarationToBuffer(tree.xmlOutputBuffer* c_buffer,
 */
    xmlOutputBufferWrite(__pyx_v_c_buffer, 1, __pyx_k_47);
    goto __pyx_L13;
  }
  __pyx_L13:;

  __pyx_L0:;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":248
 *         tree.xmlOutputBufferWrite(c_buffer, 1, "\n")
 * 
 * cdef void _writeDeclarationToBuffer(tree.xmlOutputBuffer* c_buffer,             # <<<<<<<<<<<<<<
 *                                     char* version, char* encoding,
 *                                     int standalone) nogil:
 */

static  void __pyx_f_4lxml_5etree__writeDeclarationToBuffer(xmlOutputBuffer *__pyx_v_c_buffer, char *__pyx_v_version, char *__pyx_v_encoding, int __pyx_v_standalone) {
  int __pyx_t_1;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":251
 *                                     char* version, char* encoding,
 *                                     int standalone) nogil:
 *     if version is NULL:             # <<<<<<<<<<<<<<
 *         version = "1.0"
 *     tree.xmlOutputBufferWrite(c_buffer, 15, "<?xml version='")
 */
  __pyx_t_1 = (__pyx_v_version == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":252
 *                                     int standalone) nogil:
 *     if version is NULL:
 *         version = "1.0"             # <<<<<<<<<<<<<<
 *     tree.xmlOutputBufferWrite(c_buffer, 15, "<?xml version='")
 *     tree.xmlOutputBufferWriteString(c_buffer, version)
 */
    __pyx_v_version = __pyx_k_241;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":253
 *     if version is NULL:
 *         version = "1.0"
 *     tree.xmlOutputBufferWrite(c_buffer, 15, "<?xml version='")             # <<<<<<<<<<<<<<
 *     tree.xmlOutputBufferWriteString(c_buffer, version)
 *     tree.xmlOutputBufferWrite(c_buffer, 12, "' encoding='")
 */
  xmlOutputBufferWrite(__pyx_v_c_buffer, 15, __pyx_k_242);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":254
 *         version = "1.0"
 *     tree.xmlOutputBufferWrite(c_buffer, 15, "<?xml version='")
 *     tree.xmlOutputBufferWriteString(c_buffer, version)             # <<<<<<<<<<<<<<
 *     tree.xmlOutputBufferWrite(c_buffer, 12, "' encoding='")
 *     tree.xmlOutputBufferWriteString(c_buffer, encoding)
 */
  xmlOutputBufferWriteString(__pyx_v_c_buffer, __pyx_v_version);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":255
 *     tree.xmlOutputBufferWrite(c_buffer, 15, "<?xml version='")
 *     tree.xmlOutputBufferWriteString(c_buffer, version)
 *     tree.xmlOutputBufferWrite(c_buffer, 12, "' encoding='")             # <<<<<<<<<<<<<<
 *     tree.xmlOutputBufferWriteString(c_buffer, encoding)
 *     if standalone == 0:
 */
  xmlOutputBufferWrite(__pyx_v_c_buffer, 12, __pyx_k_243);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":256
 *     tree.xmlOutputBufferWriteString(c_buffer, version)
 *     tree.xmlOutputBufferWrite(c_buffer, 12, "' encoding='")
 *     tree.xmlOutputBufferWriteString(c_buffer, encoding)             # <<<<<<<<<<<<<<
 *     if standalone == 0:
 *         tree.xmlOutputBufferWrite(c_buffer, 20, "' standalone='no'?>\n")
 */
  xmlOutputBufferWriteString(__pyx_v_c_buffer, __pyx_v_encoding);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":259
 *     if standalone == 0:
 *         tree.xmlOutputBufferWrite(c_buffer, 20, "' standalone='no'?>\n")
 *     elif standalone == 1:             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWrite(c_buffer, 21, "' standalone='yes'?>\n")
 *     else:
 */
  switch (__pyx_v_standalone) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":257
 *     tree.xmlOutputBufferWrite(c_buffer, 12, "' encoding='")
 *     tree.xmlOutputBufferWriteString(c_buffer, encoding)
 *     if standalone == 0:             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWrite(c_buffer, 20, "' standalone='no'?>\n")
 *     elif standalone == 1:
 */
    case 0:

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":258
 *     tree.xmlOutputBufferWriteString(c_buffer, encoding)
 *     if standalone == 0:
 *         tree.xmlOutputBufferWrite(c_buffer, 20, "' standalone='no'?>\n")             # <<<<<<<<<<<<<<
 *     elif standalone == 1:
 *         tree.xmlOutputBufferWrite(c_buffer, 21, "' standalone='yes'?>\n")
 */
    xmlOutputBufferWrite(__pyx_v_c_buffer, 20, __pyx_k_244);
    break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":259
 *     if standalone == 0:
 *         tree.xmlOutputBufferWrite(c_buffer, 20, "' standalone='no'?>\n")
 *     elif standalone == 1:             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWrite(c_buffer, 21, "' standalone='yes'?>\n")
 *     else:
 */
    case 1:

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":260
 *         tree.xmlOutputBufferWrite(c_buffer, 20, "' standalone='no'?>\n")
 *     elif standalone == 1:
 *         tree.xmlOutputBufferWrite(c_buffer, 21, "' standalone='yes'?>\n")             # <<<<<<<<<<<<<<
 *     else:
 *         tree.xmlOutputBufferWrite(c_buffer, 4, "'?>\n")
 */
    xmlOutputBufferWrite(__pyx_v_c_buffer, 21, __pyx_k_245);
    break;
    default:

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":262
 *         tree.xmlOutputBufferWrite(c_buffer, 21, "' standalone='yes'?>\n")
 *     else:
 *         tree.xmlOutputBufferWrite(c_buffer, 4, "'?>\n")             # <<<<<<<<<<<<<<
 * 
 * cdef void _writeDtdToBuffer(tree.xmlOutputBuffer* c_buffer,
 */
    xmlOutputBufferWrite(__pyx_v_c_buffer, 4, __pyx_k_246);
    break;
  }

}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":264
 *         tree.xmlOutputBufferWrite(c_buffer, 4, "'?>\n")
 * 
 * cdef void _writeDtdToBuffer(tree.xmlOutputBuffer* c_buffer,             # <<<<<<<<<<<<<<
 *                             xmlDoc* c_doc, char* c_root_name,
 *                             char* encoding) nogil:
 */

static  void __pyx_f_4lxml_5etree__writeDtdToBuffer(xmlOutputBuffer *__pyx_v_c_buffer, xmlDoc *__pyx_v_c_doc, char *__pyx_v_c_root_name, char *__pyx_v_encoding) {
  xmlDtd *__pyx_v_c_dtd;
  xmlNode *__pyx_v_c_node;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":269
 *     cdef tree.xmlDtd* c_dtd
 *     cdef xmlNode* c_node
 *     c_dtd = c_doc.intSubset             # <<<<<<<<<<<<<<
 *     if c_dtd is NULL or c_dtd.name is NULL:
 *         return
 */
  __pyx_v_c_dtd = __pyx_v_c_doc->intSubset;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":270
 *     cdef xmlNode* c_node
 *     c_dtd = c_doc.intSubset
 *     if c_dtd is NULL or c_dtd.name is NULL:             # <<<<<<<<<<<<<<
 *         return
 *     if cstd.strcmp(c_root_name, c_dtd.name) != 0:
 */
  __pyx_t_1 = (__pyx_v_c_dtd == NULL);
  if (!__pyx_t_1) {
    __pyx_t_2 = (__pyx_v_c_dtd->name == NULL);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":271
 *     c_dtd = c_doc.intSubset
 *     if c_dtd is NULL or c_dtd.name is NULL:
 *         return             # <<<<<<<<<<<<<<
 *     if cstd.strcmp(c_root_name, c_dtd.name) != 0:
 *         return
 */
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":272
 *     if c_dtd is NULL or c_dtd.name is NULL:
 *         return
 *     if cstd.strcmp(c_root_name, c_dtd.name) != 0:             # <<<<<<<<<<<<<<
 *         return
 *     tree.xmlOutputBufferWrite(c_buffer, 10, "<!DOCTYPE ")
 */
  __pyx_t_3 = (strcmp(__pyx_v_c_root_name, __pyx_v_c_dtd->name) != 0);
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":273
 *         return
 *     if cstd.strcmp(c_root_name, c_dtd.name) != 0:
 *         return             # <<<<<<<<<<<<<<
 *     tree.xmlOutputBufferWrite(c_buffer, 10, "<!DOCTYPE ")
 *     tree.xmlOutputBufferWriteString(c_buffer, c_dtd.name)
 */
    goto __pyx_L0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":274
 *     if cstd.strcmp(c_root_name, c_dtd.name) != 0:
 *         return
 *     tree.xmlOutputBufferWrite(c_buffer, 10, "<!DOCTYPE ")             # <<<<<<<<<<<<<<
 *     tree.xmlOutputBufferWriteString(c_buffer, c_dtd.name)
 *     if c_dtd.SystemID != NULL and c_dtd.SystemID[0] != c'\0':
 */
  xmlOutputBufferWrite(__pyx_v_c_buffer, 10, __pyx_k_247);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":275
 *         return
 *     tree.xmlOutputBufferWrite(c_buffer, 10, "<!DOCTYPE ")
 *     tree.xmlOutputBufferWriteString(c_buffer, c_dtd.name)             # <<<<<<<<<<<<<<
 *     if c_dtd.SystemID != NULL and c_dtd.SystemID[0] != c'\0':
 *         if c_dtd.ExternalID != NULL and c_dtd.ExternalID[0] != c'\0':
 */
  xmlOutputBufferWriteString(__pyx_v_c_buffer, __pyx_v_c_dtd->name);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":276
 *     tree.xmlOutputBufferWrite(c_buffer, 10, "<!DOCTYPE ")
 *     tree.xmlOutputBufferWriteString(c_buffer, c_dtd.name)
 *     if c_dtd.SystemID != NULL and c_dtd.SystemID[0] != c'\0':             # <<<<<<<<<<<<<<
 *         if c_dtd.ExternalID != NULL and c_dtd.ExternalID[0] != c'\0':
 *             tree.xmlOutputBufferWrite(c_buffer, 9, ' PUBLIC "')
 */
  __pyx_t_3 = (__pyx_v_c_dtd->SystemID != NULL);
  if (__pyx_t_3) {
    __pyx_t_1 = ((__pyx_v_c_dtd->SystemID[0]) != '\x00');
    __pyx_t_2 = __pyx_t_1;
  } else {
    __pyx_t_2 = __pyx_t_3;
  }
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":277
 *     tree.xmlOutputBufferWriteString(c_buffer, c_dtd.name)
 *     if c_dtd.SystemID != NULL and c_dtd.SystemID[0] != c'\0':
 *         if c_dtd.ExternalID != NULL and c_dtd.ExternalID[0] != c'\0':             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferWrite(c_buffer, 9, ' PUBLIC "')
 *             tree.xmlOutputBufferWriteString(c_buffer, c_dtd.ExternalID)
 */
    __pyx_t_2 = (__pyx_v_c_dtd->ExternalID != NULL);
    if (__pyx_t_2) {
      __pyx_t_3 = ((__pyx_v_c_dtd->ExternalID[0]) != '\x00');
      __pyx_t_1 = __pyx_t_3;
    } else {
      __pyx_t_1 = __pyx_t_2;
    }
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":278
 *     if c_dtd.SystemID != NULL and c_dtd.SystemID[0] != c'\0':
 *         if c_dtd.ExternalID != NULL and c_dtd.ExternalID[0] != c'\0':
 *             tree.xmlOutputBufferWrite(c_buffer, 9, ' PUBLIC "')             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferWriteString(c_buffer, c_dtd.ExternalID)
 *             tree.xmlOutputBufferWrite(c_buffer, 3, '" "')
 */
      xmlOutputBufferWrite(__pyx_v_c_buffer, 9, __pyx_k_248);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":279
 *         if c_dtd.ExternalID != NULL and c_dtd.ExternalID[0] != c'\0':
 *             tree.xmlOutputBufferWrite(c_buffer, 9, ' PUBLIC "')
 *             tree.xmlOutputBufferWriteString(c_buffer, c_dtd.ExternalID)             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferWrite(c_buffer, 3, '" "')
 *         else:
 */
      xmlOutputBufferWriteString(__pyx_v_c_buffer, __pyx_v_c_dtd->ExternalID);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":280
 *             tree.xmlOutputBufferWrite(c_buffer, 9, ' PUBLIC "')
 *             tree.xmlOutputBufferWriteString(c_buffer, c_dtd.ExternalID)
 *             tree.xmlOutputBufferWrite(c_buffer, 3, '" "')             # <<<<<<<<<<<<<<
 *         else:
 *             tree.xmlOutputBufferWrite(c_buffer, 9, ' SYSTEM "')
 */
      xmlOutputBufferWrite(__pyx_v_c_buffer, 3, __pyx_k_249);
      goto __pyx_L6;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":282
 *             tree.xmlOutputBufferWrite(c_buffer, 3, '" "')
 *         else:
 *             tree.xmlOutputBufferWrite(c_buffer, 9, ' SYSTEM "')             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWriteString(c_buffer, c_dtd.SystemID)
 *         tree.xmlOutputBufferWrite(c_buffer, 1, '"')
 */
      xmlOutputBufferWrite(__pyx_v_c_buffer, 9, __pyx_k_250);
    }
    __pyx_L6:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":283
 *         else:
 *             tree.xmlOutputBufferWrite(c_buffer, 9, ' SYSTEM "')
 *         tree.xmlOutputBufferWriteString(c_buffer, c_dtd.SystemID)             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWrite(c_buffer, 1, '"')
 *     if c_dtd.entities == NULL and c_dtd.elements == NULL and \
 */
    xmlOutputBufferWriteString(__pyx_v_c_buffer, __pyx_v_c_dtd->SystemID);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":284
 *             tree.xmlOutputBufferWrite(c_buffer, 9, ' SYSTEM "')
 *         tree.xmlOutputBufferWriteString(c_buffer, c_dtd.SystemID)
 *         tree.xmlOutputBufferWrite(c_buffer, 1, '"')             # <<<<<<<<<<<<<<
 *     if c_dtd.entities == NULL and c_dtd.elements == NULL and \
 *            c_dtd.attributes == NULL and c_dtd.notations == NULL and \
 */
    xmlOutputBufferWrite(__pyx_v_c_buffer, 1, __pyx_k_251);
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":285
 *         tree.xmlOutputBufferWriteString(c_buffer, c_dtd.SystemID)
 *         tree.xmlOutputBufferWrite(c_buffer, 1, '"')
 *     if c_dtd.entities == NULL and c_dtd.elements == NULL and \             # <<<<<<<<<<<<<<
 *            c_dtd.attributes == NULL and c_dtd.notations == NULL and \
 *            c_dtd.pentities == NULL:
 */
  __pyx_t_1 = (__pyx_v_c_dtd->entities == NULL);
  if (__pyx_t_1) {
    __pyx_t_2 = (__pyx_v_c_dtd->elements == NULL);
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":286
 *         tree.xmlOutputBufferWrite(c_buffer, 1, '"')
 *     if c_dtd.entities == NULL and c_dtd.elements == NULL and \
 *            c_dtd.attributes == NULL and c_dtd.notations == NULL and \             # <<<<<<<<<<<<<<
 *            c_dtd.pentities == NULL:
 *         tree.xmlOutputBufferWrite(c_buffer, 2, '>\n')
 */
      __pyx_t_3 = (__pyx_v_c_dtd->attributes == NULL);
      if (__pyx_t_3) {
        __pyx_t_4 = (__pyx_v_c_dtd->notations == NULL);
        if (__pyx_t_4) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":287
 *     if c_dtd.entities == NULL and c_dtd.elements == NULL and \
 *            c_dtd.attributes == NULL and c_dtd.notations == NULL and \
 *            c_dtd.pentities == NULL:             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWrite(c_buffer, 2, '>\n')
 *         return
 */
          __pyx_t_5 = (__pyx_v_c_dtd->pentities == NULL);
          __pyx_t_6 = __pyx_t_5;
        } else {
          __pyx_t_6 = __pyx_t_4;
        }
        __pyx_t_4 = __pyx_t_6;
      } else {
        __pyx_t_4 = __pyx_t_3;
      }
      __pyx_t_3 = __pyx_t_4;
    } else {
      __pyx_t_3 = __pyx_t_2;
    }
    __pyx_t_2 = __pyx_t_3;
  } else {
    __pyx_t_2 = __pyx_t_1;
  }
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":288
 *            c_dtd.attributes == NULL and c_dtd.notations == NULL and \
 *            c_dtd.pentities == NULL:
 *         tree.xmlOutputBufferWrite(c_buffer, 2, '>\n')             # <<<<<<<<<<<<<<
 *         return
 *     tree.xmlOutputBufferWrite(c_buffer, 3, ' [\n')
 */
    xmlOutputBufferWrite(__pyx_v_c_buffer, 2, __pyx_k_252);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":289
 *            c_dtd.pentities == NULL:
 *         tree.xmlOutputBufferWrite(c_buffer, 2, '>\n')
 *         return             # <<<<<<<<<<<<<<
 *     tree.xmlOutputBufferWrite(c_buffer, 3, ' [\n')
 *     if c_dtd.notations != NULL:
 */
    goto __pyx_L0;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":290
 *         tree.xmlOutputBufferWrite(c_buffer, 2, '>\n')
 *         return
 *     tree.xmlOutputBufferWrite(c_buffer, 3, ' [\n')             # <<<<<<<<<<<<<<
 *     if c_dtd.notations != NULL:
 *         tree.xmlDumpNotationTable(c_buffer.buffer,
 */
  xmlOutputBufferWrite(__pyx_v_c_buffer, 3, __pyx_k_253);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":291
 *         return
 *     tree.xmlOutputBufferWrite(c_buffer, 3, ' [\n')
 *     if c_dtd.notations != NULL:             # <<<<<<<<<<<<<<
 *         tree.xmlDumpNotationTable(c_buffer.buffer,
 *                                   <tree.xmlNotationTable*>c_dtd.notations)
 */
  __pyx_t_2 = (__pyx_v_c_dtd->notations != NULL);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":293
 *     if c_dtd.notations != NULL:
 *         tree.xmlDumpNotationTable(c_buffer.buffer,
 *                                   <tree.xmlNotationTable*>c_dtd.notations)             # <<<<<<<<<<<<<<
 *     c_node = c_dtd.children
 *     while c_node is not NULL:
 */
    xmlDumpNotationTable(__pyx_v_c_buffer->buffer, ((xmlNotationTable *)__pyx_v_c_dtd->notations));
    goto __pyx_L8;
  }
  __pyx_L8:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":294
 *         tree.xmlDumpNotationTable(c_buffer.buffer,
 *                                   <tree.xmlNotationTable*>c_dtd.notations)
 *     c_node = c_dtd.children             # <<<<<<<<<<<<<<
 *     while c_node is not NULL:
 *         tree.xmlNodeDumpOutput(c_buffer, c_node.doc, c_node, 0, 0, encoding)
 */
  __pyx_v_c_node = __pyx_v_c_dtd->children;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":295
 *                                   <tree.xmlNotationTable*>c_dtd.notations)
 *     c_node = c_dtd.children
 *     while c_node is not NULL:             # <<<<<<<<<<<<<<
 *         tree.xmlNodeDumpOutput(c_buffer, c_node.doc, c_node, 0, 0, encoding)
 *         c_node = c_node.next
 */
  while (1) {
    __pyx_t_2 = (__pyx_v_c_node != NULL);
    if (!__pyx_t_2) break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":296
 *     c_node = c_dtd.children
 *     while c_node is not NULL:
 *         tree.xmlNodeDumpOutput(c_buffer, c_node.doc, c_node, 0, 0, encoding)             # <<<<<<<<<<<<<<
 *         c_node = c_node.next
 *     tree.xmlOutputBufferWrite(c_buffer, 3, "]>\n")
 */
    xmlNodeDumpOutput(__pyx_v_c_buffer, __pyx_v_c_node->doc, __pyx_v_c_node, 0, 0, __pyx_v_encoding);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":297
 *     while c_node is not NULL:
 *         tree.xmlNodeDumpOutput(c_buffer, c_node.doc, c_node, 0, 0, encoding)
 *         c_node = c_node.next             # <<<<<<<<<<<<<<
 *     tree.xmlOutputBufferWrite(c_buffer, 3, "]>\n")
 * 
 */
    __pyx_v_c_node = __pyx_v_c_node->next;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":298
 *         tree.xmlNodeDumpOutput(c_buffer, c_node.doc, c_node, 0, 0, encoding)
 *         c_node = c_node.next
 *     tree.xmlOutputBufferWrite(c_buffer, 3, "]>\n")             # <<<<<<<<<<<<<<
 * 
 * cdef void _writeTail(tree.xmlOutputBuffer* c_buffer, xmlNode* c_node,
 */
  xmlOutputBufferWrite(__pyx_v_c_buffer, 3, __pyx_k_254);

  __pyx_L0:;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":300
 *     tree.xmlOutputBufferWrite(c_buffer, 3, "]>\n")
 * 
 * cdef void _writeTail(tree.xmlOutputBuffer* c_buffer, xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                      char* encoding, bint pretty_print) nogil:
 *     u"Write the element tail."
 */

static  void __pyx_f_4lxml_5etree__writeTail(xmlOutputBuffer *__pyx_v_c_buffer, xmlNode *__pyx_v_c_node, char *__pyx_v_encoding, int __pyx_v_pretty_print) {
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":303
 *                      char* encoding, bint pretty_print) nogil:
 *     u"Write the element tail."
 *     c_node = c_node.next             # <<<<<<<<<<<<<<
 *     while c_node is not NULL and c_node.type == tree.XML_TEXT_NODE:
 *         tree.xmlNodeDumpOutput(c_buffer, c_node.doc, c_node, 0,
 */
  __pyx_v_c_node = __pyx_v_c_node->next;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":304
 *     u"Write the element tail."
 *     c_node = c_node.next
 *     while c_node is not NULL and c_node.type == tree.XML_TEXT_NODE:             # <<<<<<<<<<<<<<
 *         tree.xmlNodeDumpOutput(c_buffer, c_node.doc, c_node, 0,
 *                                pretty_print, encoding)
 */
  while (1) {
    __pyx_t_1 = (__pyx_v_c_node != NULL);
    if (__pyx_t_1) {
      __pyx_t_2 = (__pyx_v_c_node->type == XML_TEXT_NODE);
      __pyx_t_3 = __pyx_t_2;
    } else {
      __pyx_t_3 = __pyx_t_1;
    }
    if (!__pyx_t_3) break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":306
 *     while c_node is not NULL and c_node.type == tree.XML_TEXT_NODE:
 *         tree.xmlNodeDumpOutput(c_buffer, c_node.doc, c_node, 0,
 *                                pretty_print, encoding)             # <<<<<<<<<<<<<<
 *         c_node = c_node.next
 * 
 */
    xmlNodeDumpOutput(__pyx_v_c_buffer, __pyx_v_c_node->doc, __pyx_v_c_node, 0, __pyx_v_pretty_print, __pyx_v_encoding);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":307
 *         tree.xmlNodeDumpOutput(c_buffer, c_node.doc, c_node, 0,
 *                                pretty_print, encoding)
 *         c_node = c_node.next             # <<<<<<<<<<<<<<
 * 
 * cdef void _writePrevSiblings(tree.xmlOutputBuffer* c_buffer, xmlNode* c_node,
 */
    __pyx_v_c_node = __pyx_v_c_node->next;
  }

}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":309
 *         c_node = c_node.next
 * 
 * cdef void _writePrevSiblings(tree.xmlOutputBuffer* c_buffer, xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                              char* encoding, bint pretty_print) nogil:
 *     cdef xmlNode* c_sibling
 */

static  void __pyx_f_4lxml_5etree__writePrevSiblings(xmlOutputBuffer *__pyx_v_c_buffer, xmlNode *__pyx_v_c_node, char *__pyx_v_encoding, int __pyx_v_pretty_print) {
  xmlNode *__pyx_v_c_sibling;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":312
 *                              char* encoding, bint pretty_print) nogil:
 *     cdef xmlNode* c_sibling
 *     if c_node.parent is not NULL and _isElement(c_node.parent):             # <<<<<<<<<<<<<<
 *         return
 *     # we are at a root node, so add PI and comment siblings
 */
  __pyx_t_1 = (__pyx_v_c_node->parent != NULL);
  if (__pyx_t_1) {
    __pyx_t_2 = _isElement(__pyx_v_c_node->parent);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":313
 *     cdef xmlNode* c_sibling
 *     if c_node.parent is not NULL and _isElement(c_node.parent):
 *         return             # <<<<<<<<<<<<<<
 *     # we are at a root node, so add PI and comment siblings
 *     c_sibling = c_node
 */
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":315
 *         return
 *     # we are at a root node, so add PI and comment siblings
 *     c_sibling = c_node             # <<<<<<<<<<<<<<
 *     while c_sibling.prev != NULL and \
 *             (c_sibling.prev.type == tree.XML_PI_NODE or \
 */
  __pyx_v_c_sibling = __pyx_v_c_node;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":316
 *     # we are at a root node, so add PI and comment siblings
 *     c_sibling = c_node
 *     while c_sibling.prev != NULL and \             # <<<<<<<<<<<<<<
 *             (c_sibling.prev.type == tree.XML_PI_NODE or \
 *                  c_sibling.prev.type == tree.XML_COMMENT_NODE):
 */
  while (1) {
    __pyx_t_3 = (__pyx_v_c_sibling->prev != NULL);
    if (__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":317
 *     c_sibling = c_node
 *     while c_sibling.prev != NULL and \
 *             (c_sibling.prev.type == tree.XML_PI_NODE or \             # <<<<<<<<<<<<<<
 *                  c_sibling.prev.type == tree.XML_COMMENT_NODE):
 *         c_sibling = c_sibling.prev
 */
      __pyx_t_1 = (__pyx_v_c_sibling->prev->type == XML_PI_NODE);
      if (!__pyx_t_1) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":318
 *     while c_sibling.prev != NULL and \
 *             (c_sibling.prev.type == tree.XML_PI_NODE or \
 *                  c_sibling.prev.type == tree.XML_COMMENT_NODE):             # <<<<<<<<<<<<<<
 *         c_sibling = c_sibling.prev
 *     while c_sibling != c_node:
 */
        __pyx_t_2 = (__pyx_v_c_sibling->prev->type == XML_COMMENT_NODE);
        __pyx_t_4 = __pyx_t_2;
      } else {
        __pyx_t_4 = __pyx_t_1;
      }
      __pyx_t_1 = __pyx_t_4;
    } else {
      __pyx_t_1 = __pyx_t_3;
    }
    if (!__pyx_t_1) break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":319
 *             (c_sibling.prev.type == tree.XML_PI_NODE or \
 *                  c_sibling.prev.type == tree.XML_COMMENT_NODE):
 *         c_sibling = c_sibling.prev             # <<<<<<<<<<<<<<
 *     while c_sibling != c_node:
 *         tree.xmlNodeDumpOutput(c_buffer, c_node.doc, c_sibling, 0,
 */
    __pyx_v_c_sibling = __pyx_v_c_sibling->prev;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":320
 *                  c_sibling.prev.type == tree.XML_COMMENT_NODE):
 *         c_sibling = c_sibling.prev
 *     while c_sibling != c_node:             # <<<<<<<<<<<<<<
 *         tree.xmlNodeDumpOutput(c_buffer, c_node.doc, c_sibling, 0,
 *                                pretty_print, encoding)
 */
  while (1) {
    __pyx_t_1 = (__pyx_v_c_sibling != __pyx_v_c_node);
    if (!__pyx_t_1) break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":322
 *     while c_sibling != c_node:
 *         tree.xmlNodeDumpOutput(c_buffer, c_node.doc, c_sibling, 0,
 *                                pretty_print, encoding)             # <<<<<<<<<<<<<<
 *         if pretty_print:
 *             tree.xmlOutputBufferWriteString(c_buffer, "\n")
 */
    xmlNodeDumpOutput(__pyx_v_c_buffer, __pyx_v_c_node->doc, __pyx_v_c_sibling, 0, __pyx_v_pretty_print, __pyx_v_encoding);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":323
 *         tree.xmlNodeDumpOutput(c_buffer, c_node.doc, c_sibling, 0,
 *                                pretty_print, encoding)
 *         if pretty_print:             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferWriteString(c_buffer, "\n")
 *         c_sibling = c_sibling.next
 */
    if (__pyx_v_pretty_print) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":324
 *                                pretty_print, encoding)
 *         if pretty_print:
 *             tree.xmlOutputBufferWriteString(c_buffer, "\n")             # <<<<<<<<<<<<<<
 *         c_sibling = c_sibling.next
 * 
 */
      xmlOutputBufferWriteString(__pyx_v_c_buffer, __pyx_k_47);
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":325
 *         if pretty_print:
 *             tree.xmlOutputBufferWriteString(c_buffer, "\n")
 *         c_sibling = c_sibling.next             # <<<<<<<<<<<<<<
 * 
 * cdef void _writeNextSiblings(tree.xmlOutputBuffer* c_buffer, xmlNode* c_node,
 */
    __pyx_v_c_sibling = __pyx_v_c_sibling->next;
  }

  __pyx_L0:;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":327
 *         c_sibling = c_sibling.next
 * 
 * cdef void _writeNextSiblings(tree.xmlOutputBuffer* c_buffer, xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                              char* encoding, bint pretty_print) nogil:
 *     cdef xmlNode* c_sibling
 */

static  void __pyx_f_4lxml_5etree__writeNextSiblings(xmlOutputBuffer *__pyx_v_c_buffer, xmlNode *__pyx_v_c_node, char *__pyx_v_encoding, int __pyx_v_pretty_print) {
  xmlNode *__pyx_v_c_sibling;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":330
 *                              char* encoding, bint pretty_print) nogil:
 *     cdef xmlNode* c_sibling
 *     if c_node.parent is not NULL and _isElement(c_node.parent):             # <<<<<<<<<<<<<<
 *         return
 *     # we are at a root node, so add PI and comment siblings
 */
  __pyx_t_1 = (__pyx_v_c_node->parent != NULL);
  if (__pyx_t_1) {
    __pyx_t_2 = _isElement(__pyx_v_c_node->parent);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":331
 *     cdef xmlNode* c_sibling
 *     if c_node.parent is not NULL and _isElement(c_node.parent):
 *         return             # <<<<<<<<<<<<<<
 *     # we are at a root node, so add PI and comment siblings
 *     c_sibling = c_node.next
 */
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":333
 *         return
 *     # we are at a root node, so add PI and comment siblings
 *     c_sibling = c_node.next             # <<<<<<<<<<<<<<
 *     while c_sibling != NULL and \
 *             (c_sibling.type == tree.XML_PI_NODE or \
 */
  __pyx_v_c_sibling = __pyx_v_c_node->next;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":334
 *     # we are at a root node, so add PI and comment siblings
 *     c_sibling = c_node.next
 *     while c_sibling != NULL and \             # <<<<<<<<<<<<<<
 *             (c_sibling.type == tree.XML_PI_NODE or \
 *                  c_sibling.type == tree.XML_COMMENT_NODE):
 */
  while (1) {
    __pyx_t_3 = (__pyx_v_c_sibling != NULL);
    if (__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":335
 *     c_sibling = c_node.next
 *     while c_sibling != NULL and \
 *             (c_sibling.type == tree.XML_PI_NODE or \             # <<<<<<<<<<<<<<
 *                  c_sibling.type == tree.XML_COMMENT_NODE):
 *         if pretty_print:
 */
      __pyx_t_1 = (__pyx_v_c_sibling->type == XML_PI_NODE);
      if (!__pyx_t_1) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":336
 *     while c_sibling != NULL and \
 *             (c_sibling.type == tree.XML_PI_NODE or \
 *                  c_sibling.type == tree.XML_COMMENT_NODE):             # <<<<<<<<<<<<<<
 *         if pretty_print:
 *             tree.xmlOutputBufferWriteString(c_buffer, "\n")
 */
        __pyx_t_2 = (__pyx_v_c_sibling->type == XML_COMMENT_NODE);
        __pyx_t_4 = __pyx_t_2;
      } else {
        __pyx_t_4 = __pyx_t_1;
      }
      __pyx_t_1 = __pyx_t_4;
    } else {
      __pyx_t_1 = __pyx_t_3;
    }
    if (!__pyx_t_1) break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":337
 *             (c_sibling.type == tree.XML_PI_NODE or \
 *                  c_sibling.type == tree.XML_COMMENT_NODE):
 *         if pretty_print:             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferWriteString(c_buffer, "\n")
 *         tree.xmlNodeDumpOutput(c_buffer, c_node.doc, c_sibling, 0,
 */
    if (__pyx_v_pretty_print) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":338
 *                  c_sibling.type == tree.XML_COMMENT_NODE):
 *         if pretty_print:
 *             tree.xmlOutputBufferWriteString(c_buffer, "\n")             # <<<<<<<<<<<<<<
 *         tree.xmlNodeDumpOutput(c_buffer, c_node.doc, c_sibling, 0,
 *                                pretty_print, encoding)
 */
      xmlOutputBufferWriteString(__pyx_v_c_buffer, __pyx_k_47);
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":340
 *             tree.xmlOutputBufferWriteString(c_buffer, "\n")
 *         tree.xmlNodeDumpOutput(c_buffer, c_node.doc, c_sibling, 0,
 *                                pretty_print, encoding)             # <<<<<<<<<<<<<<
 *         c_sibling = c_sibling.next
 * 
 */
    xmlNodeDumpOutput(__pyx_v_c_buffer, __pyx_v_c_node->doc, __pyx_v_c_sibling, 0, __pyx_v_pretty_print, __pyx_v_encoding);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":341
 *         tree.xmlNodeDumpOutput(c_buffer, c_node.doc, c_sibling, 0,
 *                                pretty_print, encoding)
 *         c_sibling = c_sibling.next             # <<<<<<<<<<<<<<
 * 
 * ############################################################
 */
    __pyx_v_c_sibling = __pyx_v_c_sibling->next;
  }

  __pyx_L0:;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":351
 *     cdef _ExceptionContext _exc_context
 *     cdef _ErrorLog error_log
 *     def __cinit__(self, filelike, exc_context=None, compression=None):             # <<<<<<<<<<<<<<
 *         if compression is not None and compression > 0:
 *             filelike = gzip.GzipFile(
 */

static int __pyx_pf_4lxml_5etree_15_FilelikeWriter___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_15_FilelikeWriter___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filelike = 0;
  PyObject *__pyx_v_exc_context = 0;
  PyObject *__pyx_v_compression = 0;
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__filelike,&__pyx_n_s__exc_context,&__pyx_n_s__compression,0};
  __Pyx_RefNannySetupContext("__cinit__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filelike);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__exc_context);
        if (value) { values[1] = value; kw_args--; }
      }
      case  2:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__compression);
        if (value) { values[2] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_filelike = values[0];
    __pyx_v_exc_context = values[1];
    __pyx_v_compression = values[2];
  } else {
    __pyx_v_exc_context = ((PyObject *)Py_None);
    __pyx_v_compression = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: __pyx_v_compression = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: __pyx_v_exc_context = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v_filelike = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._FilelikeWriter.__cinit__");
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF(__pyx_v_filelike);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":352
 *     cdef _ErrorLog error_log
 *     def __cinit__(self, filelike, exc_context=None, compression=None):
 *         if compression is not None and compression > 0:             # <<<<<<<<<<<<<<
 *             filelike = gzip.GzipFile(
 *                 fileobj=filelike, mode=u'wb', compresslevel=compression)
 */
  __pyx_t_1 = (__pyx_v_compression != Py_None);
  if (__pyx_t_1) {
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_compression, __pyx_int_0, Py_GT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_4 = __pyx_t_3;
  } else {
    __pyx_t_4 = __pyx_t_1;
  }
  if (__pyx_t_4) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":353
 *     def __cinit__(self, filelike, exc_context=None, compression=None):
 *         if compression is not None and compression > 0:
 *             filelike = gzip.GzipFile(             # <<<<<<<<<<<<<<
 *                 fileobj=filelike, mode=u'wb', compresslevel=compression)
 *             self._close_filelike = filelike.close
 */
    __pyx_t_2 = PyObject_GetAttr(__pyx_v_4lxml_5etree_gzip, __pyx_n_s__GzipFile); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_5));

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":354
 *         if compression is not None and compression > 0:
 *             filelike = gzip.GzipFile(
 *                 fileobj=filelike, mode=u'wb', compresslevel=compression)             # <<<<<<<<<<<<<<
 *             self._close_filelike = filelike.close
 *         self._filelike = filelike
 */
    if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__fileobj), __pyx_v_filelike) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__mode), ((PyObject *)__pyx_n_u__wb)) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__compresslevel), __pyx_v_compression) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_6 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_v_filelike);
    __pyx_v_filelike = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":355
 *             filelike = gzip.GzipFile(
 *                 fileobj=filelike, mode=u'wb', compresslevel=compression)
 *             self._close_filelike = filelike.close             # <<<<<<<<<<<<<<
 *         self._filelike = filelike
 *         if exc_context is None:
 */
    __pyx_t_6 = PyObject_GetAttr(__pyx_v_filelike, __pyx_n_s__close); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)__pyx_v_self)->_close_filelike);
    __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)__pyx_v_self)->_close_filelike);
    ((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)__pyx_v_self)->_close_filelike = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":356
 *                 fileobj=filelike, mode=u'wb', compresslevel=compression)
 *             self._close_filelike = filelike.close
 *         self._filelike = filelike             # <<<<<<<<<<<<<<
 *         if exc_context is None:
 *             self._exc_context = _ExceptionContext()
 */
  __Pyx_INCREF(__pyx_v_filelike);
  __Pyx_GIVEREF(__pyx_v_filelike);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)__pyx_v_self)->_filelike);
  __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)__pyx_v_self)->_filelike);
  ((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)__pyx_v_self)->_filelike = __pyx_v_filelike;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":357
 *             self._close_filelike = filelike.close
 *         self._filelike = filelike
 *         if exc_context is None:             # <<<<<<<<<<<<<<
 *             self._exc_context = _ExceptionContext()
 *         else:
 */
  __pyx_t_4 = (__pyx_v_exc_context == Py_None);
  if (__pyx_t_4) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":358
 *         self._filelike = filelike
 *         if exc_context is None:
 *             self._exc_context = _ExceptionContext()             # <<<<<<<<<<<<<<
 *         else:
 *             self._exc_context = exc_context
 */
    __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ExceptionContext)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)__pyx_v_self)->_exc_context);
    __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)__pyx_v_self)->_exc_context));
    ((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)__pyx_v_self)->_exc_context = ((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_t_6);
    __pyx_t_6 = 0;
    goto __pyx_L7;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":360
 *             self._exc_context = _ExceptionContext()
 *         else:
 *             self._exc_context = exc_context             # <<<<<<<<<<<<<<
 *         self.error_log = _ErrorLog()
 * 
 */
    if (!(likely(((__pyx_v_exc_context) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_exc_context, __pyx_ptype_4lxml_5etree__ExceptionContext))))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_INCREF(__pyx_v_exc_context);
    __Pyx_GIVEREF(__pyx_v_exc_context);
    __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)__pyx_v_self)->_exc_context);
    __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)__pyx_v_self)->_exc_context));
    ((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)__pyx_v_self)->_exc_context = ((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_v_exc_context);
  }
  __pyx_L7:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":361
 *         else:
 *             self._exc_context = exc_context
 *         self.error_log = _ErrorLog()             # <<<<<<<<<<<<<<
 * 
 *     cdef tree.xmlOutputBuffer* _createOutputBuffer(
 */
  __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ErrorLog)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)__pyx_v_self)->error_log);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)__pyx_v_self)->error_log));
  ((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)__pyx_v_self)->error_log = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_t_6);
  __pyx_t_6 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._FilelikeWriter.__cinit__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_filelike);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":363
 *         self.error_log = _ErrorLog()
 * 
 *     cdef tree.xmlOutputBuffer* _createOutputBuffer(             # <<<<<<<<<<<<<<
 *         self, tree.xmlCharEncodingHandler* enchandler) except NULL:
 *         cdef tree.xmlOutputBuffer* c_buffer
 */

static  xmlOutputBuffer *__pyx_f_4lxml_5etree_15_FilelikeWriter__createOutputBuffer(struct __pyx_obj_4lxml_5etree__FilelikeWriter *__pyx_v_self, xmlCharEncodingHandler *__pyx_v_enchandler) {
  xmlOutputBuffer *__pyx_v_c_buffer;
  xmlOutputBuffer *__pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_createOutputBuffer");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":368
 *         c_buffer = tree.xmlOutputBufferCreateIO(
 *             _writeFilelikeWriter, _closeFilelikeWriter,
 *             <python.PyObject*>self, enchandler)             # <<<<<<<<<<<<<<
 *         if c_buffer is NULL:
 *             raise IOError, u"Could not create I/O writer context."
 */
  __pyx_v_c_buffer = xmlOutputBufferCreateIO(__pyx_f_4lxml_5etree__writeFilelikeWriter, __pyx_f_4lxml_5etree__closeFilelikeWriter, ((PyObject *)__pyx_v_self), __pyx_v_enchandler);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":369
 *             _writeFilelikeWriter, _closeFilelikeWriter,
 *             <python.PyObject*>self, enchandler)
 *         if c_buffer is NULL:             # <<<<<<<<<<<<<<
 *             raise IOError, u"Could not create I/O writer context."
 *         return c_buffer
 */
  __pyx_t_1 = (__pyx_v_c_buffer == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":370
 *             <python.PyObject*>self, enchandler)
 *         if c_buffer is NULL:
 *             raise IOError, u"Could not create I/O writer context."             # <<<<<<<<<<<<<<
 *         return c_buffer
 * 
 */
    __Pyx_Raise(__pyx_builtin_IOError, ((PyObject *)__pyx_kp_u_255), 0);
    {__pyx_filename = __pyx_f[4]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":371
 *         if c_buffer is NULL:
 *             raise IOError, u"Could not create I/O writer context."
 *         return c_buffer             # <<<<<<<<<<<<<<
 * 
 *     cdef int write(self, char* c_buffer, int size):
 */
  __pyx_r = __pyx_v_c_buffer;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._FilelikeWriter._createOutputBuffer");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":373
 *         return c_buffer
 * 
 *     cdef int write(self, char* c_buffer, int size):             # <<<<<<<<<<<<<<
 *         try:
 *             if self._filelike is None:
 */

static  int __pyx_f_4lxml_5etree_15_FilelikeWriter_write(struct __pyx_obj_4lxml_5etree__FilelikeWriter *__pyx_v_self, char *__pyx_v_c_buffer, int __pyx_v_size) {
  PyObject *__pyx_v_py_buffer;
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("write");
  __pyx_v_py_buffer = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":374
 * 
 *     cdef int write(self, char* c_buffer, int size):
 *         try:             # <<<<<<<<<<<<<<
 *             if self._filelike is None:
 *                 raise IOError, u"File is already closed"
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":375
 *     cdef int write(self, char* c_buffer, int size):
 *         try:
 *             if self._filelike is None:             # <<<<<<<<<<<<<<
 *                 raise IOError, u"File is already closed"
 *             py_buffer = <bytes>c_buffer[:size]
 */
      __pyx_t_1 = (__pyx_v_self->_filelike == Py_None);
      if (__pyx_t_1) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":376
 *         try:
 *             if self._filelike is None:
 *                 raise IOError, u"File is already closed"             # <<<<<<<<<<<<<<
 *             py_buffer = <bytes>c_buffer[:size]
 *             self._filelike.write(py_buffer)
 */
        __Pyx_Raise(__pyx_builtin_IOError, ((PyObject *)__pyx_kp_u_256), 0);
        {__pyx_filename = __pyx_f[4]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        goto __pyx_L11;
      }
      __pyx_L11:;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":377
 *             if self._filelike is None:
 *                 raise IOError, u"File is already closed"
 *             py_buffer = <bytes>c_buffer[:size]             # <<<<<<<<<<<<<<
 *             self._filelike.write(py_buffer)
 *             return size
 */
      __pyx_t_2 = PyBytes_FromStringAndSize(__pyx_v_c_buffer + 0, __pyx_v_size - 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __Pyx_DECREF(((PyObject *)__pyx_v_py_buffer));
      __pyx_v_py_buffer = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":378
 *                 raise IOError, u"File is already closed"
 *             py_buffer = <bytes>c_buffer[:size]
 *             self._filelike.write(py_buffer)             # <<<<<<<<<<<<<<
 *             return size
 *         except:
 */
      __pyx_t_2 = PyObject_GetAttr(__pyx_v_self->_filelike, __pyx_n_s__write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
      __Pyx_INCREF(((PyObject *)__pyx_v_py_buffer));
      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_py_buffer));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_py_buffer));
      __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":379
 *             py_buffer = <bytes>c_buffer[:size]
 *             self._filelike.write(py_buffer)
 *             return size             # <<<<<<<<<<<<<<
 *         except:
 *             self._exc_context._store_raised()
 */
      __pyx_r = __pyx_v_size;
      goto __pyx_L7_try_return;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L10_try_end;
    __pyx_L7_try_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":380
 *             self._filelike.write(py_buffer)
 *             return size
 *         except:             # <<<<<<<<<<<<<<
 *             self._exc_context._store_raised()
 *             return -1
 */
    /*except:*/ {
      __Pyx_AddTraceback("lxml.etree._FilelikeWriter.write");
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_2);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":381
 *             return size
 *         except:
 *             self._exc_context._store_raised()             # <<<<<<<<<<<<<<
 *             return -1
 * 
 */
      ((struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext *)__pyx_v_self->_exc_context->__pyx_vtab)->_store_raised(__pyx_v_self->_exc_context);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":382
 *         except:
 *             self._exc_context._store_raised()
 *             return -1             # <<<<<<<<<<<<<<
 * 
 *     cdef int close(self):
 */
      __pyx_r = -1;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L6_except_return;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L4_exception_handled;
    }
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L10_try_end:;
  }

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_WriteUnraisable("lxml.etree._FilelikeWriter.write");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_py_buffer);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":384
 *             return -1
 * 
 *     cdef int close(self):             # <<<<<<<<<<<<<<
 *         try:
 *             if self._close_filelike is not None:
 */

static  int __pyx_f_4lxml_5etree_15_FilelikeWriter_close(struct __pyx_obj_4lxml_5etree__FilelikeWriter *__pyx_v_self) {
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("close");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":385
 * 
 *     cdef int close(self):
 *         try:             # <<<<<<<<<<<<<<
 *             if self._close_filelike is not None:
 *                 self._close_filelike()
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":386
 *     cdef int close(self):
 *         try:
 *             if self._close_filelike is not None:             # <<<<<<<<<<<<<<
 *                 self._close_filelike()
 *             # we should not close the file here as we didn't open it
 */
      __pyx_t_1 = (__pyx_v_self->_close_filelike != Py_None);
      if (__pyx_t_1) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":387
 *         try:
 *             if self._close_filelike is not None:
 *                 self._close_filelike()             # <<<<<<<<<<<<<<
 *             # we should not close the file here as we didn't open it
 *             self._filelike = None
 */
        __pyx_t_2 = PyObject_Call(__pyx_v_self->_close_filelike, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        goto __pyx_L11;
      }
      __pyx_L11:;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":389
 *                 self._close_filelike()
 *             # we should not close the file here as we didn't open it
 *             self._filelike = None             # <<<<<<<<<<<<<<
 *             return 0
 *         except:
 */
      __Pyx_INCREF(Py_None);
      __Pyx_GIVEREF(Py_None);
      __Pyx_GOTREF(__pyx_v_self->_filelike);
      __Pyx_DECREF(__pyx_v_self->_filelike);
      __pyx_v_self->_filelike = Py_None;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":390
 *             # we should not close the file here as we didn't open it
 *             self._filelike = None
 *             return 0             # <<<<<<<<<<<<<<
 *         except:
 *             self._exc_context._store_raised()
 */
      __pyx_r = 0;
      goto __pyx_L7_try_return;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L10_try_end;
    __pyx_L7_try_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":391
 *             self._filelike = None
 *             return 0
 *         except:             # <<<<<<<<<<<<<<
 *             self._exc_context._store_raised()
 *             return -1
 */
    /*except:*/ {
      __Pyx_AddTraceback("lxml.etree._FilelikeWriter.close");
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_4);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":392
 *             return 0
 *         except:
 *             self._exc_context._store_raised()             # <<<<<<<<<<<<<<
 *             return -1
 * 
 */
      ((struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext *)__pyx_v_self->_exc_context->__pyx_vtab)->_store_raised(__pyx_v_self->_exc_context);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":393
 *         except:
 *             self._exc_context._store_raised()
 *             return -1             # <<<<<<<<<<<<<<
 * 
 * cdef int _writeFilelikeWriter(void* ctxt, char* c_buffer, int len):
 */
      __pyx_r = -1;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L6_except_return;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L4_exception_handled;
    }
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L10_try_end:;
  }

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_WriteUnraisable("lxml.etree._FilelikeWriter.close");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":395
 *             return -1
 * 
 * cdef int _writeFilelikeWriter(void* ctxt, char* c_buffer, int len):             # <<<<<<<<<<<<<<
 *     return (<_FilelikeWriter>ctxt).write(c_buffer, len)
 * 
 */

static  int __pyx_f_4lxml_5etree__writeFilelikeWriter(void *__pyx_v_ctxt, char *__pyx_v_c_buffer, int __pyx_v_len) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("_writeFilelikeWriter");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":396
 * 
 * cdef int _writeFilelikeWriter(void* ctxt, char* c_buffer, int len):
 *     return (<_FilelikeWriter>ctxt).write(c_buffer, len)             # <<<<<<<<<<<<<<
 * 
 * cdef int _closeFilelikeWriter(void* ctxt):
 */
  __pyx_r = ((struct __pyx_vtabstruct_4lxml_5etree__FilelikeWriter *)((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)__pyx_v_ctxt)->__pyx_vtab)->write(((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)__pyx_v_ctxt), __pyx_v_c_buffer, __pyx_v_len);
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":398
 *     return (<_FilelikeWriter>ctxt).write(c_buffer, len)
 * 
 * cdef int _closeFilelikeWriter(void* ctxt):             # <<<<<<<<<<<<<<
 *     return (<_FilelikeWriter>ctxt).close()
 * 
 */

static  int __pyx_f_4lxml_5etree__closeFilelikeWriter(void *__pyx_v_ctxt) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("_closeFilelikeWriter");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":399
 * 
 * cdef int _closeFilelikeWriter(void* ctxt):
 *     return (<_FilelikeWriter>ctxt).close()             # <<<<<<<<<<<<<<
 * 
 * cdef _tofilelike(f, _Element element, encoding, doctype, method,
 */
  __pyx_r = ((struct __pyx_vtabstruct_4lxml_5etree__FilelikeWriter *)((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)__pyx_v_ctxt)->__pyx_vtab)->close(((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)__pyx_v_ctxt));
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":401
 *     return (<_FilelikeWriter>ctxt).close()
 * 
 * cdef _tofilelike(f, _Element element, encoding, doctype, method,             # <<<<<<<<<<<<<<
 *                  bint write_xml_declaration, bint write_doctype,
 *                  bint pretty_print, bint with_tail, int standalone,
 */

static  PyObject *__pyx_f_4lxml_5etree__tofilelike(PyObject *__pyx_v_f, struct LxmlElement *__pyx_v_element, PyObject *__pyx_v_encoding, PyObject *__pyx_v_doctype, PyObject *__pyx_v_method, int __pyx_v_write_xml_declaration, int __pyx_v_write_doctype, int __pyx_v_pretty_print, int __pyx_v_with_tail, int __pyx_v_standalone, int __pyx_v_compression) {
  PyThreadState *__pyx_v_state;
  struct __pyx_obj_4lxml_5etree__FilelikeWriter *__pyx_v_writer;
  xmlOutputBuffer *__pyx_v_c_buffer;
  xmlCharEncodingHandler *__pyx_v_enchandler;
  char *__pyx_v_c_enc;
  char *__pyx_v_c_doctype;
  int __pyx_v_error_result;
  int __pyx_v_c_method;
  PyObject *__pyx_v_data;
  PyObject *__pyx_v_bytes_out;
  PyObject *__pyx_v_gzip_file;
  PyObject *__pyx_v_filename8;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  xmlOutputBuffer *__pyx_t_6;
  __Pyx_RefNannySetupContext("_tofilelike");
  __Pyx_INCREF(__pyx_v_f);
  __Pyx_INCREF(__pyx_v_encoding);
  __Pyx_INCREF(__pyx_v_doctype);
  __pyx_v_writer = ((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_data = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_bytes_out = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_gzip_file = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_filename8 = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":405
 *                  bint pretty_print, bint with_tail, int standalone,
 *                  int compression):
 *     cdef python.PyThreadState* state = NULL             # <<<<<<<<<<<<<<
 *     cdef _FilelikeWriter writer
 *     cdef tree.xmlOutputBuffer* c_buffer
 */
  __pyx_v_state = NULL;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":412
 *     cdef char* c_doctype
 *     cdef int error_result
 *     if encoding is None:             # <<<<<<<<<<<<<<
 *         c_enc = NULL
 *     else:
 */
  __pyx_t_1 = (__pyx_v_encoding == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":413
 *     cdef int error_result
 *     if encoding is None:
 *         c_enc = NULL             # <<<<<<<<<<<<<<
 *     else:
 *         encoding = _utf8(encoding)
 */
    __pyx_v_c_enc = NULL;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":415
 *         c_enc = NULL
 *     else:
 *         encoding = _utf8(encoding)             # <<<<<<<<<<<<<<
 *         c_enc = _cstr(encoding)
 *     if doctype is None:
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_v_encoding)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_v_encoding);
    __pyx_v_encoding = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":416
 *     else:
 *         encoding = _utf8(encoding)
 *         c_enc = _cstr(encoding)             # <<<<<<<<<<<<<<
 *     if doctype is None:
 *         c_doctype = NULL
 */
    __pyx_v_c_enc = PyBytes_AS_STRING(__pyx_v_encoding);
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":417
 *         encoding = _utf8(encoding)
 *         c_enc = _cstr(encoding)
 *     if doctype is None:             # <<<<<<<<<<<<<<
 *         c_doctype = NULL
 *     else:
 */
  __pyx_t_1 = (__pyx_v_doctype == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":418
 *         c_enc = _cstr(encoding)
 *     if doctype is None:
 *         c_doctype = NULL             # <<<<<<<<<<<<<<
 *     else:
 *         doctype = _utf8(doctype)
 */
    __pyx_v_c_doctype = NULL;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":420
 *         c_doctype = NULL
 *     else:
 *         doctype = _utf8(doctype)             # <<<<<<<<<<<<<<
 *         c_doctype = _cstr(doctype)
 *     c_method = _findOutputMethod(method)
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_v_doctype)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_v_doctype);
    __pyx_v_doctype = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":421
 *     else:
 *         doctype = _utf8(doctype)
 *         c_doctype = _cstr(doctype)             # <<<<<<<<<<<<<<
 *     c_method = _findOutputMethod(method)
 *     if c_method == OUTPUT_METHOD_TEXT:
 */
    __pyx_v_c_doctype = PyBytes_AS_STRING(__pyx_v_doctype);
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":422
 *         doctype = _utf8(doctype)
 *         c_doctype = _cstr(doctype)
 *     c_method = _findOutputMethod(method)             # <<<<<<<<<<<<<<
 *     if c_method == OUTPUT_METHOD_TEXT:
 *         data = _textToString(element._c_node, encoding, with_tail)
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree__findOutputMethod(__pyx_v_method); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_method = __pyx_t_3;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":423
 *         c_doctype = _cstr(doctype)
 *     c_method = _findOutputMethod(method)
 *     if c_method == OUTPUT_METHOD_TEXT:             # <<<<<<<<<<<<<<
 *         data = _textToString(element._c_node, encoding, with_tail)
 *         if compression:
 */
  __pyx_t_1 = (__pyx_v_c_method == __pyx_e_4lxml_5etree_OUTPUT_METHOD_TEXT);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":424
 *     c_method = _findOutputMethod(method)
 *     if c_method == OUTPUT_METHOD_TEXT:
 *         data = _textToString(element._c_node, encoding, with_tail)             # <<<<<<<<<<<<<<
 *         if compression:
 *             bytes_out = BytesIO()
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree__textToString(__pyx_v_element->_c_node, __pyx_v_encoding, __pyx_v_with_tail); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_v_data);
    __pyx_v_data = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":425
 *     if c_method == OUTPUT_METHOD_TEXT:
 *         data = _textToString(element._c_node, encoding, with_tail)
 *         if compression:             # <<<<<<<<<<<<<<
 *             bytes_out = BytesIO()
 *             gzip_file = gzip.GzipFile(
 */
    if (__pyx_v_compression) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":426
 *         data = _textToString(element._c_node, encoding, with_tail)
 *         if compression:
 *             bytes_out = BytesIO()             # <<<<<<<<<<<<<<
 *             gzip_file = gzip.GzipFile(
 *                 fileobj=bytes_out, mode=u'wb', compresslevel=compression)
 */
      __pyx_t_2 = PyObject_Call(__pyx_v_4lxml_5etree_BytesIO, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_v_bytes_out);
      __pyx_v_bytes_out = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":427
 *         if compression:
 *             bytes_out = BytesIO()
 *             gzip_file = gzip.GzipFile(             # <<<<<<<<<<<<<<
 *                 fileobj=bytes_out, mode=u'wb', compresslevel=compression)
 *             try:
 */
      __pyx_t_2 = PyObject_GetAttr(__pyx_v_4lxml_5etree_gzip, __pyx_n_s__GzipFile); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":428
 *             bytes_out = BytesIO()
 *             gzip_file = gzip.GzipFile(
 *                 fileobj=bytes_out, mode=u'wb', compresslevel=compression)             # <<<<<<<<<<<<<<
 *             try:
 *                 gzip_file.write(data)
 */
      if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__fileobj), __pyx_v_bytes_out) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__mode), ((PyObject *)__pyx_n_u__wb)) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_5 = PyInt_FromLong(__pyx_v_compression); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__compresslevel), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_v_gzip_file);
      __pyx_v_gzip_file = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":429
 *             gzip_file = gzip.GzipFile(
 *                 fileobj=bytes_out, mode=u'wb', compresslevel=compression)
 *             try:             # <<<<<<<<<<<<<<
 *                 gzip_file.write(data)
 *             finally:
 */
      /*try:*/ {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":430
 *                 fileobj=bytes_out, mode=u'wb', compresslevel=compression)
 *             try:
 *                 gzip_file.write(data)             # <<<<<<<<<<<<<<
 *             finally:
 *                 gzip_file.close()
 */
        __pyx_t_5 = PyObject_GetAttr(__pyx_v_gzip_file, __pyx_n_s__write); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L8;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L8;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_4));
        __Pyx_INCREF(__pyx_v_data);
        PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_data);
        __Pyx_GIVEREF(__pyx_v_data);
        __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L8;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":432
 *                 gzip_file.write(data)
 *             finally:
 *                 gzip_file.close()             # <<<<<<<<<<<<<<
 *             data = bytes_out
 *         if _isString(f):
 */
      /*finally:*/ {
        int __pyx_why;
        PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
        int __pyx_exc_lineno;
        __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
        __pyx_why = 0; goto __pyx_L9;
        __pyx_L8: {
          __pyx_why = 4;
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
          __pyx_exc_lineno = __pyx_lineno;
          goto __pyx_L9;
        }
        __pyx_L9:;
        __pyx_t_2 = PyObject_GetAttr(__pyx_v_gzip_file, __pyx_n_s__close); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        goto __pyx_L11;
        __pyx_L10_error:;
        if (__pyx_why == 4) {
          Py_XDECREF(__pyx_exc_type);
          Py_XDECREF(__pyx_exc_value);
          Py_XDECREF(__pyx_exc_tb);
        }
        goto __pyx_L1_error;
        __pyx_L11:;
        switch (__pyx_why) {
          case 4: {
            __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
            __pyx_lineno = __pyx_exc_lineno;
            __pyx_exc_type = 0;
            __pyx_exc_value = 0;
            __pyx_exc_tb = 0;
            goto __pyx_L1_error;
          }
        }
      }

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":433
 *             finally:
 *                 gzip_file.close()
 *             data = bytes_out             # <<<<<<<<<<<<<<
 *         if _isString(f):
 *             filename8 = _encodeFilename(f)
 */
      __Pyx_INCREF(__pyx_v_bytes_out);
      __Pyx_DECREF(__pyx_v_data);
      __pyx_v_data = __pyx_v_bytes_out;
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":434
 *                 gzip_file.close()
 *             data = bytes_out
 *         if _isString(f):             # <<<<<<<<<<<<<<
 *             filename8 = _encodeFilename(f)
 *             f = open(filename8, u'wb')
 */
    __pyx_t_1 = _isString(__pyx_v_f);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":435
 *             data = bytes_out
 *         if _isString(f):
 *             filename8 = _encodeFilename(f)             # <<<<<<<<<<<<<<
 *             f = open(filename8, u'wb')
 *             try:
 */
      __pyx_t_4 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_f); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_v_filename8);
      __pyx_v_filename8 = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":436
 *         if _isString(f):
 *             filename8 = _encodeFilename(f)
 *             f = open(filename8, u'wb')             # <<<<<<<<<<<<<<
 *             try:
 *                 f.write(data)
 */
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      __Pyx_INCREF(__pyx_v_filename8);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_filename8);
      __Pyx_GIVEREF(__pyx_v_filename8);
      __Pyx_INCREF(((PyObject *)__pyx_n_u__wb));
      PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_n_u__wb));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_u__wb));
      __pyx_t_2 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_v_f);
      __pyx_v_f = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":437
 *             filename8 = _encodeFilename(f)
 *             f = open(filename8, u'wb')
 *             try:             # <<<<<<<<<<<<<<
 *                 f.write(data)
 *             finally:
 */
      /*try:*/ {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":438
 *             f = open(filename8, u'wb')
 *             try:
 *                 f.write(data)             # <<<<<<<<<<<<<<
 *             finally:
 *                 f.close()
 */
        __pyx_t_2 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L14;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L14;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_4));
        __Pyx_INCREF(__pyx_v_data);
        PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_data);
        __Pyx_GIVEREF(__pyx_v_data);
        __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L14;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":440
 *                 f.write(data)
 *             finally:
 *                 f.close()             # <<<<<<<<<<<<<<
 *         else:
 *             f.write(data)
 */
      /*finally:*/ {
        int __pyx_why;
        PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
        int __pyx_exc_lineno;
        __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
        __pyx_why = 0; goto __pyx_L15;
        __pyx_L14: {
          __pyx_why = 4;
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
          __pyx_exc_lineno = __pyx_lineno;
          goto __pyx_L15;
        }
        __pyx_L15:;
        __pyx_t_5 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__close); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        goto __pyx_L17;
        __pyx_L16_error:;
        if (__pyx_why == 4) {
          Py_XDECREF(__pyx_exc_type);
          Py_XDECREF(__pyx_exc_value);
          Py_XDECREF(__pyx_exc_tb);
        }
        goto __pyx_L1_error;
        __pyx_L17:;
        switch (__pyx_why) {
          case 4: {
            __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
            __pyx_lineno = __pyx_exc_lineno;
            __pyx_exc_type = 0;
            __pyx_exc_value = 0;
            __pyx_exc_tb = 0;
            goto __pyx_L1_error;
          }
        }
      }
      goto __pyx_L12;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":442
 *                 f.close()
 *         else:
 *             f.write(data)             # <<<<<<<<<<<<<<
 *         return
 *     enchandler = tree.xmlFindCharEncodingHandler(c_enc)
 */
      __pyx_t_4 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
      __Pyx_INCREF(__pyx_v_data);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_data);
      __Pyx_GIVEREF(__pyx_v_data);
      __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __pyx_L12:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":443
 *         else:
 *             f.write(data)
 *         return             # <<<<<<<<<<<<<<
 *     enchandler = tree.xmlFindCharEncodingHandler(c_enc)
 *     if enchandler is NULL:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":444
 *             f.write(data)
 *         return
 *     enchandler = tree.xmlFindCharEncodingHandler(c_enc)             # <<<<<<<<<<<<<<
 *     if enchandler is NULL:
 *         if encoding is not None:
 */
  __pyx_v_enchandler = xmlFindCharEncodingHandler(__pyx_v_c_enc);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":445
 *         return
 *     enchandler = tree.xmlFindCharEncodingHandler(c_enc)
 *     if enchandler is NULL:             # <<<<<<<<<<<<<<
 *         if encoding is not None:
 *             encoding = encoding.decode(u'UTF-8')
 */
  __pyx_t_1 = (__pyx_v_enchandler == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":446
 *     enchandler = tree.xmlFindCharEncodingHandler(c_enc)
 *     if enchandler is NULL:
 *         if encoding is not None:             # <<<<<<<<<<<<<<
 *             encoding = encoding.decode(u'UTF-8')
 *         raise LookupError, u"unknown encoding: '%s'" % encoding
 */
    __pyx_t_1 = (__pyx_v_encoding != Py_None);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":447
 *     if enchandler is NULL:
 *         if encoding is not None:
 *             encoding = encoding.decode(u'UTF-8')             # <<<<<<<<<<<<<<
 *         raise LookupError, u"unknown encoding: '%s'" % encoding
 * 
 */
      __pyx_t_2 = PyObject_GetAttr(__pyx_v_encoding, __pyx_n_s__decode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_257), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_v_encoding);
      __pyx_v_encoding = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L19;
    }
    __pyx_L19:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":448
 *         if encoding is not None:
 *             encoding = encoding.decode(u'UTF-8')
 *         raise LookupError, u"unknown encoding: '%s'" % encoding             # <<<<<<<<<<<<<<
 * 
 *     if _isString(f):
 */
    __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_180), __pyx_v_encoding); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
    __Pyx_Raise(__pyx_builtin_LookupError, ((PyObject *)__pyx_t_5), 0);
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    {__pyx_filename = __pyx_f[4]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L18;
  }
  __pyx_L18:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":450
 *         raise LookupError, u"unknown encoding: '%s'" % encoding
 * 
 *     if _isString(f):             # <<<<<<<<<<<<<<
 *         filename8 = _encodeFilename(f)
 *         c_buffer = tree.xmlOutputBufferCreateFilename(
 */
  __pyx_t_1 = _isString(__pyx_v_f);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":451
 * 
 *     if _isString(f):
 *         filename8 = _encodeFilename(f)             # <<<<<<<<<<<<<<
 *         c_buffer = tree.xmlOutputBufferCreateFilename(
 *             _cstr(filename8), enchandler, compression)
 */
    __pyx_t_5 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_f); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_v_filename8);
    __pyx_v_filename8 = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":453
 *         filename8 = _encodeFilename(f)
 *         c_buffer = tree.xmlOutputBufferCreateFilename(
 *             _cstr(filename8), enchandler, compression)             # <<<<<<<<<<<<<<
 *         if c_buffer is NULL:
 *             return python.PyErr_SetFromErrno(IOError)
 */
    __pyx_v_c_buffer = xmlOutputBufferCreateFilename(PyBytes_AS_STRING(__pyx_v_filename8), __pyx_v_enchandler, __pyx_v_compression);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":454
 *         c_buffer = tree.xmlOutputBufferCreateFilename(
 *             _cstr(filename8), enchandler, compression)
 *         if c_buffer is NULL:             # <<<<<<<<<<<<<<
 *             return python.PyErr_SetFromErrno(IOError)
 *         state = python.PyEval_SaveThread()
 */
    __pyx_t_1 = (__pyx_v_c_buffer == NULL);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":455
 *             _cstr(filename8), enchandler, compression)
 *         if c_buffer is NULL:
 *             return python.PyErr_SetFromErrno(IOError)             # <<<<<<<<<<<<<<
 *         state = python.PyEval_SaveThread()
 *     elif hasattr(f, u'write'):
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_5 = PyErr_SetFromErrno(__pyx_builtin_IOError); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L0;
      goto __pyx_L21;
    }
    __pyx_L21:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":456
 *         if c_buffer is NULL:
 *             return python.PyErr_SetFromErrno(IOError)
 *         state = python.PyEval_SaveThread()             # <<<<<<<<<<<<<<
 *     elif hasattr(f, u'write'):
 *         writer   = _FilelikeWriter(f, compression=compression)
 */
    __pyx_v_state = PyEval_SaveThread();
    goto __pyx_L20;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":457
 *             return python.PyErr_SetFromErrno(IOError)
 *         state = python.PyEval_SaveThread()
 *     elif hasattr(f, u'write'):             # <<<<<<<<<<<<<<
 *         writer   = _FilelikeWriter(f, compression=compression)
 *         c_buffer = writer._createOutputBuffer(enchandler)
 */
  __pyx_t_1 = PyObject_HasAttr(__pyx_v_f, ((PyObject *)__pyx_n_u__write)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":458
 *         state = python.PyEval_SaveThread()
 *     elif hasattr(f, u'write'):
 *         writer   = _FilelikeWriter(f, compression=compression)             # <<<<<<<<<<<<<<
 *         c_buffer = writer._createOutputBuffer(enchandler)
 *     else:
 */
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
    __Pyx_INCREF(__pyx_v_f);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_f);
    __Pyx_GIVEREF(__pyx_v_f);
    __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __pyx_t_4 = PyInt_FromLong(__pyx_v_compression); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__compression), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__FilelikeWriter)), ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_v_writer));
    __pyx_v_writer = ((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":459
 *     elif hasattr(f, u'write'):
 *         writer   = _FilelikeWriter(f, compression=compression)
 *         c_buffer = writer._createOutputBuffer(enchandler)             # <<<<<<<<<<<<<<
 *     else:
 *         tree.xmlCharEncCloseFunc(enchandler)
 */
    __pyx_t_6 = ((struct __pyx_vtabstruct_4lxml_5etree__FilelikeWriter *)__pyx_v_writer->__pyx_vtab)->_createOutputBuffer(__pyx_v_writer, __pyx_v_enchandler); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_c_buffer = __pyx_t_6;
    goto __pyx_L20;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":461
 *         c_buffer = writer._createOutputBuffer(enchandler)
 *     else:
 *         tree.xmlCharEncCloseFunc(enchandler)             # <<<<<<<<<<<<<<
 *         raise TypeError, \
 *             u"File or filename expected, got '%s'" % funicode(python._fqtypename(f))
 */
    xmlCharEncCloseFunc(__pyx_v_enchandler);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":463
 *         tree.xmlCharEncCloseFunc(enchandler)
 *         raise TypeError, \
 *             u"File or filename expected, got '%s'" % funicode(python._fqtypename(f))             # <<<<<<<<<<<<<<
 * 
 *     _writeNodeToBuffer(c_buffer, element._c_node, c_enc, c_doctype, c_method,
 */
    __pyx_t_4 = __pyx_f_4lxml_5etree_funicode(_fqtypename(__pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_258), __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_2), 0);
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[4]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L20:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":467
 *     _writeNodeToBuffer(c_buffer, element._c_node, c_enc, c_doctype, c_method,
 *                        write_xml_declaration, write_doctype,
 *                        pretty_print, with_tail, standalone)             # <<<<<<<<<<<<<<
 *     error_result = c_buffer.error
 *     if error_result == xmlerror.XML_ERR_OK:
 */
  __pyx_f_4lxml_5etree__writeNodeToBuffer(__pyx_v_c_buffer, __pyx_v_element->_c_node, __pyx_v_c_enc, __pyx_v_c_doctype, __pyx_v_c_method, __pyx_v_write_xml_declaration, __pyx_v_write_doctype, __pyx_v_pretty_print, __pyx_v_with_tail, __pyx_v_standalone);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":468
 *                        write_xml_declaration, write_doctype,
 *                        pretty_print, with_tail, standalone)
 *     error_result = c_buffer.error             # <<<<<<<<<<<<<<
 *     if error_result == xmlerror.XML_ERR_OK:
 *         error_result = tree.xmlOutputBufferClose(c_buffer)
 */
  __pyx_v_error_result = __pyx_v_c_buffer->error;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":469
 *                        pretty_print, with_tail, standalone)
 *     error_result = c_buffer.error
 *     if error_result == xmlerror.XML_ERR_OK:             # <<<<<<<<<<<<<<
 *         error_result = tree.xmlOutputBufferClose(c_buffer)
 *         if error_result > 0:
 */
  __pyx_t_1 = (__pyx_v_error_result == XML_ERR_OK);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":470
 *     error_result = c_buffer.error
 *     if error_result == xmlerror.XML_ERR_OK:
 *         error_result = tree.xmlOutputBufferClose(c_buffer)             # <<<<<<<<<<<<<<
 *         if error_result > 0:
 *             error_result = xmlerror.XML_ERR_OK
 */
    __pyx_v_error_result = xmlOutputBufferClose(__pyx_v_c_buffer);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":471
 *     if error_result == xmlerror.XML_ERR_OK:
 *         error_result = tree.xmlOutputBufferClose(c_buffer)
 *         if error_result > 0:             # <<<<<<<<<<<<<<
 *             error_result = xmlerror.XML_ERR_OK
 *     else:
 */
    __pyx_t_1 = (__pyx_v_error_result > 0);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":472
 *         error_result = tree.xmlOutputBufferClose(c_buffer)
 *         if error_result > 0:
 *             error_result = xmlerror.XML_ERR_OK             # <<<<<<<<<<<<<<
 *     else:
 *         tree.xmlOutputBufferClose(c_buffer)
 */
      __pyx_v_error_result = XML_ERR_OK;
      goto __pyx_L23;
    }
    __pyx_L23:;
    goto __pyx_L22;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":474
 *             error_result = xmlerror.XML_ERR_OK
 *     else:
 *         tree.xmlOutputBufferClose(c_buffer)             # <<<<<<<<<<<<<<
 *     if writer is None:
 *         python.PyEval_RestoreThread(state)
 */
    xmlOutputBufferClose(__pyx_v_c_buffer);
  }
  __pyx_L22:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":475
 *     else:
 *         tree.xmlOutputBufferClose(c_buffer)
 *     if writer is None:             # <<<<<<<<<<<<<<
 *         python.PyEval_RestoreThread(state)
 *     else:
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_writer) == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":476
 *         tree.xmlOutputBufferClose(c_buffer)
 *     if writer is None:
 *         python.PyEval_RestoreThread(state)             # <<<<<<<<<<<<<<
 *     else:
 *         writer._exc_context._raise_if_stored()
 */
    PyEval_RestoreThread(__pyx_v_state);
    goto __pyx_L24;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":478
 *         python.PyEval_RestoreThread(state)
 *     else:
 *         writer._exc_context._raise_if_stored()             # <<<<<<<<<<<<<<
 *     if error_result != xmlerror.XML_ERR_OK:
 *         _raiseSerialisationError(error_result)
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext *)__pyx_v_writer->_exc_context->__pyx_vtab)->_raise_if_stored(__pyx_v_writer->_exc_context); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L24:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":479
 *     else:
 *         writer._exc_context._raise_if_stored()
 *     if error_result != xmlerror.XML_ERR_OK:             # <<<<<<<<<<<<<<
 *         _raiseSerialisationError(error_result)
 * 
 */
  __pyx_t_1 = (__pyx_v_error_result != XML_ERR_OK);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":480
 *         writer._exc_context._raise_if_stored()
 *     if error_result != xmlerror.XML_ERR_OK:
 *         _raiseSerialisationError(error_result)             # <<<<<<<<<<<<<<
 * 
 * cdef _tofilelikeC14N(f, _Element element, bint exclusive, bint with_comments,
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree__raiseSerialisationError(__pyx_v_error_result); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L25;
  }
  __pyx_L25:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._tofilelike");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_writer);
  __Pyx_DECREF(__pyx_v_data);
  __Pyx_DECREF(__pyx_v_bytes_out);
  __Pyx_DECREF(__pyx_v_gzip_file);
  __Pyx_DECREF(__pyx_v_filename8);
  __Pyx_DECREF(__pyx_v_f);
  __Pyx_DECREF(__pyx_v_encoding);
  __Pyx_DECREF(__pyx_v_doctype);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":482
 *         _raiseSerialisationError(error_result)
 * 
 * cdef _tofilelikeC14N(f, _Element element, bint exclusive, bint with_comments,             # <<<<<<<<<<<<<<
 *                      int compression):
 *     cdef _FilelikeWriter writer
 */

static  PyObject *__pyx_f_4lxml_5etree__tofilelikeC14N(PyObject *__pyx_v_f, struct LxmlElement *__pyx_v_element, int __pyx_v_exclusive, int __pyx_v_with_comments, int __pyx_v_compression) {
  struct __pyx_obj_4lxml_5etree__FilelikeWriter *__pyx_v_writer;
  xmlOutputBuffer *__pyx_v_c_buffer;
  char *__pyx_v_c_filename;
  xmlDoc *__pyx_v_c_base_doc;
  xmlDoc *__pyx_v_c_doc;
  int __pyx_v_bytes;
  PyObject *__pyx_v_filename8;
  PyObject *__pyx_v_message;
  struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_errors;
  PyObject *__pyx_r = NULL;
  xmlDoc *__pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  xmlOutputBuffer *__pyx_t_6;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  __Pyx_RefNannySetupContext("_tofilelikeC14N");
  __pyx_v_writer = ((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_filename8 = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_message = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_errors = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":489
 *     cdef xmlDoc* c_base_doc
 *     cdef xmlDoc* c_doc
 *     cdef int bytes = -1             # <<<<<<<<<<<<<<
 * 
 *     c_base_doc = element._c_node.doc
 */
  __pyx_v_bytes = -1;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":491
 *     cdef int bytes = -1
 * 
 *     c_base_doc = element._c_node.doc             # <<<<<<<<<<<<<<
 *     c_doc = _fakeRootDoc(c_base_doc, element._c_node)
 *     try:
 */
  __pyx_v_c_base_doc = __pyx_v_element->_c_node->doc;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":492
 * 
 *     c_base_doc = element._c_node.doc
 *     c_doc = _fakeRootDoc(c_base_doc, element._c_node)             # <<<<<<<<<<<<<<
 *     try:
 *         if _isString(f):
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__fakeRootDoc(__pyx_v_c_base_doc, __pyx_v_element->_c_node); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_doc = __pyx_t_1;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":493
 *     c_base_doc = element._c_node.doc
 *     c_doc = _fakeRootDoc(c_base_doc, element._c_node)
 *     try:             # <<<<<<<<<<<<<<
 *         if _isString(f):
 *             filename8 = _encodeFilename(f)
 */
  /*try:*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":494
 *     c_doc = _fakeRootDoc(c_base_doc, element._c_node)
 *     try:
 *         if _isString(f):             # <<<<<<<<<<<<<<
 *             filename8 = _encodeFilename(f)
 *             c_filename = _cstr(filename8)
 */
    __pyx_t_2 = _isString(__pyx_v_f);
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":495
 *     try:
 *         if _isString(f):
 *             filename8 = _encodeFilename(f)             # <<<<<<<<<<<<<<
 *             c_filename = _cstr(filename8)
 *             with nogil:
 */
      __pyx_t_3 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_f); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L4;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_v_filename8);
      __pyx_v_filename8 = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":496
 *         if _isString(f):
 *             filename8 = _encodeFilename(f)
 *             c_filename = _cstr(filename8)             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 bytes = c14n.xmlC14NDocSave(c_doc, NULL, exclusive, NULL,
 */
      __pyx_v_c_filename = PyBytes_AS_STRING(__pyx_v_filename8);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":497
 *             filename8 = _encodeFilename(f)
 *             c_filename = _cstr(filename8)
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 bytes = c14n.xmlC14NDocSave(c_doc, NULL, exclusive, NULL,
 *                                             with_comments, c_filename, compression)
 */
      {
        #ifdef WITH_THREAD
        PyThreadState *_save;
        #endif
        Py_UNBLOCK_THREADS
        /*try:*/ {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":499
 *             with nogil:
 *                 bytes = c14n.xmlC14NDocSave(c_doc, NULL, exclusive, NULL,
 *                                             with_comments, c_filename, compression)             # <<<<<<<<<<<<<<
 *         elif hasattr(f, u'write'):
 *             writer   = _FilelikeWriter(f, compression=compression)
 */
          __pyx_v_bytes = xmlC14NDocSave(__pyx_v_c_doc, NULL, __pyx_v_exclusive, NULL, __pyx_v_with_comments, __pyx_v_c_filename, __pyx_v_compression);
        }

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":497
 *             filename8 = _encodeFilename(f)
 *             c_filename = _cstr(filename8)
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 bytes = c14n.xmlC14NDocSave(c_doc, NULL, exclusive, NULL,
 *                                             with_comments, c_filename, compression)
 */
        /*finally:*/ {
          Py_BLOCK_THREADS
        }
      }
      goto __pyx_L6;
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":500
 *                 bytes = c14n.xmlC14NDocSave(c_doc, NULL, exclusive, NULL,
 *                                             with_comments, c_filename, compression)
 *         elif hasattr(f, u'write'):             # <<<<<<<<<<<<<<
 *             writer   = _FilelikeWriter(f, compression=compression)
 *             c_buffer = writer._createOutputBuffer(NULL)
 */
    __pyx_t_2 = PyObject_HasAttr(__pyx_v_f, ((PyObject *)__pyx_n_u__write)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L4;}
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":501
 *                                             with_comments, c_filename, compression)
 *         elif hasattr(f, u'write'):
 *             writer   = _FilelikeWriter(f, compression=compression)             # <<<<<<<<<<<<<<
 *             c_buffer = writer._createOutputBuffer(NULL)
 *             writer.error_log.connect()
 */
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L4;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
      __Pyx_INCREF(__pyx_v_f);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_f);
      __Pyx_GIVEREF(__pyx_v_f);
      __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L4;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      __pyx_t_5 = PyInt_FromLong(__pyx_v_compression); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L4;}
      __Pyx_GOTREF(__pyx_t_5);
      if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__compression), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L4;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__FilelikeWriter)), ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L4;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_v_writer));
      __pyx_v_writer = ((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)__pyx_t_5);
      __pyx_t_5 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":502
 *         elif hasattr(f, u'write'):
 *             writer   = _FilelikeWriter(f, compression=compression)
 *             c_buffer = writer._createOutputBuffer(NULL)             # <<<<<<<<<<<<<<
 *             writer.error_log.connect()
 *             bytes = c14n.xmlC14NDocSaveTo(c_doc, NULL, exclusive, NULL,
 */
      __pyx_t_6 = ((struct __pyx_vtabstruct_4lxml_5etree__FilelikeWriter *)__pyx_v_writer->__pyx_vtab)->_createOutputBuffer(__pyx_v_writer, NULL); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L4;}
      __pyx_v_c_buffer = __pyx_t_6;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":503
 *             writer   = _FilelikeWriter(f, compression=compression)
 *             c_buffer = writer._createOutputBuffer(NULL)
 *             writer.error_log.connect()             # <<<<<<<<<<<<<<
 *             bytes = c14n.xmlC14NDocSaveTo(c_doc, NULL, exclusive, NULL,
 *                                           with_comments, c_buffer)
 */
      ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)__pyx_v_writer->error_log->__pyx_base.__pyx_base.__pyx_vtab)->connect(__pyx_v_writer->error_log);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":505
 *             writer.error_log.connect()
 *             bytes = c14n.xmlC14NDocSaveTo(c_doc, NULL, exclusive, NULL,
 *                                           with_comments, c_buffer)             # <<<<<<<<<<<<<<
 *             writer.error_log.disconnect()
 *             if bytes >= 0:
 */
      __pyx_v_bytes = xmlC14NDocSaveTo(__pyx_v_c_doc, NULL, __pyx_v_exclusive, NULL, __pyx_v_with_comments, __pyx_v_c_buffer);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":506
 *             bytes = c14n.xmlC14NDocSaveTo(c_doc, NULL, exclusive, NULL,
 *                                           with_comments, c_buffer)
 *             writer.error_log.disconnect()             # <<<<<<<<<<<<<<
 *             if bytes >= 0:
 *                 bytes = tree.xmlOutputBufferClose(c_buffer)
 */
      ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)__pyx_v_writer->error_log->__pyx_base.__pyx_base.__pyx_vtab)->disconnect(__pyx_v_writer->error_log);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":507
 *                                           with_comments, c_buffer)
 *             writer.error_log.disconnect()
 *             if bytes >= 0:             # <<<<<<<<<<<<<<
 *                 bytes = tree.xmlOutputBufferClose(c_buffer)
 *             else:
 */
      __pyx_t_2 = (__pyx_v_bytes >= 0);
      if (__pyx_t_2) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":508
 *             writer.error_log.disconnect()
 *             if bytes >= 0:
 *                 bytes = tree.xmlOutputBufferClose(c_buffer)             # <<<<<<<<<<<<<<
 *             else:
 *                 tree.xmlOutputBufferClose(c_buffer)
 */
        __pyx_v_bytes = xmlOutputBufferClose(__pyx_v_c_buffer);
        goto __pyx_L10;
      }
      /*else*/ {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":510
 *                 bytes = tree.xmlOutputBufferClose(c_buffer)
 *             else:
 *                 tree.xmlOutputBufferClose(c_buffer)             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError, \
 */
        xmlOutputBufferClose(__pyx_v_c_buffer);
      }
      __pyx_L10:;
      goto __pyx_L6;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":513
 *         else:
 *             raise TypeError, \
 *                 u"File or filename expected, got '%s'" % funicode(python._fqtypename(f))             # <<<<<<<<<<<<<<
 *     finally:
 *         _destroyFakeDoc(c_base_doc, c_doc)
 */
      __pyx_t_5 = __pyx_f_4lxml_5etree_funicode(_fqtypename(__pyx_v_f)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L4;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_258), __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L4;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_4), 0);
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      {__pyx_filename = __pyx_f[4]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L4;}
    }
    __pyx_L6:;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":515
 *                 u"File or filename expected, got '%s'" % funicode(python._fqtypename(f))
 *     finally:
 *         _destroyFakeDoc(c_base_doc, c_doc)             # <<<<<<<<<<<<<<
 * 
 *     if writer is not None:
 */
  /*finally:*/ {
    int __pyx_why;
    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
    int __pyx_exc_lineno;
    __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 0; goto __pyx_L5;
    __pyx_L4: {
      __pyx_why = 4;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
      __pyx_exc_lineno = __pyx_lineno;
      goto __pyx_L5;
    }
    __pyx_L5:;
    __pyx_f_4lxml_5etree__destroyFakeDoc(__pyx_v_c_base_doc, __pyx_v_c_doc);
    switch (__pyx_why) {
      case 4: {
        __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
        __pyx_lineno = __pyx_exc_lineno;
        __pyx_exc_type = 0;
        __pyx_exc_value = 0;
        __pyx_exc_tb = 0;
        goto __pyx_L1_error;
      }
    }
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":517
 *         _destroyFakeDoc(c_base_doc, c_doc)
 * 
 *     if writer is not None:             # <<<<<<<<<<<<<<
 *         writer._exc_context._raise_if_stored()
 * 
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_writer) != Py_None);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":518
 * 
 *     if writer is not None:
 *         writer._exc_context._raise_if_stored()             # <<<<<<<<<<<<<<
 * 
 *     if bytes < 0:
 */
    __pyx_t_7 = ((struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext *)__pyx_v_writer->_exc_context->__pyx_vtab)->_raise_if_stored(__pyx_v_writer->_exc_context); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L12;
  }
  __pyx_L12:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":520
 *         writer._exc_context._raise_if_stored()
 * 
 *     if bytes < 0:             # <<<<<<<<<<<<<<
 *         message = u"C14N failed"
 *         if writer is not None:
 */
  __pyx_t_2 = (__pyx_v_bytes < 0);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":521
 * 
 *     if bytes < 0:
 *         message = u"C14N failed"             # <<<<<<<<<<<<<<
 *         if writer is not None:
 *             errors = writer.error_log
 */
    __Pyx_INCREF(((PyObject *)__pyx_kp_u_239));
    __Pyx_DECREF(__pyx_v_message);
    __pyx_v_message = ((PyObject *)__pyx_kp_u_239);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":522
 *     if bytes < 0:
 *         message = u"C14N failed"
 *         if writer is not None:             # <<<<<<<<<<<<<<
 *             errors = writer.error_log
 *             if len(errors):
 */
    __pyx_t_2 = (((PyObject *)__pyx_v_writer) != Py_None);
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":523
 *         message = u"C14N failed"
 *         if writer is not None:
 *             errors = writer.error_log             # <<<<<<<<<<<<<<
 *             if len(errors):
 *                 message = errors[0].message
 */
      __Pyx_INCREF(((PyObject *)__pyx_v_writer->error_log));
      __Pyx_DECREF(((PyObject *)__pyx_v_errors));
      __pyx_v_errors = __pyx_v_writer->error_log;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":524
 *         if writer is not None:
 *             errors = writer.error_log
 *             if len(errors):             # <<<<<<<<<<<<<<
 *                 message = errors[0].message
 *         raise C14NError, message
 */
      __pyx_t_8 = PyObject_Length(((PyObject *)__pyx_v_errors)); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (__pyx_t_8) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":525
 *             errors = writer.error_log
 *             if len(errors):
 *                 message = errors[0].message             # <<<<<<<<<<<<<<
 *         raise C14NError, message
 * 
 */
        __pyx_t_4 = __Pyx_GetItemInt(((PyObject *)__pyx_v_errors), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__message); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_v_message);
        __pyx_v_message = __pyx_t_5;
        __pyx_t_5 = 0;
        goto __pyx_L15;
      }
      __pyx_L15:;
      goto __pyx_L14;
    }
    __pyx_L14:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":526
 *             if len(errors):
 *                 message = errors[0].message
 *         raise C14NError, message             # <<<<<<<<<<<<<<
 * 
 * # dump node to file (mainly for debug)
 */
    __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__C14NError); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_Raise(__pyx_t_5, __pyx_v_message, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    {__pyx_filename = __pyx_f[4]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L13;
  }
  __pyx_L13:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._tofilelikeC14N");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_writer);
  __Pyx_DECREF(__pyx_v_filename8);
  __Pyx_DECREF(__pyx_v_message);
  __Pyx_DECREF((PyObject *)__pyx_v_errors);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":530
 * # dump node to file (mainly for debug)
 * 
 * cdef _dumpToFile(f, xmlNode* c_node, bint pretty_print, bint with_tail):             # <<<<<<<<<<<<<<
 *     cdef tree.xmlOutputBuffer* c_buffer
 *     cdef cstd.FILE* c_file
 */

static  PyObject *__pyx_f_4lxml_5etree__dumpToFile(PyObject *__pyx_v_f, xmlNode *__pyx_v_c_node, int __pyx_v_pretty_print, int __pyx_v_with_tail) {
  xmlOutputBuffer *__pyx_v_c_buffer;
  FILE *__pyx_v_c_file;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_dumpToFile");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":533
 *     cdef tree.xmlOutputBuffer* c_buffer
 *     cdef cstd.FILE* c_file
 *     c_file = python.PyFile_AsFile(f)             # <<<<<<<<<<<<<<
 *     if c_file is NULL:
 *         raise ValueError, u"not a file"
 */
  __pyx_v_c_file = PyFile_AsFile(__pyx_v_f);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":534
 *     cdef cstd.FILE* c_file
 *     c_file = python.PyFile_AsFile(f)
 *     if c_file is NULL:             # <<<<<<<<<<<<<<
 *         raise ValueError, u"not a file"
 *     c_buffer = tree.xmlOutputBufferCreateFile(c_file, NULL)
 */
  __pyx_t_1 = (__pyx_v_c_file == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":535
 *     c_file = python.PyFile_AsFile(f)
 *     if c_file is NULL:
 *         raise ValueError, u"not a file"             # <<<<<<<<<<<<<<
 *     c_buffer = tree.xmlOutputBufferCreateFile(c_file, NULL)
 *     tree.xmlNodeDumpOutput(c_buffer, c_node.doc, c_node, 0, pretty_print, NULL)
 */
    __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_u_259), 0);
    {__pyx_filename = __pyx_f[4]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":536
 *     if c_file is NULL:
 *         raise ValueError, u"not a file"
 *     c_buffer = tree.xmlOutputBufferCreateFile(c_file, NULL)             # <<<<<<<<<<<<<<
 *     tree.xmlNodeDumpOutput(c_buffer, c_node.doc, c_node, 0, pretty_print, NULL)
 *     if with_tail:
 */
  __pyx_v_c_buffer = xmlOutputBufferCreateFile(__pyx_v_c_file, NULL);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":537
 *         raise ValueError, u"not a file"
 *     c_buffer = tree.xmlOutputBufferCreateFile(c_file, NULL)
 *     tree.xmlNodeDumpOutput(c_buffer, c_node.doc, c_node, 0, pretty_print, NULL)             # <<<<<<<<<<<<<<
 *     if with_tail:
 *         _writeTail(c_buffer, c_node, NULL, 0)
 */
  xmlNodeDumpOutput(__pyx_v_c_buffer, __pyx_v_c_node->doc, __pyx_v_c_node, 0, __pyx_v_pretty_print, NULL);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":538
 *     c_buffer = tree.xmlOutputBufferCreateFile(c_file, NULL)
 *     tree.xmlNodeDumpOutput(c_buffer, c_node.doc, c_node, 0, pretty_print, NULL)
 *     if with_tail:             # <<<<<<<<<<<<<<
 *         _writeTail(c_buffer, c_node, NULL, 0)
 *     if not pretty_print:
 */
  if (__pyx_v_with_tail) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":539
 *     tree.xmlNodeDumpOutput(c_buffer, c_node.doc, c_node, 0, pretty_print, NULL)
 *     if with_tail:
 *         _writeTail(c_buffer, c_node, NULL, 0)             # <<<<<<<<<<<<<<
 *     if not pretty_print:
 *         # not written yet
 */
    __pyx_f_4lxml_5etree__writeTail(__pyx_v_c_buffer, __pyx_v_c_node, NULL, 0);
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":540
 *     if with_tail:
 *         _writeTail(c_buffer, c_node, NULL, 0)
 *     if not pretty_print:             # <<<<<<<<<<<<<<
 *         # not written yet
 *         tree.xmlOutputBufferWriteString(c_buffer, '\n')
 */
  __pyx_t_1 = (!__pyx_v_pretty_print);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":542
 *     if not pretty_print:
 *         # not written yet
 *         tree.xmlOutputBufferWriteString(c_buffer, '\n')             # <<<<<<<<<<<<<<
 *     tree.xmlOutputBufferFlush(c_buffer)
 */
    xmlOutputBufferWriteString(__pyx_v_c_buffer, __pyx_k_47);
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":543
 *         # not written yet
 *         tree.xmlOutputBufferWriteString(c_buffer, '\n')
 *     tree.xmlOutputBufferFlush(c_buffer)             # <<<<<<<<<<<<<<
 */
  xmlOutputBufferFlush(__pyx_v_c_buffer);

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._dumpToFile");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":13
 *     ITERPARSE_FILTER_PI        = 32
 * 
 * cdef int _buildIterparseEventFilter(events) except -1:             # <<<<<<<<<<<<<<
 *     cdef int event_filter
 *     event_filter = 0
 */

static  int __pyx_f_4lxml_5etree__buildIterparseEventFilter(PyObject *__pyx_v_events) {
  int __pyx_v_event_filter;
  PyObject *__pyx_v_event;
  int __pyx_r;
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("_buildIterparseEventFilter");
  __pyx_v_event = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":15
 * cdef int _buildIterparseEventFilter(events) except -1:
 *     cdef int event_filter
 *     event_filter = 0             # <<<<<<<<<<<<<<
 *     for event in events:
 *         if event == u'start':
 */
  __pyx_v_event_filter = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":16
 *     cdef int event_filter
 *     event_filter = 0
 *     for event in events:             # <<<<<<<<<<<<<<
 *         if event == u'start':
 *             event_filter |= ITERPARSE_FILTER_START
 */
  if (PyList_CheckExact(__pyx_v_events) || PyTuple_CheckExact(__pyx_v_events)) {
    __pyx_t_1 = 0; __pyx_t_2 = __pyx_v_events; __Pyx_INCREF(__pyx_t_2);
  } else {
    __pyx_t_1 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_events); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
  }
  for (;;) {
    if (likely(PyList_CheckExact(__pyx_t_2))) {
      if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++;
    } else if (likely(PyTuple_CheckExact(__pyx_t_2))) {
      if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++;
    } else {
      __pyx_t_3 = PyIter_Next(__pyx_t_2);
      if (!__pyx_t_3) {
        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_DECREF(__pyx_v_event);
    __pyx_v_event = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":17
 *     event_filter = 0
 *     for event in events:
 *         if event == u'start':             # <<<<<<<<<<<<<<
 *             event_filter |= ITERPARSE_FILTER_START
 *         elif event == u'end':
 */
    __pyx_t_4 = __Pyx_PyUnicode_Equals(__pyx_v_event, ((PyObject *)__pyx_n_u__start), Py_EQ); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_4) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":18
 *     for event in events:
 *         if event == u'start':
 *             event_filter |= ITERPARSE_FILTER_START             # <<<<<<<<<<<<<<
 *         elif event == u'end':
 *             event_filter |= ITERPARSE_FILTER_END
 */
      __pyx_v_event_filter = (__pyx_v_event_filter | __pyx_e_4lxml_5etree_ITERPARSE_FILTER_START);
      goto __pyx_L5;
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":19
 *         if event == u'start':
 *             event_filter |= ITERPARSE_FILTER_START
 *         elif event == u'end':             # <<<<<<<<<<<<<<
 *             event_filter |= ITERPARSE_FILTER_END
 *         elif event == u'start-ns':
 */
    __pyx_t_4 = __Pyx_PyUnicode_Equals(__pyx_v_event, ((PyObject *)__pyx_n_u__end), Py_EQ); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_4) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":20
 *             event_filter |= ITERPARSE_FILTER_START
 *         elif event == u'end':
 *             event_filter |= ITERPARSE_FILTER_END             # <<<<<<<<<<<<<<
 *         elif event == u'start-ns':
 *             event_filter |= ITERPARSE_FILTER_START_NS
 */
      __pyx_v_event_filter = (__pyx_v_event_filter | __pyx_e_4lxml_5etree_ITERPARSE_FILTER_END);
      goto __pyx_L5;
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":21
 *         elif event == u'end':
 *             event_filter |= ITERPARSE_FILTER_END
 *         elif event == u'start-ns':             # <<<<<<<<<<<<<<
 *             event_filter |= ITERPARSE_FILTER_START_NS
 *         elif event == u'end-ns':
 */
    __pyx_t_4 = __Pyx_PyUnicode_Equals(__pyx_v_event, ((PyObject *)__pyx_kp_u_260), Py_EQ); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_4) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":22
 *             event_filter |= ITERPARSE_FILTER_END
 *         elif event == u'start-ns':
 *             event_filter |= ITERPARSE_FILTER_START_NS             # <<<<<<<<<<<<<<
 *         elif event == u'end-ns':
 *             event_filter |= ITERPARSE_FILTER_END_NS
 */
      __pyx_v_event_filter = (__pyx_v_event_filter | __pyx_e_4lxml_5etree_ITERPARSE_FILTER_START_NS);
      goto __pyx_L5;
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":23
 *         elif event == u'start-ns':
 *             event_filter |= ITERPARSE_FILTER_START_NS
 *         elif event == u'end-ns':             # <<<<<<<<<<<<<<
 *             event_filter |= ITERPARSE_FILTER_END_NS
 *         elif event == u'comment':
 */
    __pyx_t_4 = __Pyx_PyUnicode_Equals(__pyx_v_event, ((PyObject *)__pyx_kp_u_261), Py_EQ); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_4) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":24
 *             event_filter |= ITERPARSE_FILTER_START_NS
 *         elif event == u'end-ns':
 *             event_filter |= ITERPARSE_FILTER_END_NS             # <<<<<<<<<<<<<<
 *         elif event == u'comment':
 *             event_filter |= ITERPARSE_FILTER_COMMENT
 */
      __pyx_v_event_filter = (__pyx_v_event_filter | __pyx_e_4lxml_5etree_ITERPARSE_FILTER_END_NS);
      goto __pyx_L5;
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":25
 *         elif event == u'end-ns':
 *             event_filter |= ITERPARSE_FILTER_END_NS
 *         elif event == u'comment':             # <<<<<<<<<<<<<<
 *             event_filter |= ITERPARSE_FILTER_COMMENT
 *         elif event == u'pi':
 */
    __pyx_t_4 = __Pyx_PyUnicode_Equals(__pyx_v_event, ((PyObject *)__pyx_n_u__comment), Py_EQ); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_4) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":26
 *             event_filter |= ITERPARSE_FILTER_END_NS
 *         elif event == u'comment':
 *             event_filter |= ITERPARSE_FILTER_COMMENT             # <<<<<<<<<<<<<<
 *         elif event == u'pi':
 *             event_filter |= ITERPARSE_FILTER_PI
 */
      __pyx_v_event_filter = (__pyx_v_event_filter | __pyx_e_4lxml_5etree_ITERPARSE_FILTER_COMMENT);
      goto __pyx_L5;
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":27
 *         elif event == u'comment':
 *             event_filter |= ITERPARSE_FILTER_COMMENT
 *         elif event == u'pi':             # <<<<<<<<<<<<<<
 *             event_filter |= ITERPARSE_FILTER_PI
 *         else:
 */
    __pyx_t_4 = __Pyx_PyUnicode_Equals(__pyx_v_event, ((PyObject *)__pyx_n_u__pi), Py_EQ); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_4) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":28
 *             event_filter |= ITERPARSE_FILTER_COMMENT
 *         elif event == u'pi':
 *             event_filter |= ITERPARSE_FILTER_PI             # <<<<<<<<<<<<<<
 *         else:
 *             raise ValueError, u"invalid event name '%s'" % event
 */
      __pyx_v_event_filter = (__pyx_v_event_filter | __pyx_e_4lxml_5etree_ITERPARSE_FILTER_PI);
      goto __pyx_L5;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":30
 *             event_filter |= ITERPARSE_FILTER_PI
 *         else:
 *             raise ValueError, u"invalid event name '%s'" % event             # <<<<<<<<<<<<<<
 *     return event_filter
 * 
 */
      __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_262), __pyx_v_event); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
      __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), 0);
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      {__pyx_filename = __pyx_f[14]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_L5:;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":31
 *         else:
 *             raise ValueError, u"invalid event name '%s'" % event
 *     return event_filter             # <<<<<<<<<<<<<<
 * 
 * cdef int _countNsDefs(xmlNode* c_node):
 */
  __pyx_r = __pyx_v_event_filter;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._buildIterparseEventFilter");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_event);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":33
 *     return event_filter
 * 
 * cdef int _countNsDefs(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     cdef xmlNs* c_ns
 *     cdef int count
 */

static  int __pyx_f_4lxml_5etree__countNsDefs(xmlNode *__pyx_v_c_node) {
  xmlNs *__pyx_v_c_ns;
  int __pyx_v_count;
  int __pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_countNsDefs");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":36
 *     cdef xmlNs* c_ns
 *     cdef int count
 *     count = 0             # <<<<<<<<<<<<<<
 *     c_ns = c_node.nsDef
 *     while c_ns is not NULL:
 */
  __pyx_v_count = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":37
 *     cdef int count
 *     count = 0
 *     c_ns = c_node.nsDef             # <<<<<<<<<<<<<<
 *     while c_ns is not NULL:
 *         count = count + 1
 */
  __pyx_v_c_ns = __pyx_v_c_node->nsDef;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":38
 *     count = 0
 *     c_ns = c_node.nsDef
 *     while c_ns is not NULL:             # <<<<<<<<<<<<<<
 *         count = count + 1
 *         c_ns = c_ns.next
 */
  while (1) {
    __pyx_t_1 = (__pyx_v_c_ns != NULL);
    if (!__pyx_t_1) break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":39
 *     c_ns = c_node.nsDef
 *     while c_ns is not NULL:
 *         count = count + 1             # <<<<<<<<<<<<<<
 *         c_ns = c_ns.next
 *     return count
 */
    __pyx_v_count = (__pyx_v_count + 1);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":40
 *     while c_ns is not NULL:
 *         count = count + 1
 *         c_ns = c_ns.next             # <<<<<<<<<<<<<<
 *     return count
 * 
 */
    __pyx_v_c_ns = __pyx_v_c_ns->next;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":41
 *         count = count + 1
 *         c_ns = c_ns.next
 *     return count             # <<<<<<<<<<<<<<
 * 
 * cdef int _appendStartNsEvents(xmlNode* c_node, list event_list):
 */
  __pyx_r = __pyx_v_count;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":43
 *     return count
 * 
 * cdef int _appendStartNsEvents(xmlNode* c_node, list event_list):             # <<<<<<<<<<<<<<
 *     cdef xmlNs* c_ns
 *     cdef int count
 */

static  int __pyx_f_4lxml_5etree__appendStartNsEvents(xmlNode *__pyx_v_c_node, PyObject *__pyx_v_event_list) {
  xmlNs *__pyx_v_c_ns;
  int __pyx_v_count;
  PyObject *__pyx_v_prefix;
  PyObject *__pyx_v_ns_tuple;
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("_appendStartNsEvents");
  __pyx_v_prefix = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_ns_tuple = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":46
 *     cdef xmlNs* c_ns
 *     cdef int count
 *     count = 0             # <<<<<<<<<<<<<<
 *     c_ns = c_node.nsDef
 *     while c_ns is not NULL:
 */
  __pyx_v_count = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":47
 *     cdef int count
 *     count = 0
 *     c_ns = c_node.nsDef             # <<<<<<<<<<<<<<
 *     while c_ns is not NULL:
 *         if c_ns.prefix is NULL:
 */
  __pyx_v_c_ns = __pyx_v_c_node->nsDef;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":48
 *     count = 0
 *     c_ns = c_node.nsDef
 *     while c_ns is not NULL:             # <<<<<<<<<<<<<<
 *         if c_ns.prefix is NULL:
 *             if python.IS_PYTHON3:
 */
  while (1) {
    __pyx_t_1 = (__pyx_v_c_ns != NULL);
    if (!__pyx_t_1) break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":49
 *     c_ns = c_node.nsDef
 *     while c_ns is not NULL:
 *         if c_ns.prefix is NULL:             # <<<<<<<<<<<<<<
 *             if python.IS_PYTHON3:
 *                 prefix = u''
 */
    __pyx_t_1 = (__pyx_v_c_ns->prefix == NULL);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":50
 *     while c_ns is not NULL:
 *         if c_ns.prefix is NULL:
 *             if python.IS_PYTHON3:             # <<<<<<<<<<<<<<
 *                 prefix = u''
 *             else:
 */
      if (IS_PYTHON3) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":51
 *         if c_ns.prefix is NULL:
 *             if python.IS_PYTHON3:
 *                 prefix = u''             # <<<<<<<<<<<<<<
 *             else:
 *                 prefix = ''
 */
        __Pyx_INCREF(((PyObject *)__pyx_kp_u_25));
        __Pyx_DECREF(__pyx_v_prefix);
        __pyx_v_prefix = ((PyObject *)__pyx_kp_u_25);
        goto __pyx_L6;
      }
      /*else*/ {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":53
 *                 prefix = u''
 *             else:
 *                 prefix = ''             # <<<<<<<<<<<<<<
 *         else:
 *             prefix = funicode(c_ns.prefix)
 */
        __Pyx_INCREF(((PyObject *)__pyx_kp_s_25));
        __Pyx_DECREF(__pyx_v_prefix);
        __pyx_v_prefix = ((PyObject *)__pyx_kp_s_25);
      }
      __pyx_L6:;
      goto __pyx_L5;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":55
 *                 prefix = ''
 *         else:
 *             prefix = funicode(c_ns.prefix)             # <<<<<<<<<<<<<<
 *         ns_tuple = (prefix, funicode(c_ns.href))
 *         event_list.append( (u"start-ns", ns_tuple) )
 */
      __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_ns->prefix); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_v_prefix);
      __pyx_v_prefix = __pyx_t_2;
      __pyx_t_2 = 0;
    }
    __pyx_L5:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":56
 *         else:
 *             prefix = funicode(c_ns.prefix)
 *         ns_tuple = (prefix, funicode(c_ns.href))             # <<<<<<<<<<<<<<
 *         event_list.append( (u"start-ns", ns_tuple) )
 *         count = count + 1
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_ns->href); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_INCREF(__pyx_v_prefix);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_prefix);
    __Pyx_GIVEREF(__pyx_v_prefix);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_v_ns_tuple));
    __pyx_v_ns_tuple = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":57
 *             prefix = funicode(c_ns.prefix)
 *         ns_tuple = (prefix, funicode(c_ns.href))
 *         event_list.append( (u"start-ns", ns_tuple) )             # <<<<<<<<<<<<<<
 *         count = count + 1
 *         c_ns = c_ns.next
 */
    if (unlikely(__pyx_v_event_list == Py_None)) {
      PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[14]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_INCREF(((PyObject *)__pyx_kp_u_260));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_260));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_260));
    __Pyx_INCREF(((PyObject *)__pyx_v_ns_tuple));
    PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_ns_tuple));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_ns_tuple));
    __pyx_t_4 = PyList_Append(__pyx_v_event_list, ((PyObject *)__pyx_t_3)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":58
 *         ns_tuple = (prefix, funicode(c_ns.href))
 *         event_list.append( (u"start-ns", ns_tuple) )
 *         count = count + 1             # <<<<<<<<<<<<<<
 *         c_ns = c_ns.next
 *     return count
 */
    __pyx_v_count = (__pyx_v_count + 1);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":59
 *         event_list.append( (u"start-ns", ns_tuple) )
 *         count = count + 1
 *         c_ns = c_ns.next             # <<<<<<<<<<<<<<
 *     return count
 * 
 */
    __pyx_v_c_ns = __pyx_v_c_ns->next;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":60
 *         count = count + 1
 *         c_ns = c_ns.next
 *     return count             # <<<<<<<<<<<<<<
 * 
 * cdef class _IterparseContext(_ParserContext):
 */
  __pyx_r = __pyx_v_count;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_WriteUnraisable("lxml.etree._appendStartNsEvents");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_prefix);
  __Pyx_DECREF(__pyx_v_ns_tuple);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":82
 *     cdef char*  _tag_name
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._ns_stack = []
 *         self._pop_ns = self._ns_stack.pop
 */

static int __pyx_pf_4lxml_5etree_17_IterparseContext___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_17_IterparseContext___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__cinit__");
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":83
 * 
 *     def __cinit__(self):
 *         self._ns_stack = []             # <<<<<<<<<<<<<<
 *         self._pop_ns = self._ns_stack.pop
 *         self._node_stack = []
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__IterparseContext *)__pyx_v_self)->_ns_stack);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__IterparseContext *)__pyx_v_self)->_ns_stack));
  ((struct __pyx_obj_4lxml_5etree__IterparseContext *)__pyx_v_self)->_ns_stack = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":84
 *     def __cinit__(self):
 *         self._ns_stack = []
 *         self._pop_ns = self._ns_stack.pop             # <<<<<<<<<<<<<<
 *         self._node_stack = []
 *         self._pop_node = self._node_stack.pop
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_4lxml_5etree__IterparseContext *)__pyx_v_self)->_ns_stack), __pyx_n_s__pop); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__IterparseContext *)__pyx_v_self)->_pop_ns);
  __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree__IterparseContext *)__pyx_v_self)->_pop_ns);
  ((struct __pyx_obj_4lxml_5etree__IterparseContext *)__pyx_v_self)->_pop_ns = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":85
 *         self._ns_stack = []
 *         self._pop_ns = self._ns_stack.pop
 *         self._node_stack = []             # <<<<<<<<<<<<<<
 *         self._pop_node = self._node_stack.pop
 *         self._events = []
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__IterparseContext *)__pyx_v_self)->_node_stack);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__IterparseContext *)__pyx_v_self)->_node_stack));
  ((struct __pyx_obj_4lxml_5etree__IterparseContext *)__pyx_v_self)->_node_stack = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":86
 *         self._pop_ns = self._ns_stack.pop
 *         self._node_stack = []
 *         self._pop_node = self._node_stack.pop             # <<<<<<<<<<<<<<
 *         self._events = []
 *         self._event_index = 0
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_4lxml_5etree__IterparseContext *)__pyx_v_self)->_node_stack), __pyx_n_s__pop); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__IterparseContext *)__pyx_v_self)->_pop_node);
  __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree__IterparseContext *)__pyx_v_self)->_pop_node);
  ((struct __pyx_obj_4lxml_5etree__IterparseContext *)__pyx_v_self)->_pop_node = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":87
 *         self._node_stack = []
 *         self._pop_node = self._node_stack.pop
 *         self._events = []             # <<<<<<<<<<<<<<
 *         self._event_index = 0
 * 
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__IterparseContext *)__pyx_v_self)->_events);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__IterparseContext *)__pyx_v_self)->_events));
  ((struct __pyx_obj_4lxml_5etree__IterparseContext *)__pyx_v_self)->_events = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":88
 *         self._pop_node = self._node_stack.pop
 *         self._events = []
 *         self._event_index = 0             # <<<<<<<<<<<<<<
 * 
 *     cdef void _initParserContext(self, xmlparser.xmlParserCtxt* c_ctxt):
 */
  ((struct __pyx_obj_4lxml_5etree__IterparseContext *)__pyx_v_self)->_event_index = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._IterparseContext.__cinit__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":90
 *         self._event_index = 0
 * 
 *     cdef void _initParserContext(self, xmlparser.xmlParserCtxt* c_ctxt):             # <<<<<<<<<<<<<<
 *         u"wrap original SAX2 callbacks"
 *         cdef xmlparser.xmlSAXHandler* sax
 */

static  void __pyx_f_4lxml_5etree_17_IterparseContext__initParserContext(struct __pyx_obj_4lxml_5etree__IterparseContext *__pyx_v_self, xmlParserCtxt *__pyx_v_c_ctxt) {
  xmlSAXHandler *__pyx_v_sax;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("_initParserContext");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":93
 *         u"wrap original SAX2 callbacks"
 *         cdef xmlparser.xmlSAXHandler* sax
 *         _ParserContext._initParserContext(self, c_ctxt)             # <<<<<<<<<<<<<<
 *         sax = c_ctxt.sax
 *         self._origSaxStart = sax.startElementNs
 */
  __pyx_vtabptr_4lxml_5etree__ParserContext->_initParserContext(((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_v_self), __pyx_v_c_ctxt);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":94
 *         cdef xmlparser.xmlSAXHandler* sax
 *         _ParserContext._initParserContext(self, c_ctxt)
 *         sax = c_ctxt.sax             # <<<<<<<<<<<<<<
 *         self._origSaxStart = sax.startElementNs
 *         self._origSaxStartNoNs = sax.startElement
 */
  __pyx_v_sax = __pyx_v_c_ctxt->sax;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":95
 *         _ParserContext._initParserContext(self, c_ctxt)
 *         sax = c_ctxt.sax
 *         self._origSaxStart = sax.startElementNs             # <<<<<<<<<<<<<<
 *         self._origSaxStartNoNs = sax.startElement
 *         # only override start event handler if needed
 */
  __pyx_v_self->_origSaxStart = __pyx_v_sax->startElementNs;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":96
 *         sax = c_ctxt.sax
 *         self._origSaxStart = sax.startElementNs
 *         self._origSaxStartNoNs = sax.startElement             # <<<<<<<<<<<<<<
 *         # only override start event handler if needed
 *         if self._event_filter == 0 or \
 */
  __pyx_v_self->_origSaxStartNoNs = __pyx_v_sax->startElement;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":98
 *         self._origSaxStartNoNs = sax.startElement
 *         # only override start event handler if needed
 *         if self._event_filter == 0 or \             # <<<<<<<<<<<<<<
 *                self._event_filter & (ITERPARSE_FILTER_START | \
 *                                      ITERPARSE_FILTER_START_NS | \
 */
  __pyx_t_1 = (__pyx_v_self->_event_filter == 0);
  if (!__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":101
 *                self._event_filter & (ITERPARSE_FILTER_START | \
 *                                      ITERPARSE_FILTER_START_NS | \
 *                                      ITERPARSE_FILTER_END_NS):             # <<<<<<<<<<<<<<
 *             sax.startElementNs = _iterparseSaxStart
 *             sax.startElement = _iterparseSaxStartNoNs
 */
    __pyx_t_2 = (__pyx_v_self->_event_filter & ((__pyx_e_4lxml_5etree_ITERPARSE_FILTER_START | __pyx_e_4lxml_5etree_ITERPARSE_FILTER_START_NS) | __pyx_e_4lxml_5etree_ITERPARSE_FILTER_END_NS));
  } else {
    __pyx_t_2 = __pyx_t_1;
  }
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":102
 *                                      ITERPARSE_FILTER_START_NS | \
 *                                      ITERPARSE_FILTER_END_NS):
 *             sax.startElementNs = _iterparseSaxStart             # <<<<<<<<<<<<<<
 *             sax.startElement = _iterparseSaxStartNoNs
 * 
 */
    __pyx_v_sax->startElementNs = __pyx_f_4lxml_5etree__iterparseSaxStart;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":103
 *                                      ITERPARSE_FILTER_END_NS):
 *             sax.startElementNs = _iterparseSaxStart
 *             sax.startElement = _iterparseSaxStartNoNs             # <<<<<<<<<<<<<<
 * 
 *         self._origSaxEnd = sax.endElementNs
 */
    __pyx_v_sax->startElement = __pyx_f_4lxml_5etree__iterparseSaxStartNoNs;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":105
 *             sax.startElement = _iterparseSaxStartNoNs
 * 
 *         self._origSaxEnd = sax.endElementNs             # <<<<<<<<<<<<<<
 *         self._origSaxEndNoNs = sax.endElement
 *         # only override end event handler if needed
 */
  __pyx_v_self->_origSaxEnd = __pyx_v_sax->endElementNs;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":106
 * 
 *         self._origSaxEnd = sax.endElementNs
 *         self._origSaxEndNoNs = sax.endElement             # <<<<<<<<<<<<<<
 *         # only override end event handler if needed
 *         if self._event_filter == 0 or \
 */
  __pyx_v_self->_origSaxEndNoNs = __pyx_v_sax->endElement;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":108
 *         self._origSaxEndNoNs = sax.endElement
 *         # only override end event handler if needed
 *         if self._event_filter == 0 or \             # <<<<<<<<<<<<<<
 *                self._event_filter & (ITERPARSE_FILTER_END | \
 *                                      ITERPARSE_FILTER_END_NS):
 */
  __pyx_t_2 = (__pyx_v_self->_event_filter == 0);
  if (!__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":110
 *         if self._event_filter == 0 or \
 *                self._event_filter & (ITERPARSE_FILTER_END | \
 *                                      ITERPARSE_FILTER_END_NS):             # <<<<<<<<<<<<<<
 *             sax.endElementNs = _iterparseSaxEnd
 *             sax.endElement = _iterparseSaxEndNoNs
 */
    __pyx_t_1 = (__pyx_v_self->_event_filter & (__pyx_e_4lxml_5etree_ITERPARSE_FILTER_END | __pyx_e_4lxml_5etree_ITERPARSE_FILTER_END_NS));
  } else {
    __pyx_t_1 = __pyx_t_2;
  }
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":111
 *                self._event_filter & (ITERPARSE_FILTER_END | \
 *                                      ITERPARSE_FILTER_END_NS):
 *             sax.endElementNs = _iterparseSaxEnd             # <<<<<<<<<<<<<<
 *             sax.endElement = _iterparseSaxEndNoNs
 * 
 */
    __pyx_v_sax->endElementNs = __pyx_f_4lxml_5etree__iterparseSaxEnd;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":112
 *                                      ITERPARSE_FILTER_END_NS):
 *             sax.endElementNs = _iterparseSaxEnd
 *             sax.endElement = _iterparseSaxEndNoNs             # <<<<<<<<<<<<<<
 * 
 *         self._origSaxComment = sax.comment
 */
    __pyx_v_sax->endElement = __pyx_f_4lxml_5etree__iterparseSaxEndNoNs;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":114
 *             sax.endElement = _iterparseSaxEndNoNs
 * 
 *         self._origSaxComment = sax.comment             # <<<<<<<<<<<<<<
 *         if self._event_filter & ITERPARSE_FILTER_COMMENT:
 *             sax.comment = _iterparseSaxComment
 */
  __pyx_v_self->_origSaxComment = __pyx_v_sax->comment;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":115
 * 
 *         self._origSaxComment = sax.comment
 *         if self._event_filter & ITERPARSE_FILTER_COMMENT:             # <<<<<<<<<<<<<<
 *             sax.comment = _iterparseSaxComment
 * 
 */
  __pyx_t_3 = (__pyx_v_self->_event_filter & __pyx_e_4lxml_5etree_ITERPARSE_FILTER_COMMENT);
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":116
 *         self._origSaxComment = sax.comment
 *         if self._event_filter & ITERPARSE_FILTER_COMMENT:
 *             sax.comment = _iterparseSaxComment             # <<<<<<<<<<<<<<
 * 
 *         self._origSaxPI = sax.processingInstruction
 */
    __pyx_v_sax->comment = __pyx_f_4lxml_5etree__iterparseSaxComment;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":118
 *             sax.comment = _iterparseSaxComment
 * 
 *         self._origSaxPI = sax.processingInstruction             # <<<<<<<<<<<<<<
 *         if self._event_filter & ITERPARSE_FILTER_PI:
 *             sax.processingInstruction = _iterparseSaxPI
 */
  __pyx_v_self->_origSaxPI = __pyx_v_sax->processingInstruction;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":119
 * 
 *         self._origSaxPI = sax.processingInstruction
 *         if self._event_filter & ITERPARSE_FILTER_PI:             # <<<<<<<<<<<<<<
 *             sax.processingInstruction = _iterparseSaxPI
 * 
 */
  __pyx_t_3 = (__pyx_v_self->_event_filter & __pyx_e_4lxml_5etree_ITERPARSE_FILTER_PI);
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":120
 *         self._origSaxPI = sax.processingInstruction
 *         if self._event_filter & ITERPARSE_FILTER_PI:
 *             sax.processingInstruction = _iterparseSaxPI             # <<<<<<<<<<<<<<
 * 
 *     cdef _setEventFilter(self, events, tag):
 */
    __pyx_v_sax->processingInstruction = __pyx_f_4lxml_5etree__iterparseSaxPI;
    goto __pyx_L6;
  }
  __pyx_L6:;

  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":122
 *             sax.processingInstruction = _iterparseSaxPI
 * 
 *     cdef _setEventFilter(self, events, tag):             # <<<<<<<<<<<<<<
 *         self._event_filter = _buildIterparseEventFilter(events)
 *         if tag is None or tag == u'*':
 */

static  PyObject *__pyx_f_4lxml_5etree_17_IterparseContext__setEventFilter(struct __pyx_obj_4lxml_5etree__IterparseContext *__pyx_v_self, PyObject *__pyx_v_events, PyObject *__pyx_v_tag) {
  PyObject *__pyx_v_href;
  PyObject *__pyx_v_name;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("_setEventFilter");
  __pyx_v_href = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_name = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":123
 * 
 *     cdef _setEventFilter(self, events, tag):
 *         self._event_filter = _buildIterparseEventFilter(events)             # <<<<<<<<<<<<<<
 *         if tag is None or tag == u'*':
 *             self._tag_href  = NULL
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__buildIterparseEventFilter(__pyx_v_events); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_self->_event_filter = __pyx_t_1;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":124
 *     cdef _setEventFilter(self, events, tag):
 *         self._event_filter = _buildIterparseEventFilter(events)
 *         if tag is None or tag == u'*':             # <<<<<<<<<<<<<<
 *             self._tag_href  = NULL
 *             self._tag_name  = NULL
 */
  __pyx_t_2 = (__pyx_v_tag == Py_None);
  if (!__pyx_t_2) {
    __pyx_t_3 = __Pyx_PyUnicode_Equals(__pyx_v_tag, ((PyObject *)__pyx_kp_u_132), Py_EQ); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __pyx_t_3;
  } else {
    __pyx_t_4 = __pyx_t_2;
  }
  if (__pyx_t_4) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":125
 *         self._event_filter = _buildIterparseEventFilter(events)
 *         if tag is None or tag == u'*':
 *             self._tag_href  = NULL             # <<<<<<<<<<<<<<
 *             self._tag_name  = NULL
 *         else:
 */
    __pyx_v_self->_tag_href = NULL;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":126
 *         if tag is None or tag == u'*':
 *             self._tag_href  = NULL
 *             self._tag_name  = NULL             # <<<<<<<<<<<<<<
 *         else:
 *             self._tag_tuple = _getNsTag(tag)
 */
    __pyx_v_self->_tag_name = NULL;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":128
 *             self._tag_name  = NULL
 *         else:
 *             self._tag_tuple = _getNsTag(tag)             # <<<<<<<<<<<<<<
 *             href, name = self._tag_tuple
 *             if href is None or href == b'*':
 */
    __pyx_t_5 = ((PyObject *)__pyx_f_4lxml_5etree__getNsTag(__pyx_v_tag)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_v_self->_tag_tuple);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->_tag_tuple));
    __pyx_v_self->_tag_tuple = ((PyObject*)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":129
 *         else:
 *             self._tag_tuple = _getNsTag(tag)
 *             href, name = self._tag_tuple             # <<<<<<<<<<<<<<
 *             if href is None or href == b'*':
 *                 self._tag_href = NULL
 */
    if (likely(((PyObject *)__pyx_v_self->_tag_tuple) != Py_None) && likely(PyTuple_GET_SIZE(((PyObject *)__pyx_v_self->_tag_tuple)) == 2)) {
      PyObject* tuple = ((PyObject *)__pyx_v_self->_tag_tuple);
      __pyx_t_5 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_5);
      __pyx_t_6 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_v_href);
      __pyx_v_href = __pyx_t_5;
      __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_v_name);
      __pyx_v_name = __pyx_t_6;
      __pyx_t_6 = 0;
    } else {
      __Pyx_UnpackTupleError(((PyObject *)__pyx_v_self->_tag_tuple), 2);
      {__pyx_filename = __pyx_f[14]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":130
 *             self._tag_tuple = _getNsTag(tag)
 *             href, name = self._tag_tuple
 *             if href is None or href == b'*':             # <<<<<<<<<<<<<<
 *                 self._tag_href = NULL
 *             else:
 */
    __pyx_t_4 = (__pyx_v_href == Py_None);
    if (!__pyx_t_4) {
      __pyx_t_6 = PyObject_RichCompare(__pyx_v_href, ((PyObject *)__pyx_kp_b_132), Py_EQ); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_3 = __pyx_t_2;
    } else {
      __pyx_t_3 = __pyx_t_4;
    }
    if (__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":131
 *             href, name = self._tag_tuple
 *             if href is None or href == b'*':
 *                 self._tag_href = NULL             # <<<<<<<<<<<<<<
 *             else:
 *                 self._tag_href = _cstr(href)
 */
      __pyx_v_self->_tag_href = NULL;
      goto __pyx_L4;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":133
 *                 self._tag_href = NULL
 *             else:
 *                 self._tag_href = _cstr(href)             # <<<<<<<<<<<<<<
 *             if name is None or name == b'*':
 *                 self._tag_name = NULL
 */
      __pyx_v_self->_tag_href = PyBytes_AS_STRING(__pyx_v_href);
    }
    __pyx_L4:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":134
 *             else:
 *                 self._tag_href = _cstr(href)
 *             if name is None or name == b'*':             # <<<<<<<<<<<<<<
 *                 self._tag_name = NULL
 *             else:
 */
    __pyx_t_3 = (__pyx_v_name == Py_None);
    if (!__pyx_t_3) {
      __pyx_t_6 = PyObject_RichCompare(__pyx_v_name, ((PyObject *)__pyx_kp_b_132), Py_EQ); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_2 = __pyx_t_4;
    } else {
      __pyx_t_2 = __pyx_t_3;
    }
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":135
 *                 self._tag_href = _cstr(href)
 *             if name is None or name == b'*':
 *                 self._tag_name = NULL             # <<<<<<<<<<<<<<
 *             else:
 *                 self._tag_name = _cstr(name)
 */
      __pyx_v_self->_tag_name = NULL;
      goto __pyx_L5;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":137
 *                 self._tag_name = NULL
 *             else:
 *                 self._tag_name = _cstr(name)             # <<<<<<<<<<<<<<
 *             if self._tag_href is NULL and self._tag_name is NULL:
 *                 self._tag_tuple = None
 */
      __pyx_v_self->_tag_name = PyBytes_AS_STRING(__pyx_v_name);
    }
    __pyx_L5:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":138
 *             else:
 *                 self._tag_name = _cstr(name)
 *             if self._tag_href is NULL and self._tag_name is NULL:             # <<<<<<<<<<<<<<
 *                 self._tag_tuple = None
 * 
 */
    __pyx_t_2 = (__pyx_v_self->_tag_href == NULL);
    if (__pyx_t_2) {
      __pyx_t_3 = (__pyx_v_self->_tag_name == NULL);
      __pyx_t_4 = __pyx_t_3;
    } else {
      __pyx_t_4 = __pyx_t_2;
    }
    if (__pyx_t_4) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":139
 *                 self._tag_name = _cstr(name)
 *             if self._tag_href is NULL and self._tag_name is NULL:
 *                 self._tag_tuple = None             # <<<<<<<<<<<<<<
 * 
 *     cdef int startNode(self, xmlNode* c_node) except -1:
 */
      __Pyx_INCREF(Py_None);
      __Pyx_GIVEREF(Py_None);
      __Pyx_GOTREF(__pyx_v_self->_tag_tuple);
      __Pyx_DECREF(((PyObject *)__pyx_v_self->_tag_tuple));
      __pyx_v_self->_tag_tuple = ((PyObject*)Py_None);
      goto __pyx_L6;
    }
    __pyx_L6:;
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._IterparseContext._setEventFilter");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_href);
  __Pyx_DECREF(__pyx_v_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":141
 *                 self._tag_tuple = None
 * 
 *     cdef int startNode(self, xmlNode* c_node) except -1:             # <<<<<<<<<<<<<<
 *         cdef xmlNs* c_ns
 *         cdef int ns_count
 */

static  int __pyx_f_4lxml_5etree_17_IterparseContext_startNode(struct __pyx_obj_4lxml_5etree__IterparseContext *__pyx_v_self, xmlNode *__pyx_v_c_node) {
  int __pyx_v_ns_count;
  struct LxmlElement *__pyx_v_node;
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("startNode");
  __pyx_v_node = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":144
 *         cdef xmlNs* c_ns
 *         cdef int ns_count
 *         if self._event_filter & ITERPARSE_FILTER_START_NS:             # <<<<<<<<<<<<<<
 *             ns_count = _appendStartNsEvents(c_node, self._events)
 *         elif self._event_filter & ITERPARSE_FILTER_END_NS:
 */
  __pyx_t_1 = (__pyx_v_self->_event_filter & __pyx_e_4lxml_5etree_ITERPARSE_FILTER_START_NS);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":145
 *         cdef int ns_count
 *         if self._event_filter & ITERPARSE_FILTER_START_NS:
 *             ns_count = _appendStartNsEvents(c_node, self._events)             # <<<<<<<<<<<<<<
 *         elif self._event_filter & ITERPARSE_FILTER_END_NS:
 *             ns_count = _countNsDefs(c_node)
 */
    __pyx_t_2 = ((PyObject *)__pyx_v_self->_events);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v_ns_count = __pyx_f_4lxml_5etree__appendStartNsEvents(__pyx_v_c_node, ((PyObject*)__pyx_t_2));
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":146
 *         if self._event_filter & ITERPARSE_FILTER_START_NS:
 *             ns_count = _appendStartNsEvents(c_node, self._events)
 *         elif self._event_filter & ITERPARSE_FILTER_END_NS:             # <<<<<<<<<<<<<<
 *             ns_count = _countNsDefs(c_node)
 *         if self._event_filter & ITERPARSE_FILTER_END_NS:
 */
  __pyx_t_1 = (__pyx_v_self->_event_filter & __pyx_e_4lxml_5etree_ITERPARSE_FILTER_END_NS);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":147
 *             ns_count = _appendStartNsEvents(c_node, self._events)
 *         elif self._event_filter & ITERPARSE_FILTER_END_NS:
 *             ns_count = _countNsDefs(c_node)             # <<<<<<<<<<<<<<
 *         if self._event_filter & ITERPARSE_FILTER_END_NS:
 *             self._ns_stack.append(ns_count)
 */
    __pyx_v_ns_count = __pyx_f_4lxml_5etree__countNsDefs(__pyx_v_c_node);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":148
 *         elif self._event_filter & ITERPARSE_FILTER_END_NS:
 *             ns_count = _countNsDefs(c_node)
 *         if self._event_filter & ITERPARSE_FILTER_END_NS:             # <<<<<<<<<<<<<<
 *             self._ns_stack.append(ns_count)
 *         if self._root is None:
 */
  __pyx_t_1 = (__pyx_v_self->_event_filter & __pyx_e_4lxml_5etree_ITERPARSE_FILTER_END_NS);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":149
 *             ns_count = _countNsDefs(c_node)
 *         if self._event_filter & ITERPARSE_FILTER_END_NS:
 *             self._ns_stack.append(ns_count)             # <<<<<<<<<<<<<<
 *         if self._root is None:
 *             if self._doc is None:
 */
    if (unlikely(__pyx_v_self->_ns_stack == Py_None)) {
      PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[14]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_2 = PyInt_FromLong(__pyx_v_ns_count); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyList_Append(__pyx_v_self->_ns_stack, __pyx_t_2); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":150
 *         if self._event_filter & ITERPARSE_FILTER_END_NS:
 *             self._ns_stack.append(ns_count)
 *         if self._root is None:             # <<<<<<<<<<<<<<
 *             if self._doc is None:
 *                 self._doc = _documentFactory(c_node.doc, None)
 */
  __pyx_t_3 = (((PyObject *)__pyx_v_self->_root) == Py_None);
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":151
 *             self._ns_stack.append(ns_count)
 *         if self._root is None:
 *             if self._doc is None:             # <<<<<<<<<<<<<<
 *                 self._doc = _documentFactory(c_node.doc, None)
 *             self._root = self._doc.getroot()
 */
    __pyx_t_3 = (((PyObject *)__pyx_v_self->_doc) == Py_None);
    if (__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":152
 *         if self._root is None:
 *             if self._doc is None:
 *                 self._doc = _documentFactory(c_node.doc, None)             # <<<<<<<<<<<<<<
 *             self._root = self._doc.getroot()
 *         if self._tag_tuple is None or \
 */
      __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_node->doc, ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_v_self->_doc);
      __Pyx_DECREF(((PyObject *)__pyx_v_self->_doc));
      __pyx_v_self->_doc = ((struct LxmlDocument *)__pyx_t_2);
      __pyx_t_2 = 0;
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":153
 *             if self._doc is None:
 *                 self._doc = _documentFactory(c_node.doc, None)
 *             self._root = self._doc.getroot()             # <<<<<<<<<<<<<<
 *         if self._tag_tuple is None or \
 *                _tagMatches(c_node, self._tag_href, self._tag_name):
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__Document *)__pyx_v_self->_doc->__pyx_vtab)->getroot(__pyx_v_self->_doc); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_GOTREF(__pyx_v_self->_root);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->_root));
    __pyx_v_self->_root = ((struct LxmlElement *)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":154
 *                 self._doc = _documentFactory(c_node.doc, None)
 *             self._root = self._doc.getroot()
 *         if self._tag_tuple is None or \             # <<<<<<<<<<<<<<
 *                _tagMatches(c_node, self._tag_href, self._tag_name):
 *             node = _elementFactory(self._doc, c_node)
 */
  __pyx_t_3 = (__pyx_v_self->_tag_tuple == ((PyObject*)Py_None));
  if (!__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":155
 *             self._root = self._doc.getroot()
 *         if self._tag_tuple is None or \
 *                _tagMatches(c_node, self._tag_href, self._tag_name):             # <<<<<<<<<<<<<<
 *             node = _elementFactory(self._doc, c_node)
 *             if self._event_filter & ITERPARSE_FILTER_END:
 */
    __pyx_t_4 = __pyx_f_4lxml_5etree__tagMatches(__pyx_v_c_node, __pyx_v_self->_tag_href, __pyx_v_self->_tag_name);
    __pyx_t_5 = __pyx_t_4;
  } else {
    __pyx_t_5 = __pyx_t_3;
  }
  if (__pyx_t_5) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":156
 *         if self._tag_tuple is None or \
 *                _tagMatches(c_node, self._tag_href, self._tag_name):
 *             node = _elementFactory(self._doc, c_node)             # <<<<<<<<<<<<<<
 *             if self._event_filter & ITERPARSE_FILTER_END:
 *                 self._node_stack.append(node)
 */
    __pyx_t_2 = ((PyObject *)__pyx_v_self->_doc);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_6 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_2), __pyx_v_c_node)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_v_node));
    __pyx_v_node = ((struct LxmlElement *)__pyx_t_6);
    __pyx_t_6 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":157
 *                _tagMatches(c_node, self._tag_href, self._tag_name):
 *             node = _elementFactory(self._doc, c_node)
 *             if self._event_filter & ITERPARSE_FILTER_END:             # <<<<<<<<<<<<<<
 *                 self._node_stack.append(node)
 *             if self._event_filter & ITERPARSE_FILTER_START:
 */
    __pyx_t_1 = (__pyx_v_self->_event_filter & __pyx_e_4lxml_5etree_ITERPARSE_FILTER_END);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":158
 *             node = _elementFactory(self._doc, c_node)
 *             if self._event_filter & ITERPARSE_FILTER_END:
 *                 self._node_stack.append(node)             # <<<<<<<<<<<<<<
 *             if self._event_filter & ITERPARSE_FILTER_START:
 *                 self._events.append( (u"start", node) )
 */
      if (unlikely(__pyx_v_self->_node_stack == Py_None)) {
        PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[14]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
      }
      __pyx_t_1 = PyList_Append(__pyx_v_self->_node_stack, ((PyObject *)__pyx_v_node)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":159
 *             if self._event_filter & ITERPARSE_FILTER_END:
 *                 self._node_stack.append(node)
 *             if self._event_filter & ITERPARSE_FILTER_START:             # <<<<<<<<<<<<<<
 *                 self._events.append( (u"start", node) )
 *         return 0
 */
    __pyx_t_1 = (__pyx_v_self->_event_filter & __pyx_e_4lxml_5etree_ITERPARSE_FILTER_START);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":160
 *                 self._node_stack.append(node)
 *             if self._event_filter & ITERPARSE_FILTER_START:
 *                 self._events.append( (u"start", node) )             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
      if (unlikely(__pyx_v_self->_events == Py_None)) {
        PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[14]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
      }
      __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
      __Pyx_INCREF(((PyObject *)__pyx_n_u__start));
      PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_n_u__start));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_u__start));
      __Pyx_INCREF(((PyObject *)__pyx_v_node));
      PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_v_node));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_node));
      __pyx_t_1 = PyList_Append(__pyx_v_self->_events, ((PyObject *)__pyx_t_6)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
      goto __pyx_L9;
    }
    __pyx_L9:;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":161
 *             if self._event_filter & ITERPARSE_FILTER_START:
 *                 self._events.append( (u"start", node) )
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cdef int endNode(self, xmlNode* c_node) except -1:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._IterparseContext.startNode");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_node);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":163
 *         return 0
 * 
 *     cdef int endNode(self, xmlNode* c_node) except -1:             # <<<<<<<<<<<<<<
 *         cdef xmlNs* c_ns
 *         cdef int ns_count
 */

static  int __pyx_f_4lxml_5etree_17_IterparseContext_endNode(struct __pyx_obj_4lxml_5etree__IterparseContext *__pyx_v_self, xmlNode *__pyx_v_c_node) {
  int __pyx_v_ns_count;
  PyObject *__pyx_v_node;
  PyObject *__pyx_v_event;
  long __pyx_v_i;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  __Pyx_RefNannySetupContext("endNode");
  __pyx_v_node = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_event = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":166
 *         cdef xmlNs* c_ns
 *         cdef int ns_count
 *         if self._event_filter & ITERPARSE_FILTER_END:             # <<<<<<<<<<<<<<
 *             if self._tag_tuple is None or \
 *                    _tagMatches(c_node, self._tag_href, self._tag_name):
 */
  __pyx_t_1 = (__pyx_v_self->_event_filter & __pyx_e_4lxml_5etree_ITERPARSE_FILTER_END);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":167
 *         cdef int ns_count
 *         if self._event_filter & ITERPARSE_FILTER_END:
 *             if self._tag_tuple is None or \             # <<<<<<<<<<<<<<
 *                    _tagMatches(c_node, self._tag_href, self._tag_name):
 *                 if self._event_filter & (ITERPARSE_FILTER_START | \
 */
    __pyx_t_2 = (__pyx_v_self->_tag_tuple == ((PyObject*)Py_None));
    if (!__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":168
 *         if self._event_filter & ITERPARSE_FILTER_END:
 *             if self._tag_tuple is None or \
 *                    _tagMatches(c_node, self._tag_href, self._tag_name):             # <<<<<<<<<<<<<<
 *                 if self._event_filter & (ITERPARSE_FILTER_START | \
 *                                          ITERPARSE_FILTER_START_NS | \
 */
      __pyx_t_3 = __pyx_f_4lxml_5etree__tagMatches(__pyx_v_c_node, __pyx_v_self->_tag_href, __pyx_v_self->_tag_name);
      __pyx_t_4 = __pyx_t_3;
    } else {
      __pyx_t_4 = __pyx_t_2;
    }
    if (__pyx_t_4) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":171
 *                 if self._event_filter & (ITERPARSE_FILTER_START | \
 *                                          ITERPARSE_FILTER_START_NS | \
 *                                          ITERPARSE_FILTER_END_NS):             # <<<<<<<<<<<<<<
 *                     node = self._pop_node()
 *                 else:
 */
      __pyx_t_1 = (__pyx_v_self->_event_filter & ((__pyx_e_4lxml_5etree_ITERPARSE_FILTER_START | __pyx_e_4lxml_5etree_ITERPARSE_FILTER_START_NS) | __pyx_e_4lxml_5etree_ITERPARSE_FILTER_END_NS));
      if (__pyx_t_1) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":172
 *                                          ITERPARSE_FILTER_START_NS | \
 *                                          ITERPARSE_FILTER_END_NS):
 *                     node = self._pop_node()             # <<<<<<<<<<<<<<
 *                 else:
 *                     if self._root is None:
 */
        __pyx_t_5 = PyObject_Call(__pyx_v_self->_pop_node, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_v_node);
        __pyx_v_node = __pyx_t_5;
        __pyx_t_5 = 0;
        goto __pyx_L5;
      }
      /*else*/ {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":174
 *                     node = self._pop_node()
 *                 else:
 *                     if self._root is None:             # <<<<<<<<<<<<<<
 *                         if self._doc is None:
 *                             self._doc = _documentFactory(c_node.doc, None)
 */
        __pyx_t_4 = (((PyObject *)__pyx_v_self->_root) == Py_None);
        if (__pyx_t_4) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":175
 *                 else:
 *                     if self._root is None:
 *                         if self._doc is None:             # <<<<<<<<<<<<<<
 *                             self._doc = _documentFactory(c_node.doc, None)
 *                         self._root = self._doc.getroot()
 */
          __pyx_t_4 = (((PyObject *)__pyx_v_self->_doc) == Py_None);
          if (__pyx_t_4) {

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":176
 *                     if self._root is None:
 *                         if self._doc is None:
 *                             self._doc = _documentFactory(c_node.doc, None)             # <<<<<<<<<<<<<<
 *                         self._root = self._doc.getroot()
 *                     node = _elementFactory(self._doc, c_node)
 */
            __pyx_t_5 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_node->doc, ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_5);
            __Pyx_GIVEREF(__pyx_t_5);
            __Pyx_GOTREF(__pyx_v_self->_doc);
            __Pyx_DECREF(((PyObject *)__pyx_v_self->_doc));
            __pyx_v_self->_doc = ((struct LxmlDocument *)__pyx_t_5);
            __pyx_t_5 = 0;
            goto __pyx_L7;
          }
          __pyx_L7:;

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":177
 *                         if self._doc is None:
 *                             self._doc = _documentFactory(c_node.doc, None)
 *                         self._root = self._doc.getroot()             # <<<<<<<<<<<<<<
 *                     node = _elementFactory(self._doc, c_node)
 *                 self._events.append( (u"end", node) )
 */
          __pyx_t_5 = ((struct __pyx_vtabstruct_4lxml_5etree__Document *)__pyx_v_self->_doc->__pyx_vtab)->getroot(__pyx_v_self->_doc); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_5);
          if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GIVEREF(__pyx_t_5);
          __Pyx_GOTREF(__pyx_v_self->_root);
          __Pyx_DECREF(((PyObject *)__pyx_v_self->_root));
          __pyx_v_self->_root = ((struct LxmlElement *)__pyx_t_5);
          __pyx_t_5 = 0;
          goto __pyx_L6;
        }
        __pyx_L6:;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":178
 *                             self._doc = _documentFactory(c_node.doc, None)
 *                         self._root = self._doc.getroot()
 *                     node = _elementFactory(self._doc, c_node)             # <<<<<<<<<<<<<<
 *                 self._events.append( (u"end", node) )
 * 
 */
        __pyx_t_5 = ((PyObject *)__pyx_v_self->_doc);
        __Pyx_INCREF(__pyx_t_5);
        __pyx_t_6 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_5), __pyx_v_c_node)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_v_node);
        __pyx_v_node = __pyx_t_6;
        __pyx_t_6 = 0;
      }
      __pyx_L5:;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":179
 *                         self._root = self._doc.getroot()
 *                     node = _elementFactory(self._doc, c_node)
 *                 self._events.append( (u"end", node) )             # <<<<<<<<<<<<<<
 * 
 *         if self._event_filter & ITERPARSE_FILTER_END_NS:
 */
      if (unlikely(__pyx_v_self->_events == Py_None)) {
        PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[14]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
      }
      __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
      __Pyx_INCREF(((PyObject *)__pyx_n_u__end));
      PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_n_u__end));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_u__end));
      __Pyx_INCREF(__pyx_v_node);
      PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_node);
      __Pyx_GIVEREF(__pyx_v_node);
      __pyx_t_1 = PyList_Append(__pyx_v_self->_events, ((PyObject *)__pyx_t_6)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
      goto __pyx_L4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":181
 *                 self._events.append( (u"end", node) )
 * 
 *         if self._event_filter & ITERPARSE_FILTER_END_NS:             # <<<<<<<<<<<<<<
 *             ns_count = self._pop_ns()
 *             if ns_count > 0:
 */
  __pyx_t_1 = (__pyx_v_self->_event_filter & __pyx_e_4lxml_5etree_ITERPARSE_FILTER_END_NS);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":182
 * 
 *         if self._event_filter & ITERPARSE_FILTER_END_NS:
 *             ns_count = self._pop_ns()             # <<<<<<<<<<<<<<
 *             if ns_count > 0:
 *                 event = (u"end-ns", None)
 */
    __pyx_t_6 = PyObject_Call(__pyx_v_self->_pop_ns, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_t_6); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_v_ns_count = __pyx_t_1;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":183
 *         if self._event_filter & ITERPARSE_FILTER_END_NS:
 *             ns_count = self._pop_ns()
 *             if ns_count > 0:             # <<<<<<<<<<<<<<
 *                 event = (u"end-ns", None)
 *                 for i from 0 <= i < ns_count:
 */
    __pyx_t_4 = (__pyx_v_ns_count > 0);
    if (__pyx_t_4) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":184
 *             ns_count = self._pop_ns()
 *             if ns_count > 0:
 *                 event = (u"end-ns", None)             # <<<<<<<<<<<<<<
 *                 for i from 0 <= i < ns_count:
 *                     self._events.append(event)
 */
      __Pyx_INCREF(((PyObject *)__pyx_k_tuple_263));
      __Pyx_DECREF(((PyObject *)__pyx_v_event));
      __pyx_v_event = __pyx_k_tuple_263;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":185
 *             if ns_count > 0:
 *                 event = (u"end-ns", None)
 *                 for i from 0 <= i < ns_count:             # <<<<<<<<<<<<<<
 *                     self._events.append(event)
 *         return 0
 */
      __pyx_t_1 = __pyx_v_ns_count;
      for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":186
 *                 event = (u"end-ns", None)
 *                 for i from 0 <= i < ns_count:
 *                     self._events.append(event)             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
        if (unlikely(__pyx_v_self->_events == Py_None)) {
          PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[14]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
        }
        __pyx_t_7 = PyList_Append(__pyx_v_self->_events, ((PyObject *)__pyx_v_event)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      goto __pyx_L9;
    }
    __pyx_L9:;
    goto __pyx_L8;
  }
  __pyx_L8:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":187
 *                 for i from 0 <= i < ns_count:
 *                     self._events.append(event)
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cdef int pushEvent(self, event, xmlNode* c_node) except -1:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._IterparseContext.endNode");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_node);
  __Pyx_DECREF(__pyx_v_event);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":189
 *         return 0
 * 
 *     cdef int pushEvent(self, event, xmlNode* c_node) except -1:             # <<<<<<<<<<<<<<
 *         cdef _Element root
 *         if self._doc is None:
 */

static  int __pyx_f_4lxml_5etree_17_IterparseContext_pushEvent(struct __pyx_obj_4lxml_5etree__IterparseContext *__pyx_v_self, PyObject *__pyx_v_event, xmlNode *__pyx_v_c_node) {
  struct LxmlElement *__pyx_v_root;
  struct LxmlElement *__pyx_v_node;
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("pushEvent");
  __pyx_v_root = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_node = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":191
 *     cdef int pushEvent(self, event, xmlNode* c_node) except -1:
 *         cdef _Element root
 *         if self._doc is None:             # <<<<<<<<<<<<<<
 *             self._doc = _documentFactory(c_node.doc, None)
 *             root = self._doc.getroot()
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_self->_doc) == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":192
 *         cdef _Element root
 *         if self._doc is None:
 *             self._doc = _documentFactory(c_node.doc, None)             # <<<<<<<<<<<<<<
 *             root = self._doc.getroot()
 *             if root is not None and root._c_node.type == tree.XML_ELEMENT_NODE:
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_node->doc, ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_GOTREF(__pyx_v_self->_doc);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->_doc));
    __pyx_v_self->_doc = ((struct LxmlDocument *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":193
 *         if self._doc is None:
 *             self._doc = _documentFactory(c_node.doc, None)
 *             root = self._doc.getroot()             # <<<<<<<<<<<<<<
 *             if root is not None and root._c_node.type == tree.XML_ELEMENT_NODE:
 *                 self._root = root
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__Document *)__pyx_v_self->_doc->__pyx_vtab)->getroot(__pyx_v_self->_doc); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_v_root));
    __pyx_v_root = ((struct LxmlElement *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":194
 *             self._doc = _documentFactory(c_node.doc, None)
 *             root = self._doc.getroot()
 *             if root is not None and root._c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *                 self._root = root
 *         node = _elementFactory(self._doc, c_node)
 */
    __pyx_t_1 = (((PyObject *)__pyx_v_root) != Py_None);
    if (__pyx_t_1) {
      __pyx_t_3 = (__pyx_v_root->_c_node->type == XML_ELEMENT_NODE);
      __pyx_t_4 = __pyx_t_3;
    } else {
      __pyx_t_4 = __pyx_t_1;
    }
    if (__pyx_t_4) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":195
 *             root = self._doc.getroot()
 *             if root is not None and root._c_node.type == tree.XML_ELEMENT_NODE:
 *                 self._root = root             # <<<<<<<<<<<<<<
 *         node = _elementFactory(self._doc, c_node)
 *         self._events.append( (event, node) )
 */
      __Pyx_INCREF(((PyObject *)__pyx_v_root));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_root));
      __Pyx_GOTREF(__pyx_v_self->_root);
      __Pyx_DECREF(((PyObject *)__pyx_v_self->_root));
      __pyx_v_self->_root = __pyx_v_root;
      goto __pyx_L4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":196
 *             if root is not None and root._c_node.type == tree.XML_ELEMENT_NODE:
 *                 self._root = root
 *         node = _elementFactory(self._doc, c_node)             # <<<<<<<<<<<<<<
 *         self._events.append( (event, node) )
 *         return 0
 */
  __pyx_t_2 = ((PyObject *)__pyx_v_self->_doc);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_5 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_2), __pyx_v_c_node)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_v_node));
  __pyx_v_node = ((struct LxmlElement *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":197
 *                 self._root = root
 *         node = _elementFactory(self._doc, c_node)
 *         self._events.append( (event, node) )             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  if (unlikely(__pyx_v_self->_events == Py_None)) {
    PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[14]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  __Pyx_INCREF(__pyx_v_event);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_event);
  __Pyx_GIVEREF(__pyx_v_event);
  __Pyx_INCREF(((PyObject *)__pyx_v_node));
  PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_v_node));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_node));
  __pyx_t_6 = PyList_Append(__pyx_v_self->_events, ((PyObject *)__pyx_t_5)); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":198
 *         node = _elementFactory(self._doc, c_node)
 *         self._events.append( (event, node) )
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cdef void _assureDocGetsFreed(self):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._IterparseContext.pushEvent");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_root);
  __Pyx_DECREF((PyObject *)__pyx_v_node);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":200
 *         return 0
 * 
 *     cdef void _assureDocGetsFreed(self):             # <<<<<<<<<<<<<<
 *         if self._c_ctxt.myDoc is not NULL and self._doc is None:
 *             tree.xmlFreeDoc(self._c_ctxt.myDoc)
 */

static  void __pyx_f_4lxml_5etree_17_IterparseContext__assureDocGetsFreed(struct __pyx_obj_4lxml_5etree__IterparseContext *__pyx_v_self) {
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("_assureDocGetsFreed");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":201
 * 
 *     cdef void _assureDocGetsFreed(self):
 *         if self._c_ctxt.myDoc is not NULL and self._doc is None:             # <<<<<<<<<<<<<<
 *             tree.xmlFreeDoc(self._c_ctxt.myDoc)
 *             self._c_ctxt.myDoc = NULL
 */
  __pyx_t_1 = (__pyx_v_self->__pyx_base._c_ctxt->myDoc != NULL);
  if (__pyx_t_1) {
    __pyx_t_2 = (((PyObject *)__pyx_v_self->_doc) == Py_None);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":202
 *     cdef void _assureDocGetsFreed(self):
 *         if self._c_ctxt.myDoc is not NULL and self._doc is None:
 *             tree.xmlFreeDoc(self._c_ctxt.myDoc)             # <<<<<<<<<<<<<<
 *             self._c_ctxt.myDoc = NULL
 * 
 */
    xmlFreeDoc(__pyx_v_self->__pyx_base._c_ctxt->myDoc);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":203
 *         if self._c_ctxt.myDoc is not NULL and self._doc is None:
 *             tree.xmlFreeDoc(self._c_ctxt.myDoc)
 *             self._c_ctxt.myDoc = NULL             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_v_self->__pyx_base._c_ctxt->myDoc = NULL;
    goto __pyx_L3;
  }
  __pyx_L3:;

  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":206
 * 
 * 
 * cdef inline void _pushSaxStartEvent(_IterparseContext context,             # <<<<<<<<<<<<<<
 *                                     xmlNode* c_node):
 *     try:
 */

static CYTHON_INLINE void __pyx_f_4lxml_5etree__pushSaxStartEvent(struct __pyx_obj_4lxml_5etree__IterparseContext *__pyx_v_context, xmlNode *__pyx_v_c_node) {
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("_pushSaxStartEvent");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":208
 * cdef inline void _pushSaxStartEvent(_IterparseContext context,
 *                                     xmlNode* c_node):
 *     try:             # <<<<<<<<<<<<<<
 *         if context._c_ctxt.html:
 *             _fixHtmlDictNodeNames(context._c_ctxt.dict, c_node)
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":209
 *                                     xmlNode* c_node):
 *     try:
 *         if context._c_ctxt.html:             # <<<<<<<<<<<<<<
 *             _fixHtmlDictNodeNames(context._c_ctxt.dict, c_node)
 *         context.startNode(c_node)
 */
      if (__pyx_v_context->__pyx_base._c_ctxt->html) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":210
 *     try:
 *         if context._c_ctxt.html:
 *             _fixHtmlDictNodeNames(context._c_ctxt.dict, c_node)             # <<<<<<<<<<<<<<
 *         context.startNode(c_node)
 *     except:
 */
        __pyx_f_4lxml_5etree__fixHtmlDictNodeNames(__pyx_v_context->__pyx_base._c_ctxt->dict, __pyx_v_c_node);
        goto __pyx_L11;
      }
      __pyx_L11:;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":211
 *         if context._c_ctxt.html:
 *             _fixHtmlDictNodeNames(context._c_ctxt.dict, c_node)
 *         context.startNode(c_node)             # <<<<<<<<<<<<<<
 *     except:
 *         if context._c_ctxt.errNo == xmlerror.XML_ERR_OK:
 */
      __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__IterparseContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->startNode(__pyx_v_context, __pyx_v_c_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L10_try_end;
    __pyx_L3_error:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":212
 *             _fixHtmlDictNodeNames(context._c_ctxt.dict, c_node)
 *         context.startNode(c_node)
 *     except:             # <<<<<<<<<<<<<<
 *         if context._c_ctxt.errNo == xmlerror.XML_ERR_OK:
 *             context._c_ctxt.errNo = xmlerror.XML_ERR_INTERNAL_ERROR
 */
    /*except:*/ {
      __Pyx_AddTraceback("lxml.etree._pushSaxStartEvent");
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_4);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":213
 *         context.startNode(c_node)
 *     except:
 *         if context._c_ctxt.errNo == xmlerror.XML_ERR_OK:             # <<<<<<<<<<<<<<
 *             context._c_ctxt.errNo = xmlerror.XML_ERR_INTERNAL_ERROR
 *         context._c_ctxt.disableSAX = 1
 */
      __pyx_t_5 = (__pyx_v_context->__pyx_base._c_ctxt->errNo == XML_ERR_OK);
      if (__pyx_t_5) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":214
 *     except:
 *         if context._c_ctxt.errNo == xmlerror.XML_ERR_OK:
 *             context._c_ctxt.errNo = xmlerror.XML_ERR_INTERNAL_ERROR             # <<<<<<<<<<<<<<
 *         context._c_ctxt.disableSAX = 1
 *         context._store_raised()
 */
        __pyx_v_context->__pyx_base._c_ctxt->errNo = XML_ERR_INTERNAL_ERROR;
        goto __pyx_L14;
      }
      __pyx_L14:;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":215
 *         if context._c_ctxt.errNo == xmlerror.XML_ERR_OK:
 *             context._c_ctxt.errNo = xmlerror.XML_ERR_INTERNAL_ERROR
 *         context._c_ctxt.disableSAX = 1             # <<<<<<<<<<<<<<
 *         context._store_raised()
 * 
 */
      __pyx_v_context->__pyx_base._c_ctxt->disableSAX = 1;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":216
 *             context._c_ctxt.errNo = xmlerror.XML_ERR_INTERNAL_ERROR
 *         context._c_ctxt.disableSAX = 1
 *         context._store_raised()             # <<<<<<<<<<<<<<
 * 
 * cdef inline void _pushSaxEndEvent(_IterparseContext context,
 */
      ((struct __pyx_vtabstruct_4lxml_5etree__IterparseContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.__pyx_base._store_raised(((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_v_context));
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L4_exception_handled;
    }
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L10_try_end:;
  }

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_WriteUnraisable("lxml.etree._pushSaxStartEvent");
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":218
 *         context._store_raised()
 * 
 * cdef inline void _pushSaxEndEvent(_IterparseContext context,             # <<<<<<<<<<<<<<
 *                                   xmlNode* c_node):
 *     try:
 */

static CYTHON_INLINE void __pyx_f_4lxml_5etree__pushSaxEndEvent(struct __pyx_obj_4lxml_5etree__IterparseContext *__pyx_v_context, xmlNode *__pyx_v_c_node) {
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("_pushSaxEndEvent");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":220
 * cdef inline void _pushSaxEndEvent(_IterparseContext context,
 *                                   xmlNode* c_node):
 *     try:             # <<<<<<<<<<<<<<
 *         context.endNode(c_node)
 *     except:
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":221
 *                                   xmlNode* c_node):
 *     try:
 *         context.endNode(c_node)             # <<<<<<<<<<<<<<
 *     except:
 *         if context._c_ctxt.errNo == xmlerror.XML_ERR_OK:
 */
      __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__IterparseContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->endNode(__pyx_v_context, __pyx_v_c_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L10_try_end;
    __pyx_L3_error:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":222
 *     try:
 *         context.endNode(c_node)
 *     except:             # <<<<<<<<<<<<<<
 *         if context._c_ctxt.errNo == xmlerror.XML_ERR_OK:
 *             context._c_ctxt.errNo = xmlerror.XML_ERR_INTERNAL_ERROR
 */
    /*except:*/ {
      __Pyx_AddTraceback("lxml.etree._pushSaxEndEvent");
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_4);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":223
 *         context.endNode(c_node)
 *     except:
 *         if context._c_ctxt.errNo == xmlerror.XML_ERR_OK:             # <<<<<<<<<<<<<<
 *             context._c_ctxt.errNo = xmlerror.XML_ERR_INTERNAL_ERROR
 *         context._c_ctxt.disableSAX = 1
 */
      __pyx_t_5 = (__pyx_v_context->__pyx_base._c_ctxt->errNo == XML_ERR_OK);
      if (__pyx_t_5) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":224
 *     except:
 *         if context._c_ctxt.errNo == xmlerror.XML_ERR_OK:
 *             context._c_ctxt.errNo = xmlerror.XML_ERR_INTERNAL_ERROR             # <<<<<<<<<<<<<<
 *         context._c_ctxt.disableSAX = 1
 *         context._store_raised()
 */
        __pyx_v_context->__pyx_base._c_ctxt->errNo = XML_ERR_INTERNAL_ERROR;
        goto __pyx_L13;
      }
      __pyx_L13:;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":225
 *         if context._c_ctxt.errNo == xmlerror.XML_ERR_OK:
 *             context._c_ctxt.errNo = xmlerror.XML_ERR_INTERNAL_ERROR
 *         context._c_ctxt.disableSAX = 1             # <<<<<<<<<<<<<<
 *         context._store_raised()
 * 
 */
      __pyx_v_context->__pyx_base._c_ctxt->disableSAX = 1;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":226
 *             context._c_ctxt.errNo = xmlerror.XML_ERR_INTERNAL_ERROR
 *         context._c_ctxt.disableSAX = 1
 *         context._store_raised()             # <<<<<<<<<<<<<<
 * 
 * cdef inline void _pushSaxEvent(_IterparseContext context,
 */
      ((struct __pyx_vtabstruct_4lxml_5etree__IterparseContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.__pyx_base._store_raised(((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_v_context));
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L4_exception_handled;
    }
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L10_try_end:;
  }

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_WriteUnraisable("lxml.etree._pushSaxEndEvent");
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":228
 *         context._store_raised()
 * 
 * cdef inline void _pushSaxEvent(_IterparseContext context,             # <<<<<<<<<<<<<<
 *                                event, xmlNode* c_node):
 *     try:
 */

static CYTHON_INLINE void __pyx_f_4lxml_5etree__pushSaxEvent(struct __pyx_obj_4lxml_5etree__IterparseContext *__pyx_v_context, PyObject *__pyx_v_event, xmlNode *__pyx_v_c_node) {
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("_pushSaxEvent");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":230
 * cdef inline void _pushSaxEvent(_IterparseContext context,
 *                                event, xmlNode* c_node):
 *     try:             # <<<<<<<<<<<<<<
 *         context.pushEvent(event, c_node)
 *     except:
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":231
 *                                event, xmlNode* c_node):
 *     try:
 *         context.pushEvent(event, c_node)             # <<<<<<<<<<<<<<
 *     except:
 *         if context._c_ctxt.errNo == xmlerror.XML_ERR_OK:
 */
      __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__IterparseContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->pushEvent(__pyx_v_context, __pyx_v_event, __pyx_v_c_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L10_try_end;
    __pyx_L3_error:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":232
 *     try:
 *         context.pushEvent(event, c_node)
 *     except:             # <<<<<<<<<<<<<<
 *         if context._c_ctxt.errNo == xmlerror.XML_ERR_OK:
 *             context._c_ctxt.errNo = xmlerror.XML_ERR_INTERNAL_ERROR
 */
    /*except:*/ {
      __Pyx_AddTraceback("lxml.etree._pushSaxEvent");
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_4);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":233
 *         context.pushEvent(event, c_node)
 *     except:
 *         if context._c_ctxt.errNo == xmlerror.XML_ERR_OK:             # <<<<<<<<<<<<<<
 *             context._c_ctxt.errNo = xmlerror.XML_ERR_INTERNAL_ERROR
 *         context._c_ctxt.disableSAX = 1
 */
      __pyx_t_5 = (__pyx_v_context->__pyx_base._c_ctxt->errNo == XML_ERR_OK);
      if (__pyx_t_5) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":234
 *     except:
 *         if context._c_ctxt.errNo == xmlerror.XML_ERR_OK:
 *             context._c_ctxt.errNo = xmlerror.XML_ERR_INTERNAL_ERROR             # <<<<<<<<<<<<<<
 *         context._c_ctxt.disableSAX = 1
 *         context._store_raised()
 */
        __pyx_v_context->__pyx_base._c_ctxt->errNo = XML_ERR_INTERNAL_ERROR;
        goto __pyx_L13;
      }
      __pyx_L13:;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":235
 *         if context._c_ctxt.errNo == xmlerror.XML_ERR_OK:
 *             context._c_ctxt.errNo = xmlerror.XML_ERR_INTERNAL_ERROR
 *         context._c_ctxt.disableSAX = 1             # <<<<<<<<<<<<<<
 *         context._store_raised()
 * 
 */
      __pyx_v_context->__pyx_base._c_ctxt->disableSAX = 1;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":236
 *             context._c_ctxt.errNo = xmlerror.XML_ERR_INTERNAL_ERROR
 *         context._c_ctxt.disableSAX = 1
 *         context._store_raised()             # <<<<<<<<<<<<<<
 * 
 * cdef void _iterparseSaxStart(void* ctxt, char* localname, char* prefix,
 */
      ((struct __pyx_vtabstruct_4lxml_5etree__IterparseContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.__pyx_base._store_raised(((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_v_context));
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L4_exception_handled;
    }
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L10_try_end:;
  }

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_WriteUnraisable("lxml.etree._pushSaxEvent");
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":238
 *         context._store_raised()
 * 
 * cdef void _iterparseSaxStart(void* ctxt, char* localname, char* prefix,             # <<<<<<<<<<<<<<
 *                              char* URI, int nb_namespaces, char** namespaces,
 *                              int nb_attributes, int nb_defaulted,
 */

static  void __pyx_f_4lxml_5etree__iterparseSaxStart(void *__pyx_v_ctxt, char *__pyx_v_localname, char *__pyx_v_prefix, char *__pyx_v_URI, int __pyx_v_nb_namespaces, char **__pyx_v_namespaces, int __pyx_v_nb_attributes, int __pyx_v_nb_defaulted, char **__pyx_v_attributes) {
  xmlParserCtxt *__pyx_v_c_ctxt;
  struct __pyx_obj_4lxml_5etree__IterparseContext *__pyx_v_context;
  __Pyx_RefNannySetupContext("_iterparseSaxStart");
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__IterparseContext *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":244
 *     cdef xmlparser.xmlParserCtxt* c_ctxt
 *     cdef _IterparseContext context
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt             # <<<<<<<<<<<<<<
 *     context = <_IterparseContext>c_ctxt._private
 *     context._origSaxStart(
 */
  __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":245
 *     cdef _IterparseContext context
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     context = <_IterparseContext>c_ctxt._private             # <<<<<<<<<<<<<<
 *     context._origSaxStart(
 *         ctxt, localname, prefix, URI,
 */
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__IterparseContext *)__pyx_v_c_ctxt->_private)));
  __Pyx_DECREF(((PyObject *)__pyx_v_context));
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__IterparseContext *)__pyx_v_c_ctxt->_private);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":249
 *         ctxt, localname, prefix, URI,
 *         nb_namespaces, namespaces,
 *         nb_attributes, nb_defaulted, attributes)             # <<<<<<<<<<<<<<
 *     _pushSaxStartEvent(context, c_ctxt.node)
 * 
 */
  __pyx_v_context->_origSaxStart(__pyx_v_ctxt, __pyx_v_localname, __pyx_v_prefix, __pyx_v_URI, __pyx_v_nb_namespaces, __pyx_v_namespaces, __pyx_v_nb_attributes, __pyx_v_nb_defaulted, __pyx_v_attributes);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":250
 *         nb_namespaces, namespaces,
 *         nb_attributes, nb_defaulted, attributes)
 *     _pushSaxStartEvent(context, c_ctxt.node)             # <<<<<<<<<<<<<<
 * 
 * cdef void _iterparseSaxEnd(void* ctxt, char* localname, char* prefix, char* URI):
 */
  __pyx_f_4lxml_5etree__pushSaxStartEvent(__pyx_v_context, __pyx_v_c_ctxt->node);

  __Pyx_DECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":252
 *     _pushSaxStartEvent(context, c_ctxt.node)
 * 
 * cdef void _iterparseSaxEnd(void* ctxt, char* localname, char* prefix, char* URI):             # <<<<<<<<<<<<<<
 *     cdef xmlparser.xmlParserCtxt* c_ctxt
 *     cdef _IterparseContext context
 */

static  void __pyx_f_4lxml_5etree__iterparseSaxEnd(void *__pyx_v_ctxt, char *__pyx_v_localname, char *__pyx_v_prefix, char *__pyx_v_URI) {
  xmlParserCtxt *__pyx_v_c_ctxt;
  struct __pyx_obj_4lxml_5etree__IterparseContext *__pyx_v_context;
  __Pyx_RefNannySetupContext("_iterparseSaxEnd");
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__IterparseContext *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":255
 *     cdef xmlparser.xmlParserCtxt* c_ctxt
 *     cdef _IterparseContext context
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt             # <<<<<<<<<<<<<<
 *     context = <_IterparseContext>c_ctxt._private
 *     _pushSaxEndEvent(context, c_ctxt.node)
 */
  __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":256
 *     cdef _IterparseContext context
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     context = <_IterparseContext>c_ctxt._private             # <<<<<<<<<<<<<<
 *     _pushSaxEndEvent(context, c_ctxt.node)
 *     context._origSaxEnd(ctxt, localname, prefix, URI)
 */
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__IterparseContext *)__pyx_v_c_ctxt->_private)));
  __Pyx_DECREF(((PyObject *)__pyx_v_context));
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__IterparseContext *)__pyx_v_c_ctxt->_private);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":257
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     context = <_IterparseContext>c_ctxt._private
 *     _pushSaxEndEvent(context, c_ctxt.node)             # <<<<<<<<<<<<<<
 *     context._origSaxEnd(ctxt, localname, prefix, URI)
 * 
 */
  __pyx_f_4lxml_5etree__pushSaxEndEvent(__pyx_v_context, __pyx_v_c_ctxt->node);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":258
 *     context = <_IterparseContext>c_ctxt._private
 *     _pushSaxEndEvent(context, c_ctxt.node)
 *     context._origSaxEnd(ctxt, localname, prefix, URI)             # <<<<<<<<<<<<<<
 * 
 * cdef void _iterparseSaxStartNoNs(void* ctxt, char* name, char** attributes):
 */
  __pyx_v_context->_origSaxEnd(__pyx_v_ctxt, __pyx_v_localname, __pyx_v_prefix, __pyx_v_URI);

  __Pyx_DECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":260
 *     context._origSaxEnd(ctxt, localname, prefix, URI)
 * 
 * cdef void _iterparseSaxStartNoNs(void* ctxt, char* name, char** attributes):             # <<<<<<<<<<<<<<
 *     cdef xmlparser.xmlParserCtxt* c_ctxt
 *     cdef _IterparseContext context
 */

static  void __pyx_f_4lxml_5etree__iterparseSaxStartNoNs(void *__pyx_v_ctxt, char *__pyx_v_name, char **__pyx_v_attributes) {
  xmlParserCtxt *__pyx_v_c_ctxt;
  struct __pyx_obj_4lxml_5etree__IterparseContext *__pyx_v_context;
  __Pyx_RefNannySetupContext("_iterparseSaxStartNoNs");
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__IterparseContext *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":263
 *     cdef xmlparser.xmlParserCtxt* c_ctxt
 *     cdef _IterparseContext context
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt             # <<<<<<<<<<<<<<
 *     context = <_IterparseContext>c_ctxt._private
 *     context._origSaxStartNoNs(ctxt, name, attributes)
 */
  __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":264
 *     cdef _IterparseContext context
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     context = <_IterparseContext>c_ctxt._private             # <<<<<<<<<<<<<<
 *     context._origSaxStartNoNs(ctxt, name, attributes)
 *     _pushSaxStartEvent(context, c_ctxt.node)
 */
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__IterparseContext *)__pyx_v_c_ctxt->_private)));
  __Pyx_DECREF(((PyObject *)__pyx_v_context));
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__IterparseContext *)__pyx_v_c_ctxt->_private);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":265
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     context = <_IterparseContext>c_ctxt._private
 *     context._origSaxStartNoNs(ctxt, name, attributes)             # <<<<<<<<<<<<<<
 *     _pushSaxStartEvent(context, c_ctxt.node)
 * 
 */
  __pyx_v_context->_origSaxStartNoNs(__pyx_v_ctxt, __pyx_v_name, __pyx_v_attributes);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":266
 *     context = <_IterparseContext>c_ctxt._private
 *     context._origSaxStartNoNs(ctxt, name, attributes)
 *     _pushSaxStartEvent(context, c_ctxt.node)             # <<<<<<<<<<<<<<
 * 
 * cdef void _iterparseSaxEndNoNs(void* ctxt, char* name):
 */
  __pyx_f_4lxml_5etree__pushSaxStartEvent(__pyx_v_context, __pyx_v_c_ctxt->node);

  __Pyx_DECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":268
 *     _pushSaxStartEvent(context, c_ctxt.node)
 * 
 * cdef void _iterparseSaxEndNoNs(void* ctxt, char* name):             # <<<<<<<<<<<<<<
 *     cdef xmlparser.xmlParserCtxt* c_ctxt
 *     cdef _IterparseContext context
 */

static  void __pyx_f_4lxml_5etree__iterparseSaxEndNoNs(void *__pyx_v_ctxt, char *__pyx_v_name) {
  xmlParserCtxt *__pyx_v_c_ctxt;
  struct __pyx_obj_4lxml_5etree__IterparseContext *__pyx_v_context;
  __Pyx_RefNannySetupContext("_iterparseSaxEndNoNs");
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__IterparseContext *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":271
 *     cdef xmlparser.xmlParserCtxt* c_ctxt
 *     cdef _IterparseContext context
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt             # <<<<<<<<<<<<<<
 *     context = <_IterparseContext>c_ctxt._private
 *     _pushSaxEndEvent(context, c_ctxt.node)
 */
  __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":272
 *     cdef _IterparseContext context
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     context = <_IterparseContext>c_ctxt._private             # <<<<<<<<<<<<<<
 *     _pushSaxEndEvent(context, c_ctxt.node)
 *     context._origSaxEndNoNs(ctxt, name)
 */
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__IterparseContext *)__pyx_v_c_ctxt->_private)));
  __Pyx_DECREF(((PyObject *)__pyx_v_context));
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__IterparseContext *)__pyx_v_c_ctxt->_private);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":273
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     context = <_IterparseContext>c_ctxt._private
 *     _pushSaxEndEvent(context, c_ctxt.node)             # <<<<<<<<<<<<<<
 *     context._origSaxEndNoNs(ctxt, name)
 * 
 */
  __pyx_f_4lxml_5etree__pushSaxEndEvent(__pyx_v_context, __pyx_v_c_ctxt->node);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":274
 *     context = <_IterparseContext>c_ctxt._private
 *     _pushSaxEndEvent(context, c_ctxt.node)
 *     context._origSaxEndNoNs(ctxt, name)             # <<<<<<<<<<<<<<
 * 
 * cdef void _iterparseSaxComment(void* ctxt, char* text):
 */
  __pyx_v_context->_origSaxEndNoNs(__pyx_v_ctxt, __pyx_v_name);

  __Pyx_DECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":276
 *     context._origSaxEndNoNs(ctxt, name)
 * 
 * cdef void _iterparseSaxComment(void* ctxt, char* text):             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     cdef xmlparser.xmlParserCtxt* c_ctxt
 */

static  void __pyx_f_4lxml_5etree__iterparseSaxComment(void *__pyx_v_ctxt, char *__pyx_v_text) {
  xmlNode *__pyx_v_c_node;
  xmlParserCtxt *__pyx_v_c_ctxt;
  struct __pyx_obj_4lxml_5etree__IterparseContext *__pyx_v_context;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_iterparseSaxComment");
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__IterparseContext *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":280
 *     cdef xmlparser.xmlParserCtxt* c_ctxt
 *     cdef _IterparseContext context
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt             # <<<<<<<<<<<<<<
 *     context = <_IterparseContext>c_ctxt._private
 *     context._origSaxComment(ctxt, text)
 */
  __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":281
 *     cdef _IterparseContext context
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     context = <_IterparseContext>c_ctxt._private             # <<<<<<<<<<<<<<
 *     context._origSaxComment(ctxt, text)
 *     c_node = _iterparseFindLastNode(c_ctxt)
 */
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__IterparseContext *)__pyx_v_c_ctxt->_private)));
  __Pyx_DECREF(((PyObject *)__pyx_v_context));
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__IterparseContext *)__pyx_v_c_ctxt->_private);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":282
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     context = <_IterparseContext>c_ctxt._private
 *     context._origSaxComment(ctxt, text)             # <<<<<<<<<<<<<<
 *     c_node = _iterparseFindLastNode(c_ctxt)
 *     if c_node is not NULL:
 */
  __pyx_v_context->_origSaxComment(__pyx_v_ctxt, __pyx_v_text);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":283
 *     context = <_IterparseContext>c_ctxt._private
 *     context._origSaxComment(ctxt, text)
 *     c_node = _iterparseFindLastNode(c_ctxt)             # <<<<<<<<<<<<<<
 *     if c_node is not NULL:
 *         _pushSaxEvent(context, u"comment", c_node)
 */
  __pyx_v_c_node = __pyx_f_4lxml_5etree__iterparseFindLastNode(__pyx_v_c_ctxt);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":284
 *     context._origSaxComment(ctxt, text)
 *     c_node = _iterparseFindLastNode(c_ctxt)
 *     if c_node is not NULL:             # <<<<<<<<<<<<<<
 *         _pushSaxEvent(context, u"comment", c_node)
 * 
 */
  __pyx_t_1 = (__pyx_v_c_node != NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":285
 *     c_node = _iterparseFindLastNode(c_ctxt)
 *     if c_node is not NULL:
 *         _pushSaxEvent(context, u"comment", c_node)             # <<<<<<<<<<<<<<
 * 
 * cdef void _iterparseSaxPI(void* ctxt, char* target, char* data):
 */
    __pyx_f_4lxml_5etree__pushSaxEvent(__pyx_v_context, ((PyObject *)__pyx_n_u__comment), __pyx_v_c_node);
    goto __pyx_L3;
  }
  __pyx_L3:;

  __Pyx_DECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":287
 *         _pushSaxEvent(context, u"comment", c_node)
 * 
 * cdef void _iterparseSaxPI(void* ctxt, char* target, char* data):             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     cdef xmlparser.xmlParserCtxt* c_ctxt
 */

static  void __pyx_f_4lxml_5etree__iterparseSaxPI(void *__pyx_v_ctxt, char *__pyx_v_target, char *__pyx_v_data) {
  xmlNode *__pyx_v_c_node;
  xmlParserCtxt *__pyx_v_c_ctxt;
  struct __pyx_obj_4lxml_5etree__IterparseContext *__pyx_v_context;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_iterparseSaxPI");
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__IterparseContext *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":291
 *     cdef xmlparser.xmlParserCtxt* c_ctxt
 *     cdef _IterparseContext context
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt             # <<<<<<<<<<<<<<
 *     context = <_IterparseContext>c_ctxt._private
 *     context._origSaxPI(ctxt, target, data)
 */
  __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":292
 *     cdef _IterparseContext context
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     context = <_IterparseContext>c_ctxt._private             # <<<<<<<<<<<<<<
 *     context._origSaxPI(ctxt, target, data)
 *     c_node = _iterparseFindLastNode(c_ctxt)
 */
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__IterparseContext *)__pyx_v_c_ctxt->_private)));
  __Pyx_DECREF(((PyObject *)__pyx_v_context));
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__IterparseContext *)__pyx_v_c_ctxt->_private);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":293
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     context = <_IterparseContext>c_ctxt._private
 *     context._origSaxPI(ctxt, target, data)             # <<<<<<<<<<<<<<
 *     c_node = _iterparseFindLastNode(c_ctxt)
 *     if c_node is not NULL:
 */
  __pyx_v_context->_origSaxPI(__pyx_v_ctxt, __pyx_v_target, __pyx_v_data);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":294
 *     context = <_IterparseContext>c_ctxt._private
 *     context._origSaxPI(ctxt, target, data)
 *     c_node = _iterparseFindLastNode(c_ctxt)             # <<<<<<<<<<<<<<
 *     if c_node is not NULL:
 *         _pushSaxEvent(context, u"pi", c_node)
 */
  __pyx_v_c_node = __pyx_f_4lxml_5etree__iterparseFindLastNode(__pyx_v_c_ctxt);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":295
 *     context._origSaxPI(ctxt, target, data)
 *     c_node = _iterparseFindLastNode(c_ctxt)
 *     if c_node is not NULL:             # <<<<<<<<<<<<<<
 *         _pushSaxEvent(context, u"pi", c_node)
 * 
 */
  __pyx_t_1 = (__pyx_v_c_node != NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":296
 *     c_node = _iterparseFindLastNode(c_ctxt)
 *     if c_node is not NULL:
 *         _pushSaxEvent(context, u"pi", c_node)             # <<<<<<<<<<<<<<
 * 
 * cdef inline xmlNode* _iterparseFindLastNode(xmlparser.xmlParserCtxt* c_ctxt):
 */
    __pyx_f_4lxml_5etree__pushSaxEvent(__pyx_v_context, ((PyObject *)__pyx_n_u__pi), __pyx_v_c_node);
    goto __pyx_L3;
  }
  __pyx_L3:;

  __Pyx_DECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":298
 *         _pushSaxEvent(context, u"pi", c_node)
 * 
 * cdef inline xmlNode* _iterparseFindLastNode(xmlparser.xmlParserCtxt* c_ctxt):             # <<<<<<<<<<<<<<
 *     # this mimics what libxml2 creates for comments/PIs
 *     if c_ctxt.inSubset == 1:
 */

static CYTHON_INLINE xmlNode *__pyx_f_4lxml_5etree__iterparseFindLastNode(xmlParserCtxt *__pyx_v_c_ctxt) {
  xmlNode *__pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_iterparseFindLastNode");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":300
 * cdef inline xmlNode* _iterparseFindLastNode(xmlparser.xmlParserCtxt* c_ctxt):
 *     # this mimics what libxml2 creates for comments/PIs
 *     if c_ctxt.inSubset == 1:             # <<<<<<<<<<<<<<
 *         return c_ctxt.myDoc.intSubset.last
 *     elif c_ctxt.inSubset == 2:
 */
  __pyx_t_1 = (__pyx_v_c_ctxt->inSubset == 1);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":301
 *     # this mimics what libxml2 creates for comments/PIs
 *     if c_ctxt.inSubset == 1:
 *         return c_ctxt.myDoc.intSubset.last             # <<<<<<<<<<<<<<
 *     elif c_ctxt.inSubset == 2:
 *         return c_ctxt.myDoc.extSubset.last
 */
    __pyx_r = __pyx_v_c_ctxt->myDoc->intSubset->last;
    goto __pyx_L0;
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":302
 *     if c_ctxt.inSubset == 1:
 *         return c_ctxt.myDoc.intSubset.last
 *     elif c_ctxt.inSubset == 2:             # <<<<<<<<<<<<<<
 *         return c_ctxt.myDoc.extSubset.last
 *     elif c_ctxt.node is NULL:
 */
  __pyx_t_1 = (__pyx_v_c_ctxt->inSubset == 2);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":303
 *         return c_ctxt.myDoc.intSubset.last
 *     elif c_ctxt.inSubset == 2:
 *         return c_ctxt.myDoc.extSubset.last             # <<<<<<<<<<<<<<
 *     elif c_ctxt.node is NULL:
 *         return c_ctxt.myDoc.last
 */
    __pyx_r = __pyx_v_c_ctxt->myDoc->extSubset->last;
    goto __pyx_L0;
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":304
 *     elif c_ctxt.inSubset == 2:
 *         return c_ctxt.myDoc.extSubset.last
 *     elif c_ctxt.node is NULL:             # <<<<<<<<<<<<<<
 *         return c_ctxt.myDoc.last
 *     elif c_ctxt.node.type == tree.XML_ELEMENT_NODE:
 */
  __pyx_t_1 = (__pyx_v_c_ctxt->node == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":305
 *         return c_ctxt.myDoc.extSubset.last
 *     elif c_ctxt.node is NULL:
 *         return c_ctxt.myDoc.last             # <<<<<<<<<<<<<<
 *     elif c_ctxt.node.type == tree.XML_ELEMENT_NODE:
 *         return c_ctxt.node.last
 */
    __pyx_r = __pyx_v_c_ctxt->myDoc->last;
    goto __pyx_L0;
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":306
 *     elif c_ctxt.node is NULL:
 *         return c_ctxt.myDoc.last
 *     elif c_ctxt.node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         return c_ctxt.node.last
 *     else:
 */
  __pyx_t_1 = (__pyx_v_c_ctxt->node->type == XML_ELEMENT_NODE);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":307
 *         return c_ctxt.myDoc.last
 *     elif c_ctxt.node.type == tree.XML_ELEMENT_NODE:
 *         return c_ctxt.node.last             # <<<<<<<<<<<<<<
 *     else:
 *         return c_ctxt.node.next
 */
    __pyx_r = __pyx_v_c_ctxt->node->last;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":309
 *         return c_ctxt.node.last
 *     else:
 *         return c_ctxt.node.next             # <<<<<<<<<<<<<<
 * 
 * cdef class iterparse(_BaseParser):
 */
    __pyx_r = __pyx_v_c_ctxt->node->next;
    goto __pyx_L0;
  }
  __pyx_L3:;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":364
 *                              char* chunk, int size, int terminate) nogil
 * 
 *     def __init__(self, source, events=(u"end",), *, tag=None,             # <<<<<<<<<<<<<<
 *                  attribute_defaults=False, dtd_validation=False,
 *                  load_dtd=False, no_network=True, remove_blank_text=False,
 */

static int __pyx_pf_4lxml_5etree_9iterparse___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_9iterparse___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_source = 0;
  PyObject *__pyx_v_events = 0;
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_attribute_defaults = 0;
  PyObject *__pyx_v_dtd_validation = 0;
  PyObject *__pyx_v_load_dtd = 0;
  PyObject *__pyx_v_no_network = 0;
  PyObject *__pyx_v_remove_blank_text = 0;
  PyObject *__pyx_v_compact = 0;
  PyObject *__pyx_v_resolve_entities = 0;
  PyObject *__pyx_v_remove_comments = 0;
  PyObject *__pyx_v_remove_pis = 0;
  PyObject *__pyx_v_strip_cdata = 0;
  PyObject *__pyx_v_encoding = 0;
  PyObject *__pyx_v_html = 0;
  PyObject *__pyx_v_huge_tree = 0;
  struct __pyx_obj_4lxml_5etree_XMLSchema *__pyx_v_schema = 0;
  struct __pyx_obj_4lxml_5etree__IterparseContext *__pyx_v_context;
  int __pyx_v_parse_options;
  PyObject *__pyx_v_filename;
  int __pyx_v_error;
  PyObject *__pyx_v_event;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__source,&__pyx_n_s__events,&__pyx_n_s__tag,&__pyx_n_s__attribute_defaults,&__pyx_n_s__dtd_validation,&__pyx_n_s__load_dtd,&__pyx_n_s__no_network,&__pyx_n_s__remove_blank_text,&__pyx_n_s__compact,&__pyx_n_s__resolve_entities,&__pyx_n_s__remove_comments,&__pyx_n_s__remove_pis,&__pyx_n_s__strip_cdata,&__pyx_n_s__encoding,&__pyx_n_s__html,&__pyx_n_s__huge_tree,&__pyx_n_s__schema,0};
  __Pyx_RefNannySetupContext("__init__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[17] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
    values[1] = ((PyObject *)__pyx_k_tuple_264);
    values[2] = ((PyObject *)Py_None);
    values[3] = __pyx_k_265;
    values[4] = __pyx_k_266;
    values[5] = __pyx_k_267;
    values[6] = __pyx_k_268;
    values[7] = __pyx_k_269;
    values[8] = __pyx_k_270;
    values[9] = __pyx_k_271;
    values[10] = __pyx_k_272;
    values[11] = __pyx_k_273;
    values[12] = __pyx_k_274;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":368
 *                  load_dtd=False, no_network=True, remove_blank_text=False,
 *                  compact=True, resolve_entities=True, remove_comments=False,
 *                  remove_pis=False, strip_cdata=True, encoding=None,             # <<<<<<<<<<<<<<
 *                  html=False, huge_tree=False, XMLSchema schema=None):
 *         cdef _IterparseContext context
 */
    values[13] = ((PyObject *)Py_None);
    values[14] = __pyx_k_275;
    values[15] = __pyx_k_276;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":369
 *                  compact=True, resolve_entities=True, remove_comments=False,
 *                  remove_pis=False, strip_cdata=True, encoding=None,
 *                  html=False, huge_tree=False, XMLSchema schema=None):             # <<<<<<<<<<<<<<
 *         cdef _IterparseContext context
 *         cdef char* c_encoding
 */
    values[16] = (PyObject *)((struct __pyx_obj_4lxml_5etree_XMLSchema *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__source);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__events);
        if (value) { values[1] = value; kw_args--; }
      }
    }
    while (kw_args > 0) {
      PyObject* value;
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tag);
      if (value) { values[2] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__attribute_defaults);
      if (value) { values[3] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dtd_validation);
      if (value) { values[4] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__load_dtd);
      if (value) { values[5] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__no_network);
      if (value) { values[6] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__remove_blank_text);
      if (value) { values[7] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__compact);
      if (value) { values[8] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__resolve_entities);
      if (value) { values[9] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__remove_comments);
      if (value) { values[10] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__remove_pis);
      if (value) { values[11] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__strip_cdata);
      if (value) { values[12] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__encoding);
      if (value) { values[13] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__html);
      if (value) { values[14] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__huge_tree);
      if (value) { values[15] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__schema);
      if (value) { values[16] = value; if (!(--kw_args)) break; }
      break;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_source = values[0];
    __pyx_v_events = values[1];
    __pyx_v_tag = values[2];
    __pyx_v_attribute_defaults = values[3];
    __pyx_v_dtd_validation = values[4];
    __pyx_v_load_dtd = values[5];
    __pyx_v_no_network = values[6];
    __pyx_v_remove_blank_text = values[7];
    __pyx_v_compact = values[8];
    __pyx_v_resolve_entities = values[9];
    __pyx_v_remove_comments = values[10];
    __pyx_v_remove_pis = values[11];
    __pyx_v_strip_cdata = values[12];
    __pyx_v_encoding = values[13];
    __pyx_v_html = values[14];
    __pyx_v_huge_tree = values[15];
    __pyx_v_schema = ((struct __pyx_obj_4lxml_5etree_XMLSchema *)values[16]);
  } else {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":364
 *                              char* chunk, int size, int terminate) nogil
 * 
 *     def __init__(self, source, events=(u"end",), *, tag=None,             # <<<<<<<<<<<<<<
 *                  attribute_defaults=False, dtd_validation=False,
 *                  load_dtd=False, no_network=True, remove_blank_text=False,
 */
    __pyx_v_events = ((PyObject *)__pyx_k_tuple_277);
    __pyx_v_tag = ((PyObject *)Py_None);
    __pyx_v_attribute_defaults = __pyx_k_265;
    __pyx_v_dtd_validation = __pyx_k_266;
    __pyx_v_load_dtd = __pyx_k_267;
    __pyx_v_no_network = __pyx_k_268;
    __pyx_v_remove_blank_text = __pyx_k_269;
    __pyx_v_compact = __pyx_k_270;
    __pyx_v_resolve_entities = __pyx_k_271;
    __pyx_v_remove_comments = __pyx_k_272;
    __pyx_v_remove_pis = __pyx_k_273;
    __pyx_v_strip_cdata = __pyx_k_274;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":368
 *                  load_dtd=False, no_network=True, remove_blank_text=False,
 *                  compact=True, resolve_entities=True, remove_comments=False,
 *                  remove_pis=False, strip_cdata=True, encoding=None,             # <<<<<<<<<<<<<<
 *                  html=False, huge_tree=False, XMLSchema schema=None):
 *         cdef _IterparseContext context
 */
    __pyx_v_encoding = ((PyObject *)Py_None);
    __pyx_v_html = __pyx_k_275;
    __pyx_v_huge_tree = __pyx_k_276;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":369
 *                  compact=True, resolve_entities=True, remove_comments=False,
 *                  remove_pis=False, strip_cdata=True, encoding=None,
 *                  html=False, huge_tree=False, XMLSchema schema=None):             # <<<<<<<<<<<<<<
 *         cdef _IterparseContext context
 *         cdef char* c_encoding
 */
    __pyx_v_schema = ((struct __pyx_obj_4lxml_5etree_XMLSchema *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_events = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v_source = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[14]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.iterparse.__init__");
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF(__pyx_v_source);
  __Pyx_INCREF(__pyx_v_events);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__IterparseContext *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_filename = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_event = Py_None; __Pyx_INCREF(Py_None);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_schema), __pyx_ptype_4lxml_5etree_XMLSchema, 1, "schema", 0))) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":373
 *         cdef char* c_encoding
 *         cdef int parse_options
 *         if not hasattr(source, u'read'):             # <<<<<<<<<<<<<<
 *             filename = _encodeFilename(source)
 *             if not python.IS_PYTHON3:
 */
  __pyx_t_1 = PyObject_HasAttr(__pyx_v_source, ((PyObject *)__pyx_n_u__read)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = (!__pyx_t_1);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":374
 *         cdef int parse_options
 *         if not hasattr(source, u'read'):
 *             filename = _encodeFilename(source)             # <<<<<<<<<<<<<<
 *             if not python.IS_PYTHON3:
 *                 source = filename
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_source); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_v_filename);
    __pyx_v_filename = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":375
 *         if not hasattr(source, u'read'):
 *             filename = _encodeFilename(source)
 *             if not python.IS_PYTHON3:             # <<<<<<<<<<<<<<
 *                 source = filename
 *             source = open(source, u'rb')
 */
    __pyx_t_2 = (!IS_PYTHON3);
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":376
 *             filename = _encodeFilename(source)
 *             if not python.IS_PYTHON3:
 *                 source = filename             # <<<<<<<<<<<<<<
 *             source = open(source, u'rb')
 *         else:
 */
      __Pyx_INCREF(__pyx_v_filename);
      __Pyx_DECREF(__pyx_v_source);
      __pyx_v_source = __pyx_v_filename;
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":377
 *             if not python.IS_PYTHON3:
 *                 source = filename
 *             source = open(source, u'rb')             # <<<<<<<<<<<<<<
 *         else:
 *             filename = _encodeFilename(_getFilenameForFile(source))
 */
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_INCREF(__pyx_v_source);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_source);
    __Pyx_GIVEREF(__pyx_v_source);
    __Pyx_INCREF(((PyObject *)__pyx_n_u__rb));
    PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_n_u__rb));
    __Pyx_GIVEREF(((PyObject *)__pyx_n_u__rb));
    __pyx_t_4 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_v_source);
    __pyx_v_source = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":379
 *             source = open(source, u'rb')
 *         else:
 *             filename = _encodeFilename(_getFilenameForFile(source))             # <<<<<<<<<<<<<<
 * 
 *         self._source = source
 */
    __pyx_t_4 = __pyx_f_4lxml_5etree__getFilenameForFile(__pyx_v_source); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_v_filename);
    __pyx_v_filename = __pyx_t_3;
    __pyx_t_3 = 0;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":381
 *             filename = _encodeFilename(_getFilenameForFile(source))
 * 
 *         self._source = source             # <<<<<<<<<<<<<<
 *         if html:
 *             # make sure we're not looking for namespaces
 */
  __Pyx_INCREF(__pyx_v_source);
  __Pyx_GIVEREF(__pyx_v_source);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self)->_source);
  __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self)->_source);
  ((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self)->_source = __pyx_v_source;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":382
 * 
 *         self._source = source
 *         if html:             # <<<<<<<<<<<<<<
 *             # make sure we're not looking for namespaces
 *             events = tuple([ event for event in events
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_html); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":384
 *         if html:
 *             # make sure we're not looking for namespaces
 *             events = tuple([ event for event in events             # <<<<<<<<<<<<<<
 *                              if event != u'start-ns' and event != u'end-ns' ])
 * 
 */
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":385
 *             # make sure we're not looking for namespaces
 *             events = tuple([ event for event in events
 *                              if event != u'start-ns' and event != u'end-ns' ])             # <<<<<<<<<<<<<<
 * 
 *         self._events = events
 */
    if (PyList_CheckExact(__pyx_v_events) || PyTuple_CheckExact(__pyx_v_events)) {
      __pyx_t_5 = 0; __pyx_t_4 = __pyx_v_events; __Pyx_INCREF(__pyx_t_4);
    } else {
      __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_events); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
    }
    for (;;) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":384
 *         if html:
 *             # make sure we're not looking for namespaces
 *             events = tuple([ event for event in events             # <<<<<<<<<<<<<<
 *                              if event != u'start-ns' and event != u'end-ns' ])
 * 
 */
      if (likely(PyList_CheckExact(__pyx_t_4))) {
        if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
        __pyx_t_6 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_6); __pyx_t_5++;
      } else if (likely(PyTuple_CheckExact(__pyx_t_4))) {
        if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
        __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_6); __pyx_t_5++;
      } else {
        __pyx_t_6 = PyIter_Next(__pyx_t_4);
        if (!__pyx_t_6) {
          if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          break;
        }
        __Pyx_GOTREF(__pyx_t_6);
      }
      __Pyx_DECREF(__pyx_v_event);
      __pyx_v_event = __pyx_t_6;
      __pyx_t_6 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":385
 *             # make sure we're not looking for namespaces
 *             events = tuple([ event for event in events
 *                              if event != u'start-ns' and event != u'end-ns' ])             # <<<<<<<<<<<<<<
 * 
 *         self._events = events
 */
      __pyx_t_2 = __Pyx_PyUnicode_Equals(__pyx_v_event, ((PyObject *)__pyx_kp_u_260), Py_NE); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (__pyx_t_2) {
        __pyx_t_1 = __Pyx_PyUnicode_Equals(__pyx_v_event, ((PyObject *)__pyx_kp_u_261), Py_NE); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_7 = __pyx_t_1;
      } else {
        __pyx_t_7 = __pyx_t_2;
      }
      if (__pyx_t_7) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":384
 *         if html:
 *             # make sure we're not looking for namespaces
 *             events = tuple([ event for event in events             # <<<<<<<<<<<<<<
 *                              if event != u'start-ns' and event != u'end-ns' ])
 * 
 */
        if (unlikely(PyList_Append(__pyx_t_3, (PyObject*)__pyx_v_event))) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L11;
      }
      __pyx_L11:;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = ((PyObject *)PyList_AsTuple(__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_v_events);
    __pyx_v_events = ((PyObject *)__pyx_t_4);
    __pyx_t_4 = 0;
    goto __pyx_L8;
  }
  __pyx_L8:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":387
 *                              if event != u'start-ns' and event != u'end-ns' ])
 * 
 *         self._events = events             # <<<<<<<<<<<<<<
 *         self._tag = tag
 * 
 */
  __Pyx_INCREF(__pyx_v_events);
  __Pyx_GIVEREF(__pyx_v_events);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self)->_events);
  __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self)->_events);
  ((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self)->_events = __pyx_v_events;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":388
 * 
 *         self._events = events
 *         self._tag = tag             # <<<<<<<<<<<<<<
 * 
 *         parse_options = _XML_DEFAULT_PARSE_OPTIONS
 */
  __Pyx_INCREF(__pyx_v_tag);
  __Pyx_GIVEREF(__pyx_v_tag);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self)->_tag);
  __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self)->_tag);
  ((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self)->_tag = __pyx_v_tag;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":390
 *         self._tag = tag
 * 
 *         parse_options = _XML_DEFAULT_PARSE_OPTIONS             # <<<<<<<<<<<<<<
 *         if load_dtd:
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDLOAD
 */
  __pyx_v_parse_options = __pyx_v_4lxml_5etree__XML_DEFAULT_PARSE_OPTIONS;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":391
 * 
 *         parse_options = _XML_DEFAULT_PARSE_OPTIONS
 *         if load_dtd:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDLOAD
 *         if dtd_validation:
 */
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_load_dtd); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_7) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":392
 *         parse_options = _XML_DEFAULT_PARSE_OPTIONS
 *         if load_dtd:
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDLOAD             # <<<<<<<<<<<<<<
 *         if dtd_validation:
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDVALID | \
 */
    __pyx_v_parse_options = (__pyx_v_parse_options | XML_PARSE_DTDLOAD);
    goto __pyx_L12;
  }
  __pyx_L12:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":393
 *         if load_dtd:
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDLOAD
 *         if dtd_validation:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDVALID | \
 *                             xmlparser.XML_PARSE_DTDLOAD
 */
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_dtd_validation); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_7) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":395
 *         if dtd_validation:
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDVALID | \
 *                             xmlparser.XML_PARSE_DTDLOAD             # <<<<<<<<<<<<<<
 *         if attribute_defaults:
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDATTR | \
 */
    __pyx_v_parse_options = ((__pyx_v_parse_options | XML_PARSE_DTDVALID) | XML_PARSE_DTDLOAD);
    goto __pyx_L13;
  }
  __pyx_L13:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":396
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDVALID | \
 *                             xmlparser.XML_PARSE_DTDLOAD
 *         if attribute_defaults:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDATTR | \
 *                             xmlparser.XML_PARSE_DTDLOAD
 */
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_attribute_defaults); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_7) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":398
 *         if attribute_defaults:
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDATTR | \
 *                             xmlparser.XML_PARSE_DTDLOAD             # <<<<<<<<<<<<<<
 *         if remove_blank_text:
 *             parse_options = parse_options | xmlparser.XML_PARSE_NOBLANKS
 */
    __pyx_v_parse_options = ((__pyx_v_parse_options | XML_PARSE_DTDATTR) | XML_PARSE_DTDLOAD);
    goto __pyx_L14;
  }
  __pyx_L14:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":399
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDATTR | \
 *                             xmlparser.XML_PARSE_DTDLOAD
 *         if remove_blank_text:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options | xmlparser.XML_PARSE_NOBLANKS
 *         if huge_tree:
 */
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_remove_blank_text); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_7) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":400
 *                             xmlparser.XML_PARSE_DTDLOAD
 *         if remove_blank_text:
 *             parse_options = parse_options | xmlparser.XML_PARSE_NOBLANKS             # <<<<<<<<<<<<<<
 *         if huge_tree:
 *             parse_options = parse_options | xmlparser.XML_PARSE_HUGE
 */
    __pyx_v_parse_options = (__pyx_v_parse_options | XML_PARSE_NOBLANKS);
    goto __pyx_L15;
  }
  __pyx_L15:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":401
 *         if remove_blank_text:
 *             parse_options = parse_options | xmlparser.XML_PARSE_NOBLANKS
 *         if huge_tree:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options | xmlparser.XML_PARSE_HUGE
 *         if not no_network:
 */
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_huge_tree); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_7) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":402
 *             parse_options = parse_options | xmlparser.XML_PARSE_NOBLANKS
 *         if huge_tree:
 *             parse_options = parse_options | xmlparser.XML_PARSE_HUGE             # <<<<<<<<<<<<<<
 *         if not no_network:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NONET
 */
    __pyx_v_parse_options = (__pyx_v_parse_options | XML_PARSE_HUGE);
    goto __pyx_L16;
  }
  __pyx_L16:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":403
 *         if huge_tree:
 *             parse_options = parse_options | xmlparser.XML_PARSE_HUGE
 *         if not no_network:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NONET
 *         if not compact:
 */
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_no_network); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = (!__pyx_t_7);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":404
 *             parse_options = parse_options | xmlparser.XML_PARSE_HUGE
 *         if not no_network:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NONET             # <<<<<<<<<<<<<<
 *         if not compact:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_COMPACT
 */
    __pyx_v_parse_options = (__pyx_v_parse_options ^ XML_PARSE_NONET);
    goto __pyx_L17;
  }
  __pyx_L17:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":405
 *         if not no_network:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NONET
 *         if not compact:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_COMPACT
 *         if not resolve_entities:
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_compact); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_7 = (!__pyx_t_2);
  if (__pyx_t_7) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":406
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NONET
 *         if not compact:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_COMPACT             # <<<<<<<<<<<<<<
 *         if not resolve_entities:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NOENT
 */
    __pyx_v_parse_options = (__pyx_v_parse_options ^ XML_PARSE_COMPACT);
    goto __pyx_L18;
  }
  __pyx_L18:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":407
 *         if not compact:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_COMPACT
 *         if not resolve_entities:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NOENT
 *         if not strip_cdata:
 */
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_resolve_entities); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = (!__pyx_t_7);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":408
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_COMPACT
 *         if not resolve_entities:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NOENT             # <<<<<<<<<<<<<<
 *         if not strip_cdata:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NOCDATA
 */
    __pyx_v_parse_options = (__pyx_v_parse_options ^ XML_PARSE_NOENT);
    goto __pyx_L19;
  }
  __pyx_L19:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":409
 *         if not resolve_entities:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NOENT
 *         if not strip_cdata:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NOCDATA
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_strip_cdata); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_7 = (!__pyx_t_2);
  if (__pyx_t_7) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":410
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NOENT
 *         if not strip_cdata:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NOCDATA             # <<<<<<<<<<<<<<
 * 
 *         _BaseParser.__init__(self, parse_options, html, schema,
 */
    __pyx_v_parse_options = (__pyx_v_parse_options ^ XML_PARSE_NOCDATA);
    goto __pyx_L20;
  }
  __pyx_L20:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":412
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NOCDATA
 * 
 *         _BaseParser.__init__(self, parse_options, html, schema,             # <<<<<<<<<<<<<<
 *                              remove_comments, remove_pis, strip_cdata,
 *                              None, filename, encoding)
 */
  __pyx_t_4 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__BaseParser)), __pyx_n_s____init__); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyInt_FromLong(__pyx_v_parse_options); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":414
 *         _BaseParser.__init__(self, parse_options, html, schema,
 *                              remove_comments, remove_pis, strip_cdata,
 *                              None, filename, encoding)             # <<<<<<<<<<<<<<
 * 
 *         if self._for_html:
 */
  __pyx_t_6 = PyTuple_New(10); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_6));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_html);
  PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_html);
  __Pyx_GIVEREF(__pyx_v_html);
  __Pyx_INCREF(((PyObject *)__pyx_v_schema));
  PyTuple_SET_ITEM(__pyx_t_6, 3, ((PyObject *)__pyx_v_schema));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_schema));
  __Pyx_INCREF(__pyx_v_remove_comments);
  PyTuple_SET_ITEM(__pyx_t_6, 4, __pyx_v_remove_comments);
  __Pyx_GIVEREF(__pyx_v_remove_comments);
  __Pyx_INCREF(__pyx_v_remove_pis);
  PyTuple_SET_ITEM(__pyx_t_6, 5, __pyx_v_remove_pis);
  __Pyx_GIVEREF(__pyx_v_remove_pis);
  __Pyx_INCREF(__pyx_v_strip_cdata);
  PyTuple_SET_ITEM(__pyx_t_6, 6, __pyx_v_strip_cdata);
  __Pyx_GIVEREF(__pyx_v_strip_cdata);
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_6, 7, Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_INCREF(__pyx_v_filename);
  PyTuple_SET_ITEM(__pyx_t_6, 8, __pyx_v_filename);
  __Pyx_GIVEREF(__pyx_v_filename);
  __Pyx_INCREF(__pyx_v_encoding);
  PyTuple_SET_ITEM(__pyx_t_6, 9, __pyx_v_encoding);
  __Pyx_GIVEREF(__pyx_v_encoding);
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":416
 *                              None, filename, encoding)
 * 
 *         if self._for_html:             # <<<<<<<<<<<<<<
 *             self._parse_chunk = htmlparser.htmlParseChunk
 *         else:
 */
  if (((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self)->__pyx_base._for_html) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":417
 * 
 *         if self._for_html:
 *             self._parse_chunk = htmlparser.htmlParseChunk             # <<<<<<<<<<<<<<
 *         else:
 *             self._parse_chunk = xmlparser.xmlParseChunk
 */
    ((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self)->_parse_chunk = htmlParseChunk;
    goto __pyx_L21;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":419
 *             self._parse_chunk = htmlparser.htmlParseChunk
 *         else:
 *             self._parse_chunk = xmlparser.xmlParseChunk             # <<<<<<<<<<<<<<
 * 
 *         context = <_IterparseContext>self._getPushParserContext()
 */
    ((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self)->_parse_chunk = xmlParseChunk;
  }
  __pyx_L21:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":421
 *             self._parse_chunk = xmlparser.xmlParseChunk
 * 
 *         context = <_IterparseContext>self._getPushParserContext()             # <<<<<<<<<<<<<<
 *         __GLOBAL_PARSER_CONTEXT.initParserDict(context._c_ctxt)
 * 
 */
  __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree_iterparse *)((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base._getPushParserContext(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__IterparseContext *)__pyx_t_3)));
  __Pyx_DECREF(((PyObject *)__pyx_v_context));
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__IterparseContext *)__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":422
 * 
 *         context = <_IterparseContext>self._getPushParserContext()
 *         __GLOBAL_PARSER_CONTEXT.initParserDict(context._c_ctxt)             # <<<<<<<<<<<<<<
 * 
 *         if self._default_encoding is not None:
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext *)__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT->__pyx_vtab)->initParserDict(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, __pyx_v_context->__pyx_base._c_ctxt);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":424
 *         __GLOBAL_PARSER_CONTEXT.initParserDict(context._c_ctxt)
 * 
 *         if self._default_encoding is not None:             # <<<<<<<<<<<<<<
 *             if self._for_html:
 *                 error = _htmlCtxtResetPush(
 */
  __pyx_t_7 = (((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self)->__pyx_base._default_encoding != Py_None);
  if (__pyx_t_7) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":425
 * 
 *         if self._default_encoding is not None:
 *             if self._for_html:             # <<<<<<<<<<<<<<
 *                 error = _htmlCtxtResetPush(
 *                     context._c_ctxt, NULL, 0,
 */
    if (((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self)->__pyx_base._for_html) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":428
 *                 error = _htmlCtxtResetPush(
 *                     context._c_ctxt, NULL, 0,
 *                     _cstr(self._default_encoding), self._parse_options)             # <<<<<<<<<<<<<<
 *             else:
 *                 xmlparser.xmlCtxtUseOptions(
 */
      __pyx_t_3 = ((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self)->__pyx_base._default_encoding;
      __Pyx_INCREF(__pyx_t_3);
      __pyx_t_8 = __pyx_f_4lxml_5etree__htmlCtxtResetPush(__pyx_v_context->__pyx_base._c_ctxt, NULL, 0, PyBytes_AS_STRING(__pyx_t_3), ((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self)->__pyx_base._parse_options); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_error = __pyx_t_8;
      goto __pyx_L23;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":431
 *             else:
 *                 xmlparser.xmlCtxtUseOptions(
 *                     context._c_ctxt, self._parse_options)             # <<<<<<<<<<<<<<
 *                 error = xmlparser.xmlCtxtResetPush(
 *                     context._c_ctxt, NULL, 0, NULL,
 */
      xmlCtxtUseOptions(__pyx_v_context->__pyx_base._c_ctxt, ((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self)->__pyx_base._parse_options);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":434
 *                 error = xmlparser.xmlCtxtResetPush(
 *                     context._c_ctxt, NULL, 0, NULL,
 *                     _cstr(self._default_encoding))             # <<<<<<<<<<<<<<
 * 
 *         context.prepare()
 */
      __pyx_t_3 = ((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self)->__pyx_base._default_encoding;
      __Pyx_INCREF(__pyx_t_3);
      __pyx_v_error = xmlCtxtResetPush(__pyx_v_context->__pyx_base._c_ctxt, NULL, 0, NULL, PyBytes_AS_STRING(__pyx_t_3));
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __pyx_L23:;
    goto __pyx_L22;
  }
  __pyx_L22:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":436
 *                     _cstr(self._default_encoding))
 * 
 *         context.prepare()             # <<<<<<<<<<<<<<
 *         # parser will not be unlocked - no other methods supported
 * 
 */
  __pyx_t_8 = ((struct __pyx_vtabstruct_4lxml_5etree__IterparseContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.prepare(((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_v_context)); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree.iterparse.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_context);
  __Pyx_DECREF(__pyx_v_filename);
  __Pyx_DECREF(__pyx_v_event);
  __Pyx_DECREF(__pyx_v_source);
  __Pyx_DECREF(__pyx_v_events);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":442
 *         u"""The error log of the last (or current) parser run.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef _ParserContext context
 *             context = self._getPushParserContext()
 */

static PyObject *__pyx_pf_4lxml_5etree_9iterparse_9error_log___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_9iterparse_9error_log___get__(PyObject *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_context;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":444
 *         def __get__(self):
 *             cdef _ParserContext context
 *             context = self._getPushParserContext()             # <<<<<<<<<<<<<<
 *             return context._error_log.copy()
 * 
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree_iterparse *)((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base._getPushParserContext(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_context));
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":445
 *             cdef _ParserContext context
 *             context = self._getPushParserContext()
 *             return context._error_log.copy()             # <<<<<<<<<<<<<<
 * 
 *     cdef _ParserContext _createContext(self, target):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_context->_error_log), __pyx_n_s__copy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.iterparse.error_log.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_context);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":447
 *             return context._error_log.copy()
 * 
 *     cdef _ParserContext _createContext(self, target):             # <<<<<<<<<<<<<<
 *         cdef _IterparseContext context
 *         context = _IterparseContext()
 */

static  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_f_4lxml_5etree_9iterparse__createContext(struct __pyx_obj_4lxml_5etree_iterparse *__pyx_v_self, PyObject *__pyx_v_target) {
  struct __pyx_obj_4lxml_5etree__IterparseContext *__pyx_v_context;
  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("_createContext");
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__IterparseContext *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":449
 *     cdef _ParserContext _createContext(self, target):
 *         cdef _IterparseContext context
 *         context = _IterparseContext()             # <<<<<<<<<<<<<<
 *         context._setEventFilter(self._events, self._tag)
 *         return context
 */
  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__IterparseContext)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_context));
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__IterparseContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":450
 *         cdef _IterparseContext context
 *         context = _IterparseContext()
 *         context._setEventFilter(self._events, self._tag)             # <<<<<<<<<<<<<<
 *         return context
 * 
 */
  __pyx_t_1 = __pyx_v_self->_events;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_v_self->_tag;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree__IterparseContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->_setEventFilter(__pyx_v_context, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":451
 *         context = _IterparseContext()
 *         context._setEventFilter(self._events, self._tag)
 *         return context             # <<<<<<<<<<<<<<
 * 
 *     cdef _close_source(self):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_context));
  __pyx_r = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_v_context);
  goto __pyx_L0;

  __pyx_r = ((struct __pyx_obj_4lxml_5etree__ParserContext *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.iterparse._createContext");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_context);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":453
 *         return context
 * 
 *     cdef _close_source(self):             # <<<<<<<<<<<<<<
 *         if self._source is None:
 *             return
 */

static  PyObject *__pyx_f_4lxml_5etree_9iterparse__close_source(struct __pyx_obj_4lxml_5etree_iterparse *__pyx_v_self) {
  PyObject *__pyx_v_close;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("_close_source");
  __pyx_v_close = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":454
 * 
 *     cdef _close_source(self):
 *         if self._source is None:             # <<<<<<<<<<<<<<
 *             return
 *         try:
 */
  __pyx_t_1 = (__pyx_v_self->_source == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":455
 *     cdef _close_source(self):
 *         if self._source is None:
 *             return             # <<<<<<<<<<<<<<
 *         try:
 *             close = self._source.close
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":456
 *         if self._source is None:
 *             return
 *         try:             # <<<<<<<<<<<<<<
 *             close = self._source.close
 *         except AttributeError:
 */
  /*try:*/ {
    {
      PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
      __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
      __Pyx_XGOTREF(__pyx_save_exc_type);
      __Pyx_XGOTREF(__pyx_save_exc_value);
      __Pyx_XGOTREF(__pyx_save_exc_tb);
      /*try:*/ {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":457
 *             return
 *         try:
 *             close = self._source.close             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             close = None
 */
        __pyx_t_2 = PyObject_GetAttr(__pyx_v_self->_source, __pyx_n_s__close); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_v_close);
        __pyx_v_close = __pyx_t_2;
        __pyx_t_2 = 0;
      }
      __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
      __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
      __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
      goto __pyx_L14_try_end;
      __pyx_L7_error:;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":458
 *         try:
 *             close = self._source.close
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             close = None
 *         finally:
 */
      __pyx_t_3 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
      if (__pyx_t_3) {
        __Pyx_AddTraceback("lxml.etree.iterparse._close_source");
        if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_4, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GOTREF(__pyx_t_5);

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":459
 *             close = self._source.close
 *         except AttributeError:
 *             close = None             # <<<<<<<<<<<<<<
 *         finally:
 *             self._source = None
 */
        __Pyx_INCREF(Py_None);
        __Pyx_DECREF(__pyx_v_close);
        __pyx_v_close = Py_None;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        goto __pyx_L8_exception_handled;
      }
      __pyx_L9_except_error:;
      __Pyx_XGIVEREF(__pyx_save_exc_type);
      __Pyx_XGIVEREF(__pyx_save_exc_value);
      __Pyx_XGIVEREF(__pyx_save_exc_tb);
      __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
      goto __pyx_L5;
      __pyx_L8_exception_handled:;
      __Pyx_XGIVEREF(__pyx_save_exc_type);
      __Pyx_XGIVEREF(__pyx_save_exc_value);
      __Pyx_XGIVEREF(__pyx_save_exc_tb);
      __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
      __pyx_L14_try_end:;
    }
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":461
 *             close = None
 *         finally:
 *             self._source = None             # <<<<<<<<<<<<<<
 *         if close is not None:
 *             close()
 */
  /*finally:*/ {
    int __pyx_why;
    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
    int __pyx_exc_lineno;
    __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 0; goto __pyx_L6;
    __pyx_L5: {
      __pyx_why = 4;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
      __pyx_exc_lineno = __pyx_lineno;
      goto __pyx_L6;
    }
    __pyx_L6:;
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_self->_source);
    __Pyx_DECREF(__pyx_v_self->_source);
    __pyx_v_self->_source = Py_None;
    switch (__pyx_why) {
      case 4: {
        __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
        __pyx_lineno = __pyx_exc_lineno;
        __pyx_exc_type = 0;
        __pyx_exc_value = 0;
        __pyx_exc_tb = 0;
        goto __pyx_L1_error;
      }
    }
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":462
 *         finally:
 *             self._source = None
 *         if close is not None:             # <<<<<<<<<<<<<<
 *             close()
 * 
 */
  __pyx_t_1 = (__pyx_v_close != Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":463
 *             self._source = None
 *         if close is not None:
 *             close()             # <<<<<<<<<<<<<<
 * 
 *     def copy(self):
 */
    __pyx_t_5 = PyObject_Call(__pyx_v_close, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L18;
  }
  __pyx_L18:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.iterparse._close_source");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_close);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":465
 *             close()
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         raise TypeError, u"iterparse parsers cannot be copied"
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_9iterparse_1copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_9iterparse_1copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("copy");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":466
 * 
 *     def copy(self):
 *         raise TypeError, u"iterparse parsers cannot be copied"             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_u_278), 0);
  {__pyx_filename = __pyx_f[14]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.iterparse.copy");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":468
 *         raise TypeError, u"iterparse parsers cannot be copied"
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_9iterparse_2__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_9iterparse_2__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("__iter__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":469
 * 
 *     def __iter__(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __next__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self);
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":471
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         cdef _IterparseContext context
 *         if self._source is None:
 */

static PyObject *__pyx_pf_4lxml_5etree_9iterparse_3__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_9iterparse_3__next__(PyObject *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree__IterparseContext *__pyx_v_context;
  PyObject *__pyx_v_item;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__next__");
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__IterparseContext *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_item = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":473
 *     def __next__(self):
 *         cdef _IterparseContext context
 *         if self._source is None:             # <<<<<<<<<<<<<<
 *             raise StopIteration
 * 
 */
  __pyx_t_1 = (((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self)->_source == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":474
 *         cdef _IterparseContext context
 *         if self._source is None:
 *             raise StopIteration             # <<<<<<<<<<<<<<
 * 
 *         context = <_IterparseContext>self._push_parser_context
 */
    __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0);
    {__pyx_filename = __pyx_f[14]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":476
 *             raise StopIteration
 * 
 *         context = <_IterparseContext>self._push_parser_context             # <<<<<<<<<<<<<<
 *         if python.PyList_GET_SIZE(context._events) <= context._event_index:
 *             self._read_more_events(context)
 */
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__IterparseContext *)((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self)->__pyx_base._push_parser_context)));
  __Pyx_DECREF(((PyObject *)__pyx_v_context));
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__IterparseContext *)((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self)->__pyx_base._push_parser_context);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":477
 * 
 *         context = <_IterparseContext>self._push_parser_context
 *         if python.PyList_GET_SIZE(context._events) <= context._event_index:             # <<<<<<<<<<<<<<
 *             self._read_more_events(context)
 *         item = python.PyList_GET_ITEM(context._events, context._event_index)
 */
  __pyx_t_2 = ((PyObject *)__pyx_v_context->_events);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_1 = (PyList_GET_SIZE(__pyx_t_2) <= __pyx_v_context->_event_index);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":478
 *         context = <_IterparseContext>self._push_parser_context
 *         if python.PyList_GET_SIZE(context._events) <= context._event_index:
 *             self._read_more_events(context)             # <<<<<<<<<<<<<<
 *         item = python.PyList_GET_ITEM(context._events, context._event_index)
 *         python.Py_INCREF(item) # 'borrowed reference' from PyList_GET_ITEM
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree_iterparse *)((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self)->__pyx_base.__pyx_vtab)->_read_more_events(((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self), __pyx_v_context); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":479
 *         if python.PyList_GET_SIZE(context._events) <= context._event_index:
 *             self._read_more_events(context)
 *         item = python.PyList_GET_ITEM(context._events, context._event_index)             # <<<<<<<<<<<<<<
 *         python.Py_INCREF(item) # 'borrowed reference' from PyList_GET_ITEM
 *         context._event_index += 1
 */
  __pyx_t_2 = ((PyObject *)__pyx_v_context->_events);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_v_context->_event_index); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_v_item);
  __pyx_v_item = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":480
 *             self._read_more_events(context)
 *         item = python.PyList_GET_ITEM(context._events, context._event_index)
 *         python.Py_INCREF(item) # 'borrowed reference' from PyList_GET_ITEM             # <<<<<<<<<<<<<<
 *         context._event_index += 1
 *         return item
 */
  Py_INCREF(__pyx_v_item);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":481
 *         item = python.PyList_GET_ITEM(context._events, context._event_index)
 *         python.Py_INCREF(item) # 'borrowed reference' from PyList_GET_ITEM
 *         context._event_index += 1             # <<<<<<<<<<<<<<
 *         return item
 * 
 */
  __pyx_v_context->_event_index = (__pyx_v_context->_event_index + 1);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":482
 *         python.Py_INCREF(item) # 'borrowed reference' from PyList_GET_ITEM
 *         context._event_index += 1
 *         return item             # <<<<<<<<<<<<<<
 * 
 *     cdef _read_more_events(self, _IterparseContext context):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_item);
  __pyx_r = __pyx_v_item;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.iterparse.__next__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_context);
  __Pyx_DECREF(__pyx_v_item);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":484
 *         return item
 * 
 *     cdef _read_more_events(self, _IterparseContext context):             # <<<<<<<<<<<<<<
 *         cdef cstd.FILE* c_stream
 *         cdef char* c_data
 */

static  PyObject *__pyx_f_4lxml_5etree_9iterparse__read_more_events(struct __pyx_obj_4lxml_5etree_iterparse *__pyx_v_self, struct __pyx_obj_4lxml_5etree__IterparseContext *__pyx_v_context) {
  FILE *__pyx_v_c_stream;
  char *__pyx_v_c_data;
  Py_ssize_t __pyx_v_c_data_len;
  xmlParserCtxt *__pyx_v_pctxt;
  int __pyx_v_error;
  int __pyx_v_done;
  PyObject *__pyx_v_data;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("_read_more_events");
  __pyx_v_data = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":488
 *         cdef char* c_data
 *         cdef Py_ssize_t c_data_len
 *         cdef xmlparser.xmlParserCtxt* pctxt = context._c_ctxt             # <<<<<<<<<<<<<<
 *         cdef int error = 0, done = 0
 * 
 */
  __pyx_v_pctxt = __pyx_v_context->__pyx_base._c_ctxt;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":489
 *         cdef Py_ssize_t c_data_len
 *         cdef xmlparser.xmlParserCtxt* pctxt = context._c_ctxt
 *         cdef int error = 0, done = 0             # <<<<<<<<<<<<<<
 * 
 *         del context._events[:]
 */
  __pyx_v_error = 0;
  __pyx_v_done = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":491
 *         cdef int error = 0, done = 0
 * 
 *         del context._events[:]             # <<<<<<<<<<<<<<
 *         context._event_index = 0
 *         c_stream = python.PyFile_AsFile(self._source)
 */
  if (__Pyx_PySequence_DelSlice(((PyObject *)__pyx_v_context->_events), 0, PY_SSIZE_T_MAX) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":492
 * 
 *         del context._events[:]
 *         context._event_index = 0             # <<<<<<<<<<<<<<
 *         c_stream = python.PyFile_AsFile(self._source)
 *         while python.PyList_GET_SIZE(context._events) == 0:
 */
  __pyx_v_context->_event_index = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":493
 *         del context._events[:]
 *         context._event_index = 0
 *         c_stream = python.PyFile_AsFile(self._source)             # <<<<<<<<<<<<<<
 *         while python.PyList_GET_SIZE(context._events) == 0:
 *             if c_stream is NULL:
 */
  __pyx_t_1 = __pyx_v_self->_source;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_c_stream = PyFile_AsFile(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":494
 *         context._event_index = 0
 *         c_stream = python.PyFile_AsFile(self._source)
 *         while python.PyList_GET_SIZE(context._events) == 0:             # <<<<<<<<<<<<<<
 *             if c_stream is NULL:
 *                 data = self._source.read(__ITERPARSE_CHUNK_SIZE)
 */
  while (1) {
    __pyx_t_1 = ((PyObject *)__pyx_v_context->_events);
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_2 = (PyList_GET_SIZE(__pyx_t_1) == 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (!__pyx_t_2) break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":495
 *         c_stream = python.PyFile_AsFile(self._source)
 *         while python.PyList_GET_SIZE(context._events) == 0:
 *             if c_stream is NULL:             # <<<<<<<<<<<<<<
 *                 data = self._source.read(__ITERPARSE_CHUNK_SIZE)
 *                 if not python.PyBytes_Check(data):
 */
    __pyx_t_2 = (__pyx_v_c_stream == NULL);
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":496
 *         while python.PyList_GET_SIZE(context._events) == 0:
 *             if c_stream is NULL:
 *                 data = self._source.read(__ITERPARSE_CHUNK_SIZE)             # <<<<<<<<<<<<<<
 *                 if not python.PyBytes_Check(data):
 *                     self._close_source()
 */
      __pyx_t_1 = PyObject_GetAttr(__pyx_v_self->_source, __pyx_n_s__read); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_279), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_v_data);
      __pyx_v_data = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":497
 *             if c_stream is NULL:
 *                 data = self._source.read(__ITERPARSE_CHUNK_SIZE)
 *                 if not python.PyBytes_Check(data):             # <<<<<<<<<<<<<<
 *                     self._close_source()
 *                     raise TypeError, u"reading file objects must return plain strings"
 */
      __pyx_t_2 = (!PyBytes_Check(__pyx_v_data));
      if (__pyx_t_2) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":498
 *                 data = self._source.read(__ITERPARSE_CHUNK_SIZE)
 *                 if not python.PyBytes_Check(data):
 *                     self._close_source()             # <<<<<<<<<<<<<<
 *                     raise TypeError, u"reading file objects must return plain strings"
 *                 c_data_len = python.PyBytes_GET_SIZE(data)
 */
        __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree_iterparse *)__pyx_v_self->__pyx_base.__pyx_vtab)->_close_source(__pyx_v_self); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":499
 *                 if not python.PyBytes_Check(data):
 *                     self._close_source()
 *                     raise TypeError, u"reading file objects must return plain strings"             # <<<<<<<<<<<<<<
 *                 c_data_len = python.PyBytes_GET_SIZE(data)
 *                 c_data = _cstr(data)
 */
        __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_u_280), 0);
        {__pyx_filename = __pyx_f[14]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L6;
      }
      __pyx_L6:;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":500
 *                     self._close_source()
 *                     raise TypeError, u"reading file objects must return plain strings"
 *                 c_data_len = python.PyBytes_GET_SIZE(data)             # <<<<<<<<<<<<<<
 *                 c_data = _cstr(data)
 *                 done = (c_data_len == 0)
 */
      __pyx_v_c_data_len = PyBytes_GET_SIZE(__pyx_v_data);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":501
 *                     raise TypeError, u"reading file objects must return plain strings"
 *                 c_data_len = python.PyBytes_GET_SIZE(data)
 *                 c_data = _cstr(data)             # <<<<<<<<<<<<<<
 *                 done = (c_data_len == 0)
 *                 error = self._parse_chunk(pctxt, c_data, c_data_len, done)
 */
      __pyx_v_c_data = PyBytes_AS_STRING(__pyx_v_data);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":502
 *                 c_data_len = python.PyBytes_GET_SIZE(data)
 *                 c_data = _cstr(data)
 *                 done = (c_data_len == 0)             # <<<<<<<<<<<<<<
 *                 error = self._parse_chunk(pctxt, c_data, c_data_len, done)
 *             else:
 */
      __pyx_v_done = (__pyx_v_c_data_len == 0);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":503
 *                 c_data = _cstr(data)
 *                 done = (c_data_len == 0)
 *                 error = self._parse_chunk(pctxt, c_data, c_data_len, done)             # <<<<<<<<<<<<<<
 *             else:
 *                 if self._buffer is None:
 */
      __pyx_v_error = __pyx_v_self->_parse_chunk(__pyx_v_pctxt, __pyx_v_c_data, __pyx_v_c_data_len, __pyx_v_done);
      goto __pyx_L5;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":505
 *                 error = self._parse_chunk(pctxt, c_data, c_data_len, done)
 *             else:
 *                 if self._buffer is None:             # <<<<<<<<<<<<<<
 *                     self._buffer = python.PyBytes_FromStringAndSize(
 *                         NULL, __ITERPARSE_CHUNK_SIZE)
 */
      __pyx_t_2 = (__pyx_v_self->_buffer == Py_None);
      if (__pyx_t_2) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":507
 *                 if self._buffer is None:
 *                     self._buffer = python.PyBytes_FromStringAndSize(
 *                         NULL, __ITERPARSE_CHUNK_SIZE)             # <<<<<<<<<<<<<<
 *                 c_data = _cstr(self._buffer)
 *                 with nogil:
 */
        __pyx_t_3 = ((PyObject *)PyBytes_FromStringAndSize(NULL, 32768)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":506
 *             else:
 *                 if self._buffer is None:
 *                     self._buffer = python.PyBytes_FromStringAndSize(             # <<<<<<<<<<<<<<
 *                         NULL, __ITERPARSE_CHUNK_SIZE)
 *                 c_data = _cstr(self._buffer)
 */
        __Pyx_GIVEREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_v_self->_buffer);
        __Pyx_DECREF(__pyx_v_self->_buffer);
        __pyx_v_self->_buffer = __pyx_t_3;
        __pyx_t_3 = 0;
        goto __pyx_L7;
      }
      __pyx_L7:;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":508
 *                     self._buffer = python.PyBytes_FromStringAndSize(
 *                         NULL, __ITERPARSE_CHUNK_SIZE)
 *                 c_data = _cstr(self._buffer)             # <<<<<<<<<<<<<<
 *                 with nogil:
 *                     c_data_len = cstd.fread(
 */
      __pyx_t_3 = __pyx_v_self->_buffer;
      __Pyx_INCREF(__pyx_t_3);
      __pyx_v_c_data = PyBytes_AS_STRING(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":509
 *                         NULL, __ITERPARSE_CHUNK_SIZE)
 *                 c_data = _cstr(self._buffer)
 *                 with nogil:             # <<<<<<<<<<<<<<
 *                     c_data_len = cstd.fread(
 *                         c_data, 1, __ITERPARSE_CHUNK_SIZE, c_stream)
 */
      {
        #ifdef WITH_THREAD
        PyThreadState *_save;
        #endif
        Py_UNBLOCK_THREADS
        /*try:*/ {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":511
 *                 with nogil:
 *                     c_data_len = cstd.fread(
 *                         c_data, 1, __ITERPARSE_CHUNK_SIZE, c_stream)             # <<<<<<<<<<<<<<
 *                     if c_data_len < __ITERPARSE_CHUNK_SIZE:
 *                         if cstd.ferror(c_stream):
 */
          __pyx_v_c_data_len = fread(__pyx_v_c_data, 1, 32768, __pyx_v_c_stream);

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":512
 *                     c_data_len = cstd.fread(
 *                         c_data, 1, __ITERPARSE_CHUNK_SIZE, c_stream)
 *                     if c_data_len < __ITERPARSE_CHUNK_SIZE:             # <<<<<<<<<<<<<<
 *                         if cstd.ferror(c_stream):
 *                             error = 1
 */
          __pyx_t_2 = (__pyx_v_c_data_len < 32768);
          if (__pyx_t_2) {

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":513
 *                         c_data, 1, __ITERPARSE_CHUNK_SIZE, c_stream)
 *                     if c_data_len < __ITERPARSE_CHUNK_SIZE:
 *                         if cstd.ferror(c_stream):             # <<<<<<<<<<<<<<
 *                             error = 1
 *                         elif cstd.feof(c_stream):
 */
            __pyx_t_4 = ferror(__pyx_v_c_stream);
            if (__pyx_t_4) {

              /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":514
 *                     if c_data_len < __ITERPARSE_CHUNK_SIZE:
 *                         if cstd.ferror(c_stream):
 *                             error = 1             # <<<<<<<<<<<<<<
 *                         elif cstd.feof(c_stream):
 *                             done = 1
 */
              __pyx_v_error = 1;
              goto __pyx_L14;
            }

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":515
 *                         if cstd.ferror(c_stream):
 *                             error = 1
 *                         elif cstd.feof(c_stream):             # <<<<<<<<<<<<<<
 *                             done = 1
 *                 if not error:
 */
            __pyx_t_4 = feof(__pyx_v_c_stream);
            if (__pyx_t_4) {

              /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":516
 *                             error = 1
 *                         elif cstd.feof(c_stream):
 *                             done = 1             # <<<<<<<<<<<<<<
 *                 if not error:
 *                     error = self._parse_chunk(
 */
              __pyx_v_done = 1;
              goto __pyx_L14;
            }
            __pyx_L14:;
            goto __pyx_L13;
          }
          __pyx_L13:;
        }

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":509
 *                         NULL, __ITERPARSE_CHUNK_SIZE)
 *                 c_data = _cstr(self._buffer)
 *                 with nogil:             # <<<<<<<<<<<<<<
 *                     c_data_len = cstd.fread(
 *                         c_data, 1, __ITERPARSE_CHUNK_SIZE, c_stream)
 */
        /*finally:*/ {
          Py_BLOCK_THREADS
        }
      }

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":517
 *                         elif cstd.feof(c_stream):
 *                             done = 1
 *                 if not error:             # <<<<<<<<<<<<<<
 *                     error = self._parse_chunk(
 *                         pctxt, c_data, c_data_len, done)
 */
      __pyx_t_2 = (!__pyx_v_error);
      if (__pyx_t_2) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":519
 *                 if not error:
 *                     error = self._parse_chunk(
 *                         pctxt, c_data, c_data_len, done)             # <<<<<<<<<<<<<<
 *             if error or done:
 *                 self._buffer = None
 */
        __pyx_v_error = __pyx_v_self->_parse_chunk(__pyx_v_pctxt, __pyx_v_c_data, __pyx_v_c_data_len, __pyx_v_done);
        goto __pyx_L15;
      }
      __pyx_L15:;
    }
    __pyx_L5:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":520
 *                     error = self._parse_chunk(
 *                         pctxt, c_data, c_data_len, done)
 *             if error or done:             # <<<<<<<<<<<<<<
 *                 self._buffer = None
 *                 break
 */
    if (!__pyx_v_error) {
      __pyx_t_2 = __pyx_v_done;
    } else {
      __pyx_t_2 = __pyx_v_error;
    }
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":521
 *                         pctxt, c_data, c_data_len, done)
 *             if error or done:
 *                 self._buffer = None             # <<<<<<<<<<<<<<
 *                 break
 * 
 */
      __Pyx_INCREF(Py_None);
      __Pyx_GIVEREF(Py_None);
      __Pyx_GOTREF(__pyx_v_self->_buffer);
      __Pyx_DECREF(__pyx_v_self->_buffer);
      __pyx_v_self->_buffer = Py_None;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":522
 *             if error or done:
 *                 self._buffer = None
 *                 break             # <<<<<<<<<<<<<<
 * 
 *         if not error and context._validator is not None:
 */
      goto __pyx_L4_break;
      goto __pyx_L16;
    }
    __pyx_L16:;
  }
  __pyx_L4_break:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":524
 *                 break
 * 
 *         if not error and context._validator is not None:             # <<<<<<<<<<<<<<
 *             error = not context._validator.isvalid()
 *         if error:
 */
  __pyx_t_2 = (!__pyx_v_error);
  if (__pyx_t_2) {
    __pyx_t_5 = (((PyObject *)__pyx_v_context->__pyx_base._validator) != Py_None);
    __pyx_t_6 = __pyx_t_5;
  } else {
    __pyx_t_6 = __pyx_t_2;
  }
  if (__pyx_t_6) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":525
 * 
 *         if not error and context._validator is not None:
 *             error = not context._validator.isvalid()             # <<<<<<<<<<<<<<
 *         if error:
 *             self._close_source()
 */
    __pyx_v_error = (!((struct __pyx_vtabstruct_4lxml_5etree__ParserSchemaValidationContext *)__pyx_v_context->__pyx_base._validator->__pyx_vtab)->isvalid(__pyx_v_context->__pyx_base._validator));
    goto __pyx_L17;
  }
  __pyx_L17:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":526
 *         if not error and context._validator is not None:
 *             error = not context._validator.isvalid()
 *         if error:             # <<<<<<<<<<<<<<
 *             self._close_source()
 *             del context._events[:]
 */
  if (__pyx_v_error) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":527
 *             error = not context._validator.isvalid()
 *         if error:
 *             self._close_source()             # <<<<<<<<<<<<<<
 *             del context._events[:]
 *             context._assureDocGetsFreed()
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree_iterparse *)__pyx_v_self->__pyx_base.__pyx_vtab)->_close_source(__pyx_v_self); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":528
 *         if error:
 *             self._close_source()
 *             del context._events[:]             # <<<<<<<<<<<<<<
 *             context._assureDocGetsFreed()
 *             _raiseParseError(pctxt, self._filename, context._error_log)
 */
    if (__Pyx_PySequence_DelSlice(((PyObject *)__pyx_v_context->_events), 0, PY_SSIZE_T_MAX) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":529
 *             self._close_source()
 *             del context._events[:]
 *             context._assureDocGetsFreed()             # <<<<<<<<<<<<<<
 *             _raiseParseError(pctxt, self._filename, context._error_log)
 *         if python.PyList_GET_SIZE(context._events) == 0:
 */
    ((struct __pyx_vtabstruct_4lxml_5etree__IterparseContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->_assureDocGetsFreed(__pyx_v_context);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":530
 *             del context._events[:]
 *             context._assureDocGetsFreed()
 *             _raiseParseError(pctxt, self._filename, context._error_log)             # <<<<<<<<<<<<<<
 *         if python.PyList_GET_SIZE(context._events) == 0:
 *             self.root = context._root
 */
    __pyx_t_3 = __pyx_v_self->__pyx_base._filename;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_1 = ((PyObject *)__pyx_v_context->__pyx_base._error_log);
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_4 = __pyx_f_4lxml_5etree__raiseParseError(__pyx_v_pctxt, __pyx_t_3, ((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_t_1)); if (unlikely(__pyx_t_4 == 0)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L18;
  }
  __pyx_L18:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":531
 *             context._assureDocGetsFreed()
 *             _raiseParseError(pctxt, self._filename, context._error_log)
 *         if python.PyList_GET_SIZE(context._events) == 0:             # <<<<<<<<<<<<<<
 *             self.root = context._root
 *             self._close_source()
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_context->_events);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_6 = (PyList_GET_SIZE(__pyx_t_1) == 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_6) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":532
 *             _raiseParseError(pctxt, self._filename, context._error_log)
 *         if python.PyList_GET_SIZE(context._events) == 0:
 *             self.root = context._root             # <<<<<<<<<<<<<<
 *             self._close_source()
 *             raise StopIteration
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_context->_root));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_context->_root));
    __Pyx_GOTREF(__pyx_v_self->root);
    __Pyx_DECREF(__pyx_v_self->root);
    __pyx_v_self->root = ((PyObject *)__pyx_v_context->_root);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":533
 *         if python.PyList_GET_SIZE(context._events) == 0:
 *             self.root = context._root
 *             self._close_source()             # <<<<<<<<<<<<<<
 *             raise StopIteration
 * 
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree_iterparse *)__pyx_v_self->__pyx_base.__pyx_vtab)->_close_source(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":534
 *             self.root = context._root
 *             self._close_source()
 *             raise StopIteration             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0);
    {__pyx_filename = __pyx_f[14]; __pyx_lineno = 534; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L19;
  }
  __pyx_L19:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.iterparse._read_more_events");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_data);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":358
 *     cdef object _tag
 *     cdef object _events
 *     cdef readonly object root             # <<<<<<<<<<<<<<
 *     cdef object _source
 *     cdef object _buffer
 */

static PyObject *__pyx_pf_4lxml_5etree_9iterparse_4root___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_9iterparse_4root___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self)->root);
  __pyx_r = ((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self)->root;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":553
 *     cdef char*  _tag_name
 * 
 *     def __init__(self, element_or_tree, events=(u"end",), tag=None):             # <<<<<<<<<<<<<<
 *         cdef _Element root
 *         cdef int ns_count
 */

static int __pyx_pf_4lxml_5etree_8iterwalk___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_8iterwalk___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_element_or_tree = 0;
  PyObject *__pyx_v_events = 0;
  PyObject *__pyx_v_tag = 0;
  struct LxmlElement *__pyx_v_root;
  int __pyx_v_ns_count;
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__element_or_tree,&__pyx_n_s__events,&__pyx_n_s__tag,0};
  __Pyx_RefNannySetupContext("__init__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)__pyx_k_tuple_281);
    values[2] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__element_or_tree);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__events);
        if (value) { values[1] = value; kw_args--; }
      }
      case  2:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tag);
        if (value) { values[2] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_element_or_tree = values[0];
    __pyx_v_events = values[1];
    __pyx_v_tag = values[2];
  } else {
    __pyx_v_events = ((PyObject *)__pyx_k_tuple_282);
    __pyx_v_tag = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: __pyx_v_tag = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: __pyx_v_events = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v_element_or_tree = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[14]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.iterwalk.__init__");
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_root = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":556
 *         cdef _Element root
 *         cdef int ns_count
 *         root = _rootNodeOrRaise(element_or_tree)             # <<<<<<<<<<<<<<
 *         self._event_filter = _buildIterparseEventFilter(events)
 *         self._setTagFilter(tag)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v_element_or_tree)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_root));
  __pyx_v_root = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":557
 *         cdef int ns_count
 *         root = _rootNodeOrRaise(element_or_tree)
 *         self._event_filter = _buildIterparseEventFilter(events)             # <<<<<<<<<<<<<<
 *         self._setTagFilter(tag)
 *         self._node_stack  = []
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__buildIterparseEventFilter(__pyx_v_events); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self)->_event_filter = __pyx_t_2;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":558
 *         root = _rootNodeOrRaise(element_or_tree)
 *         self._event_filter = _buildIterparseEventFilter(events)
 *         self._setTagFilter(tag)             # <<<<<<<<<<<<<<
 *         self._node_stack  = []
 *         self._pop_node = self._node_stack.pop
 */
  ((struct __pyx_vtabstruct_4lxml_5etree_iterwalk *)((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self)->__pyx_vtab)->_setTagFilter(((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self), __pyx_v_tag);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":559
 *         self._event_filter = _buildIterparseEventFilter(events)
 *         self._setTagFilter(tag)
 *         self._node_stack  = []             # <<<<<<<<<<<<<<
 *         self._pop_node = self._node_stack.pop
 *         self._events = []
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self)->_node_stack);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self)->_node_stack));
  ((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self)->_node_stack = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":560
 *         self._setTagFilter(tag)
 *         self._node_stack  = []
 *         self._pop_node = self._node_stack.pop             # <<<<<<<<<<<<<<
 *         self._events = []
 *         self._pop_event = self._events.pop
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self)->_node_stack), __pyx_n_s__pop); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self)->_pop_node);
  __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self)->_pop_node);
  ((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self)->_pop_node = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":561
 *         self._node_stack  = []
 *         self._pop_node = self._node_stack.pop
 *         self._events = []             # <<<<<<<<<<<<<<
 *         self._pop_event = self._events.pop
 * 
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self)->_events);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self)->_events));
  ((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self)->_events = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":562
 *         self._pop_node = self._node_stack.pop
 *         self._events = []
 *         self._pop_event = self._events.pop             # <<<<<<<<<<<<<<
 * 
 *         if self._event_filter != 0:
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self)->_events), __pyx_n_s__pop); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self)->_pop_event);
  __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self)->_pop_event);
  ((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self)->_pop_event = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":564
 *         self._pop_event = self._events.pop
 * 
 *         if self._event_filter != 0:             # <<<<<<<<<<<<<<
 *             self._index = 0
 *             ns_count = self._start_node(root)
 */
  __pyx_t_3 = (((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self)->_event_filter != 0);
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":565
 * 
 *         if self._event_filter != 0:
 *             self._index = 0             # <<<<<<<<<<<<<<
 *             ns_count = self._start_node(root)
 *             self._node_stack.append( (root, ns_count) )
 */
    ((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self)->_index = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":566
 *         if self._event_filter != 0:
 *             self._index = 0
 *             ns_count = self._start_node(root)             # <<<<<<<<<<<<<<
 *             self._node_stack.append( (root, ns_count) )
 *         else:
 */
    __pyx_v_ns_count = ((struct __pyx_vtabstruct_4lxml_5etree_iterwalk *)((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self)->__pyx_vtab)->_start_node(((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self), __pyx_v_root);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":567
 *             self._index = 0
 *             ns_count = self._start_node(root)
 *             self._node_stack.append( (root, ns_count) )             # <<<<<<<<<<<<<<
 *         else:
 *             self._index = -1
 */
    if (unlikely(((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self)->_node_stack == Py_None)) {
      PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[14]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_1 = PyInt_FromLong(__pyx_v_ns_count); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_INCREF(((PyObject *)__pyx_v_root));
    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_root));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_root));
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_2 = PyList_Append(((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self)->_node_stack, ((PyObject *)__pyx_t_4)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":569
 *             self._node_stack.append( (root, ns_count) )
 *         else:
 *             self._index = -1             # <<<<<<<<<<<<<<
 * 
 *     cdef void _setTagFilter(self, tag):
 */
    ((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self)->_index = -1;
  }
  __pyx_L6:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.iterwalk.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_root);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":571
 *             self._index = -1
 * 
 *     cdef void _setTagFilter(self, tag):             # <<<<<<<<<<<<<<
 *         if tag is None or tag == u'*':
 *             self._tag_href  = NULL
 */

static  void __pyx_f_4lxml_5etree_8iterwalk__setTagFilter(struct __pyx_obj_4lxml_5etree_iterwalk *__pyx_v_self, PyObject *__pyx_v_tag) {
  PyObject *__pyx_v_href;
  PyObject *__pyx_v_name;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("_setTagFilter");
  __pyx_v_href = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_name = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":572
 * 
 *     cdef void _setTagFilter(self, tag):
 *         if tag is None or tag == u'*':             # <<<<<<<<<<<<<<
 *             self._tag_href  = NULL
 *             self._tag_name  = NULL
 */
  __pyx_t_1 = (__pyx_v_tag == Py_None);
  if (!__pyx_t_1) {
    __pyx_t_2 = __Pyx_PyUnicode_Equals(__pyx_v_tag, ((PyObject *)__pyx_kp_u_132), Py_EQ); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":573
 *     cdef void _setTagFilter(self, tag):
 *         if tag is None or tag == u'*':
 *             self._tag_href  = NULL             # <<<<<<<<<<<<<<
 *             self._tag_name  = NULL
 *         else:
 */
    __pyx_v_self->_tag_href = NULL;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":574
 *         if tag is None or tag == u'*':
 *             self._tag_href  = NULL
 *             self._tag_name  = NULL             # <<<<<<<<<<<<<<
 *         else:
 *             self._tag_tuple = _getNsTag(tag)
 */
    __pyx_v_self->_tag_name = NULL;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":576
 *             self._tag_name  = NULL
 *         else:
 *             self._tag_tuple = _getNsTag(tag)             # <<<<<<<<<<<<<<
 *             href, name = self._tag_tuple
 *             if href is None or href == b'*':
 */
    __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__getNsTag(__pyx_v_tag)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __Pyx_GOTREF(__pyx_v_self->_tag_tuple);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->_tag_tuple));
    __pyx_v_self->_tag_tuple = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":577
 *         else:
 *             self._tag_tuple = _getNsTag(tag)
 *             href, name = self._tag_tuple             # <<<<<<<<<<<<<<
 *             if href is None or href == b'*':
 *                 self._tag_href = NULL
 */
    if (likely(((PyObject *)__pyx_v_self->_tag_tuple) != Py_None) && likely(PyTuple_GET_SIZE(((PyObject *)__pyx_v_self->_tag_tuple)) == 2)) {
      PyObject* tuple = ((PyObject *)__pyx_v_self->_tag_tuple);
      __pyx_t_4 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_4);
      __pyx_t_5 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_v_href);
      __pyx_v_href = __pyx_t_4;
      __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_v_name);
      __pyx_v_name = __pyx_t_5;
      __pyx_t_5 = 0;
    } else {
      __Pyx_UnpackTupleError(((PyObject *)__pyx_v_self->_tag_tuple), 2);
      {__pyx_filename = __pyx_f[14]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":578
 *             self._tag_tuple = _getNsTag(tag)
 *             href, name = self._tag_tuple
 *             if href is None or href == b'*':             # <<<<<<<<<<<<<<
 *                 self._tag_href = NULL
 *             else:
 */
    __pyx_t_3 = (__pyx_v_href == Py_None);
    if (!__pyx_t_3) {
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_href, ((PyObject *)__pyx_kp_b_132), Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_2 = __pyx_t_1;
    } else {
      __pyx_t_2 = __pyx_t_3;
    }
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":579
 *             href, name = self._tag_tuple
 *             if href is None or href == b'*':
 *                 self._tag_href = NULL             # <<<<<<<<<<<<<<
 *             else:
 *                 self._tag_href = _cstr(href)
 */
      __pyx_v_self->_tag_href = NULL;
      goto __pyx_L4;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":581
 *                 self._tag_href = NULL
 *             else:
 *                 self._tag_href = _cstr(href)             # <<<<<<<<<<<<<<
 *             if name is None or name == b'*':
 *                 self._tag_name = NULL
 */
      __pyx_v_self->_tag_href = PyBytes_AS_STRING(__pyx_v_href);
    }
    __pyx_L4:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":582
 *             else:
 *                 self._tag_href = _cstr(href)
 *             if name is None or name == b'*':             # <<<<<<<<<<<<<<
 *                 self._tag_name = NULL
 *             else:
 */
    __pyx_t_2 = (__pyx_v_name == Py_None);
    if (!__pyx_t_2) {
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_name, ((PyObject *)__pyx_kp_b_132), Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_1 = __pyx_t_3;
    } else {
      __pyx_t_1 = __pyx_t_2;
    }
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":583
 *                 self._tag_href = _cstr(href)
 *             if name is None or name == b'*':
 *                 self._tag_name = NULL             # <<<<<<<<<<<<<<
 *             else:
 *                 self._tag_name = _cstr(name)
 */
      __pyx_v_self->_tag_name = NULL;
      goto __pyx_L5;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":585
 *                 self._tag_name = NULL
 *             else:
 *                 self._tag_name = _cstr(name)             # <<<<<<<<<<<<<<
 *             if self._tag_href is NULL and self._tag_name is NULL:
 *                 self._tag_tuple = None
 */
      __pyx_v_self->_tag_name = PyBytes_AS_STRING(__pyx_v_name);
    }
    __pyx_L5:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":586
 *             else:
 *                 self._tag_name = _cstr(name)
 *             if self._tag_href is NULL and self._tag_name is NULL:             # <<<<<<<<<<<<<<
 *                 self._tag_tuple = None
 * 
 */
    __pyx_t_1 = (__pyx_v_self->_tag_href == NULL);
    if (__pyx_t_1) {
      __pyx_t_2 = (__pyx_v_self->_tag_name == NULL);
      __pyx_t_3 = __pyx_t_2;
    } else {
      __pyx_t_3 = __pyx_t_1;
    }
    if (__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":587
 *                 self._tag_name = _cstr(name)
 *             if self._tag_href is NULL and self._tag_name is NULL:
 *                 self._tag_tuple = None             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
      __Pyx_INCREF(Py_None);
      __Pyx_GIVEREF(Py_None);
      __Pyx_GOTREF(__pyx_v_self->_tag_tuple);
      __Pyx_DECREF(((PyObject *)__pyx_v_self->_tag_tuple));
      __pyx_v_self->_tag_tuple = ((PyObject*)Py_None);
      goto __pyx_L6;
    }
    __pyx_L6:;
  }
  __pyx_L3:;

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_WriteUnraisable("lxml.etree.iterwalk._setTagFilter");
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_href);
  __Pyx_DECREF(__pyx_v_name);
  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":589
 *                 self._tag_tuple = None
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_8iterwalk_1__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_8iterwalk_1__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("__iter__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":590
 * 
 *     def __iter__(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __next__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self);
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":592
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         cdef xmlNode* c_child
 *         cdef _Element node
 */

static PyObject *__pyx_pf_4lxml_5etree_8iterwalk_2__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_8iterwalk_2__next__(PyObject *__pyx_v_self) {
  xmlNode *__pyx_v_c_child;
  struct LxmlElement *__pyx_v_node;
  struct LxmlElement *__pyx_v_next_node;
  int __pyx_v_ns_count;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("__next__");
  __pyx_v_node = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_next_node = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":597
 *         cdef _Element next_node
 *         cdef int ns_count
 *         if self._events:             # <<<<<<<<<<<<<<
 *             return self._pop_event(0)
 *         ns_count = 0
 */
  __pyx_t_1 = (((PyObject *)((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self)->_events) != Py_None) && (PyList_GET_SIZE(((PyObject *)((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self)->_events)) != 0);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":598
 *         cdef int ns_count
 *         if self._events:
 *             return self._pop_event(0)             # <<<<<<<<<<<<<<
 *         ns_count = 0
 *         # find next node
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyObject_Call(((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self)->_pop_event, ((PyObject *)__pyx_k_tuple_283), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":599
 *         if self._events:
 *             return self._pop_event(0)
 *         ns_count = 0             # <<<<<<<<<<<<<<
 *         # find next node
 *         while self._index >= 0:
 */
  __pyx_v_ns_count = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":601
 *         ns_count = 0
 *         # find next node
 *         while self._index >= 0:             # <<<<<<<<<<<<<<
 *             node = self._node_stack[self._index][0]
 * 
 */
  while (1) {
    __pyx_t_1 = (((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self)->_index >= 0);
    if (!__pyx_t_1) break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":602
 *         # find next node
 *         while self._index >= 0:
 *             node = self._node_stack[self._index][0]             # <<<<<<<<<<<<<<
 * 
 *             c_child = _findChildForwards(node._c_node, 0)
 */
    __pyx_t_2 = __Pyx_GetItemInt_List(((PyObject *)((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self)->_node_stack), ((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self)->_index, sizeof(int), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_v_node));
    __pyx_v_node = ((struct LxmlElement *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":604
 *             node = self._node_stack[self._index][0]
 * 
 *             c_child = _findChildForwards(node._c_node, 0)             # <<<<<<<<<<<<<<
 *             if c_child is not NULL:
 *                 # try children
 */
    __pyx_v_c_child = __pyx_f_4lxml_5etree__findChildForwards(__pyx_v_node->_c_node, 0);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":605
 * 
 *             c_child = _findChildForwards(node._c_node, 0)
 *             if c_child is not NULL:             # <<<<<<<<<<<<<<
 *                 # try children
 *                 next_node = _elementFactory(node._doc, c_child)
 */
    __pyx_t_1 = (__pyx_v_c_child != NULL);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":607
 *             if c_child is not NULL:
 *                 # try children
 *                 next_node = _elementFactory(node._doc, c_child)             # <<<<<<<<<<<<<<
 *             else:
 *                 # back off
 */
      __pyx_t_3 = ((PyObject *)__pyx_v_node->_doc);
      __Pyx_INCREF(__pyx_t_3);
      __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_3), __pyx_v_c_child)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_v_next_node));
      __pyx_v_next_node = ((struct LxmlElement *)__pyx_t_2);
      __pyx_t_2 = 0;
      goto __pyx_L8;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":610
 *             else:
 *                 # back off
 *                 next_node = None             # <<<<<<<<<<<<<<
 *                 while next_node is None:
 *                     # back off through parents
 */
      __Pyx_INCREF(Py_None);
      __Pyx_DECREF(((PyObject *)__pyx_v_next_node));
      __pyx_v_next_node = ((struct LxmlElement *)Py_None);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":611
 *                 # back off
 *                 next_node = None
 *                 while next_node is None:             # <<<<<<<<<<<<<<
 *                     # back off through parents
 *                     self._index -= 1
 */
      while (1) {
        __pyx_t_1 = (((PyObject *)__pyx_v_next_node) == Py_None);
        if (!__pyx_t_1) break;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":613
 *                 while next_node is None:
 *                     # back off through parents
 *                     self._index -= 1             # <<<<<<<<<<<<<<
 *                     node = self._end_node()
 *                     if self._index < 0:
 */
        ((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self)->_index = (((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self)->_index - 1);

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":614
 *                     # back off through parents
 *                     self._index -= 1
 *                     node = self._end_node()             # <<<<<<<<<<<<<<
 *                     if self._index < 0:
 *                         break
 */
        __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree_iterwalk *)((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self)->__pyx_vtab)->_end_node(((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(((PyObject *)__pyx_v_node));
        __pyx_v_node = ((struct LxmlElement *)__pyx_t_2);
        __pyx_t_2 = 0;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":615
 *                     self._index -= 1
 *                     node = self._end_node()
 *                     if self._index < 0:             # <<<<<<<<<<<<<<
 *                         break
 *                     next_node = node.getnext()
 */
        __pyx_t_1 = (((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self)->_index < 0);
        if (__pyx_t_1) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":616
 *                     node = self._end_node()
 *                     if self._index < 0:
 *                         break             # <<<<<<<<<<<<<<
 *                     next_node = node.getnext()
 *             if next_node is not None:
 */
          goto __pyx_L10_break;
          goto __pyx_L11;
        }
        __pyx_L11:;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":617
 *                     if self._index < 0:
 *                         break
 *                     next_node = node.getnext()             # <<<<<<<<<<<<<<
 *             if next_node is not None:
 *                 if self._event_filter & (ITERPARSE_FILTER_START | \
 */
        __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_node), __pyx_n_s__getnext); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(((PyObject *)__pyx_v_next_node));
        __pyx_v_next_node = ((struct LxmlElement *)__pyx_t_3);
        __pyx_t_3 = 0;
      }
      __pyx_L10_break:;
    }
    __pyx_L8:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":618
 *                         break
 *                     next_node = node.getnext()
 *             if next_node is not None:             # <<<<<<<<<<<<<<
 *                 if self._event_filter & (ITERPARSE_FILTER_START | \
 *                                          ITERPARSE_FILTER_START_NS):
 */
    __pyx_t_1 = (((PyObject *)__pyx_v_next_node) != Py_None);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":620
 *             if next_node is not None:
 *                 if self._event_filter & (ITERPARSE_FILTER_START | \
 *                                          ITERPARSE_FILTER_START_NS):             # <<<<<<<<<<<<<<
 *                     ns_count = self._start_node(next_node)
 *                 elif self._event_filter & ITERPARSE_FILTER_END_NS:
 */
      __pyx_t_4 = (((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self)->_event_filter & (__pyx_e_4lxml_5etree_ITERPARSE_FILTER_START | __pyx_e_4lxml_5etree_ITERPARSE_FILTER_START_NS));
      if (__pyx_t_4) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":621
 *                 if self._event_filter & (ITERPARSE_FILTER_START | \
 *                                          ITERPARSE_FILTER_START_NS):
 *                     ns_count = self._start_node(next_node)             # <<<<<<<<<<<<<<
 *                 elif self._event_filter & ITERPARSE_FILTER_END_NS:
 *                     ns_count = _countNsDefs(next_node._c_node)
 */
        __pyx_v_ns_count = ((struct __pyx_vtabstruct_4lxml_5etree_iterwalk *)((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self)->__pyx_vtab)->_start_node(((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self), __pyx_v_next_node);
        goto __pyx_L13;
      }

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":622
 *                                          ITERPARSE_FILTER_START_NS):
 *                     ns_count = self._start_node(next_node)
 *                 elif self._event_filter & ITERPARSE_FILTER_END_NS:             # <<<<<<<<<<<<<<
 *                     ns_count = _countNsDefs(next_node._c_node)
 *                 self._node_stack.append( (next_node, ns_count) )
 */
      __pyx_t_4 = (((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self)->_event_filter & __pyx_e_4lxml_5etree_ITERPARSE_FILTER_END_NS);
      if (__pyx_t_4) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":623
 *                     ns_count = self._start_node(next_node)
 *                 elif self._event_filter & ITERPARSE_FILTER_END_NS:
 *                     ns_count = _countNsDefs(next_node._c_node)             # <<<<<<<<<<<<<<
 *                 self._node_stack.append( (next_node, ns_count) )
 *                 self._index += 1
 */
        __pyx_v_ns_count = __pyx_f_4lxml_5etree__countNsDefs(__pyx_v_next_node->_c_node);
        goto __pyx_L13;
      }
      __pyx_L13:;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":624
 *                 elif self._event_filter & ITERPARSE_FILTER_END_NS:
 *                     ns_count = _countNsDefs(next_node._c_node)
 *                 self._node_stack.append( (next_node, ns_count) )             # <<<<<<<<<<<<<<
 *                 self._index += 1
 *             if self._events:
 */
      if (unlikely(((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self)->_node_stack == Py_None)) {
        PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[14]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
      }
      __pyx_t_3 = PyInt_FromLong(__pyx_v_ns_count); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __Pyx_INCREF(((PyObject *)__pyx_v_next_node));
      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_next_node));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_next_node));
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_4 = PyList_Append(((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self)->_node_stack, ((PyObject *)__pyx_t_2)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":625
 *                     ns_count = _countNsDefs(next_node._c_node)
 *                 self._node_stack.append( (next_node, ns_count) )
 *                 self._index += 1             # <<<<<<<<<<<<<<
 *             if self._events:
 *                 return self._pop_event(0)
 */
      ((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self)->_index = (((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self)->_index + 1);
      goto __pyx_L12;
    }
    __pyx_L12:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":626
 *                 self._node_stack.append( (next_node, ns_count) )
 *                 self._index += 1
 *             if self._events:             # <<<<<<<<<<<<<<
 *                 return self._pop_event(0)
 *         raise StopIteration
 */
    __pyx_t_1 = (((PyObject *)((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self)->_events) != Py_None) && (PyList_GET_SIZE(((PyObject *)((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self)->_events)) != 0);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":627
 *                 self._index += 1
 *             if self._events:
 *                 return self._pop_event(0)             # <<<<<<<<<<<<<<
 *         raise StopIteration
 * 
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyObject_Call(((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self)->_pop_event, ((PyObject *)__pyx_k_tuple_284), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;
      goto __pyx_L14;
    }
    __pyx_L14:;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":628
 *             if self._events:
 *                 return self._pop_event(0)
 *         raise StopIteration             # <<<<<<<<<<<<<<
 * 
 *     cdef int _start_node(self, _Element node):
 */
  __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0);
  {__pyx_filename = __pyx_f[14]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.iterwalk.__next__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_node);
  __Pyx_DECREF((PyObject *)__pyx_v_next_node);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":630
 *         raise StopIteration
 * 
 *     cdef int _start_node(self, _Element node):             # <<<<<<<<<<<<<<
 *         cdef int ns_count
 *         if self._event_filter & ITERPARSE_FILTER_START_NS:
 */

static  int __pyx_f_4lxml_5etree_8iterwalk__start_node(struct __pyx_obj_4lxml_5etree_iterwalk *__pyx_v_self, struct LxmlElement *__pyx_v_node) {
  int __pyx_v_ns_count;
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("_start_node");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":632
 *     cdef int _start_node(self, _Element node):
 *         cdef int ns_count
 *         if self._event_filter & ITERPARSE_FILTER_START_NS:             # <<<<<<<<<<<<<<
 *             ns_count = _appendStartNsEvents(node._c_node, self._events)
 *         elif self._event_filter & ITERPARSE_FILTER_END_NS:
 */
  __pyx_t_1 = (__pyx_v_self->_event_filter & __pyx_e_4lxml_5etree_ITERPARSE_FILTER_START_NS);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":633
 *         cdef int ns_count
 *         if self._event_filter & ITERPARSE_FILTER_START_NS:
 *             ns_count = _appendStartNsEvents(node._c_node, self._events)             # <<<<<<<<<<<<<<
 *         elif self._event_filter & ITERPARSE_FILTER_END_NS:
 *             ns_count = _countNsDefs(node._c_node)
 */
    __pyx_t_2 = ((PyObject *)__pyx_v_self->_events);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v_ns_count = __pyx_f_4lxml_5etree__appendStartNsEvents(__pyx_v_node->_c_node, ((PyObject*)__pyx_t_2));
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":634
 *         if self._event_filter & ITERPARSE_FILTER_START_NS:
 *             ns_count = _appendStartNsEvents(node._c_node, self._events)
 *         elif self._event_filter & ITERPARSE_FILTER_END_NS:             # <<<<<<<<<<<<<<
 *             ns_count = _countNsDefs(node._c_node)
 *         else:
 */
  __pyx_t_1 = (__pyx_v_self->_event_filter & __pyx_e_4lxml_5etree_ITERPARSE_FILTER_END_NS);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":635
 *             ns_count = _appendStartNsEvents(node._c_node, self._events)
 *         elif self._event_filter & ITERPARSE_FILTER_END_NS:
 *             ns_count = _countNsDefs(node._c_node)             # <<<<<<<<<<<<<<
 *         else:
 *             ns_count = 0
 */
    __pyx_v_ns_count = __pyx_f_4lxml_5etree__countNsDefs(__pyx_v_node->_c_node);
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":637
 *             ns_count = _countNsDefs(node._c_node)
 *         else:
 *             ns_count = 0             # <<<<<<<<<<<<<<
 *         if self._event_filter & ITERPARSE_FILTER_START:
 *             if self._tag_tuple is None or \
 */
    __pyx_v_ns_count = 0;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":638
 *         else:
 *             ns_count = 0
 *         if self._event_filter & ITERPARSE_FILTER_START:             # <<<<<<<<<<<<<<
 *             if self._tag_tuple is None or \
 *                    _tagMatches(node._c_node, self._tag_href, self._tag_name):
 */
  __pyx_t_1 = (__pyx_v_self->_event_filter & __pyx_e_4lxml_5etree_ITERPARSE_FILTER_START);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":639
 *             ns_count = 0
 *         if self._event_filter & ITERPARSE_FILTER_START:
 *             if self._tag_tuple is None or \             # <<<<<<<<<<<<<<
 *                    _tagMatches(node._c_node, self._tag_href, self._tag_name):
 *                 self._events.append( (u"start", node) )
 */
    __pyx_t_3 = (__pyx_v_self->_tag_tuple == ((PyObject*)Py_None));
    if (!__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":640
 *         if self._event_filter & ITERPARSE_FILTER_START:
 *             if self._tag_tuple is None or \
 *                    _tagMatches(node._c_node, self._tag_href, self._tag_name):             # <<<<<<<<<<<<<<
 *                 self._events.append( (u"start", node) )
 *         return ns_count
 */
      __pyx_t_4 = __pyx_f_4lxml_5etree__tagMatches(__pyx_v_node->_c_node, __pyx_v_self->_tag_href, __pyx_v_self->_tag_name);
      __pyx_t_5 = __pyx_t_4;
    } else {
      __pyx_t_5 = __pyx_t_3;
    }
    if (__pyx_t_5) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":641
 *             if self._tag_tuple is None or \
 *                    _tagMatches(node._c_node, self._tag_href, self._tag_name):
 *                 self._events.append( (u"start", node) )             # <<<<<<<<<<<<<<
 *         return ns_count
 * 
 */
      if (unlikely(__pyx_v_self->_events == Py_None)) {
        PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[14]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
      }
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __Pyx_INCREF(((PyObject *)__pyx_n_u__start));
      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_u__start));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_u__start));
      __Pyx_INCREF(((PyObject *)__pyx_v_node));
      PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_node));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_node));
      __pyx_t_1 = PyList_Append(__pyx_v_self->_events, ((PyObject *)__pyx_t_2)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      goto __pyx_L5;
    }
    __pyx_L5:;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":642
 *                    _tagMatches(node._c_node, self._tag_href, self._tag_name):
 *                 self._events.append( (u"start", node) )
 *         return ns_count             # <<<<<<<<<<<<<<
 * 
 *     cdef _Element _end_node(self):
 */
  __pyx_r = __pyx_v_ns_count;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_WriteUnraisable("lxml.etree.iterwalk._start_node");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":644
 *         return ns_count
 * 
 *     cdef _Element _end_node(self):             # <<<<<<<<<<<<<<
 *         cdef _Element node
 *         cdef int i, ns_count
 */

static  struct LxmlElement *__pyx_f_4lxml_5etree_8iterwalk__end_node(struct __pyx_obj_4lxml_5etree_iterwalk *__pyx_v_self) {
  struct LxmlElement *__pyx_v_node;
  int __pyx_v_i;
  int __pyx_v_ns_count;
  PyObject *__pyx_v_event;
  struct LxmlElement *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  __Pyx_RefNannySetupContext("_end_node");
  __pyx_v_node = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_event = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":647
 *         cdef _Element node
 *         cdef int i, ns_count
 *         node, ns_count = self._pop_node()             # <<<<<<<<<<<<<<
 *         if self._event_filter & ITERPARSE_FILTER_END:
 *             if self._tag_tuple is None or \
 */
  __pyx_t_1 = PyObject_Call(__pyx_v_self->_pop_node, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyTuple_CheckExact(__pyx_t_1) && likely(PyTuple_GET_SIZE(__pyx_t_1) == 2)) {
    PyObject* tuple = __pyx_t_1;
    __pyx_t_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_2);
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_v_node));
    __pyx_v_node = ((struct LxmlElement *)__pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_v_ns_count = __pyx_t_4;
  } else {
    __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_5, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_5, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__Pyx_EndUnpack(__pyx_t_5, 2) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_v_node));
    __pyx_v_node = ((struct LxmlElement *)__pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_v_ns_count = __pyx_t_4;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":648
 *         cdef int i, ns_count
 *         node, ns_count = self._pop_node()
 *         if self._event_filter & ITERPARSE_FILTER_END:             # <<<<<<<<<<<<<<
 *             if self._tag_tuple is None or \
 *                    _tagMatches(node._c_node, self._tag_href, self._tag_name):
 */
  __pyx_t_4 = (__pyx_v_self->_event_filter & __pyx_e_4lxml_5etree_ITERPARSE_FILTER_END);
  if (__pyx_t_4) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":649
 *         node, ns_count = self._pop_node()
 *         if self._event_filter & ITERPARSE_FILTER_END:
 *             if self._tag_tuple is None or \             # <<<<<<<<<<<<<<
 *                    _tagMatches(node._c_node, self._tag_href, self._tag_name):
 *                 self._events.append( (u"end", node) )
 */
    __pyx_t_6 = (__pyx_v_self->_tag_tuple == ((PyObject*)Py_None));
    if (!__pyx_t_6) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":650
 *         if self._event_filter & ITERPARSE_FILTER_END:
 *             if self._tag_tuple is None or \
 *                    _tagMatches(node._c_node, self._tag_href, self._tag_name):             # <<<<<<<<<<<<<<
 *                 self._events.append( (u"end", node) )
 *         if self._event_filter & ITERPARSE_FILTER_END_NS:
 */
      __pyx_t_7 = __pyx_f_4lxml_5etree__tagMatches(__pyx_v_node->_c_node, __pyx_v_self->_tag_href, __pyx_v_self->_tag_name);
      __pyx_t_8 = __pyx_t_7;
    } else {
      __pyx_t_8 = __pyx_t_6;
    }
    if (__pyx_t_8) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":651
 *             if self._tag_tuple is None or \
 *                    _tagMatches(node._c_node, self._tag_href, self._tag_name):
 *                 self._events.append( (u"end", node) )             # <<<<<<<<<<<<<<
 *         if self._event_filter & ITERPARSE_FILTER_END_NS:
 *             event = (u"end-ns", None)
 */
      if (unlikely(__pyx_v_self->_events == Py_None)) {
        PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[14]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
      }
      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      __Pyx_INCREF(((PyObject *)__pyx_n_u__end));
      PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_u__end));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_u__end));
      __Pyx_INCREF(((PyObject *)__pyx_v_node));
      PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_node));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_node));
      __pyx_t_4 = PyList_Append(__pyx_v_self->_events, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
      goto __pyx_L4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":652
 *                    _tagMatches(node._c_node, self._tag_href, self._tag_name):
 *                 self._events.append( (u"end", node) )
 *         if self._event_filter & ITERPARSE_FILTER_END_NS:             # <<<<<<<<<<<<<<
 *             event = (u"end-ns", None)
 *             for i from 0 <= i < ns_count:
 */
  __pyx_t_4 = (__pyx_v_self->_event_filter & __pyx_e_4lxml_5etree_ITERPARSE_FILTER_END_NS);
  if (__pyx_t_4) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":653
 *                 self._events.append( (u"end", node) )
 *         if self._event_filter & ITERPARSE_FILTER_END_NS:
 *             event = (u"end-ns", None)             # <<<<<<<<<<<<<<
 *             for i from 0 <= i < ns_count:
 *                 self._events.append(event)
 */
    __Pyx_INCREF(((PyObject *)__pyx_k_tuple_285));
    __Pyx_DECREF(((PyObject *)__pyx_v_event));
    __pyx_v_event = __pyx_k_tuple_285;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":654
 *         if self._event_filter & ITERPARSE_FILTER_END_NS:
 *             event = (u"end-ns", None)
 *             for i from 0 <= i < ns_count:             # <<<<<<<<<<<<<<
 *                 self._events.append(event)
 *         return node
 */
    __pyx_t_4 = __pyx_v_ns_count;
    for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_4; __pyx_v_i++) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":655
 *             event = (u"end-ns", None)
 *             for i from 0 <= i < ns_count:
 *                 self._events.append(event)             # <<<<<<<<<<<<<<
 *         return node
 */
      if (unlikely(__pyx_v_self->_events == Py_None)) {
        PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[14]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
      }
      __pyx_t_9 = PyList_Append(__pyx_v_self->_events, ((PyObject *)__pyx_v_event)); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":656
 *             for i from 0 <= i < ns_count:
 *                 self._events.append(event)
 *         return node             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_node));
  __pyx_r = __pyx_v_node;
  goto __pyx_L0;

  __pyx_r = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.iterwalk._end_node");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_node);
  __Pyx_DECREF(__pyx_v_event);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":3
 * cdef object _find_id_attributes
 * 
 * def XMLID(text, parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     u"""XMLID(text, parser=None, base_url=None)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_23XMLID(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_23XMLID[] = "XMLID(text, parser=None, base_url=None)\n\n    Parse the text and return a tuple (root node, ID dictionary).  The root\n    node is the same as returned by the XML() function.  The dictionary\n    contains string-element pairs.  The dictionary keys are the values of 'id'\n    attributes.  The elements referenced by the ID are stored as dictionary\n    values.\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_23XMLID = {__Pyx_NAMESTR("XMLID"), (PyCFunction)__pyx_pf_4lxml_5etree_23XMLID, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_23XMLID)};
static PyObject *__pyx_pf_4lxml_5etree_23XMLID(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_text = 0;
  PyObject *__pyx_v_parser = 0;
  PyObject *__pyx_v_base_url = 0;
  PyObject *__pyx_v_dic;
  PyObject *__pyx_v_root;
  PyObject *__pyx_v_elem;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__text,&__pyx_n_s__parser,&__pyx_n_s__base_url,0};
  __Pyx_RefNannySetupContext("XMLID");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__text);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parser);
        if (value) { values[1] = value; kw_args--; }
      }
    }
    while (kw_args > 0) {
      PyObject* value;
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__base_url);
      if (value) { values[2] = value; if (!(--kw_args)) break; }
      break;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "XMLID") < 0)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_text = values[0];
    __pyx_v_parser = values[1];
    __pyx_v_base_url = values[2];
  } else {
    __pyx_v_parser = ((PyObject *)Py_None);
    __pyx_v_base_url = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_parser = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v_text = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("XMLID", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[15]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.XMLID");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_dic = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_root = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_elem = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":14
 *     cdef dict dic
 *     global _find_id_attributes
 *     if _find_id_attributes is None:             # <<<<<<<<<<<<<<
 *         _find_id_attributes = XPath(u'//[inserted by cython to avoid comment start]*[string(@id)]')
 * 
 */
  __pyx_t_1 = (__pyx_v_4lxml_5etree__find_id_attributes == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":15
 *     global _find_id_attributes
 *     if _find_id_attributes is None:
 *         _find_id_attributes = XPath(u'//[inserted by cython to avoid comment start]*[string(@id)]')             # <<<<<<<<<<<<<<
 * 
 *     # ElementTree compatible implementation: parse and look for 'id' attributes
 */
    __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_XPath)), ((PyObject *)__pyx_k_tuple_287), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GOTREF(__pyx_v_4lxml_5etree__find_id_attributes);
    __Pyx_DECREF(__pyx_v_4lxml_5etree__find_id_attributes);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_v_4lxml_5etree__find_id_attributes = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":18
 * 
 *     # ElementTree compatible implementation: parse and look for 'id' attributes
 *     root = XML(text, parser, base_url=base_url)             # <<<<<<<<<<<<<<
 *     dic = {}
 *     for elem in _find_id_attributes(root):
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__XML); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(__pyx_v_text);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_text);
  __Pyx_GIVEREF(__pyx_v_text);
  __Pyx_INCREF(__pyx_v_parser);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_parser);
  __Pyx_GIVEREF(__pyx_v_parser);
  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__base_url), __pyx_v_base_url) < 0) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_v_root);
  __pyx_v_root = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":19
 *     # ElementTree compatible implementation: parse and look for 'id' attributes
 *     root = XML(text, parser, base_url=base_url)
 *     dic = {}             # <<<<<<<<<<<<<<
 *     for elem in _find_id_attributes(root):
 *         dic[elem.get(u'id')] = elem
 */
  __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  __Pyx_DECREF(((PyObject *)__pyx_v_dic));
  __pyx_v_dic = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":20
 *     root = XML(text, parser, base_url=base_url)
 *     dic = {}
 *     for elem in _find_id_attributes(root):             # <<<<<<<<<<<<<<
 *         dic[elem.get(u'id')] = elem
 *     return (root, dic)
 */
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  __Pyx_INCREF(__pyx_v_root);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_root);
  __Pyx_GIVEREF(__pyx_v_root);
  __pyx_t_4 = PyObject_Call(__pyx_v_4lxml_5etree__find_id_attributes, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  if (PyList_CheckExact(__pyx_t_4) || PyTuple_CheckExact(__pyx_t_4)) {
    __pyx_t_6 = 0; __pyx_t_5 = __pyx_t_4; __Pyx_INCREF(__pyx_t_5);
  } else {
    __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  for (;;) {
    if (likely(PyList_CheckExact(__pyx_t_5))) {
      if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break;
      __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++;
    } else if (likely(PyTuple_CheckExact(__pyx_t_5))) {
      if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
      __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++;
    } else {
      __pyx_t_4 = PyIter_Next(__pyx_t_5);
      if (!__pyx_t_4) {
        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_DECREF(__pyx_v_elem);
    __pyx_v_elem = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":21
 *     dic = {}
 *     for elem in _find_id_attributes(root):
 *         dic[elem.get(u'id')] = elem             # <<<<<<<<<<<<<<
 *     return (root, dic)
 * 
 */
    __pyx_t_4 = PyObject_GetAttr(__pyx_v_elem, __pyx_n_s__get); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_288), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (PyDict_SetItem(((PyObject *)__pyx_v_dic), __pyx_t_3, __pyx_v_elem) < 0) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":22
 *     for elem in _find_id_attributes(root):
 *         dic[elem.get(u'id')] = elem
 *     return (root, dic)             # <<<<<<<<<<<<<<
 * 
 * def XMLDTDID(text, parser=None, *, base_url=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  __Pyx_INCREF(__pyx_v_root);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_root);
  __Pyx_GIVEREF(__pyx_v_root);
  __Pyx_INCREF(((PyObject *)__pyx_v_dic));
  PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_v_dic));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_dic));
  __pyx_r = ((PyObject *)__pyx_t_5);
  __pyx_t_5 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.XMLID");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_dic);
  __Pyx_DECREF(__pyx_v_root);
  __Pyx_DECREF(__pyx_v_elem);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":24
 *     return (root, dic)
 * 
 * def XMLDTDID(text, parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     u"""XMLDTDID(text, parser=None, base_url=None)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_24XMLDTDID(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_24XMLDTDID[] = "XMLDTDID(text, parser=None, base_url=None)\n\n    Parse the text and return a tuple (root node, ID dictionary).  The root\n    node is the same as returned by the XML() function.  The dictionary\n    contains string-element pairs.  The dictionary keys are the values of ID\n    attributes as defined by the DTD.  The elements referenced by the ID are\n    stored as dictionary values.\n\n    Note that you must not modify the XML tree if you use the ID dictionary.\n    The results are undefined.\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_24XMLDTDID = {__Pyx_NAMESTR("XMLDTDID"), (PyCFunction)__pyx_pf_4lxml_5etree_24XMLDTDID, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_24XMLDTDID)};
static PyObject *__pyx_pf_4lxml_5etree_24XMLDTDID(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_text = 0;
  PyObject *__pyx_v_parser = 0;
  PyObject *__pyx_v_base_url = 0;
  struct LxmlElement *__pyx_v_root;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__text,&__pyx_n_s__parser,&__pyx_n_s__base_url,0};
  __Pyx_RefNannySetupContext("XMLDTDID");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__text);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parser);
        if (value) { values[1] = value; kw_args--; }
      }
    }
    while (kw_args > 0) {
      PyObject* value;
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__base_url);
      if (value) { values[2] = value; if (!(--kw_args)) break; }
      break;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "XMLDTDID") < 0)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_text = values[0];
    __pyx_v_parser = values[1];
    __pyx_v_base_url = values[2];
  } else {
    __pyx_v_parser = ((PyObject *)Py_None);
    __pyx_v_base_url = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_parser = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v_text = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("XMLDTDID", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[15]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.XMLDTDID");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_root = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":37
 *     """
 *     cdef _Element root
 *     root = XML(text, parser, base_url=base_url)             # <<<<<<<<<<<<<<
 *     # xml:id spec compatible implementation: use DTD ID attributes from libxml2
 *     if root._doc._c_doc.ids is NULL:
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__XML); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(__pyx_v_text);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_text);
  __Pyx_GIVEREF(__pyx_v_text);
  __Pyx_INCREF(__pyx_v_parser);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_parser);
  __Pyx_GIVEREF(__pyx_v_parser);
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__base_url), __pyx_v_base_url) < 0) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_v_root));
  __pyx_v_root = ((struct LxmlElement *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":39
 *     root = XML(text, parser, base_url=base_url)
 *     # xml:id spec compatible implementation: use DTD ID attributes from libxml2
 *     if root._doc._c_doc.ids is NULL:             # <<<<<<<<<<<<<<
 *         return (root, {})
 *     else:
 */
  __pyx_t_5 = (__pyx_v_root->_doc->_c_doc->ids == NULL);
  if (__pyx_t_5) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":40
 *     # xml:id spec compatible implementation: use DTD ID attributes from libxml2
 *     if root._doc._c_doc.ids is NULL:
 *         return (root, {})             # <<<<<<<<<<<<<<
 *     else:
 *         return (root, _IDDict(root))
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_INCREF(((PyObject *)__pyx_v_root));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_root));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_root));
    PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_t_4));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
    __pyx_t_4 = 0;
    __pyx_r = ((PyObject *)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L0;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":42
 *         return (root, {})
 *     else:
 *         return (root, _IDDict(root))             # <<<<<<<<<<<<<<
 * 
 * def parseid(source, parser=None, *, base_url=None):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_INCREF(((PyObject *)__pyx_v_root));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_root));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_root));
    __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__IDDict)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_INCREF(((PyObject *)__pyx_v_root));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_root));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_root));
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_r = ((PyObject *)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }
  __pyx_L6:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.XMLDTDID");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_root);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":44
 *         return (root, _IDDict(root))
 * 
 * def parseid(source, parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     u"""parseid(source, parser=None)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_25parseid(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_25parseid[] = "parseid(source, parser=None)\n\n    Parses the source into a tuple containing an ElementTree object and an\n    ID dictionary.  If no parser is provided as second argument, the default\n    parser is used.\n\n    Note that you must not modify the XML tree if you use the ID dictionary.\n    The results are undefined.\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_25parseid = {__Pyx_NAMESTR("parseid"), (PyCFunction)__pyx_pf_4lxml_5etree_25parseid, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_25parseid)};
static PyObject *__pyx_pf_4lxml_5etree_25parseid(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_source = 0;
  PyObject *__pyx_v_parser = 0;
  PyObject *__pyx_v_base_url = 0;
  struct LxmlDocument *__pyx_v_doc;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__source,&__pyx_n_s__parser,&__pyx_n_s__base_url,0};
  __Pyx_RefNannySetupContext("parseid");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__source);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parser);
        if (value) { values[1] = value; kw_args--; }
      }
    }
    while (kw_args > 0) {
      PyObject* value;
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__base_url);
      if (value) { values[2] = value; if (!(--kw_args)) break; }
      break;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "parseid") < 0)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_source = values[0];
    __pyx_v_parser = values[1];
    __pyx_v_base_url = values[2];
  } else {
    __pyx_v_parser = ((PyObject *)Py_None);
    __pyx_v_base_url = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_parser = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v_source = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("parseid", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[15]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.parseid");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_doc = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":55
 *     """
 *     cdef _Document doc
 *     doc = _parseDocument(source, parser, base_url)             # <<<<<<<<<<<<<<
 *     return (_elementTreeFactory(doc, None), _IDDict(doc))
 * 
 */
  if (!(likely(((__pyx_v_parser) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_parser, __pyx_ptype_4lxml_5etree__BaseParser))))) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__parseDocument(__pyx_v_source, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_parser), __pyx_v_base_url)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_doc));
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":56
 *     cdef _Document doc
 *     doc = _parseDocument(source, parser, base_url)
 *     return (_elementTreeFactory(doc, None), _IDDict(doc))             # <<<<<<<<<<<<<<
 * 
 * cdef class _IDDict:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__elementTreeFactory(__pyx_v_doc, ((struct LxmlElement *)Py_None))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(((PyObject *)__pyx_v_doc));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_doc));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_doc));
  __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__IDDict)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_1 = 0;
  __pyx_t_3 = 0;
  __pyx_r = ((PyObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.parseid");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_doc);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":69
 *     cdef object _keys
 *     cdef object _items
 *     def __cinit__(self, etree):             # <<<<<<<<<<<<<<
 *         cdef _Document doc
 *         doc = _documentOrRaise(etree)
 */

static int __pyx_pf_4lxml_5etree_7_IDDict___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_7_IDDict___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_etree = 0;
  struct LxmlDocument *__pyx_v_doc;
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__etree,0};
  __Pyx_RefNannySetupContext("__cinit__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[1] = {0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__etree);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_etree = values[0];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_etree = PyTuple_GET_ITEM(__pyx_args, 0);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[15]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._IDDict.__cinit__");
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_doc = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":71
 *     def __cinit__(self, etree):
 *         cdef _Document doc
 *         doc = _documentOrRaise(etree)             # <<<<<<<<<<<<<<
 *         if doc._c_doc.ids is NULL:
 *             raise ValueError, u"No ID dictionary available."
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_doc));
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":72
 *         cdef _Document doc
 *         doc = _documentOrRaise(etree)
 *         if doc._c_doc.ids is NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError, u"No ID dictionary available."
 *         self._doc = doc
 */
  __pyx_t_2 = (__pyx_v_doc->_c_doc->ids == NULL);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":73
 *         doc = _documentOrRaise(etree)
 *         if doc._c_doc.ids is NULL:
 *             raise ValueError, u"No ID dictionary available."             # <<<<<<<<<<<<<<
 *         self._doc = doc
 *         self._keys  = None
 */
    __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_u_289), 0);
    {__pyx_filename = __pyx_f[15]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":74
 *         if doc._c_doc.ids is NULL:
 *             raise ValueError, u"No ID dictionary available."
 *         self._doc = doc             # <<<<<<<<<<<<<<
 *         self._keys  = None
 *         self._items = None
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_doc));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_doc));
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->_doc);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->_doc));
  ((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->_doc = __pyx_v_doc;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":75
 *             raise ValueError, u"No ID dictionary available."
 *         self._doc = doc
 *         self._keys  = None             # <<<<<<<<<<<<<<
 *         self._items = None
 * 
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->_keys);
  __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->_keys);
  ((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->_keys = Py_None;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":76
 *         self._doc = doc
 *         self._keys  = None
 *         self._items = None             # <<<<<<<<<<<<<<
 * 
 *     def copy(self):
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->_items);
  __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->_items);
  ((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->_items = Py_None;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._IDDict.__cinit__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_doc);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":78
 *         self._items = None
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         return _IDDict(self._doc)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_1copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_1copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("copy");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":79
 * 
 *     def copy(self):
 *         return _IDDict(self._doc)             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, id_name):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->_doc));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->_doc));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->_doc));
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__IDDict)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._IDDict.copy");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":81
 *         return _IDDict(self._doc)
 * 
 *     def __getitem__(self, id_name):             # <<<<<<<<<<<<<<
 *         cdef tree.xmlHashTable* c_ids
 *         cdef tree.xmlID* c_id
 */

static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_2__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_id_name); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_2__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_id_name) {
  xmlHashTable *__pyx_v_c_ids;
  xmlID *__pyx_v_c_id;
  xmlAttr *__pyx_v_c_attr;
  PyObject *__pyx_v_id_utf;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__getitem__");
  __pyx_v_id_utf = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":85
 *         cdef tree.xmlID* c_id
 *         cdef xmlAttr* c_attr
 *         c_ids = self._doc._c_doc.ids             # <<<<<<<<<<<<<<
 *         id_utf = _utf8(id_name)
 *         c_id = <tree.xmlID*>tree.xmlHashLookup(c_ids, _cstr(id_utf))
 */
  __pyx_v_c_ids = ((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->_doc->_c_doc->ids;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":86
 *         cdef xmlAttr* c_attr
 *         c_ids = self._doc._c_doc.ids
 *         id_utf = _utf8(id_name)             # <<<<<<<<<<<<<<
 *         c_id = <tree.xmlID*>tree.xmlHashLookup(c_ids, _cstr(id_utf))
 *         if c_id is NULL:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_v_id_name)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_id_utf));
  __pyx_v_id_utf = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":87
 *         c_ids = self._doc._c_doc.ids
 *         id_utf = _utf8(id_name)
 *         c_id = <tree.xmlID*>tree.xmlHashLookup(c_ids, _cstr(id_utf))             # <<<<<<<<<<<<<<
 *         if c_id is NULL:
 *             raise KeyError, u"key not found."
 */
  __pyx_v_c_id = ((xmlID *)xmlHashLookup(__pyx_v_c_ids, PyBytes_AS_STRING(((PyObject *)__pyx_v_id_utf))));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":88
 *         id_utf = _utf8(id_name)
 *         c_id = <tree.xmlID*>tree.xmlHashLookup(c_ids, _cstr(id_utf))
 *         if c_id is NULL:             # <<<<<<<<<<<<<<
 *             raise KeyError, u"key not found."
 *         c_attr = c_id.attr
 */
  __pyx_t_2 = (__pyx_v_c_id == NULL);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":89
 *         c_id = <tree.xmlID*>tree.xmlHashLookup(c_ids, _cstr(id_utf))
 *         if c_id is NULL:
 *             raise KeyError, u"key not found."             # <<<<<<<<<<<<<<
 *         c_attr = c_id.attr
 *         if c_attr is NULL or c_attr.parent is NULL:
 */
    __Pyx_Raise(__pyx_builtin_KeyError, ((PyObject *)__pyx_kp_u_290), 0);
    {__pyx_filename = __pyx_f[15]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":90
 *         if c_id is NULL:
 *             raise KeyError, u"key not found."
 *         c_attr = c_id.attr             # <<<<<<<<<<<<<<
 *         if c_attr is NULL or c_attr.parent is NULL:
 *             raise KeyError, u"ID attribute not found."
 */
  __pyx_v_c_attr = __pyx_v_c_id->attr;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":91
 *             raise KeyError, u"key not found."
 *         c_attr = c_id.attr
 *         if c_attr is NULL or c_attr.parent is NULL:             # <<<<<<<<<<<<<<
 *             raise KeyError, u"ID attribute not found."
 *         return _elementFactory(self._doc, c_attr.parent)
 */
  __pyx_t_2 = (__pyx_v_c_attr == NULL);
  if (!__pyx_t_2) {
    __pyx_t_3 = (__pyx_v_c_attr->parent == NULL);
    __pyx_t_4 = __pyx_t_3;
  } else {
    __pyx_t_4 = __pyx_t_2;
  }
  if (__pyx_t_4) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":92
 *         c_attr = c_id.attr
 *         if c_attr is NULL or c_attr.parent is NULL:
 *             raise KeyError, u"ID attribute not found."             # <<<<<<<<<<<<<<
 *         return _elementFactory(self._doc, c_attr.parent)
 * 
 */
    __Pyx_Raise(__pyx_builtin_KeyError, ((PyObject *)__pyx_kp_u_291), 0);
    {__pyx_filename = __pyx_f[15]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":93
 *         if c_attr is NULL or c_attr.parent is NULL:
 *             raise KeyError, u"ID attribute not found."
 *         return _elementFactory(self._doc, c_attr.parent)             # <<<<<<<<<<<<<<
 * 
 *     def get(self, id_name):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->_doc);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_5 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_1), __pyx_v_c_attr->parent)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._IDDict.__getitem__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_id_utf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":95
 *         return _elementFactory(self._doc, c_attr.parent)
 * 
 *     def get(self, id_name):             # <<<<<<<<<<<<<<
 *         return self[id_name]
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_3get(PyObject *__pyx_v_self, PyObject *__pyx_v_id_name); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_3get(PyObject *__pyx_v_self, PyObject *__pyx_v_id_name) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("get");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":96
 * 
 *     def get(self, id_name):
 *         return self[id_name]             # <<<<<<<<<<<<<<
 * 
 *     def __contains__(self, id_name):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetItem(__pyx_v_self, __pyx_v_id_name); if (!__pyx_t_1) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._IDDict.get");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":98
 *         return self[id_name]
 * 
 *     def __contains__(self, id_name):             # <<<<<<<<<<<<<<
 *         cdef tree.xmlID* c_id
 *         id_utf = _utf8(id_name)
 */

static int __pyx_pf_4lxml_5etree_7_IDDict_4__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_id_name); /*proto*/
static int __pyx_pf_4lxml_5etree_7_IDDict_4__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_id_name) {
  xmlID *__pyx_v_c_id;
  PyObject *__pyx_v_id_utf;
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__contains__");
  __pyx_v_id_utf = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":100
 *     def __contains__(self, id_name):
 *         cdef tree.xmlID* c_id
 *         id_utf = _utf8(id_name)             # <<<<<<<<<<<<<<
 *         c_id = <tree.xmlID*>tree.xmlHashLookup(
 *             self._doc._c_doc.ids, _cstr(id_utf))
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_v_id_name)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_id_utf));
  __pyx_v_id_utf = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":102
 *         id_utf = _utf8(id_name)
 *         c_id = <tree.xmlID*>tree.xmlHashLookup(
 *             self._doc._c_doc.ids, _cstr(id_utf))             # <<<<<<<<<<<<<<
 *         return c_id is not NULL
 * 
 */
  __pyx_v_c_id = ((xmlID *)xmlHashLookup(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->_doc->_c_doc->ids, PyBytes_AS_STRING(((PyObject *)__pyx_v_id_utf))));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":103
 *         c_id = <tree.xmlID*>tree.xmlHashLookup(
 *             self._doc._c_doc.ids, _cstr(id_utf))
 *         return c_id is not NULL             # <<<<<<<<<<<<<<
 * 
 *     def has_key(self, id_name):
 */
  __pyx_r = (__pyx_v_c_id != NULL);
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._IDDict.__contains__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_id_utf);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":105
 *         return c_id is not NULL
 * 
 *     def has_key(self, id_name):             # <<<<<<<<<<<<<<
 *         return id_name in self
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_5has_key(PyObject *__pyx_v_self, PyObject *__pyx_v_id_name); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_5has_key(PyObject *__pyx_v_self, PyObject *__pyx_v_id_name) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("has_key");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":106
 * 
 *     def has_key(self, id_name):
 *         return id_name in self             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PySequence_Contains(__pyx_v_self, __pyx_v_id_name))); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._IDDict.has_key");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":108
 *         return id_name in self
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return repr(dict(self))
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_6__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_6__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__repr__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":109
 * 
 *     def __repr__(self):
 *         return repr(dict(self))             # <<<<<<<<<<<<<<
 * 
 *     def keys(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyDict_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Repr(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._IDDict.__repr__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":111
 *         return repr(dict(self))
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         if self._keys is None:
 *             self._keys = self._build_keys()
 */

static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_7keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_7keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("keys");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":112
 * 
 *     def keys(self):
 *         if self._keys is None:             # <<<<<<<<<<<<<<
 *             self._keys = self._build_keys()
 *         return self._keys[:]
 */
  __pyx_t_1 = (((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->_keys == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":113
 *     def keys(self):
 *         if self._keys is None:
 *             self._keys = self._build_keys()             # <<<<<<<<<<<<<<
 *         return self._keys[:]
 * 
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__IDDict *)((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->__pyx_vtab)->_build_keys(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->_keys);
    __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->_keys);
    ((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->_keys = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":114
 *         if self._keys is None:
 *             self._keys = self._build_keys()
 *         return self._keys[:]             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PySequence_GetSlice(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->_keys, 0, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._IDDict.keys");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":116
 *         return self._keys[:]
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         if self._keys is None:
 *             self._keys = self._build_keys()
 */

static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_8__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_8__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__iter__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":117
 * 
 *     def __iter__(self):
 *         if self._keys is None:             # <<<<<<<<<<<<<<
 *             self._keys = self._build_keys()
 *         return iter(self._keys)
 */
  __pyx_t_1 = (((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->_keys == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":118
 *     def __iter__(self):
 *         if self._keys is None:
 *             self._keys = self._build_keys()             # <<<<<<<<<<<<<<
 *         return iter(self._keys)
 * 
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__IDDict *)((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->__pyx_vtab)->_build_keys(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->_keys);
    __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->_keys);
    ((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->_keys = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":119
 *         if self._keys is None:
 *             self._keys = self._build_keys()
 *         return iter(self._keys)             # <<<<<<<<<<<<<<
 * 
 *     def iterkeys(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->_keys;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._IDDict.__iter__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":121
 *         return iter(self._keys)
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_9iterkeys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_9iterkeys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("iterkeys");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":122
 * 
 *     def iterkeys(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self);
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":124
 *         return self
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         if self._keys is None:
 *             self._keys = self._build_keys()
 */

static Py_ssize_t __pyx_pf_4lxml_5etree_7_IDDict_10__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pf_4lxml_5etree_7_IDDict_10__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  __Pyx_RefNannySetupContext("__len__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":125
 * 
 *     def __len__(self):
 *         if self._keys is None:             # <<<<<<<<<<<<<<
 *             self._keys = self._build_keys()
 *         return len(self._keys)
 */
  __pyx_t_1 = (((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->_keys == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":126
 *     def __len__(self):
 *         if self._keys is None:
 *             self._keys = self._build_keys()             # <<<<<<<<<<<<<<
 *         return len(self._keys)
 * 
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__IDDict *)((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->__pyx_vtab)->_build_keys(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->_keys);
    __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->_keys);
    ((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->_keys = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":127
 *         if self._keys is None:
 *             self._keys = self._build_keys()
 *         return len(self._keys)             # <<<<<<<<<<<<<<
 * 
 *     def items(self):
 */
  __pyx_t_2 = ((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->_keys;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._IDDict.__len__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":129
 *         return len(self._keys)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         if self._items is None:
 *             self._items = self._build_items()
 */

static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_11items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_11items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("items");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":130
 * 
 *     def items(self):
 *         if self._items is None:             # <<<<<<<<<<<<<<
 *             self._items = self._build_items()
 *         return self._items[:]
 */
  __pyx_t_1 = (((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->_items == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":131
 *     def items(self):
 *         if self._items is None:
 *             self._items = self._build_items()             # <<<<<<<<<<<<<<
 *         return self._items[:]
 * 
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__IDDict *)((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->__pyx_vtab)->_build_items(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->_items);
    __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->_items);
    ((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->_items = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":132
 *         if self._items is None:
 *             self._items = self._build_items()
 *         return self._items[:]             # <<<<<<<<<<<<<<
 * 
 *     def iteritems(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PySequence_GetSlice(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->_items, 0, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._IDDict.items");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":134
 *         return self._items[:]
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         if self._items is None:
 *             self._items = self._build_items()
 */

static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_12iteritems(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_12iteritems(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("iteritems");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":135
 * 
 *     def iteritems(self):
 *         if self._items is None:             # <<<<<<<<<<<<<<
 *             self._items = self._build_items()
 *         return iter(self._items)
 */
  __pyx_t_1 = (((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->_items == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":136
 *     def iteritems(self):
 *         if self._items is None:
 *             self._items = self._build_items()             # <<<<<<<<<<<<<<
 *         return iter(self._items)
 * 
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__IDDict *)((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->__pyx_vtab)->_build_items(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->_items);
    __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->_items);
    ((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->_items = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":137
 *         if self._items is None:
 *             self._items = self._build_items()
 *         return iter(self._items)             # <<<<<<<<<<<<<<
 * 
 *     def values(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->_items;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._IDDict.iteritems");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":139
 *         return iter(self._items)
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         cdef list values = []
 *         if self._items is None:
 */

static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_13values(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_13values(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_v_values = 0;
  PyObject *__pyx_v_item;
  PyObject *__pyx_v_value;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("values");
  __pyx_v_item = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_value = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":140
 * 
 *     def values(self):
 *         cdef list values = []             # <<<<<<<<<<<<<<
 *         if self._items is None:
 *             self._items = self._build_items()
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_values = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":141
 *     def values(self):
 *         cdef list values = []
 *         if self._items is None:             # <<<<<<<<<<<<<<
 *             self._items = self._build_items()
 *         for item in self._items:
 */
  __pyx_t_2 = (((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->_items == Py_None);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":142
 *         cdef list values = []
 *         if self._items is None:
 *             self._items = self._build_items()             # <<<<<<<<<<<<<<
 *         for item in self._items:
 *             value = python.PyTuple_GET_ITEM(item, 1)
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__IDDict *)((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->__pyx_vtab)->_build_items(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->_items);
    __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->_items);
    ((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->_items = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":143
 *         if self._items is None:
 *             self._items = self._build_items()
 *         for item in self._items:             # <<<<<<<<<<<<<<
 *             value = python.PyTuple_GET_ITEM(item, 1)
 *             python.Py_INCREF(value)
 */
  if (PyList_CheckExact(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->_items) || PyTuple_CheckExact(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->_items)) {
    __pyx_t_3 = 0; __pyx_t_1 = ((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->_items; __Pyx_INCREF(__pyx_t_1);
  } else {
    __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->_items); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
  }
  for (;;) {
    if (likely(PyList_CheckExact(__pyx_t_1))) {
      if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
      __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++;
    } else if (likely(PyTuple_CheckExact(__pyx_t_1))) {
      if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
      __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++;
    } else {
      __pyx_t_4 = PyIter_Next(__pyx_t_1);
      if (!__pyx_t_4) {
        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_DECREF(__pyx_v_item);
    __pyx_v_item = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":144
 *             self._items = self._build_items()
 *         for item in self._items:
 *             value = python.PyTuple_GET_ITEM(item, 1)             # <<<<<<<<<<<<<<
 *             python.Py_INCREF(value)
 *             values.append(value)
 */
    __pyx_t_4 = PyTuple_GET_ITEM(__pyx_v_item, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_v_value);
    __pyx_v_value = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":145
 *         for item in self._items:
 *             value = python.PyTuple_GET_ITEM(item, 1)
 *             python.Py_INCREF(value)             # <<<<<<<<<<<<<<
 *             values.append(value)
 *         return values
 */
    Py_INCREF(__pyx_v_value);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":146
 *             value = python.PyTuple_GET_ITEM(item, 1)
 *             python.Py_INCREF(value)
 *             values.append(value)             # <<<<<<<<<<<<<<
 *         return values
 * 
 */
    if (unlikely(__pyx_v_values == Py_None)) {
      PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[15]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_5 = PyList_Append(__pyx_v_values, __pyx_v_value); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":147
 *             python.Py_INCREF(value)
 *             values.append(value)
 *         return values             # <<<<<<<<<<<<<<
 * 
 *     def itervalues(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_values));
  __pyx_r = ((PyObject *)__pyx_v_values);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._IDDict.values");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_values);
  __Pyx_DECREF(__pyx_v_item);
  __Pyx_DECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":149
 *         return values
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         return iter(self.values())
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_14itervalues(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_14itervalues(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("itervalues");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":150
 * 
 *     def itervalues(self):
 *         return iter(self.values())             # <<<<<<<<<<<<<<
 * 
 *     cdef object _build_keys(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__values); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._IDDict.itervalues");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":152
 *         return iter(self.values())
 * 
 *     cdef object _build_keys(self):             # <<<<<<<<<<<<<<
 *         keys = []
 *         tree.xmlHashScan(<tree.xmlHashTable*>self._doc._c_doc.ids,
 */

static  PyObject *__pyx_f_4lxml_5etree_7_IDDict__build_keys(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self) {
  PyObject *__pyx_v_keys;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("_build_keys");
  __pyx_v_keys = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":153
 * 
 *     cdef object _build_keys(self):
 *         keys = []             # <<<<<<<<<<<<<<
 *         tree.xmlHashScan(<tree.xmlHashTable*>self._doc._c_doc.ids,
 *                          _collectIdHashKeys, <python.PyObject*>keys)
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_DECREF(((PyObject *)__pyx_v_keys));
  __pyx_v_keys = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":155
 *         keys = []
 *         tree.xmlHashScan(<tree.xmlHashTable*>self._doc._c_doc.ids,
 *                          _collectIdHashKeys, <python.PyObject*>keys)             # <<<<<<<<<<<<<<
 *         return keys
 * 
 */
  xmlHashScan(((xmlHashTable *)__pyx_v_self->_doc->_c_doc->ids), __pyx_f_4lxml_5etree__collectIdHashKeys, ((PyObject *)__pyx_v_keys));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":156
 *         tree.xmlHashScan(<tree.xmlHashTable*>self._doc._c_doc.ids,
 *                          _collectIdHashKeys, <python.PyObject*>keys)
 *         return keys             # <<<<<<<<<<<<<<
 * 
 *     cdef object _build_items(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_keys));
  __pyx_r = ((PyObject *)__pyx_v_keys);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._IDDict._build_keys");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_keys);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":158
 *         return keys
 * 
 *     cdef object _build_items(self):             # <<<<<<<<<<<<<<
 *         items = []
 *         context = (items, self._doc)
 */

static  PyObject *__pyx_f_4lxml_5etree_7_IDDict__build_items(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self) {
  PyObject *__pyx_v_items;
  PyObject *__pyx_v_context;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("_build_items");
  __pyx_v_items = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_context = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":159
 * 
 *     cdef object _build_items(self):
 *         items = []             # <<<<<<<<<<<<<<
 *         context = (items, self._doc)
 *         tree.xmlHashScan(<tree.xmlHashTable*>self._doc._c_doc.ids,
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_DECREF(((PyObject *)__pyx_v_items));
  __pyx_v_items = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":160
 *     cdef object _build_items(self):
 *         items = []
 *         context = (items, self._doc)             # <<<<<<<<<<<<<<
 *         tree.xmlHashScan(<tree.xmlHashTable*>self._doc._c_doc.ids,
 *                          _collectIdHashItemList, <python.PyObject*>context)
 */
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(((PyObject *)__pyx_v_items));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_items));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_items));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_doc));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self->_doc));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->_doc));
  __Pyx_DECREF(((PyObject *)__pyx_v_context));
  __pyx_v_context = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":162
 *         context = (items, self._doc)
 *         tree.xmlHashScan(<tree.xmlHashTable*>self._doc._c_doc.ids,
 *                          _collectIdHashItemList, <python.PyObject*>context)             # <<<<<<<<<<<<<<
 *         return items
 * 
 */
  xmlHashScan(((xmlHashTable *)__pyx_v_self->_doc->_c_doc->ids), __pyx_f_4lxml_5etree__collectIdHashItemList, ((PyObject *)__pyx_v_context));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":163
 *         tree.xmlHashScan(<tree.xmlHashTable*>self._doc._c_doc.ids,
 *                          _collectIdHashItemList, <python.PyObject*>context)
 *         return items             # <<<<<<<<<<<<<<
 * 
 * cdef void _collectIdHashItemDict(void* payload, void* context, char* name):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_items));
  __pyx_r = ((PyObject *)__pyx_v_items);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._IDDict._build_items");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_items);
  __Pyx_DECREF(__pyx_v_context);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":165
 *         return items
 * 
 * cdef void _collectIdHashItemDict(void* payload, void* context, char* name):             # <<<<<<<<<<<<<<
 *     # collect elements from ID attribute hash table
 *     cdef tree.xmlID* c_id
 */

static  void __pyx_f_4lxml_5etree__collectIdHashItemDict(void *__pyx_v_payload, void *__pyx_v_context, char *__pyx_v_name) {
  xmlID *__pyx_v_c_id;
  PyObject *__pyx_v_dic;
  PyObject *__pyx_v_doc;
  struct LxmlElement *__pyx_v_element;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("_collectIdHashItemDict");
  __pyx_v_dic = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_doc = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_element = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":168
 *     # collect elements from ID attribute hash table
 *     cdef tree.xmlID* c_id
 *     c_id = <tree.xmlID*>payload             # <<<<<<<<<<<<<<
 *     if c_id is NULL or c_id.attr is NULL or c_id.attr.parent is NULL:
 *         return
 */
  __pyx_v_c_id = ((xmlID *)__pyx_v_payload);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":169
 *     cdef tree.xmlID* c_id
 *     c_id = <tree.xmlID*>payload
 *     if c_id is NULL or c_id.attr is NULL or c_id.attr.parent is NULL:             # <<<<<<<<<<<<<<
 *         return
 *     dic, doc = <tuple>context
 */
  __pyx_t_1 = (__pyx_v_c_id == NULL);
  if (!__pyx_t_1) {
    __pyx_t_2 = (__pyx_v_c_id->attr == NULL);
    if (!__pyx_t_2) {
      __pyx_t_3 = (__pyx_v_c_id->attr->parent == NULL);
      __pyx_t_4 = __pyx_t_3;
    } else {
      __pyx_t_4 = __pyx_t_2;
    }
    __pyx_t_2 = __pyx_t_4;
  } else {
    __pyx_t_2 = __pyx_t_1;
  }
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":170
 *     c_id = <tree.xmlID*>payload
 *     if c_id is NULL or c_id.attr is NULL or c_id.attr.parent is NULL:
 *         return             # <<<<<<<<<<<<<<
 *     dic, doc = <tuple>context
 *     element = _elementFactory(doc, c_id.attr.parent)
 */
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":171
 *     if c_id is NULL or c_id.attr is NULL or c_id.attr.parent is NULL:
 *         return
 *     dic, doc = <tuple>context             # <<<<<<<<<<<<<<
 *     element = _elementFactory(doc, c_id.attr.parent)
 *     dic[funicode(name)] = element
 */
  if (likely(((PyObject *)__pyx_v_context) != Py_None) && likely(PyTuple_GET_SIZE(((PyObject *)__pyx_v_context)) == 2)) {
    PyObject* tuple = ((PyObject *)__pyx_v_context);
    __pyx_t_5 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_5);
    __pyx_t_6 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_v_dic);
    __pyx_v_dic = __pyx_t_5;
    __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_v_doc);
    __pyx_v_doc = __pyx_t_6;
    __pyx_t_6 = 0;
  } else {
    __Pyx_UnpackTupleError(((PyObject *)__pyx_v_context), 2);
    {__pyx_filename = __pyx_f[15]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":172
 *         return
 *     dic, doc = <tuple>context
 *     element = _elementFactory(doc, c_id.attr.parent)             # <<<<<<<<<<<<<<
 *     dic[funicode(name)] = element
 * 
 */
  if (!(likely(((__pyx_v_doc) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_doc, __pyx_ptype_4lxml_5etree__Document))))) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_v_doc), __pyx_v_c_id->attr->parent)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(((PyObject *)__pyx_v_element));
  __pyx_v_element = ((struct LxmlElement *)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":173
 *     dic, doc = <tuple>context
 *     element = _elementFactory(doc, c_id.attr.parent)
 *     dic[funicode(name)] = element             # <<<<<<<<<<<<<<
 * 
 * cdef void _collectIdHashItemList(void* payload, void* context, char* name):
 */
  __pyx_t_6 = __pyx_f_4lxml_5etree_funicode(__pyx_v_name); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  if (PyObject_SetItem(__pyx_v_dic, __pyx_t_6, ((PyObject *)__pyx_v_element)) < 0) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_WriteUnraisable("lxml.etree._collectIdHashItemDict");
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_dic);
  __Pyx_DECREF(__pyx_v_doc);
  __Pyx_DECREF((PyObject *)__pyx_v_element);
  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":175
 *     dic[funicode(name)] = element
 * 
 * cdef void _collectIdHashItemList(void* payload, void* context, char* name):             # <<<<<<<<<<<<<<
 *     # collect elements from ID attribute hash table
 *     cdef tree.xmlID* c_id
 */

static  void __pyx_f_4lxml_5etree__collectIdHashItemList(void *__pyx_v_payload, void *__pyx_v_context, char *__pyx_v_name) {
  xmlID *__pyx_v_c_id;
  PyObject *__pyx_v_lst;
  PyObject *__pyx_v_doc;
  struct LxmlElement *__pyx_v_element;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  __Pyx_RefNannySetupContext("_collectIdHashItemList");
  __pyx_v_lst = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_doc = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_element = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":179
 *     cdef tree.xmlID* c_id
 *     cdef list lst
 *     c_id = <tree.xmlID*>payload             # <<<<<<<<<<<<<<
 *     if c_id is NULL or c_id.attr is NULL or c_id.attr.parent is NULL:
 *         return
 */
  __pyx_v_c_id = ((xmlID *)__pyx_v_payload);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":180
 *     cdef list lst
 *     c_id = <tree.xmlID*>payload
 *     if c_id is NULL or c_id.attr is NULL or c_id.attr.parent is NULL:             # <<<<<<<<<<<<<<
 *         return
 *     lst, doc = <tuple>context
 */
  __pyx_t_1 = (__pyx_v_c_id == NULL);
  if (!__pyx_t_1) {
    __pyx_t_2 = (__pyx_v_c_id->attr == NULL);
    if (!__pyx_t_2) {
      __pyx_t_3 = (__pyx_v_c_id->attr->parent == NULL);
      __pyx_t_4 = __pyx_t_3;
    } else {
      __pyx_t_4 = __pyx_t_2;
    }
    __pyx_t_2 = __pyx_t_4;
  } else {
    __pyx_t_2 = __pyx_t_1;
  }
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":181
 *     c_id = <tree.xmlID*>payload
 *     if c_id is NULL or c_id.attr is NULL or c_id.attr.parent is NULL:
 *         return             # <<<<<<<<<<<<<<
 *     lst, doc = <tuple>context
 *     element = _elementFactory(doc, c_id.attr.parent)
 */
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":182
 *     if c_id is NULL or c_id.attr is NULL or c_id.attr.parent is NULL:
 *         return
 *     lst, doc = <tuple>context             # <<<<<<<<<<<<<<
 *     element = _elementFactory(doc, c_id.attr.parent)
 *     lst.append( (funicode(name), element) )
 */
  if (likely(((PyObject *)__pyx_v_context) != Py_None) && likely(PyTuple_GET_SIZE(((PyObject *)__pyx_v_context)) == 2)) {
    PyObject* tuple = ((PyObject *)__pyx_v_context);
    __pyx_t_5 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_5);
    if (!(likely(PyList_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_5)->tp_name), 0))) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_6 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_6);
    __Pyx_DECREF(((PyObject *)__pyx_v_lst));
    __pyx_v_lst = ((PyObject*)__pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_v_doc);
    __pyx_v_doc = __pyx_t_6;
    __pyx_t_6 = 0;
  } else {
    __Pyx_UnpackTupleError(((PyObject *)__pyx_v_context), 2);
    {__pyx_filename = __pyx_f[15]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":183
 *         return
 *     lst, doc = <tuple>context
 *     element = _elementFactory(doc, c_id.attr.parent)             # <<<<<<<<<<<<<<
 *     lst.append( (funicode(name), element) )
 * 
 */
  if (!(likely(((__pyx_v_doc) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_doc, __pyx_ptype_4lxml_5etree__Document))))) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_v_doc), __pyx_v_c_id->attr->parent)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(((PyObject *)__pyx_v_element));
  __pyx_v_element = ((struct LxmlElement *)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":184
 *     lst, doc = <tuple>context
 *     element = _elementFactory(doc, c_id.attr.parent)
 *     lst.append( (funicode(name), element) )             # <<<<<<<<<<<<<<
 * 
 * cdef void _collectIdHashKeys(void* payload, void* collect_list, char* name):
 */
  if (unlikely(__pyx_v_lst == Py_None)) {
    PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[15]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_6 = __pyx_f_4lxml_5etree_funicode(__pyx_v_name); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  __Pyx_INCREF(((PyObject *)__pyx_v_element));
  PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_v_element));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_element));
  __pyx_t_6 = 0;
  __pyx_t_7 = PyList_Append(__pyx_v_lst, ((PyObject *)__pyx_t_5)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_WriteUnraisable("lxml.etree._collectIdHashItemList");
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_lst);
  __Pyx_DECREF(__pyx_v_doc);
  __Pyx_DECREF((PyObject *)__pyx_v_element);
  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":186
 *     lst.append( (funicode(name), element) )
 * 
 * cdef void _collectIdHashKeys(void* payload, void* collect_list, char* name):             # <<<<<<<<<<<<<<
 *     cdef tree.xmlID* c_id
 *     c_id = <tree.xmlID*>payload
 */

static  void __pyx_f_4lxml_5etree__collectIdHashKeys(void *__pyx_v_payload, void *__pyx_v_collect_list, char *__pyx_v_name) {
  xmlID *__pyx_v_c_id;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("_collectIdHashKeys");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":188
 * cdef void _collectIdHashKeys(void* payload, void* collect_list, char* name):
 *     cdef tree.xmlID* c_id
 *     c_id = <tree.xmlID*>payload             # <<<<<<<<<<<<<<
 *     if c_id is NULL or c_id.attr is NULL or c_id.attr.parent is NULL:
 *         return
 */
  __pyx_v_c_id = ((xmlID *)__pyx_v_payload);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":189
 *     cdef tree.xmlID* c_id
 *     c_id = <tree.xmlID*>payload
 *     if c_id is NULL or c_id.attr is NULL or c_id.attr.parent is NULL:             # <<<<<<<<<<<<<<
 *         return
 *     (<list>collect_list).append(funicode(name))
 */
  __pyx_t_1 = (__pyx_v_c_id == NULL);
  if (!__pyx_t_1) {
    __pyx_t_2 = (__pyx_v_c_id->attr == NULL);
    if (!__pyx_t_2) {
      __pyx_t_3 = (__pyx_v_c_id->attr->parent == NULL);
      __pyx_t_4 = __pyx_t_3;
    } else {
      __pyx_t_4 = __pyx_t_2;
    }
    __pyx_t_2 = __pyx_t_4;
  } else {
    __pyx_t_2 = __pyx_t_1;
  }
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":190
 *     c_id = <tree.xmlID*>payload
 *     if c_id is NULL or c_id.attr is NULL or c_id.attr.parent is NULL:
 *         return             # <<<<<<<<<<<<<<
 *     (<list>collect_list).append(funicode(name))
 */
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":191
 *     if c_id is NULL or c_id.attr is NULL or c_id.attr.parent is NULL:
 *         return
 *     (<list>collect_list).append(funicode(name))             # <<<<<<<<<<<<<<
 */
  if (unlikely(((PyObject*)__pyx_v_collect_list) == Py_None)) {
    PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[15]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_5 = __pyx_f_4lxml_5etree_funicode(__pyx_v_name); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyList_Append(((PyObject*)__pyx_v_collect_list), __pyx_t_5); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_WriteUnraisable("lxml.etree._collectIdHashKeys");
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xinclude.pxi":18
 *     """
 *     cdef _ErrorLog _error_log
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self._error_log = _ErrorLog()
 * 
 */

static int __pyx_pf_4lxml_5etree_8XInclude___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_8XInclude___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__init__");
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xinclude.pxi":19
 *     cdef _ErrorLog _error_log
 *     def __init__(self):
 *         self._error_log = _ErrorLog()             # <<<<<<<<<<<<<<
 * 
 *     property error_log:
 */
  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ErrorLog)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[16]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree_XInclude *)__pyx_v_self)->_error_log);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_XInclude *)__pyx_v_self)->_error_log));
  ((struct __pyx_obj_4lxml_5etree_XInclude *)__pyx_v_self)->_error_log = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_t_1);
  __pyx_t_1 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.XInclude.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xinclude.pxi":22
 * 
 *     property error_log:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             assert self._error_log is not None, "XInclude instance not initialised"
 *             return self._error_log.copy()
 */

static PyObject *__pyx_pf_4lxml_5etree_8XInclude_9error_log___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_8XInclude_9error_log___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__get__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xinclude.pxi":23
 *     property error_log:
 *         def __get__(self):
 *             assert self._error_log is not None, "XInclude instance not initialised"             # <<<<<<<<<<<<<<
 *             return self._error_log.copy()
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  __pyx_t_1 = (((PyObject *)((struct __pyx_obj_4lxml_5etree_XInclude *)__pyx_v_self)->_error_log) != Py_None);
  if (unlikely(!__pyx_t_1)) {
    PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_292));
    {__pyx_filename = __pyx_f[16]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xinclude.pxi":24
 *         def __get__(self):
 *             assert self._error_log is not None, "XInclude instance not initialised"
 *             return self._error_log.copy()             # <<<<<<<<<<<<<<
 * 
 *     def __call__(self, _Element node not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_4lxml_5etree_XInclude *)__pyx_v_self)->_error_log), __pyx_n_s__copy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[16]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[16]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.XInclude.error_log.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xinclude.pxi":26
 *             return self._error_log.copy()
 * 
 *     def __call__(self, _Element node not None):             # <<<<<<<<<<<<<<
 *         u"__call__(self, node)"
 *         # We cannot pass the XML_PARSE_NOXINCNODE option as this would free
 */

static PyObject *__pyx_pf_4lxml_5etree_8XInclude_1__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_8XInclude_1__call__[] = "__call__(self, node)";
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_8XInclude_1__call__;
static PyObject *__pyx_pf_4lxml_5etree_8XInclude_1__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct LxmlElement *__pyx_v_node = 0;
  int __pyx_v_result;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__node,0};
  __Pyx_RefNannySetupContext("__call__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[1] = {0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__node);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__call__") < 0)) {__pyx_filename = __pyx_f[16]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_node = ((struct LxmlElement *)values[0]);
  } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_node = ((struct LxmlElement *)PyTuple_GET_ITEM(__pyx_args, 0));
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[16]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.XInclude.__call__");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_node), __pyx_ptype_4lxml_5etree__Element, 0, "node", 0))) {__pyx_filename = __pyx_f[16]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xinclude.pxi":36
 *         # i.e. as a sibling, which does not conflict with traversal.
 *         cdef int result
 *         _assertValidNode(node)             # <<<<<<<<<<<<<<
 *         assert self._error_log is not None, "XPath evaluator not initialised"
 *         self._error_log.connect()
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[16]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xinclude.pxi":37
 *         cdef int result
 *         _assertValidNode(node)
 *         assert self._error_log is not None, "XPath evaluator not initialised"             # <<<<<<<<<<<<<<
 *         self._error_log.connect()
 *         __GLOBAL_PARSER_CONTEXT.pushImpliedContextFromParser(
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  __pyx_t_2 = (((PyObject *)((struct __pyx_obj_4lxml_5etree_XInclude *)__pyx_v_self)->_error_log) != Py_None);
  if (unlikely(!__pyx_t_2)) {
    PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_293));
    {__pyx_filename = __pyx_f[16]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xinclude.pxi":38
 *         _assertValidNode(node)
 *         assert self._error_log is not None, "XPath evaluator not initialised"
 *         self._error_log.connect()             # <<<<<<<<<<<<<<
 *         __GLOBAL_PARSER_CONTEXT.pushImpliedContextFromParser(
 *             node._doc._parser)
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)((struct __pyx_obj_4lxml_5etree_XInclude *)__pyx_v_self)->_error_log->__pyx_base.__pyx_base.__pyx_vtab)->connect(((struct __pyx_obj_4lxml_5etree_XInclude *)__pyx_v_self)->_error_log);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xinclude.pxi":40
 *         self._error_log.connect()
 *         __GLOBAL_PARSER_CONTEXT.pushImpliedContextFromParser(
 *             node._doc._parser)             # <<<<<<<<<<<<<<
 *         with nogil:
 *             if node._doc._parser is not None:
 */
  __pyx_t_3 = ((PyObject *)__pyx_v_node->_doc->_parser);
  __Pyx_INCREF(__pyx_t_3);
  ((struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext *)__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT->__pyx_vtab)->pushImpliedContextFromParser(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_3));
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xinclude.pxi":41
 *         __GLOBAL_PARSER_CONTEXT.pushImpliedContextFromParser(
 *             node._doc._parser)
 *         with nogil:             # <<<<<<<<<<<<<<
 *             if node._doc._parser is not None:
 *                 result = xinclude.xmlXIncludeProcessTreeFlags(
 */
  {
    #ifdef WITH_THREAD
    PyThreadState *_save;
    #endif
    Py_UNBLOCK_THREADS
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xinclude.pxi":42
 *             node._doc._parser)
 *         with nogil:
 *             if node._doc._parser is not None:             # <<<<<<<<<<<<<<
 *                 result = xinclude.xmlXIncludeProcessTreeFlags(
 *                     node._c_node, node._doc._parser._parse_options)
 */
      __pyx_t_2 = (((PyObject *)__pyx_v_node->_doc->_parser) != Py_None);
      if (__pyx_t_2) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xinclude.pxi":44
 *             if node._doc._parser is not None:
 *                 result = xinclude.xmlXIncludeProcessTreeFlags(
 *                     node._c_node, node._doc._parser._parse_options)             # <<<<<<<<<<<<<<
 *             else:
 *                 result = xinclude.xmlXIncludeProcessTree(node._c_node)
 */
        __pyx_v_result = xmlXIncludeProcessTreeFlags(__pyx_v_node->_c_node, __pyx_v_node->_doc->_parser->_parse_options);
        goto __pyx_L9;
      }
      /*else*/ {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xinclude.pxi":46
 *                     node._c_node, node._doc._parser._parse_options)
 *             else:
 *                 result = xinclude.xmlXIncludeProcessTree(node._c_node)             # <<<<<<<<<<<<<<
 *         __GLOBAL_PARSER_CONTEXT.popImpliedContext()
 *         self._error_log.disconnect()
 */
        __pyx_v_result = xmlXIncludeProcessTree(__pyx_v_node->_c_node);
      }
      __pyx_L9:;
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xinclude.pxi":41
 *         __GLOBAL_PARSER_CONTEXT.pushImpliedContextFromParser(
 *             node._doc._parser)
 *         with nogil:             # <<<<<<<<<<<<<<
 *             if node._doc._parser is not None:
 *                 result = xinclude.xmlXIncludeProcessTreeFlags(
 */
    /*finally:*/ {
      Py_BLOCK_THREADS
    }
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xinclude.pxi":47
 *             else:
 *                 result = xinclude.xmlXIncludeProcessTree(node._c_node)
 *         __GLOBAL_PARSER_CONTEXT.popImpliedContext()             # <<<<<<<<<<<<<<
 *         self._error_log.disconnect()
 * 
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext *)__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT->__pyx_vtab)->popImpliedContext(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xinclude.pxi":48
 *                 result = xinclude.xmlXIncludeProcessTree(node._c_node)
 *         __GLOBAL_PARSER_CONTEXT.popImpliedContext()
 *         self._error_log.disconnect()             # <<<<<<<<<<<<<<
 * 
 *         if result == -1:
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)((struct __pyx_obj_4lxml_5etree_XInclude *)__pyx_v_self)->_error_log->__pyx_base.__pyx_base.__pyx_vtab)->disconnect(((struct __pyx_obj_4lxml_5etree_XInclude *)__pyx_v_self)->_error_log);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xinclude.pxi":50
 *         self._error_log.disconnect()
 * 
 *         if result == -1:             # <<<<<<<<<<<<<<
 *             raise XIncludeError(
 *                 self._error_log._buildExceptionMessage(
 */
  __pyx_t_2 = (__pyx_v_result == -1);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xinclude.pxi":51
 * 
 *         if result == -1:
 *             raise XIncludeError(             # <<<<<<<<<<<<<<
 *                 self._error_log._buildExceptionMessage(
 *                     u"XInclude processing failed"),
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__XIncludeError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[16]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xinclude.pxi":52
 *         if result == -1:
 *             raise XIncludeError(
 *                 self._error_log._buildExceptionMessage(             # <<<<<<<<<<<<<<
 *                     u"XInclude processing failed"),
 *                 self._error_log)
 */
    __pyx_t_4 = ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)((struct __pyx_obj_4lxml_5etree_XInclude *)__pyx_v_self)->_error_log->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._buildExceptionMessage(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)((struct __pyx_obj_4lxml_5etree_XInclude *)__pyx_v_self)->_error_log), ((PyObject *)__pyx_kp_u_296)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[16]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xinclude.pxi":54
 *                 self._error_log._buildExceptionMessage(
 *                     u"XInclude processing failed"),
 *                 self._error_log)             # <<<<<<<<<<<<<<
 */
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[16]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_XInclude *)__pyx_v_self)->_error_log));
    PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)((struct __pyx_obj_4lxml_5etree_XInclude *)__pyx_v_self)->_error_log));
    __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_XInclude *)__pyx_v_self)->_error_log));
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[16]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[16]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L10;
  }
  __pyx_L10:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.XInclude.__call__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":3
 * # functions for tree cleanup and removing elements from subtrees
 * 
 * def cleanup_namespaces(tree_or_element):             # <<<<<<<<<<<<<<
 *     u"""cleanup_namespaces(tree_or_element)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_26cleanup_namespaces(PyObject *__pyx_self, PyObject *__pyx_v_tree_or_element); /*proto*/
static char __pyx_doc_4lxml_5etree_26cleanup_namespaces[] = "cleanup_namespaces(tree_or_element)\n\n    Remove all namespace declarations from a subtree that are not used\n    by any of the elements or attributes in that tree.\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_26cleanup_namespaces = {__Pyx_NAMESTR("cleanup_namespaces"), (PyCFunction)__pyx_pf_4lxml_5etree_26cleanup_namespaces, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_26cleanup_namespaces)};
static PyObject *__pyx_pf_4lxml_5etree_26cleanup_namespaces(PyObject *__pyx_self, PyObject *__pyx_v_tree_or_element) {
  struct LxmlElement *__pyx_v_element;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("cleanup_namespaces");
  __pyx_self = __pyx_self;
  __pyx_v_element = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":10
 *     """
 *     cdef _Element element
 *     element = _rootNodeOrRaise(tree_or_element)             # <<<<<<<<<<<<<<
 *     _removeUnusedNamespaceDeclarations(element._c_node)
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v_tree_or_element)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_element));
  __pyx_v_element = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":11
 *     cdef _Element element
 *     element = _rootNodeOrRaise(tree_or_element)
 *     _removeUnusedNamespaceDeclarations(element._c_node)             # <<<<<<<<<<<<<<
 * 
 * def strip_attributes(tree_or_element, *attribute_names):
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__removeUnusedNamespaceDeclarations(__pyx_v_element->_c_node); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.cleanup_namespaces");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_element);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":13
 *     _removeUnusedNamespaceDeclarations(element._c_node)
 * 
 * def strip_attributes(tree_or_element, *attribute_names):             # <<<<<<<<<<<<<<
 *     u"""strip_attributes(tree_or_element, *attribute_names)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_27strip_attributes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_27strip_attributes[] = "strip_attributes(tree_or_element, *attribute_names)\n\n    Delete all attributes with the provided attribute names from an\n    Element (or ElementTree) and its descendants.\n\n    Example usage::\n\n        strip_attributes(root_element,\n                         'simpleattr',\n                         '{http://some/ns}attrname')\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_27strip_attributes = {__Pyx_NAMESTR("strip_attributes"), (PyCFunction)__pyx_pf_4lxml_5etree_27strip_attributes, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_27strip_attributes)};
static PyObject *__pyx_pf_4lxml_5etree_27strip_attributes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tree_or_element = 0;
  PyObject *__pyx_v_attribute_names = 0;
  struct LxmlElement *__pyx_v_element;
  PyObject *__pyx_v_ns_tags;
  char **__pyx_v_c_ns_tags;
  Py_ssize_t __pyx_v_c_tag_count;
  PyObject *__pyx_v_attr;
  PyObject *__pyx_v_ns;
  PyObject *__pyx_v_tag;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__tree_or_element,0};
  __Pyx_RefNannySetupContext("strip_attributes");
  __pyx_self = __pyx_self;
  if (PyTuple_GET_SIZE(__pyx_args) > 1) {
    __pyx_v_attribute_names = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args)); __Pyx_GOTREF(__pyx_v_attribute_names);
    if (unlikely(!__pyx_v_attribute_names)) return NULL;
  } else {
    __pyx_v_attribute_names = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[1] = {0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      default:
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tree_or_element);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
    }
    if (unlikely(kw_args > 0)) {
      const Py_ssize_t used_pos_args = (PyTuple_GET_SIZE(__pyx_args) < 1) ? PyTuple_GET_SIZE(__pyx_args) : 1;
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "strip_attributes") < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_tree_or_element = values[0];
  } else if (PyTuple_GET_SIZE(__pyx_args) < 1) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_tree_or_element = PyTuple_GET_ITEM(__pyx_args, 0);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("strip_attributes", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_attribute_names);
  __Pyx_AddTraceback("lxml.etree.strip_attributes");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_element = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_ns_tags = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_attr = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_ns = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_tag = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":30
 *     cdef Py_ssize_t c_tag_count
 * 
 *     element = _rootNodeOrRaise(tree_or_element)             # <<<<<<<<<<<<<<
 *     if not attribute_names: return
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v_tree_or_element)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_element));
  __pyx_v_element = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":31
 * 
 *     element = _rootNodeOrRaise(tree_or_element)
 *     if not attribute_names: return             # <<<<<<<<<<<<<<
 * 
 *     ns_tags = _sortedTagList([ _getNsTag(attr)
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_attribute_names) != Py_None) && (PyTuple_GET_SIZE(((PyObject *)__pyx_v_attribute_names)) != 0);
  __pyx_t_3 = (!__pyx_t_2);
  if (__pyx_t_3) {
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":33
 *     if not attribute_names: return
 * 
 *     ns_tags = _sortedTagList([ _getNsTag(attr)             # <<<<<<<<<<<<<<
 *                                for attr in <tuple>attribute_names ])
 *     ns_tags = [ (ns, tag if tag != b'*' else None)
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":34
 * 
 *     ns_tags = _sortedTagList([ _getNsTag(attr)
 *                                for attr in <tuple>attribute_names ])             # <<<<<<<<<<<<<<
 *     ns_tags = [ (ns, tag if tag != b'*' else None)
 *                 for ns, tag in ns_tags ]
 */
  if (unlikely(__pyx_v_attribute_names == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_4 = 0; __pyx_t_5 = ((PyObject *)__pyx_v_attribute_names); __Pyx_INCREF(__pyx_t_5);
  for (;;) {
    if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
    __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++;
    __Pyx_DECREF(__pyx_v_attr);
    __pyx_v_attr = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":33
 *     if not attribute_names: return
 * 
 *     ns_tags = _sortedTagList([ _getNsTag(attr)             # <<<<<<<<<<<<<<
 *                                for attr in <tuple>attribute_names ])
 *     ns_tags = [ (ns, tag if tag != b'*' else None)
 */
    __pyx_t_6 = ((PyObject *)__pyx_f_4lxml_5etree__getNsTag(__pyx_v_attr)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    if (unlikely(PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_6))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = ((PyObject *)__pyx_f_4lxml_5etree__sortedTagList(__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_v_ns_tags));
  __pyx_v_ns_tags = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":35
 *     ns_tags = _sortedTagList([ _getNsTag(attr)
 *                                for attr in <tuple>attribute_names ])
 *     ns_tags = [ (ns, tag if tag != b'*' else None)             # <<<<<<<<<<<<<<
 *                 for ns, tag in ns_tags ]
 * 
 */
  __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":36
 *                                for attr in <tuple>attribute_names ])
 *     ns_tags = [ (ns, tag if tag != b'*' else None)
 *                 for ns, tag in ns_tags ]             # <<<<<<<<<<<<<<
 * 
 *     # tag names are passes as C pointers as this allows us to take
 */
  if (unlikely(__pyx_v_ns_tags == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_4 = 0; __pyx_t_1 = ((PyObject *)__pyx_v_ns_tags); __Pyx_INCREF(__pyx_t_1);
  for (;;) {
    if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break;
    __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++;
    if (PyTuple_CheckExact(__pyx_t_6) && likely(PyTuple_GET_SIZE(__pyx_t_6) == 2)) {
      PyObject* tuple = __pyx_t_6;
      __pyx_t_7 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_7);
      __pyx_t_8 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_v_ns);
      __pyx_v_ns = __pyx_t_7;
      __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_v_tag);
      __pyx_v_tag = __pyx_t_8;
      __pyx_t_8 = 0;
    } else {
      __pyx_t_9 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_7 = __Pyx_UnpackItem(__pyx_t_9, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = __Pyx_UnpackItem(__pyx_t_9, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      if (__Pyx_EndUnpack(__pyx_t_9, 2) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_v_ns);
      __pyx_v_ns = __pyx_t_7;
      __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_v_tag);
      __pyx_v_tag = __pyx_t_8;
      __pyx_t_8 = 0;
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":35
 *     ns_tags = _sortedTagList([ _getNsTag(attr)
 *                                for attr in <tuple>attribute_names ])
 *     ns_tags = [ (ns, tag if tag != b'*' else None)             # <<<<<<<<<<<<<<
 *                 for ns, tag in ns_tags ]
 * 
 */
    __pyx_t_8 = PyObject_RichCompare(__pyx_v_tag, ((PyObject *)__pyx_kp_b_132), Py_NE); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (__pyx_t_3) {
      __Pyx_INCREF(__pyx_v_tag);
      __pyx_t_6 = __pyx_v_tag;
    } else {
      __Pyx_INCREF(Py_None);
      __pyx_t_6 = Py_None;
    }
    __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_8));
    __Pyx_INCREF(__pyx_v_ns);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_ns);
    __Pyx_GIVEREF(__pyx_v_ns);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    __pyx_t_6 = 0;
    if (unlikely(PyList_Append(__pyx_t_5, (PyObject*)__pyx_t_8))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_INCREF(((PyObject *)__pyx_t_5));
  __Pyx_DECREF(((PyObject *)__pyx_v_ns_tags));
  __pyx_v_ns_tags = __pyx_t_5;
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":40
 *     # tag names are passes as C pointers as this allows us to take
 *     # them from the doc dict and do pointer comparisons
 *     c_ns_tags = <char**> cstd.malloc(sizeof(char*) * len(ns_tags) * 2 + 2)             # <<<<<<<<<<<<<<
 *     if c_ns_tags is NULL:
 *         python.PyErr_NoMemory()
 */
  if (unlikely(__pyx_v_ns_tags == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_4 = PyList_GET_SIZE(((PyObject *)__pyx_v_ns_tags)); 
  __pyx_v_c_ns_tags = ((char **)malloc(((((sizeof(char *)) * __pyx_t_4) * 2) + 2)));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":41
 *     # them from the doc dict and do pointer comparisons
 *     c_ns_tags = <char**> cstd.malloc(sizeof(char*) * len(ns_tags) * 2 + 2)
 *     if c_ns_tags is NULL:             # <<<<<<<<<<<<<<
 *         python.PyErr_NoMemory()
 * 
 */
  __pyx_t_3 = (__pyx_v_c_ns_tags == NULL);
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":42
 *     c_ns_tags = <char**> cstd.malloc(sizeof(char*) * len(ns_tags) * 2 + 2)
 *     if c_ns_tags is NULL:
 *         python.PyErr_NoMemory()             # <<<<<<<<<<<<<<
 * 
 *     try:
 */
    __pyx_t_5 = PyErr_NoMemory(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L11;
  }
  __pyx_L11:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":44
 *         python.PyErr_NoMemory()
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         c_tag_count = _mapTagsToCharArray(element._doc._c_doc, ns_tags, c_ns_tags)
 *         if c_tag_count > 0:
 */
  /*try:*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":45
 * 
 *     try:
 *         c_tag_count = _mapTagsToCharArray(element._doc._c_doc, ns_tags, c_ns_tags)             # <<<<<<<<<<<<<<
 *         if c_tag_count > 0:
 *             _strip_attributes(element._c_node, c_ns_tags, c_tag_count)
 */
    __pyx_t_4 = __pyx_f_4lxml_5etree__mapTagsToCharArray(__pyx_v_element->_doc->_c_doc, __pyx_v_ns_tags, __pyx_v_c_ns_tags); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L13;}
    __pyx_v_c_tag_count = __pyx_t_4;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":46
 *     try:
 *         c_tag_count = _mapTagsToCharArray(element._doc._c_doc, ns_tags, c_ns_tags)
 *         if c_tag_count > 0:             # <<<<<<<<<<<<<<
 *             _strip_attributes(element._c_node, c_ns_tags, c_tag_count)
 *     finally:
 */
    __pyx_t_3 = (__pyx_v_c_tag_count > 0);
    if (__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":47
 *         c_tag_count = _mapTagsToCharArray(element._doc._c_doc, ns_tags, c_ns_tags)
 *         if c_tag_count > 0:
 *             _strip_attributes(element._c_node, c_ns_tags, c_tag_count)             # <<<<<<<<<<<<<<
 *     finally:
 *         cstd.free(c_ns_tags)
 */
      __pyx_t_5 = __pyx_f_4lxml_5etree__strip_attributes(__pyx_v_element->_c_node, __pyx_v_c_ns_tags, __pyx_v_c_tag_count); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L13;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L15;
    }
    __pyx_L15:;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":49
 *             _strip_attributes(element._c_node, c_ns_tags, c_tag_count)
 *     finally:
 *         cstd.free(c_ns_tags)             # <<<<<<<<<<<<<<
 * 
 * cdef _strip_attributes(xmlNode* c_node, char** c_ns_tags, Py_ssize_t c_tag_count):
 */
  /*finally:*/ {
    int __pyx_why;
    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
    int __pyx_exc_lineno;
    __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 0; goto __pyx_L14;
    __pyx_L13: {
      __pyx_why = 4;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
      __pyx_exc_lineno = __pyx_lineno;
      goto __pyx_L14;
    }
    __pyx_L14:;
    free(__pyx_v_c_ns_tags);
    switch (__pyx_why) {
      case 4: {
        __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
        __pyx_lineno = __pyx_exc_lineno;
        __pyx_exc_type = 0;
        __pyx_exc_value = 0;
        __pyx_exc_tb = 0;
        goto __pyx_L1_error;
      }
    }
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("lxml.etree.strip_attributes");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_attribute_names);
  __Pyx_DECREF((PyObject *)__pyx_v_element);
  __Pyx_DECREF(__pyx_v_ns_tags);
  __Pyx_DECREF(__pyx_v_attr);
  __Pyx_DECREF(__pyx_v_ns);
  __Pyx_DECREF(__pyx_v_tag);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":51
 *         cstd.free(c_ns_tags)
 * 
 * cdef _strip_attributes(xmlNode* c_node, char** c_ns_tags, Py_ssize_t c_tag_count):             # <<<<<<<<<<<<<<
 *     cdef xmlAttr* c_attr
 *     cdef Py_ssize_t i
 */

static  PyObject *__pyx_f_4lxml_5etree__strip_attributes(xmlNode *__pyx_v_c_node, char **__pyx_v_c_ns_tags, Py_ssize_t __pyx_v_c_tag_count) {
  xmlAttr *__pyx_v_c_attr;
  Py_ssize_t __pyx_v_i;
  char *__pyx_v_c_href;
  char *__pyx_v_c_name;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("_strip_attributes");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":57
 *     cdef char* c_name
 * 
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_node, c_node, 1)             # <<<<<<<<<<<<<<
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         if c_node.properties is not NULL:
 */
  BEGIN_FOR_EACH_ELEMENT_FROM(__pyx_v_c_node, __pyx_v_c_node, 1);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":58
 * 
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_node, c_node, 1)
 *     if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         if c_node.properties is not NULL:
 *             for i in range(c_tag_count):
 */
  __pyx_t_1 = (__pyx_v_c_node->type == XML_ELEMENT_NODE);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":59
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_node, c_node, 1)
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         if c_node.properties is not NULL:             # <<<<<<<<<<<<<<
 *             for i in range(c_tag_count):
 *                 c_href = c_ns_tags[2*i]
 */
    __pyx_t_1 = (__pyx_v_c_node->properties != NULL);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":60
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         if c_node.properties is not NULL:
 *             for i in range(c_tag_count):             # <<<<<<<<<<<<<<
 *                 c_href = c_ns_tags[2*i]
 *                 c_name = c_ns_tags[2*i+1]
 */
      __pyx_t_2 = __pyx_v_c_tag_count;
      for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
        __pyx_v_i = __pyx_t_3;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":61
 *         if c_node.properties is not NULL:
 *             for i in range(c_tag_count):
 *                 c_href = c_ns_tags[2*i]             # <<<<<<<<<<<<<<
 *                 c_name = c_ns_tags[2*i+1]
 *                 # must compare attributes manually to make sure we
 */
        __pyx_v_c_href = (__pyx_v_c_ns_tags[(2 * __pyx_v_i)]);

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":62
 *             for i in range(c_tag_count):
 *                 c_href = c_ns_tags[2*i]
 *                 c_name = c_ns_tags[2*i+1]             # <<<<<<<<<<<<<<
 *                 # must compare attributes manually to make sure we
 *                 # only match on wildcard tag names if the attribute
 */
        __pyx_v_c_name = (__pyx_v_c_ns_tags[((2 * __pyx_v_i) + 1)]);

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":66
 *                 # only match on wildcard tag names if the attribute
 *                 # has no namespace
 *                 c_attr = c_node.properties             # <<<<<<<<<<<<<<
 *                 while c_attr is not NULL:
 *                     if c_name is NULL or c_attr.name == c_name:
 */
        __pyx_v_c_attr = __pyx_v_c_node->properties;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":67
 *                 # has no namespace
 *                 c_attr = c_node.properties
 *                 while c_attr is not NULL:             # <<<<<<<<<<<<<<
 *                     if c_name is NULL or c_attr.name == c_name:
 *                         if c_href is NULL:
 */
        while (1) {
          __pyx_t_1 = (__pyx_v_c_attr != NULL);
          if (!__pyx_t_1) break;

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":68
 *                 c_attr = c_node.properties
 *                 while c_attr is not NULL:
 *                     if c_name is NULL or c_attr.name == c_name:             # <<<<<<<<<<<<<<
 *                         if c_href is NULL:
 *                             if c_attr.ns is NULL or c_attr.ns.href is NULL:
 */
          __pyx_t_1 = (__pyx_v_c_name == NULL);
          if (!__pyx_t_1) {
            __pyx_t_4 = (__pyx_v_c_attr->name == __pyx_v_c_name);
            __pyx_t_5 = __pyx_t_4;
          } else {
            __pyx_t_5 = __pyx_t_1;
          }
          if (__pyx_t_5) {

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":69
 *                 while c_attr is not NULL:
 *                     if c_name is NULL or c_attr.name == c_name:
 *                         if c_href is NULL:             # <<<<<<<<<<<<<<
 *                             if c_attr.ns is NULL or c_attr.ns.href is NULL:
 *                                 tree.xmlRemoveProp(c_attr)
 */
            __pyx_t_5 = (__pyx_v_c_href == NULL);
            if (__pyx_t_5) {

              /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":70
 *                     if c_name is NULL or c_attr.name == c_name:
 *                         if c_href is NULL:
 *                             if c_attr.ns is NULL or c_attr.ns.href is NULL:             # <<<<<<<<<<<<<<
 *                                 tree.xmlRemoveProp(c_attr)
 *                                 break
 */
              __pyx_t_5 = (__pyx_v_c_attr->ns == NULL);
              if (!__pyx_t_5) {
                __pyx_t_1 = (__pyx_v_c_attr->ns->href == NULL);
                __pyx_t_4 = __pyx_t_1;
              } else {
                __pyx_t_4 = __pyx_t_5;
              }
              if (__pyx_t_4) {

                /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":71
 *                         if c_href is NULL:
 *                             if c_attr.ns is NULL or c_attr.ns.href is NULL:
 *                                 tree.xmlRemoveProp(c_attr)             # <<<<<<<<<<<<<<
 *                                 break
 *                         elif c_attr.ns is not NULL and c_attr.ns.href is not NULL:
 */
                xmlRemoveProp(__pyx_v_c_attr);

                /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":72
 *                             if c_attr.ns is NULL or c_attr.ns.href is NULL:
 *                                 tree.xmlRemoveProp(c_attr)
 *                                 break             # <<<<<<<<<<<<<<
 *                         elif c_attr.ns is not NULL and c_attr.ns.href is not NULL:
 *                             if cstd.strcmp(c_attr.ns.href, c_href) == 0:
 */
                goto __pyx_L8_break;
                goto __pyx_L11;
              }
              __pyx_L11:;
              goto __pyx_L10;
            }

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":73
 *                                 tree.xmlRemoveProp(c_attr)
 *                                 break
 *                         elif c_attr.ns is not NULL and c_attr.ns.href is not NULL:             # <<<<<<<<<<<<<<
 *                             if cstd.strcmp(c_attr.ns.href, c_href) == 0:
 *                                 tree.xmlRemoveProp(c_attr)
 */
            __pyx_t_4 = (__pyx_v_c_attr->ns != NULL);
            if (__pyx_t_4) {
              __pyx_t_5 = (__pyx_v_c_attr->ns->href != NULL);
              __pyx_t_1 = __pyx_t_5;
            } else {
              __pyx_t_1 = __pyx_t_4;
            }
            if (__pyx_t_1) {

              /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":74
 *                                 break
 *                         elif c_attr.ns is not NULL and c_attr.ns.href is not NULL:
 *                             if cstd.strcmp(c_attr.ns.href, c_href) == 0:             # <<<<<<<<<<<<<<
 *                                 tree.xmlRemoveProp(c_attr)
 *                                 break
 */
              __pyx_t_1 = (strcmp(__pyx_v_c_attr->ns->href, __pyx_v_c_href) == 0);
              if (__pyx_t_1) {

                /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":75
 *                         elif c_attr.ns is not NULL and c_attr.ns.href is not NULL:
 *                             if cstd.strcmp(c_attr.ns.href, c_href) == 0:
 *                                 tree.xmlRemoveProp(c_attr)             # <<<<<<<<<<<<<<
 *                                 break
 *                     c_attr = c_attr.next
 */
                xmlRemoveProp(__pyx_v_c_attr);

                /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":76
 *                             if cstd.strcmp(c_attr.ns.href, c_href) == 0:
 *                                 tree.xmlRemoveProp(c_attr)
 *                                 break             # <<<<<<<<<<<<<<
 *                     c_attr = c_attr.next
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 */
                goto __pyx_L8_break;
                goto __pyx_L12;
              }
              __pyx_L12:;
              goto __pyx_L10;
            }
            __pyx_L10:;
            goto __pyx_L9;
          }
          __pyx_L9:;

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":77
 *                                 tree.xmlRemoveProp(c_attr)
 *                                 break
 *                     c_attr = c_attr.next             # <<<<<<<<<<<<<<
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 * 
 */
          __pyx_v_c_attr = __pyx_v_c_attr->next;
        }
        __pyx_L8_break:;
      }
      goto __pyx_L4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":78
 *                                 break
 *                     c_attr = c_attr.next
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)             # <<<<<<<<<<<<<<
 * 
 * def strip_elements(tree_or_element, *tag_names, bint with_tail=True):
 */
  END_FOR_EACH_ELEMENT_FROM(__pyx_v_c_node);

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":80
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 * 
 * def strip_elements(tree_or_element, *tag_names, bint with_tail=True):             # <<<<<<<<<<<<<<
 *     u"""strip_elements(tree_or_element, *tag_names, with_tail=True)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_28strip_elements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_28strip_elements[] = "strip_elements(tree_or_element, *tag_names, with_tail=True)\n\n    Delete all elements with the provided tag names from a tree or\n    subtree.  This will remove the elements and their entire subtree,\n    including all their attributes, text content and descendants.  It\n    will also remove the tail text of the element unless you\n    explicitly set the ``with_tail`` option to False.\n\n    Note that this will not delete the element (or ElementTree root\n    element) that you passed even if it matches.  It will only treat\n    its descendants.  If you want to include the root element, check\n    its tag name directly before even calling this function.\n\n    Example usage::\n\n        strip_elements(some_element,\n            'simpletagname',             # non-namespaced tag\n            '{http://some/ns}tagname',   # namespaced tag\n            '{http://some/other/ns}*'    # any tag from a namespace\n            Comment                      # comments\n            )\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_28strip_elements = {__Pyx_NAMESTR("strip_elements"), (PyCFunction)__pyx_pf_4lxml_5etree_28strip_elements, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_28strip_elements)};
static PyObject *__pyx_pf_4lxml_5etree_28strip_elements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tree_or_element = 0;
  int __pyx_v_with_tail;
  PyObject *__pyx_v_tag_names = 0;
  struct LxmlElement *__pyx_v_element;
  struct LxmlDocument *__pyx_v_doc;
  PyObject *__pyx_v_ns_tags;
  char **__pyx_v_c_ns_tags;
  Py_ssize_t __pyx_v_c_tag_count;
  int __pyx_v_strip_comments;
  int __pyx_v_strip_pis;
  int __pyx_v_strip_entities;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__tree_or_element,&__pyx_n_s__with_tail,0};
  __Pyx_RefNannySetupContext("strip_elements");
  __pyx_self = __pyx_self;
  if (PyTuple_GET_SIZE(__pyx_args) > 1) {
    __pyx_v_tag_names = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args)); __Pyx_GOTREF(__pyx_v_tag_names);
    if (unlikely(!__pyx_v_tag_names)) return NULL;
  } else {
    __pyx_v_tag_names = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      default:
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tree_or_element);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
    }
    while (kw_args > 0) {
      PyObject* value;
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__with_tail);
      if (value) { values[1] = value; if (!(--kw_args)) break; }
      break;
    }
    if (unlikely(kw_args > 0)) {
      const Py_ssize_t used_pos_args = (PyTuple_GET_SIZE(__pyx_args) < 1) ? PyTuple_GET_SIZE(__pyx_args) : 1;
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "strip_elements") < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_tree_or_element = values[0];
    if (values[1]) {
      __pyx_v_with_tail = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_with_tail == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_with_tail = ((int)1);
    }
  } else if (PyTuple_GET_SIZE(__pyx_args) < 1) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_tree_or_element = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_with_tail = ((int)1);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("strip_elements", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_tag_names);
  __Pyx_AddTraceback("lxml.etree.strip_elements");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_element = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_doc = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_ns_tags = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":110
 *     cdef bint strip_comments, strip_pis, strip_entities
 * 
 *     doc = _documentOrRaise(tree_or_element)             # <<<<<<<<<<<<<<
 *     element = _rootNodeOrRaise(tree_or_element)
 *     if not tag_names: return
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v_tree_or_element)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_doc));
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":111
 * 
 *     doc = _documentOrRaise(tree_or_element)
 *     element = _rootNodeOrRaise(tree_or_element)             # <<<<<<<<<<<<<<
 *     if not tag_names: return
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v_tree_or_element)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_element));
  __pyx_v_element = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":112
 *     doc = _documentOrRaise(tree_or_element)
 *     element = _rootNodeOrRaise(tree_or_element)
 *     if not tag_names: return             # <<<<<<<<<<<<<<
 * 
 *     ns_tags = _filterSpecialTagNames(
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_tag_names) != Py_None) && (PyTuple_GET_SIZE(((PyObject *)__pyx_v_tag_names)) != 0);
  __pyx_t_3 = (!__pyx_t_2);
  if (__pyx_t_3) {
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":115
 * 
 *     ns_tags = _filterSpecialTagNames(
 *         tag_names, &strip_comments, &strip_pis, &strip_entities)             # <<<<<<<<<<<<<<
 * 
 *     if (strip_comments or strip_pis) and isinstance(tree_or_element, _ElementTree):
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__filterSpecialTagNames(((PyObject *)__pyx_v_tag_names), (&__pyx_v_strip_comments), (&__pyx_v_strip_pis), (&__pyx_v_strip_entities))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_ns_tags));
  __pyx_v_ns_tags = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":117
 *         tag_names, &strip_comments, &strip_pis, &strip_entities)
 * 
 *     if (strip_comments or strip_pis) and isinstance(tree_or_element, _ElementTree):             # <<<<<<<<<<<<<<
 *         # include PIs and comments next to the root node
 *         if strip_comments:
 */
  if (!__pyx_v_strip_comments) {
    __pyx_t_3 = __pyx_v_strip_pis;
  } else {
    __pyx_t_3 = __pyx_v_strip_comments;
  }
  if (__pyx_t_3) {
    __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_tree_or_element, ((PyObject*)__pyx_ptype_4lxml_5etree__ElementTree)); 
    __pyx_t_4 = __pyx_t_2;
  } else {
    __pyx_t_4 = __pyx_t_3;
  }
  if (__pyx_t_4) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":119
 *     if (strip_comments or strip_pis) and isinstance(tree_or_element, _ElementTree):
 *         # include PIs and comments next to the root node
 *         if strip_comments:             # <<<<<<<<<<<<<<
 *             _removeSiblings(element._c_node, tree.XML_COMMENT_NODE, with_tail)
 *         if strip_pis:
 */
    if (__pyx_v_strip_comments) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":120
 *         # include PIs and comments next to the root node
 *         if strip_comments:
 *             _removeSiblings(element._c_node, tree.XML_COMMENT_NODE, with_tail)             # <<<<<<<<<<<<<<
 *         if strip_pis:
 *             _removeSiblings(element._c_node, tree.XML_PI_NODE, with_tail)
 */
      __pyx_t_5 = __pyx_f_4lxml_5etree__removeSiblings(__pyx_v_element->_c_node, XML_COMMENT_NODE, __pyx_v_with_tail); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":121
 *         if strip_comments:
 *             _removeSiblings(element._c_node, tree.XML_COMMENT_NODE, with_tail)
 *         if strip_pis:             # <<<<<<<<<<<<<<
 *             _removeSiblings(element._c_node, tree.XML_PI_NODE, with_tail)
 * 
 */
    if (__pyx_v_strip_pis) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":122
 *             _removeSiblings(element._c_node, tree.XML_COMMENT_NODE, with_tail)
 *         if strip_pis:
 *             _removeSiblings(element._c_node, tree.XML_PI_NODE, with_tail)             # <<<<<<<<<<<<<<
 * 
 *     # tag names are passed as C pointers as this allows us to take
 */
      __pyx_t_5 = __pyx_f_4lxml_5etree__removeSiblings(__pyx_v_element->_c_node, XML_PI_NODE, __pyx_v_with_tail); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L9;
    }
    __pyx_L9:;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":126
 *     # tag names are passed as C pointers as this allows us to take
 *     # them from the doc dict and do pointer comparisons
 *     c_ns_tags = <char**> cstd.malloc(sizeof(char*) * len(ns_tags) * 2 + 2)             # <<<<<<<<<<<<<<
 *     if c_ns_tags is NULL:
 *         python.PyErr_NoMemory()
 */
  if (unlikely(__pyx_v_ns_tags == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_6 = PyList_GET_SIZE(((PyObject *)__pyx_v_ns_tags)); 
  __pyx_v_c_ns_tags = ((char **)malloc(((((sizeof(char *)) * __pyx_t_6) * 2) + 2)));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":127
 *     # them from the doc dict and do pointer comparisons
 *     c_ns_tags = <char**> cstd.malloc(sizeof(char*) * len(ns_tags) * 2 + 2)
 *     if c_ns_tags is NULL:             # <<<<<<<<<<<<<<
 *         python.PyErr_NoMemory()
 * 
 */
  __pyx_t_4 = (__pyx_v_c_ns_tags == NULL);
  if (__pyx_t_4) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":128
 *     c_ns_tags = <char**> cstd.malloc(sizeof(char*) * len(ns_tags) * 2 + 2)
 *     if c_ns_tags is NULL:
 *         python.PyErr_NoMemory()             # <<<<<<<<<<<<<<
 * 
 *     try:
 */
    __pyx_t_1 = PyErr_NoMemory(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L10;
  }
  __pyx_L10:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":130
 *         python.PyErr_NoMemory()
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         c_tag_count = _mapTagsToCharArray(doc._c_doc, ns_tags, c_ns_tags)
 *         if c_tag_count > 0 or strip_comments or strip_pis or strip_entities:
 */
  /*try:*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":131
 * 
 *     try:
 *         c_tag_count = _mapTagsToCharArray(doc._c_doc, ns_tags, c_ns_tags)             # <<<<<<<<<<<<<<
 *         if c_tag_count > 0 or strip_comments or strip_pis or strip_entities:
 *             _strip_elements(doc, element._c_node, c_ns_tags, c_tag_count,
 */
    __pyx_t_6 = __pyx_f_4lxml_5etree__mapTagsToCharArray(__pyx_v_doc->_c_doc, __pyx_v_ns_tags, __pyx_v_c_ns_tags); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L12;}
    __pyx_v_c_tag_count = __pyx_t_6;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":132
 *     try:
 *         c_tag_count = _mapTagsToCharArray(doc._c_doc, ns_tags, c_ns_tags)
 *         if c_tag_count > 0 or strip_comments or strip_pis or strip_entities:             # <<<<<<<<<<<<<<
 *             _strip_elements(doc, element._c_node, c_ns_tags, c_tag_count,
 *                             strip_comments, strip_pis, strip_entities, with_tail)
 */
    __pyx_t_4 = (__pyx_v_c_tag_count > 0);
    if (!__pyx_t_4) {
      if (!__pyx_v_strip_comments) {
        if (!__pyx_v_strip_pis) {
          __pyx_t_3 = __pyx_v_strip_entities;
        } else {
          __pyx_t_3 = __pyx_v_strip_pis;
        }
        __pyx_t_2 = __pyx_t_3;
      } else {
        __pyx_t_2 = __pyx_v_strip_comments;
      }
      __pyx_t_3 = __pyx_t_2;
    } else {
      __pyx_t_3 = __pyx_t_4;
    }
    if (__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":134
 *         if c_tag_count > 0 or strip_comments or strip_pis or strip_entities:
 *             _strip_elements(doc, element._c_node, c_ns_tags, c_tag_count,
 *                             strip_comments, strip_pis, strip_entities, with_tail)             # <<<<<<<<<<<<<<
 *     finally:
 *         cstd.free(c_ns_tags)
 */
      __pyx_t_1 = __pyx_f_4lxml_5etree__strip_elements(__pyx_v_doc, __pyx_v_element->_c_node, __pyx_v_c_ns_tags, __pyx_v_c_tag_count, __pyx_v_strip_comments, __pyx_v_strip_pis, __pyx_v_strip_entities, __pyx_v_with_tail); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L12;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L14;
    }
    __pyx_L14:;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":136
 *                             strip_comments, strip_pis, strip_entities, with_tail)
 *     finally:
 *         cstd.free(c_ns_tags)             # <<<<<<<<<<<<<<
 * 
 * cdef _strip_elements(_Document doc, xmlNode* c_node,
 */
  /*finally:*/ {
    int __pyx_why;
    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
    int __pyx_exc_lineno;
    __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 0; goto __pyx_L13;
    __pyx_L12: {
      __pyx_why = 4;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
      __pyx_exc_lineno = __pyx_lineno;
      goto __pyx_L13;
    }
    __pyx_L13:;
    free(__pyx_v_c_ns_tags);
    switch (__pyx_why) {
      case 4: {
        __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
        __pyx_lineno = __pyx_exc_lineno;
        __pyx_exc_type = 0;
        __pyx_exc_value = 0;
        __pyx_exc_tb = 0;
        goto __pyx_L1_error;
      }
    }
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.strip_elements");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_tag_names);
  __Pyx_DECREF((PyObject *)__pyx_v_element);
  __Pyx_DECREF((PyObject *)__pyx_v_doc);
  __Pyx_DECREF(__pyx_v_ns_tags);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":138
 *         cstd.free(c_ns_tags)
 * 
 * cdef _strip_elements(_Document doc, xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                      char** c_ns_tags, Py_ssize_t c_tag_count,
 *                      bint strip_comments, bint strip_pis, bint strip_entities,
 */

static  PyObject *__pyx_f_4lxml_5etree__strip_elements(struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node, char **__pyx_v_c_ns_tags, Py_ssize_t __pyx_v_c_tag_count, int __pyx_v_strip_comments, int __pyx_v_strip_pis, int __pyx_v_strip_entities, int __pyx_v_with_tail) {
  xmlNode *__pyx_v_c_child;
  xmlNode *__pyx_v_c_next;
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  __Pyx_RefNannySetupContext("_strip_elements");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":146
 *     cdef Py_ssize_t i
 * 
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_node, c_node, 1)             # <<<<<<<<<<<<<<
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         # we run through the children here to prevent any problems
 */
  BEGIN_FOR_EACH_ELEMENT_FROM(__pyx_v_c_node, __pyx_v_c_node, 1);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":147
 * 
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_node, c_node, 1)
 *     if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         # we run through the children here to prevent any problems
 *         # with the tree iteration which would occur if we unlinked the
 */
  __pyx_t_1 = (__pyx_v_c_node->type == XML_ELEMENT_NODE);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":151
 *         # with the tree iteration which would occur if we unlinked the
 *         # c_node itself
 *         c_child = _findChildForwards(c_node, 0)             # <<<<<<<<<<<<<<
 *         while c_child is not NULL:
 *             c_next = _nextElement(c_child)
 */
    __pyx_v_c_child = __pyx_f_4lxml_5etree__findChildForwards(__pyx_v_c_node, 0);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":152
 *         # c_node itself
 *         c_child = _findChildForwards(c_node, 0)
 *         while c_child is not NULL:             # <<<<<<<<<<<<<<
 *             c_next = _nextElement(c_child)
 *             if c_child.type == tree.XML_ELEMENT_NODE:
 */
    while (1) {
      __pyx_t_1 = (__pyx_v_c_child != NULL);
      if (!__pyx_t_1) break;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":153
 *         c_child = _findChildForwards(c_node, 0)
 *         while c_child is not NULL:
 *             c_next = _nextElement(c_child)             # <<<<<<<<<<<<<<
 *             if c_child.type == tree.XML_ELEMENT_NODE:
 *                 for i in range(0, c_tag_count*2, 2):
 */
      __pyx_v_c_next = __pyx_f_4lxml_5etree__nextElement(__pyx_v_c_child);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":154
 *         while c_child is not NULL:
 *             c_next = _nextElement(c_child)
 *             if c_child.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *                 for i in range(0, c_tag_count*2, 2):
 *                     if _tagMatchesExactly(c_child, c_ns_tags[i], c_ns_tags[i+1]):
 */
      __pyx_t_1 = (__pyx_v_c_child->type == XML_ELEMENT_NODE);
      if (__pyx_t_1) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":155
 *             c_next = _nextElement(c_child)
 *             if c_child.type == tree.XML_ELEMENT_NODE:
 *                 for i in range(0, c_tag_count*2, 2):             # <<<<<<<<<<<<<<
 *                     if _tagMatchesExactly(c_child, c_ns_tags[i], c_ns_tags[i+1]):
 *                         if not with_tail:
 */
        __pyx_t_2 = (__pyx_v_c_tag_count * 2);
        for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=2) {
          __pyx_v_i = __pyx_t_3;

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":156
 *             if c_child.type == tree.XML_ELEMENT_NODE:
 *                 for i in range(0, c_tag_count*2, 2):
 *                     if _tagMatchesExactly(c_child, c_ns_tags[i], c_ns_tags[i+1]):             # <<<<<<<<<<<<<<
 *                         if not with_tail:
 *                             tree.xmlUnlinkNode(c_child)
 */
          __pyx_t_1 = __pyx_f_4lxml_5etree__tagMatchesExactly(__pyx_v_c_child, (__pyx_v_c_ns_tags[__pyx_v_i]), (__pyx_v_c_ns_tags[(__pyx_v_i + 1)]));
          if (__pyx_t_1) {

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":157
 *                 for i in range(0, c_tag_count*2, 2):
 *                     if _tagMatchesExactly(c_child, c_ns_tags[i], c_ns_tags[i+1]):
 *                         if not with_tail:             # <<<<<<<<<<<<<<
 *                             tree.xmlUnlinkNode(c_child)
 *                         _removeNode(doc, c_child)
 */
            __pyx_t_1 = (!__pyx_v_with_tail);
            if (__pyx_t_1) {

              /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":158
 *                     if _tagMatchesExactly(c_child, c_ns_tags[i], c_ns_tags[i+1]):
 *                         if not with_tail:
 *                             tree.xmlUnlinkNode(c_child)             # <<<<<<<<<<<<<<
 *                         _removeNode(doc, c_child)
 *                         break
 */
              xmlUnlinkNode(__pyx_v_c_child);
              goto __pyx_L10;
            }
            __pyx_L10:;

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":159
 *                         if not with_tail:
 *                             tree.xmlUnlinkNode(c_child)
 *                         _removeNode(doc, c_child)             # <<<<<<<<<<<<<<
 *                         break
 *             elif c_child.type == tree.XML_COMMENT_NODE and strip_comments \
 */
            __pyx_t_4 = __pyx_f_4lxml_5etree__removeNode(__pyx_v_doc, __pyx_v_c_child); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":160
 *                             tree.xmlUnlinkNode(c_child)
 *                         _removeNode(doc, c_child)
 *                         break             # <<<<<<<<<<<<<<
 *             elif c_child.type == tree.XML_COMMENT_NODE and strip_comments \
 *                      or c_child.type == tree.XML_PI_NODE and strip_pis \
 */
            goto __pyx_L8_break;
            goto __pyx_L9;
          }
          __pyx_L9:;
        }
        __pyx_L8_break:;
        goto __pyx_L6;
      }

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":161
 *                         _removeNode(doc, c_child)
 *                         break
 *             elif c_child.type == tree.XML_COMMENT_NODE and strip_comments \             # <<<<<<<<<<<<<<
 *                      or c_child.type == tree.XML_PI_NODE and strip_pis \
 *                      or c_child.type == tree.XML_ENTITY_REF_NODE and strip_entities:
 */
      __pyx_t_1 = (__pyx_v_c_child->type == XML_COMMENT_NODE);
      if (__pyx_t_1) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":162
 *                         break
 *             elif c_child.type == tree.XML_COMMENT_NODE and strip_comments \
 *                      or c_child.type == tree.XML_PI_NODE and strip_pis \             # <<<<<<<<<<<<<<
 *                      or c_child.type == tree.XML_ENTITY_REF_NODE and strip_entities:
 *                 if with_tail:
 */
        __pyx_t_5 = __pyx_v_strip_comments;
      } else {
        __pyx_t_5 = __pyx_t_1;
      }
      if (!__pyx_t_5) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":163
 *             elif c_child.type == tree.XML_COMMENT_NODE and strip_comments \
 *                      or c_child.type == tree.XML_PI_NODE and strip_pis \
 *                      or c_child.type == tree.XML_ENTITY_REF_NODE and strip_entities:             # <<<<<<<<<<<<<<
 *                 if with_tail:
 *                     _removeText(c_child.next)
 */
        __pyx_t_1 = (__pyx_v_c_child->type == XML_PI_NODE);
        if (__pyx_t_1) {
          __pyx_t_6 = __pyx_v_strip_pis;
        } else {
          __pyx_t_6 = __pyx_t_1;
        }
        if (!__pyx_t_6) {
          __pyx_t_1 = (__pyx_v_c_child->type == XML_ENTITY_REF_NODE);
          if (__pyx_t_1) {
            __pyx_t_7 = __pyx_v_strip_entities;
          } else {
            __pyx_t_7 = __pyx_t_1;
          }
          __pyx_t_1 = __pyx_t_7;
        } else {
          __pyx_t_1 = __pyx_t_6;
        }
        __pyx_t_6 = __pyx_t_1;
      } else {
        __pyx_t_6 = __pyx_t_5;
      }
      if (__pyx_t_6) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":164
 *                      or c_child.type == tree.XML_PI_NODE and strip_pis \
 *                      or c_child.type == tree.XML_ENTITY_REF_NODE and strip_entities:
 *                 if with_tail:             # <<<<<<<<<<<<<<
 *                     _removeText(c_child.next)
 *                 tree.xmlUnlinkNode(c_child)
 */
        if (__pyx_v_with_tail) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":165
 *                      or c_child.type == tree.XML_ENTITY_REF_NODE and strip_entities:
 *                 if with_tail:
 *                     _removeText(c_child.next)             # <<<<<<<<<<<<<<
 *                 tree.xmlUnlinkNode(c_child)
 *                 attemptDeallocation(c_child)
 */
          __pyx_f_4lxml_5etree__removeText(__pyx_v_c_child->next);
          goto __pyx_L11;
        }
        __pyx_L11:;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":166
 *                 if with_tail:
 *                     _removeText(c_child.next)
 *                 tree.xmlUnlinkNode(c_child)             # <<<<<<<<<<<<<<
 *                 attemptDeallocation(c_child)
 *             c_child = c_next
 */
        xmlUnlinkNode(__pyx_v_c_child);

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":167
 *                     _removeText(c_child.next)
 *                 tree.xmlUnlinkNode(c_child)
 *                 attemptDeallocation(c_child)             # <<<<<<<<<<<<<<
 *             c_child = c_next
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 */
        __pyx_f_4lxml_5etree_attemptDeallocation(__pyx_v_c_child);
        goto __pyx_L6;
      }
      __pyx_L6:;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":168
 *                 tree.xmlUnlinkNode(c_child)
 *                 attemptDeallocation(c_child)
 *             c_child = c_next             # <<<<<<<<<<<<<<
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 * 
 */
      __pyx_v_c_child = __pyx_v_c_next;
    }
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":169
 *                 attemptDeallocation(c_child)
 *             c_child = c_next
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  END_FOR_EACH_ELEMENT_FROM(__pyx_v_c_node);

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._strip_elements");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":172
 * 
 * 
 * def strip_tags(tree_or_element, *tag_names):             # <<<<<<<<<<<<<<
 *     u"""strip_tags(tree_or_element, *tag_names)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_29strip_tags(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_29strip_tags[] = "strip_tags(tree_or_element, *tag_names)\n\n    Delete all elements with the provided tag names from a tree or\n    subtree.  This will remove the elements and their attributes, but\n    *not* their text/tail content or descendants.  Instead, it will\n    merge the text content and children of the element into its\n    parent.\n\n    Note that this will not delete the element (or ElementTree root\n    element) that you passed even if it matches.  It will only treat\n    its descendants.\n\n    Example usage::\n\n        strip_tags(some_element,\n            'simpletagname',             # non-namespaced tag\n            '{http://some/ns}tagname',   # namespaced tag\n            '{http://some/other/ns}*'    # any tag from a namespace\n            Comment                      # comments (including their text!)\n            )\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_29strip_tags = {__Pyx_NAMESTR("strip_tags"), (PyCFunction)__pyx_pf_4lxml_5etree_29strip_tags, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_29strip_tags)};
static PyObject *__pyx_pf_4lxml_5etree_29strip_tags(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tree_or_element = 0;
  PyObject *__pyx_v_tag_names = 0;
  struct LxmlElement *__pyx_v_element;
  struct LxmlDocument *__pyx_v_doc;
  PyObject *__pyx_v_ns_tags;
  int __pyx_v_strip_comments;
  int __pyx_v_strip_pis;
  int __pyx_v_strip_entities;
  char **__pyx_v_c_ns_tags;
  Py_ssize_t __pyx_v_c_tag_count;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__tree_or_element,0};
  __Pyx_RefNannySetupContext("strip_tags");
  __pyx_self = __pyx_self;
  if (PyTuple_GET_SIZE(__pyx_args) > 1) {
    __pyx_v_tag_names = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args)); __Pyx_GOTREF(__pyx_v_tag_names);
    if (unlikely(!__pyx_v_tag_names)) return NULL;
  } else {
    __pyx_v_tag_names = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[1] = {0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      default:
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tree_or_element);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
    }
    if (unlikely(kw_args > 0)) {
      const Py_ssize_t used_pos_args = (PyTuple_GET_SIZE(__pyx_args) < 1) ? PyTuple_GET_SIZE(__pyx_args) : 1;
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "strip_tags") < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_tree_or_element = values[0];
  } else if (PyTuple_GET_SIZE(__pyx_args) < 1) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_tree_or_element = PyTuple_GET_ITEM(__pyx_args, 0);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("strip_tags", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_tag_names);
  __Pyx_AddTraceback("lxml.etree.strip_tags");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_element = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_doc = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_ns_tags = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":201
 *     cdef Py_ssize_t c_tag_count
 * 
 *     doc = _documentOrRaise(tree_or_element)             # <<<<<<<<<<<<<<
 *     element = _rootNodeOrRaise(tree_or_element)
 *     if not tag_names: return
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v_tree_or_element)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_doc));
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":202
 * 
 *     doc = _documentOrRaise(tree_or_element)
 *     element = _rootNodeOrRaise(tree_or_element)             # <<<<<<<<<<<<<<
 *     if not tag_names: return
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v_tree_or_element)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_element));
  __pyx_v_element = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":203
 *     doc = _documentOrRaise(tree_or_element)
 *     element = _rootNodeOrRaise(tree_or_element)
 *     if not tag_names: return             # <<<<<<<<<<<<<<
 * 
 *     ns_tags = _filterSpecialTagNames(
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_tag_names) != Py_None) && (PyTuple_GET_SIZE(((PyObject *)__pyx_v_tag_names)) != 0);
  __pyx_t_3 = (!__pyx_t_2);
  if (__pyx_t_3) {
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":206
 * 
 *     ns_tags = _filterSpecialTagNames(
 *         tag_names, &strip_comments, &strip_pis, &strip_entities)             # <<<<<<<<<<<<<<
 * 
 *     if (strip_comments or strip_pis) and isinstance(tree_or_element, _ElementTree):
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__filterSpecialTagNames(((PyObject *)__pyx_v_tag_names), (&__pyx_v_strip_comments), (&__pyx_v_strip_pis), (&__pyx_v_strip_entities))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_ns_tags));
  __pyx_v_ns_tags = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":208
 *         tag_names, &strip_comments, &strip_pis, &strip_entities)
 * 
 *     if (strip_comments or strip_pis) and isinstance(tree_or_element, _ElementTree):             # <<<<<<<<<<<<<<
 *         # include PIs and comments next to the root node
 *         if strip_comments:
 */
  if (!__pyx_v_strip_comments) {
    __pyx_t_3 = __pyx_v_strip_pis;
  } else {
    __pyx_t_3 = __pyx_v_strip_comments;
  }
  if (__pyx_t_3) {
    __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_tree_or_element, ((PyObject*)__pyx_ptype_4lxml_5etree__ElementTree)); 
    __pyx_t_4 = __pyx_t_2;
  } else {
    __pyx_t_4 = __pyx_t_3;
  }
  if (__pyx_t_4) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":210
 *     if (strip_comments or strip_pis) and isinstance(tree_or_element, _ElementTree):
 *         # include PIs and comments next to the root node
 *         if strip_comments:             # <<<<<<<<<<<<<<
 *             _removeSiblings(element._c_node, tree.XML_COMMENT_NODE, 0)
 *         if strip_pis:
 */
    if (__pyx_v_strip_comments) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":211
 *         # include PIs and comments next to the root node
 *         if strip_comments:
 *             _removeSiblings(element._c_node, tree.XML_COMMENT_NODE, 0)             # <<<<<<<<<<<<<<
 *         if strip_pis:
 *             _removeSiblings(element._c_node, tree.XML_PI_NODE, 0)
 */
      __pyx_t_5 = __pyx_f_4lxml_5etree__removeSiblings(__pyx_v_element->_c_node, XML_COMMENT_NODE, 0); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":212
 *         if strip_comments:
 *             _removeSiblings(element._c_node, tree.XML_COMMENT_NODE, 0)
 *         if strip_pis:             # <<<<<<<<<<<<<<
 *             _removeSiblings(element._c_node, tree.XML_PI_NODE, 0)
 * 
 */
    if (__pyx_v_strip_pis) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":213
 *             _removeSiblings(element._c_node, tree.XML_COMMENT_NODE, 0)
 *         if strip_pis:
 *             _removeSiblings(element._c_node, tree.XML_PI_NODE, 0)             # <<<<<<<<<<<<<<
 * 
 *     # tag names are passes as C pointers as this allows us to take
 */
      __pyx_t_5 = __pyx_f_4lxml_5etree__removeSiblings(__pyx_v_element->_c_node, XML_PI_NODE, 0); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L9;
    }
    __pyx_L9:;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":217
 *     # tag names are passes as C pointers as this allows us to take
 *     # them from the doc dict and do pointer comparisons
 *     c_ns_tags = <char**> cstd.malloc(sizeof(char*) * len(ns_tags) * 2 + 2)             # <<<<<<<<<<<<<<
 *     if c_ns_tags is NULL:
 *         python.PyErr_NoMemory()
 */
  if (unlikely(__pyx_v_ns_tags == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_6 = PyList_GET_SIZE(((PyObject *)__pyx_v_ns_tags)); 
  __pyx_v_c_ns_tags = ((char **)malloc(((((sizeof(char *)) * __pyx_t_6) * 2) + 2)));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":218
 *     # them from the doc dict and do pointer comparisons
 *     c_ns_tags = <char**> cstd.malloc(sizeof(char*) * len(ns_tags) * 2 + 2)
 *     if c_ns_tags is NULL:             # <<<<<<<<<<<<<<
 *         python.PyErr_NoMemory()
 * 
 */
  __pyx_t_4 = (__pyx_v_c_ns_tags == NULL);
  if (__pyx_t_4) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":219
 *     c_ns_tags = <char**> cstd.malloc(sizeof(char*) * len(ns_tags) * 2 + 2)
 *     if c_ns_tags is NULL:
 *         python.PyErr_NoMemory()             # <<<<<<<<<<<<<<
 * 
 *     try:
 */
    __pyx_t_1 = PyErr_NoMemory(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L10;
  }
  __pyx_L10:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":221
 *         python.PyErr_NoMemory()
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         c_tag_count = _mapTagsToCharArray(doc._c_doc, ns_tags, c_ns_tags)
 *         if c_tag_count > 0 or strip_comments or strip_pis or strip_entities:
 */
  /*try:*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":222
 * 
 *     try:
 *         c_tag_count = _mapTagsToCharArray(doc._c_doc, ns_tags, c_ns_tags)             # <<<<<<<<<<<<<<
 *         if c_tag_count > 0 or strip_comments or strip_pis or strip_entities:
 *             _strip_tags(doc, element._c_node, c_ns_tags, c_tag_count,
 */
    __pyx_t_6 = __pyx_f_4lxml_5etree__mapTagsToCharArray(__pyx_v_doc->_c_doc, __pyx_v_ns_tags, __pyx_v_c_ns_tags); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L12;}
    __pyx_v_c_tag_count = __pyx_t_6;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":223
 *     try:
 *         c_tag_count = _mapTagsToCharArray(doc._c_doc, ns_tags, c_ns_tags)
 *         if c_tag_count > 0 or strip_comments or strip_pis or strip_entities:             # <<<<<<<<<<<<<<
 *             _strip_tags(doc, element._c_node, c_ns_tags, c_tag_count,
 *                         strip_comments, strip_pis, strip_entities)
 */
    __pyx_t_4 = (__pyx_v_c_tag_count > 0);
    if (!__pyx_t_4) {
      if (!__pyx_v_strip_comments) {
        if (!__pyx_v_strip_pis) {
          __pyx_t_3 = __pyx_v_strip_entities;
        } else {
          __pyx_t_3 = __pyx_v_strip_pis;
        }
        __pyx_t_2 = __pyx_t_3;
      } else {
        __pyx_t_2 = __pyx_v_strip_comments;
      }
      __pyx_t_3 = __pyx_t_2;
    } else {
      __pyx_t_3 = __pyx_t_4;
    }
    if (__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":225
 *         if c_tag_count > 0 or strip_comments or strip_pis or strip_entities:
 *             _strip_tags(doc, element._c_node, c_ns_tags, c_tag_count,
 *                         strip_comments, strip_pis, strip_entities)             # <<<<<<<<<<<<<<
 *     finally:
 *         cstd.free(c_ns_tags)
 */
      __pyx_t_1 = __pyx_f_4lxml_5etree__strip_tags(__pyx_v_doc, __pyx_v_element->_c_node, __pyx_v_c_ns_tags, __pyx_v_c_tag_count, __pyx_v_strip_comments, __pyx_v_strip_pis, __pyx_v_strip_entities); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L12;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L14;
    }
    __pyx_L14:;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":227
 *                         strip_comments, strip_pis, strip_entities)
 *     finally:
 *         cstd.free(c_ns_tags)             # <<<<<<<<<<<<<<
 * 
 * cdef _strip_tags(_Document doc, xmlNode* c_node,
 */
  /*finally:*/ {
    int __pyx_why;
    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
    int __pyx_exc_lineno;
    __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 0; goto __pyx_L13;
    __pyx_L12: {
      __pyx_why = 4;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
      __pyx_exc_lineno = __pyx_lineno;
      goto __pyx_L13;
    }
    __pyx_L13:;
    free(__pyx_v_c_ns_tags);
    switch (__pyx_why) {
      case 4: {
        __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
        __pyx_lineno = __pyx_exc_lineno;
        __pyx_exc_type = 0;
        __pyx_exc_value = 0;
        __pyx_exc_tb = 0;
        goto __pyx_L1_error;
      }
    }
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.strip_tags");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_tag_names);
  __Pyx_DECREF((PyObject *)__pyx_v_element);
  __Pyx_DECREF((PyObject *)__pyx_v_doc);
  __Pyx_DECREF(__pyx_v_ns_tags);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":229
 *         cstd.free(c_ns_tags)
 * 
 * cdef _strip_tags(_Document doc, xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                  char** c_ns_tags, Py_ssize_t c_tag_count,
 *                  bint strip_comments, bint strip_pis, bint strip_entities):
 */

static  PyObject *__pyx_f_4lxml_5etree__strip_tags(struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node, char **__pyx_v_c_ns_tags, Py_ssize_t __pyx_v_c_tag_count, int __pyx_v_strip_comments, int __pyx_v_strip_pis, int __pyx_v_strip_entities) {
  xmlNode *__pyx_v_c_child;
  xmlNode *__pyx_v_c_next;
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  xmlNode *__pyx_t_4;
  xmlNode *__pyx_t_5;
  xmlNode *__pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  __Pyx_RefNannySetupContext("_strip_tags");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":236
 *     cdef Py_ssize_t i
 * 
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_node, c_node, 1)             # <<<<<<<<<<<<<<
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         # we run through the children here to prevent any problems
 */
  BEGIN_FOR_EACH_ELEMENT_FROM(__pyx_v_c_node, __pyx_v_c_node, 1);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":237
 * 
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_node, c_node, 1)
 *     if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         # we run through the children here to prevent any problems
 *         # with the tree iteration which would occur if we unlinked the
 */
  __pyx_t_1 = (__pyx_v_c_node->type == XML_ELEMENT_NODE);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":241
 *         # with the tree iteration which would occur if we unlinked the
 *         # c_node itself
 *         c_child = _findChildForwards(c_node, 0)             # <<<<<<<<<<<<<<
 *         while c_child is not NULL:
 *             if c_child.type == tree.XML_ELEMENT_NODE:
 */
    __pyx_v_c_child = __pyx_f_4lxml_5etree__findChildForwards(__pyx_v_c_node, 0);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":242
 *         # c_node itself
 *         c_child = _findChildForwards(c_node, 0)
 *         while c_child is not NULL:             # <<<<<<<<<<<<<<
 *             if c_child.type == tree.XML_ELEMENT_NODE:
 *                 for i in range(c_tag_count):
 */
    while (1) {
      __pyx_t_1 = (__pyx_v_c_child != NULL);
      if (!__pyx_t_1) break;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":243
 *         c_child = _findChildForwards(c_node, 0)
 *         while c_child is not NULL:
 *             if c_child.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *                 for i in range(c_tag_count):
 *                     if _tagMatchesExactly(c_child, c_ns_tags[2*i], c_ns_tags[2*i+1]):
 */
      __pyx_t_1 = (__pyx_v_c_child->type == XML_ELEMENT_NODE);
      if (__pyx_t_1) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":244
 *         while c_child is not NULL:
 *             if c_child.type == tree.XML_ELEMENT_NODE:
 *                 for i in range(c_tag_count):             # <<<<<<<<<<<<<<
 *                     if _tagMatchesExactly(c_child, c_ns_tags[2*i], c_ns_tags[2*i+1]):
 *                         c_next = _findChildForwards(c_child, 0) or _nextElement(c_child)
 */
        __pyx_t_2 = __pyx_v_c_tag_count;
        for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
          __pyx_v_i = __pyx_t_3;

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":245
 *             if c_child.type == tree.XML_ELEMENT_NODE:
 *                 for i in range(c_tag_count):
 *                     if _tagMatchesExactly(c_child, c_ns_tags[2*i], c_ns_tags[2*i+1]):             # <<<<<<<<<<<<<<
 *                         c_next = _findChildForwards(c_child, 0) or _nextElement(c_child)
 *                         _replaceNodeByChildren(doc, c_child)
 */
          __pyx_t_1 = __pyx_f_4lxml_5etree__tagMatchesExactly(__pyx_v_c_child, (__pyx_v_c_ns_tags[(2 * __pyx_v_i)]), (__pyx_v_c_ns_tags[((2 * __pyx_v_i) + 1)]));
          if (__pyx_t_1) {

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":246
 *                 for i in range(c_tag_count):
 *                     if _tagMatchesExactly(c_child, c_ns_tags[2*i], c_ns_tags[2*i+1]):
 *                         c_next = _findChildForwards(c_child, 0) or _nextElement(c_child)             # <<<<<<<<<<<<<<
 *                         _replaceNodeByChildren(doc, c_child)
 *                         if not attemptDeallocation(c_child):
 */
            __pyx_t_4 = __pyx_f_4lxml_5etree__findChildForwards(__pyx_v_c_child, 0);
            if (!__pyx_t_4) {
              __pyx_t_5 = __pyx_f_4lxml_5etree__nextElement(__pyx_v_c_child);
              __pyx_t_6 = __pyx_t_5;
            } else {
              __pyx_t_6 = __pyx_t_4;
            }
            __pyx_v_c_next = __pyx_t_6;

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":247
 *                     if _tagMatchesExactly(c_child, c_ns_tags[2*i], c_ns_tags[2*i+1]):
 *                         c_next = _findChildForwards(c_child, 0) or _nextElement(c_child)
 *                         _replaceNodeByChildren(doc, c_child)             # <<<<<<<<<<<<<<
 *                         if not attemptDeallocation(c_child):
 *                             if c_child.nsDef is not NULL:
 */
            __pyx_t_7 = __pyx_f_4lxml_5etree__replaceNodeByChildren(__pyx_v_doc, __pyx_v_c_child); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":248
 *                         c_next = _findChildForwards(c_child, 0) or _nextElement(c_child)
 *                         _replaceNodeByChildren(doc, c_child)
 *                         if not attemptDeallocation(c_child):             # <<<<<<<<<<<<<<
 *                             if c_child.nsDef is not NULL:
 *                                 # make namespaces absolute
 */
            __pyx_t_1 = (!__pyx_f_4lxml_5etree_attemptDeallocation(__pyx_v_c_child));
            if (__pyx_t_1) {

              /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":249
 *                         _replaceNodeByChildren(doc, c_child)
 *                         if not attemptDeallocation(c_child):
 *                             if c_child.nsDef is not NULL:             # <<<<<<<<<<<<<<
 *                                 # make namespaces absolute
 *                                 moveNodeToDocument(doc, doc._c_doc, c_child)
 */
              __pyx_t_1 = (__pyx_v_c_child->nsDef != NULL);
              if (__pyx_t_1) {

                /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":251
 *                             if c_child.nsDef is not NULL:
 *                                 # make namespaces absolute
 *                                 moveNodeToDocument(doc, doc._c_doc, c_child)             # <<<<<<<<<<<<<<
 *                         c_child = c_next
 *                         break
 */
                __pyx_t_7 = __pyx_f_4lxml_5etree_moveNodeToDocument(__pyx_v_doc, __pyx_v_doc->_c_doc, __pyx_v_c_child); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
                goto __pyx_L11;
              }
              __pyx_L11:;
              goto __pyx_L10;
            }
            __pyx_L10:;

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":252
 *                                 # make namespaces absolute
 *                                 moveNodeToDocument(doc, doc._c_doc, c_child)
 *                         c_child = c_next             # <<<<<<<<<<<<<<
 *                         break
 *                 else:
 */
            __pyx_v_c_child = __pyx_v_c_next;

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":253
 *                                 moveNodeToDocument(doc, doc._c_doc, c_child)
 *                         c_child = c_next
 *                         break             # <<<<<<<<<<<<<<
 *                 else:
 *                     c_child = _nextElement(c_child)
 */
            goto __pyx_L8_break;
            goto __pyx_L9;
          }
          __pyx_L9:;
        }
        /*else*/ {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":255
 *                         break
 *                 else:
 *                     c_child = _nextElement(c_child)             # <<<<<<<<<<<<<<
 *             else:
 *                 c_next = _nextElement(c_child)
 */
          __pyx_v_c_child = __pyx_f_4lxml_5etree__nextElement(__pyx_v_c_child);
        }
        __pyx_L8_break:;
        goto __pyx_L6;
      }
      /*else*/ {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":257
 *                     c_child = _nextElement(c_child)
 *             else:
 *                 c_next = _nextElement(c_child)             # <<<<<<<<<<<<<<
 *                 if c_child.type == tree.XML_COMMENT_NODE and strip_comments \
 *                        or c_child.type == tree.XML_PI_NODE and strip_pis \
 */
        __pyx_v_c_next = __pyx_f_4lxml_5etree__nextElement(__pyx_v_c_child);

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":258
 *             else:
 *                 c_next = _nextElement(c_child)
 *                 if c_child.type == tree.XML_COMMENT_NODE and strip_comments \             # <<<<<<<<<<<<<<
 *                        or c_child.type == tree.XML_PI_NODE and strip_pis \
 *                        or c_child.type == tree.XML_ENTITY_REF_NODE and strip_entities:
 */
        __pyx_t_1 = (__pyx_v_c_child->type == XML_COMMENT_NODE);
        if (__pyx_t_1) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":259
 *                 c_next = _nextElement(c_child)
 *                 if c_child.type == tree.XML_COMMENT_NODE and strip_comments \
 *                        or c_child.type == tree.XML_PI_NODE and strip_pis \             # <<<<<<<<<<<<<<
 *                        or c_child.type == tree.XML_ENTITY_REF_NODE and strip_entities:
 *                     tree.xmlUnlinkNode(c_child)
 */
          __pyx_t_8 = __pyx_v_strip_comments;
        } else {
          __pyx_t_8 = __pyx_t_1;
        }
        if (!__pyx_t_8) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":260
 *                 if c_child.type == tree.XML_COMMENT_NODE and strip_comments \
 *                        or c_child.type == tree.XML_PI_NODE and strip_pis \
 *                        or c_child.type == tree.XML_ENTITY_REF_NODE and strip_entities:             # <<<<<<<<<<<<<<
 *                     tree.xmlUnlinkNode(c_child)
 *                     attemptDeallocation(c_child)
 */
          __pyx_t_1 = (__pyx_v_c_child->type == XML_PI_NODE);
          if (__pyx_t_1) {
            __pyx_t_9 = __pyx_v_strip_pis;
          } else {
            __pyx_t_9 = __pyx_t_1;
          }
          if (!__pyx_t_9) {
            __pyx_t_1 = (__pyx_v_c_child->type == XML_ENTITY_REF_NODE);
            if (__pyx_t_1) {
              __pyx_t_10 = __pyx_v_strip_entities;
            } else {
              __pyx_t_10 = __pyx_t_1;
            }
            __pyx_t_1 = __pyx_t_10;
          } else {
            __pyx_t_1 = __pyx_t_9;
          }
          __pyx_t_9 = __pyx_t_1;
        } else {
          __pyx_t_9 = __pyx_t_8;
        }
        if (__pyx_t_9) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":261
 *                        or c_child.type == tree.XML_PI_NODE and strip_pis \
 *                        or c_child.type == tree.XML_ENTITY_REF_NODE and strip_entities:
 *                     tree.xmlUnlinkNode(c_child)             # <<<<<<<<<<<<<<
 *                     attemptDeallocation(c_child)
 *                 c_child = c_next
 */
          xmlUnlinkNode(__pyx_v_c_child);

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":262
 *                        or c_child.type == tree.XML_ENTITY_REF_NODE and strip_entities:
 *                     tree.xmlUnlinkNode(c_child)
 *                     attemptDeallocation(c_child)             # <<<<<<<<<<<<<<
 *                 c_child = c_next
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 */
          __pyx_f_4lxml_5etree_attemptDeallocation(__pyx_v_c_child);
          goto __pyx_L12;
        }
        __pyx_L12:;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":263
 *                     tree.xmlUnlinkNode(c_child)
 *                     attemptDeallocation(c_child)
 *                 c_child = c_next             # <<<<<<<<<<<<<<
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 * 
 */
        __pyx_v_c_child = __pyx_v_c_next;
      }
      __pyx_L6:;
    }
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":264
 *                     attemptDeallocation(c_child)
 *                 c_child = c_next
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  END_FOR_EACH_ELEMENT_FROM(__pyx_v_c_node);

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._strip_tags");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":269
 * # helper functions
 * 
 * cdef list _sortedTagList(list l):             # <<<<<<<<<<<<<<
 *     # This is required since the namespace may be None (which Py3
 *     # can't compare to strings).  A bit of overhead, but at least
 */

static  PyObject *__pyx_f_4lxml_5etree__sortedTagList(PyObject *__pyx_v_l) {
  PyObject *__pyx_v_decorated_list;
  PyObject *__pyx_v_ns_tag;
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_v_item;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  __Pyx_RefNannySetupContext("_sortedTagList");
  __pyx_v_decorated_list = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_ns_tag = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_item = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":276
 *     cdef tuple ns_tag
 *     cdef Py_ssize_t i
 *     decorated_list = [ (ns_tag[0] or b'', ns_tag[1], i, ns_tag)             # <<<<<<<<<<<<<<
 *                        for i, ns_tag in enumerate(l) ]
 *     decorated_list.sort()
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":277
 *     cdef Py_ssize_t i
 *     decorated_list = [ (ns_tag[0] or b'', ns_tag[1], i, ns_tag)
 *                        for i, ns_tag in enumerate(l) ]             # <<<<<<<<<<<<<<
 *     decorated_list.sort()
 *     return [ item[-1] for item in decorated_list ]
 */
  __pyx_t_3 = 0; __pyx_t_4 = ((PyObject *)__pyx_v_l); __Pyx_INCREF(__pyx_t_4);
  for (;;) {
    if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_4)) break;
    __pyx_t_5 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++;
    if (!(likely(PyTuple_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_5)->tp_name), 0))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_v_ns_tag));
    __pyx_v_ns_tag = ((PyObject*)__pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_v_i = __pyx_t_2;
    __pyx_t_2 = (__pyx_t_2 + 1);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":276
 *     cdef tuple ns_tag
 *     cdef Py_ssize_t i
 *     decorated_list = [ (ns_tag[0] or b'', ns_tag[1], i, ns_tag)             # <<<<<<<<<<<<<<
 *                        for i, ns_tag in enumerate(l) ]
 *     decorated_list.sort()
 */
    __pyx_t_5 = __Pyx_GetItemInt_Tuple(((PyObject *)__pyx_v_ns_tag), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (!__pyx_t_6) {
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_INCREF(((PyObject *)__pyx_kp_b_25));
      __pyx_t_7 = __pyx_kp_b_25;
    } else {
      __pyx_t_7 = __pyx_t_5;
      __pyx_t_5 = 0;
    }
    __pyx_t_5 = __Pyx_GetItemInt_Tuple(((PyObject *)__pyx_v_ns_tag), 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_8 = PyInt_FromSsize_t(__pyx_v_i); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = PyTuple_New(4); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_9));
    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_8);
    __Pyx_INCREF(((PyObject *)__pyx_v_ns_tag));
    PyTuple_SET_ITEM(__pyx_t_9, 3, ((PyObject *)__pyx_v_ns_tag));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_ns_tag));
    __pyx_t_7 = 0;
    __pyx_t_5 = 0;
    __pyx_t_8 = 0;
    if (unlikely(PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_9))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_INCREF(((PyObject *)__pyx_t_1));
  __Pyx_DECREF(((PyObject *)__pyx_v_decorated_list));
  __pyx_v_decorated_list = __pyx_t_1;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":278
 *     decorated_list = [ (ns_tag[0] or b'', ns_tag[1], i, ns_tag)
 *                        for i, ns_tag in enumerate(l) ]
 *     decorated_list.sort()             # <<<<<<<<<<<<<<
 *     return [ item[-1] for item in decorated_list ]
 * 
 */
  if (unlikely(__pyx_v_decorated_list == Py_None)) {
    PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'sort'"); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_10 = PyList_Sort(((PyObject *)__pyx_v_decorated_list)); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":279
 *                        for i, ns_tag in enumerate(l) ]
 *     decorated_list.sort()
 *     return [ item[-1] for item in decorated_list ]             # <<<<<<<<<<<<<<
 * 
 * cdef list _filterSpecialTagNames(tag_names, bint* comments, bint* pis, bint* entities):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  if (unlikely(__pyx_v_decorated_list == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_2 = 0; __pyx_t_4 = ((PyObject *)__pyx_v_decorated_list); __Pyx_INCREF(__pyx_t_4);
  for (;;) {
    if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_4)) break;
    __pyx_t_9 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_9); __pyx_t_2++;
    __Pyx_DECREF(__pyx_v_item);
    __pyx_v_item = __pyx_t_9;
    __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_item, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    if (unlikely(PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_9))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_INCREF(((PyObject *)__pyx_t_1));
  __pyx_r = __pyx_t_1;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("lxml.etree._sortedTagList");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_decorated_list);
  __Pyx_DECREF(__pyx_v_ns_tag);
  __Pyx_DECREF(__pyx_v_item);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":281
 *     return [ item[-1] for item in decorated_list ]
 * 
 * cdef list _filterSpecialTagNames(tag_names, bint* comments, bint* pis, bint* entities):             # <<<<<<<<<<<<<<
 *     cdef list ns_tags
 *     comments[0] = 0
 */

static  PyObject *__pyx_f_4lxml_5etree__filterSpecialTagNames(PyObject *__pyx_v_tag_names, int *__pyx_v_comments, int *__pyx_v_pis, int *__pyx_v_entities) {
  PyObject *__pyx_v_ns_tags;
  PyObject *__pyx_v_tag;
  PyObject *__pyx_v_ns;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  __Pyx_RefNannySetupContext("_filterSpecialTagNames");
  __pyx_v_ns_tags = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_tag = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_ns = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":283
 * cdef list _filterSpecialTagNames(tag_names, bint* comments, bint* pis, bint* entities):
 *     cdef list ns_tags
 *     comments[0] = 0             # <<<<<<<<<<<<<<
 *     pis[0] = 0
 *     entities[0] = 0
 */
  (__pyx_v_comments[0]) = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":284
 *     cdef list ns_tags
 *     comments[0] = 0
 *     pis[0] = 0             # <<<<<<<<<<<<<<
 *     entities[0] = 0
 * 
 */
  (__pyx_v_pis[0]) = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":285
 *     comments[0] = 0
 *     pis[0] = 0
 *     entities[0] = 0             # <<<<<<<<<<<<<<
 * 
 *     ns_tags = []
 */
  (__pyx_v_entities[0]) = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":287
 *     entities[0] = 0
 * 
 *     ns_tags = []             # <<<<<<<<<<<<<<
 *     for tag in tag_names:
 *         if tag is Comment:
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_DECREF(((PyObject *)__pyx_v_ns_tags));
  __pyx_v_ns_tags = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":288
 * 
 *     ns_tags = []
 *     for tag in tag_names:             # <<<<<<<<<<<<<<
 *         if tag is Comment:
 *             comments[0] = 1
 */
  if (PyList_CheckExact(__pyx_v_tag_names) || PyTuple_CheckExact(__pyx_v_tag_names)) {
    __pyx_t_2 = 0; __pyx_t_1 = __pyx_v_tag_names; __Pyx_INCREF(__pyx_t_1);
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_tag_names); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
  }
  for (;;) {
    if (likely(PyList_CheckExact(__pyx_t_1))) {
      if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
      __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++;
    } else if (likely(PyTuple_CheckExact(__pyx_t_1))) {
      if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
      __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++;
    } else {
      __pyx_t_3 = PyIter_Next(__pyx_t_1);
      if (!__pyx_t_3) {
        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_DECREF(__pyx_v_tag);
    __pyx_v_tag = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":289
 *     ns_tags = []
 *     for tag in tag_names:
 *         if tag is Comment:             # <<<<<<<<<<<<<<
 *             comments[0] = 1
 *         elif tag is ProcessingInstruction:
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__Comment); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = (__pyx_v_tag == __pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_4) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":290
 *     for tag in tag_names:
 *         if tag is Comment:
 *             comments[0] = 1             # <<<<<<<<<<<<<<
 *         elif tag is ProcessingInstruction:
 *             pis[0] = 1
 */
      (__pyx_v_comments[0]) = 1;
      goto __pyx_L5;
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":291
 *         if tag is Comment:
 *             comments[0] = 1
 *         elif tag is ProcessingInstruction:             # <<<<<<<<<<<<<<
 *             pis[0] = 1
 *         elif tag is Entity:
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s_79); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = (__pyx_v_tag == __pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_4) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":292
 *             comments[0] = 1
 *         elif tag is ProcessingInstruction:
 *             pis[0] = 1             # <<<<<<<<<<<<<<
 *         elif tag is Entity:
 *             entities[0] = 1
 */
      (__pyx_v_pis[0]) = 1;
      goto __pyx_L5;
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":293
 *         elif tag is ProcessingInstruction:
 *             pis[0] = 1
 *         elif tag is Entity:             # <<<<<<<<<<<<<<
 *             entities[0] = 1
 *         else:
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__Entity); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = (__pyx_v_tag == __pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_4) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":294
 *             pis[0] = 1
 *         elif tag is Entity:
 *             entities[0] = 1             # <<<<<<<<<<<<<<
 *         else:
 *             ns_tags.append(_getNsTag(tag))
 */
      (__pyx_v_entities[0]) = 1;
      goto __pyx_L5;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":296
 *             entities[0] = 1
 *         else:
 *             ns_tags.append(_getNsTag(tag))             # <<<<<<<<<<<<<<
 * 
 *     return [ (ns, tag if tag != b'*' else None)
 */
      if (unlikely(__pyx_v_ns_tags == Py_None)) {
        PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
      }
      __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__getNsTag(__pyx_v_tag)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyList_Append(__pyx_v_ns_tags, __pyx_t_3); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __pyx_L5:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":298
 *             ns_tags.append(_getNsTag(tag))
 * 
 *     return [ (ns, tag if tag != b'*' else None)             # <<<<<<<<<<<<<<
 *              for ns, tag in _sortedTagList(ns_tags) ]
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":299
 * 
 *     return [ (ns, tag if tag != b'*' else None)
 *              for ns, tag in _sortedTagList(ns_tags) ]             # <<<<<<<<<<<<<<
 * 
 * cdef Py_ssize_t _mapTagsToCharArray(xmlDoc* c_doc, list ns_tags,
 */
  __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__sortedTagList(__pyx_v_ns_tags)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (unlikely(__pyx_t_3 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_2 = 0; __pyx_t_6 = __pyx_t_3; __Pyx_INCREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  for (;;) {
    if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_6)) break;
    __pyx_t_3 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++;
    if (PyTuple_CheckExact(__pyx_t_3) && likely(PyTuple_GET_SIZE(__pyx_t_3) == 2)) {
      PyObject* tuple = __pyx_t_3;
      __pyx_t_7 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_7);
      __pyx_t_8 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_v_ns);
      __pyx_v_ns = __pyx_t_7;
      __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_v_tag);
      __pyx_v_tag = __pyx_t_8;
      __pyx_t_8 = 0;
    } else {
      __pyx_t_9 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = __Pyx_UnpackItem(__pyx_t_9, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = __Pyx_UnpackItem(__pyx_t_9, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      if (__Pyx_EndUnpack(__pyx_t_9, 2) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_v_ns);
      __pyx_v_ns = __pyx_t_7;
      __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_v_tag);
      __pyx_v_tag = __pyx_t_8;
      __pyx_t_8 = 0;
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":298
 *             ns_tags.append(_getNsTag(tag))
 * 
 *     return [ (ns, tag if tag != b'*' else None)             # <<<<<<<<<<<<<<
 *              for ns, tag in _sortedTagList(ns_tags) ]
 * 
 */
    __pyx_t_8 = PyObject_RichCompare(__pyx_v_tag, ((PyObject *)__pyx_kp_b_132), Py_NE); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (__pyx_t_4) {
      __Pyx_INCREF(__pyx_v_tag);
      __pyx_t_3 = __pyx_v_tag;
    } else {
      __Pyx_INCREF(Py_None);
      __pyx_t_3 = Py_None;
    }
    __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_8));
    __Pyx_INCREF(__pyx_v_ns);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_ns);
    __Pyx_GIVEREF(__pyx_v_ns);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;
    if (unlikely(PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_8))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_INCREF(((PyObject *)__pyx_t_1));
  __pyx_r = __pyx_t_1;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("lxml.etree._filterSpecialTagNames");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_ns_tags);
  __Pyx_DECREF(__pyx_v_tag);
  __Pyx_DECREF(__pyx_v_ns);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":301
 *              for ns, tag in _sortedTagList(ns_tags) ]
 * 
 * cdef Py_ssize_t _mapTagsToCharArray(xmlDoc* c_doc, list ns_tags,             # <<<<<<<<<<<<<<
 *                                     char** c_ns_tags) except -1:
 *     cdef Py_ssize_t count = 0
 */

static  Py_ssize_t __pyx_f_4lxml_5etree__mapTagsToCharArray(xmlDoc *__pyx_v_c_doc, PyObject *__pyx_v_ns_tags, char **__pyx_v_c_ns_tags) {
  Py_ssize_t __pyx_v_count;
  char *__pyx_v_c_tag;
  PyObject *__pyx_v_ns;
  PyObject *__pyx_v_tag;
  Py_ssize_t __pyx_r;
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  __Pyx_RefNannySetupContext("_mapTagsToCharArray");
  __pyx_v_ns = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_tag = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":303
 * cdef Py_ssize_t _mapTagsToCharArray(xmlDoc* c_doc, list ns_tags,
 *                                     char** c_ns_tags) except -1:
 *     cdef Py_ssize_t count = 0             # <<<<<<<<<<<<<<
 *     cdef char* c_tag
 *     for ns, tag in ns_tags:
 */
  __pyx_v_count = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":305
 *     cdef Py_ssize_t count = 0
 *     cdef char* c_tag
 *     for ns, tag in ns_tags:             # <<<<<<<<<<<<<<
 *         if ns is None:
 *             c_ns_tags[0] = NULL
 */
  if (unlikely(__pyx_v_ns_tags == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_1 = 0; __pyx_t_2 = ((PyObject *)__pyx_v_ns_tags); __Pyx_INCREF(__pyx_t_2);
  for (;;) {
    if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_2)) break;
    __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++;
    if (PyTuple_CheckExact(__pyx_t_3) && likely(PyTuple_GET_SIZE(__pyx_t_3) == 2)) {
      PyObject* tuple = __pyx_t_3;
      __pyx_t_4 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_4);
      __pyx_t_5 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_v_ns);
      __pyx_v_ns = __pyx_t_4;
      __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_v_tag);
      __pyx_v_tag = __pyx_t_5;
      __pyx_t_5 = 0;
    } else {
      __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_4 = __Pyx_UnpackItem(__pyx_t_6, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_UnpackItem(__pyx_t_6, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_EndUnpack(__pyx_t_6, 2) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_v_ns);
      __pyx_v_ns = __pyx_t_4;
      __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_v_tag);
      __pyx_v_tag = __pyx_t_5;
      __pyx_t_5 = 0;
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":306
 *     cdef char* c_tag
 *     for ns, tag in ns_tags:
 *         if ns is None:             # <<<<<<<<<<<<<<
 *             c_ns_tags[0] = NULL
 *         else:
 */
    __pyx_t_7 = (__pyx_v_ns == Py_None);
    if (__pyx_t_7) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":307
 *     for ns, tag in ns_tags:
 *         if ns is None:
 *             c_ns_tags[0] = NULL             # <<<<<<<<<<<<<<
 *         else:
 *             c_ns_tags[0] = _cstr(ns)
 */
      (__pyx_v_c_ns_tags[0]) = NULL;
      goto __pyx_L5;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":309
 *             c_ns_tags[0] = NULL
 *         else:
 *             c_ns_tags[0] = _cstr(ns)             # <<<<<<<<<<<<<<
 *         if tag is None:
 *             c_ns_tags[1] = NULL
 */
      (__pyx_v_c_ns_tags[0]) = PyBytes_AS_STRING(__pyx_v_ns);
    }
    __pyx_L5:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":310
 *         else:
 *             c_ns_tags[0] = _cstr(ns)
 *         if tag is None:             # <<<<<<<<<<<<<<
 *             c_ns_tags[1] = NULL
 *         else:
 */
    __pyx_t_7 = (__pyx_v_tag == Py_None);
    if (__pyx_t_7) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":311
 *             c_ns_tags[0] = _cstr(ns)
 *         if tag is None:
 *             c_ns_tags[1] = NULL             # <<<<<<<<<<<<<<
 *         else:
 *             c_tag = _cstr(tag)
 */
      (__pyx_v_c_ns_tags[1]) = NULL;
      goto __pyx_L6;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":313
 *             c_ns_tags[1] = NULL
 *         else:
 *             c_tag = _cstr(tag)             # <<<<<<<<<<<<<<
 *             c_ns_tags[1] = tree.xmlDictExists(
 *                 c_doc.dict, c_tag, cstd.strlen(c_tag))
 */
      __pyx_v_c_tag = PyBytes_AS_STRING(__pyx_v_tag);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":314
 *         else:
 *             c_tag = _cstr(tag)
 *             c_ns_tags[1] = tree.xmlDictExists(             # <<<<<<<<<<<<<<
 *                 c_doc.dict, c_tag, cstd.strlen(c_tag))
 *             if c_ns_tags[1] == NULL:
 */
      (__pyx_v_c_ns_tags[1]) = xmlDictExists(__pyx_v_c_doc->dict, __pyx_v_c_tag, strlen(__pyx_v_c_tag));

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":316
 *             c_ns_tags[1] = tree.xmlDictExists(
 *                 c_doc.dict, c_tag, cstd.strlen(c_tag))
 *             if c_ns_tags[1] == NULL:             # <<<<<<<<<<<<<<
 *                 # not in the dict => not in the document
 *                 continue
 */
      __pyx_t_7 = ((__pyx_v_c_ns_tags[1]) == NULL);
      if (__pyx_t_7) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":318
 *             if c_ns_tags[1] == NULL:
 *                 # not in the dict => not in the document
 *                 continue             # <<<<<<<<<<<<<<
 *         c_ns_tags += 2
 *         count += 1
 */
        goto __pyx_L3_continue;
        goto __pyx_L7;
      }
      __pyx_L7:;
    }
    __pyx_L6:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":319
 *                 # not in the dict => not in the document
 *                 continue
 *         c_ns_tags += 2             # <<<<<<<<<<<<<<
 *         count += 1
 *     return count
 */
    __pyx_v_c_ns_tags = (__pyx_v_c_ns_tags + 2);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":320
 *                 continue
 *         c_ns_tags += 2
 *         count += 1             # <<<<<<<<<<<<<<
 *     return count
 */
    __pyx_v_count = (__pyx_v_count + 1);
    __pyx_L3_continue:;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":321
 *         c_ns_tags += 2
 *         count += 1
 *     return count             # <<<<<<<<<<<<<<
 */
  __pyx_r = __pyx_v_count;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._mapTagsToCharArray");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_ns);
  __Pyx_DECREF(__pyx_v_tag);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":45
 *     cdef set _temp_documents
 *     cdef _ExceptionContext _exc
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._xpathCtxt = NULL
 * 
 */

static int __pyx_pf_4lxml_5etree_12_BaseContext___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_12_BaseContext___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("__cinit__");
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":46
 *     cdef _ExceptionContext _exc
 *     def __cinit__(self):
 *         self._xpathCtxt = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, namespaces, extensions, enable_regexp,
 */
  ((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)->_xpathCtxt = NULL;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":48
 *         self._xpathCtxt = NULL
 * 
 *     def __init__(self, namespaces, extensions, enable_regexp,             # <<<<<<<<<<<<<<
 *                  build_smart_strings):
 *         cdef _ExsltRegExp _regexp
 */

static int __pyx_pf_4lxml_5etree_12_BaseContext_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_12_BaseContext_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_namespaces = 0;
  PyObject *__pyx_v_extensions = 0;
  PyObject *__pyx_v_enable_regexp = 0;
  PyObject *__pyx_v_build_smart_strings = 0;
  struct __pyx_obj_4lxml_5etree__ExsltRegExp *__pyx_v__regexp;
  PyObject *__pyx_v_new_extensions;
  PyObject *__pyx_v_ns;
  PyObject *__pyx_v_extension;
  PyObject *__pyx_v_ns_uri;
  PyObject *__pyx_v_name;
  PyObject *__pyx_v_function;
  PyObject *__pyx_v_ns_utf;
  PyObject *__pyx_v_name_utf;
  PyObject *__pyx_v_prefix;
  PyObject *__pyx_v_prefix_utf;
  PyObject *__pyx_v_ns_uri_utf;
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  int __pyx_t_13;
  int __pyx_t_14;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__namespaces,&__pyx_n_s__extensions,&__pyx_n_s__enable_regexp,&__pyx_n_s__build_smart_strings,0};
  __Pyx_RefNannySetupContext("__init__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[4] = {0,0,0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__namespaces);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__extensions);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 1); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__enable_regexp);
      if (likely(values[2])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 2); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  3:
      values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__build_smart_strings);
      if (likely(values[3])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 3); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_namespaces = values[0];
    __pyx_v_extensions = values[1];
    __pyx_v_enable_regexp = values[2];
    __pyx_v_build_smart_strings = values[3];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_namespaces = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_extensions = PyTuple_GET_ITEM(__pyx_args, 1);
    __pyx_v_enable_regexp = PyTuple_GET_ITEM(__pyx_args, 2);
    __pyx_v_build_smart_strings = PyTuple_GET_ITEM(__pyx_args, 3);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._BaseContext.__init__");
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF(__pyx_v_namespaces);
  __Pyx_INCREF(__pyx_v_extensions);
  __pyx_v__regexp = ((struct __pyx_obj_4lxml_5etree__ExsltRegExp *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_new_extensions = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_ns = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_extension = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_ns_uri = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_name = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_function = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_ns_utf = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_name_utf = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_prefix = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_prefix_utf = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_ns_uri_utf = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":53
 *         cdef dict new_extensions
 *         cdef list ns
 *         self._utf_refs = {}             # <<<<<<<<<<<<<<
 *         self._global_namespaces = []
 *         self._function_cache = {}
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)->_utf_refs);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)->_utf_refs));
  ((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)->_utf_refs = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":54
 *         cdef list ns
 *         self._utf_refs = {}
 *         self._global_namespaces = []             # <<<<<<<<<<<<<<
 *         self._function_cache = {}
 *         self._eval_context_dict = None
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)->_global_namespaces);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)->_global_namespaces));
  ((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)->_global_namespaces = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":55
 *         self._utf_refs = {}
 *         self._global_namespaces = []
 *         self._function_cache = {}             # <<<<<<<<<<<<<<
 *         self._eval_context_dict = None
 * 
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)->_function_cache);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)->_function_cache));
  ((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)->_function_cache = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":56
 *         self._global_namespaces = []
 *         self._function_cache = {}
 *         self._eval_context_dict = None             # <<<<<<<<<<<<<<
 * 
 *         if extensions is not None:
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)->_eval_context_dict);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)->_eval_context_dict));
  ((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)->_eval_context_dict = ((PyObject*)Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":58
 *         self._eval_context_dict = None
 * 
 *         if extensions is not None:             # <<<<<<<<<<<<<<
 *             # convert extensions to UTF-8
 *             if python.PyDict_Check(extensions):
 */
  __pyx_t_2 = (__pyx_v_extensions != Py_None);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":60
 *         if extensions is not None:
 *             # convert extensions to UTF-8
 *             if python.PyDict_Check(extensions):             # <<<<<<<<<<<<<<
 *                 extensions = (extensions,)
 *             # format: [ {(ns, name):function} ] -> {(ns_utf, name_utf):function}
 */
    __pyx_t_2 = PyDict_Check(__pyx_v_extensions);
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":61
 *             # convert extensions to UTF-8
 *             if python.PyDict_Check(extensions):
 *                 extensions = (extensions,)             # <<<<<<<<<<<<<<
 *             # format: [ {(ns, name):function} ] -> {(ns_utf, name_utf):function}
 *             new_extensions = {}
 */
      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      __Pyx_INCREF(__pyx_v_extensions);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_extensions);
      __Pyx_GIVEREF(__pyx_v_extensions);
      __Pyx_DECREF(__pyx_v_extensions);
      __pyx_v_extensions = ((PyObject *)__pyx_t_1);
      __pyx_t_1 = 0;
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":63
 *                 extensions = (extensions,)
 *             # format: [ {(ns, name):function} ] -> {(ns_utf, name_utf):function}
 *             new_extensions = {}             # <<<<<<<<<<<<<<
 *             for extension in extensions:
 *                 for (ns_uri, name), function in extension.items():
 */
    __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __Pyx_DECREF(((PyObject *)__pyx_v_new_extensions));
    __pyx_v_new_extensions = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":64
 *             # format: [ {(ns, name):function} ] -> {(ns_utf, name_utf):function}
 *             new_extensions = {}
 *             for extension in extensions:             # <<<<<<<<<<<<<<
 *                 for (ns_uri, name), function in extension.items():
 *                     if name is None:
 */
    if (PyList_CheckExact(__pyx_v_extensions) || PyTuple_CheckExact(__pyx_v_extensions)) {
      __pyx_t_3 = 0; __pyx_t_1 = __pyx_v_extensions; __Pyx_INCREF(__pyx_t_1);
    } else {
      __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_extensions); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
    }
    for (;;) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++;
      } else if (likely(PyTuple_CheckExact(__pyx_t_1))) {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++;
      } else {
        __pyx_t_4 = PyIter_Next(__pyx_t_1);
        if (!__pyx_t_4) {
          if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          break;
        }
        __Pyx_GOTREF(__pyx_t_4);
      }
      __Pyx_DECREF(__pyx_v_extension);
      __pyx_v_extension = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":65
 *             new_extensions = {}
 *             for extension in extensions:
 *                 for (ns_uri, name), function in extension.items():             # <<<<<<<<<<<<<<
 *                     if name is None:
 *                         raise ValueError, u"extensions must have non empty names"
 */
      __pyx_t_4 = PyObject_GetAttr(__pyx_v_extension, __pyx_n_s__items); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (PyList_CheckExact(__pyx_t_6) || PyTuple_CheckExact(__pyx_t_6)) {
        __pyx_t_5 = 0; __pyx_t_4 = __pyx_t_6; __Pyx_INCREF(__pyx_t_4);
      } else {
        __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      for (;;) {
        if (likely(PyList_CheckExact(__pyx_t_4))) {
          if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
          __pyx_t_6 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_6); __pyx_t_5++;
        } else if (likely(PyTuple_CheckExact(__pyx_t_4))) {
          if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
          __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_6); __pyx_t_5++;
        } else {
          __pyx_t_6 = PyIter_Next(__pyx_t_4);
          if (!__pyx_t_6) {
            if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            break;
          }
          __Pyx_GOTREF(__pyx_t_6);
        }
        if (PyTuple_CheckExact(__pyx_t_6) && likely(PyTuple_GET_SIZE(__pyx_t_6) == 2)) {
          PyObject* tuple = __pyx_t_6;
          __pyx_t_7 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_7);
          __pyx_t_8 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          if (PyTuple_CheckExact(__pyx_t_7) && likely(PyTuple_GET_SIZE(__pyx_t_7) == 2)) {
            PyObject* tuple = __pyx_t_7;
            __pyx_t_9 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_9);
            __pyx_t_10 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_10);
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            __Pyx_DECREF(__pyx_v_ns_uri);
            __pyx_v_ns_uri = __pyx_t_9;
            __pyx_t_9 = 0;
            __Pyx_DECREF(__pyx_v_name);
            __pyx_v_name = __pyx_t_10;
            __pyx_t_10 = 0;
          } else {
            __pyx_t_11 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_11);
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            __pyx_t_9 = __Pyx_UnpackItem(__pyx_t_11, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_9);
            __pyx_t_10 = __Pyx_UnpackItem(__pyx_t_11, 1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_10);
            if (__Pyx_EndUnpack(__pyx_t_11, 2) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
            __Pyx_DECREF(__pyx_v_ns_uri);
            __pyx_v_ns_uri = __pyx_t_9;
            __pyx_t_9 = 0;
            __Pyx_DECREF(__pyx_v_name);
            __pyx_v_name = __pyx_t_10;
            __pyx_t_10 = 0;
          }
          __Pyx_DECREF(__pyx_v_function);
          __pyx_v_function = __pyx_t_8;
          __pyx_t_8 = 0;
        } else {
          __pyx_t_10 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_7 = __Pyx_UnpackItem(__pyx_t_10, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_8 = __Pyx_UnpackItem(__pyx_t_10, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_8);
          if (__Pyx_EndUnpack(__pyx_t_10, 2) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          if (PyTuple_CheckExact(__pyx_t_7) && likely(PyTuple_GET_SIZE(__pyx_t_7) == 2)) {
            PyObject* tuple = __pyx_t_7;
            __pyx_t_10 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_10);
            __pyx_t_9 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_9);
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            __Pyx_DECREF(__pyx_v_ns_uri);
            __pyx_v_ns_uri = __pyx_t_10;
            __pyx_t_10 = 0;
            __Pyx_DECREF(__pyx_v_name);
            __pyx_v_name = __pyx_t_9;
            __pyx_t_9 = 0;
          } else {
            __pyx_t_11 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_11);
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            __pyx_t_10 = __Pyx_UnpackItem(__pyx_t_11, 0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_10);
            __pyx_t_9 = __Pyx_UnpackItem(__pyx_t_11, 1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_9);
            if (__Pyx_EndUnpack(__pyx_t_11, 2) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
            __Pyx_DECREF(__pyx_v_ns_uri);
            __pyx_v_ns_uri = __pyx_t_10;
            __pyx_t_10 = 0;
            __Pyx_DECREF(__pyx_v_name);
            __pyx_v_name = __pyx_t_9;
            __pyx_t_9 = 0;
          }
          __Pyx_DECREF(__pyx_v_function);
          __pyx_v_function = __pyx_t_8;
          __pyx_t_8 = 0;
        }

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":66
 *             for extension in extensions:
 *                 for (ns_uri, name), function in extension.items():
 *                     if name is None:             # <<<<<<<<<<<<<<
 *                         raise ValueError, u"extensions must have non empty names"
 *                     ns_utf   = self._to_utf(ns_uri)
 */
        __pyx_t_2 = (__pyx_v_name == Py_None);
        if (__pyx_t_2) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":67
 *                 for (ns_uri, name), function in extension.items():
 *                     if name is None:
 *                         raise ValueError, u"extensions must have non empty names"             # <<<<<<<<<<<<<<
 *                     ns_utf   = self._to_utf(ns_uri)
 *                     name_utf = self._to_utf(name)
 */
          __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_u_155), 0);
          {__pyx_filename = __pyx_f[6]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          goto __pyx_L12;
        }
        __pyx_L12:;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":68
 *                     if name is None:
 *                         raise ValueError, u"extensions must have non empty names"
 *                     ns_utf   = self._to_utf(ns_uri)             # <<<<<<<<<<<<<<
 *                     name_utf = self._to_utf(name)
 *                     new_extensions[(ns_utf, name_utf)] = function
 */
        __pyx_t_6 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseContext *)((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)->__pyx_vtab)->_to_utf(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self), __pyx_v_ns_uri); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_v_ns_utf);
        __pyx_v_ns_utf = __pyx_t_6;
        __pyx_t_6 = 0;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":69
 *                         raise ValueError, u"extensions must have non empty names"
 *                     ns_utf   = self._to_utf(ns_uri)
 *                     name_utf = self._to_utf(name)             # <<<<<<<<<<<<<<
 *                     new_extensions[(ns_utf, name_utf)] = function
 *             extensions = new_extensions or None
 */
        __pyx_t_6 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseContext *)((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)->__pyx_vtab)->_to_utf(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self), __pyx_v_name); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_v_name_utf);
        __pyx_v_name_utf = __pyx_t_6;
        __pyx_t_6 = 0;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":70
 *                     ns_utf   = self._to_utf(ns_uri)
 *                     name_utf = self._to_utf(name)
 *                     new_extensions[(ns_utf, name_utf)] = function             # <<<<<<<<<<<<<<
 *             extensions = new_extensions or None
 * 
 */
        __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_6));
        __Pyx_INCREF(__pyx_v_ns_utf);
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_ns_utf);
        __Pyx_GIVEREF(__pyx_v_ns_utf);
        __Pyx_INCREF(__pyx_v_name_utf);
        PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_name_utf);
        __Pyx_GIVEREF(__pyx_v_name_utf);
        if (PyDict_SetItem(((PyObject *)__pyx_v_new_extensions), ((PyObject *)__pyx_t_6), __pyx_v_function) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":71
 *                     name_utf = self._to_utf(name)
 *                     new_extensions[(ns_utf, name_utf)] = function
 *             extensions = new_extensions or None             # <<<<<<<<<<<<<<
 * 
 *         if namespaces is not None:
 */
    __pyx_t_2 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_new_extensions)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (!__pyx_t_2) {
      __Pyx_INCREF(Py_None);
      __pyx_t_1 = Py_None;
    } else {
      __Pyx_INCREF(((PyObject *)__pyx_v_new_extensions));
      __pyx_t_1 = __pyx_v_new_extensions;
    }
    __Pyx_DECREF(__pyx_v_extensions);
    __pyx_v_extensions = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":73
 *             extensions = new_extensions or None
 * 
 *         if namespaces is not None:             # <<<<<<<<<<<<<<
 *             if python.PyDict_Check(namespaces):
 *                 namespaces = namespaces.items()
 */
  __pyx_t_2 = (__pyx_v_namespaces != Py_None);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":74
 * 
 *         if namespaces is not None:
 *             if python.PyDict_Check(namespaces):             # <<<<<<<<<<<<<<
 *                 namespaces = namespaces.items()
 *             if namespaces:
 */
    __pyx_t_2 = PyDict_Check(__pyx_v_namespaces);
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":75
 *         if namespaces is not None:
 *             if python.PyDict_Check(namespaces):
 *                 namespaces = namespaces.items()             # <<<<<<<<<<<<<<
 *             if namespaces:
 *                 ns = []
 */
      __pyx_t_1 = PyObject_GetAttr(__pyx_v_namespaces, __pyx_n_s__items); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_v_namespaces);
      __pyx_v_namespaces = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L14;
    }
    __pyx_L14:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":76
 *             if python.PyDict_Check(namespaces):
 *                 namespaces = namespaces.items()
 *             if namespaces:             # <<<<<<<<<<<<<<
 *                 ns = []
 *                 for prefix, ns_uri in namespaces:
 */
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_namespaces); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":77
 *                 namespaces = namespaces.items()
 *             if namespaces:
 *                 ns = []             # <<<<<<<<<<<<<<
 *                 for prefix, ns_uri in namespaces:
 *                     if prefix is None or not prefix:
 */
      __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      __Pyx_DECREF(((PyObject *)__pyx_v_ns));
      __pyx_v_ns = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":78
 *             if namespaces:
 *                 ns = []
 *                 for prefix, ns_uri in namespaces:             # <<<<<<<<<<<<<<
 *                     if prefix is None or not prefix:
 *                         raise TypeError, \
 */
      if (PyList_CheckExact(__pyx_v_namespaces) || PyTuple_CheckExact(__pyx_v_namespaces)) {
        __pyx_t_3 = 0; __pyx_t_4 = __pyx_v_namespaces; __Pyx_INCREF(__pyx_t_4);
      } else {
        __pyx_t_3 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_namespaces); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
      }
      for (;;) {
        if (likely(PyList_CheckExact(__pyx_t_4))) {
          if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_4)) break;
          __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++;
        } else if (likely(PyTuple_CheckExact(__pyx_t_4))) {
          if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
          __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++;
        } else {
          __pyx_t_1 = PyIter_Next(__pyx_t_4);
          if (!__pyx_t_1) {
            if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            break;
          }
          __Pyx_GOTREF(__pyx_t_1);
        }
        if (PyTuple_CheckExact(__pyx_t_1) && likely(PyTuple_GET_SIZE(__pyx_t_1) == 2)) {
          PyObject* tuple = __pyx_t_1;
          __pyx_t_6 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_6);
          __pyx_t_8 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_v_prefix);
          __pyx_v_prefix = __pyx_t_6;
          __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_v_ns_uri);
          __pyx_v_ns_uri = __pyx_t_8;
          __pyx_t_8 = 0;
        } else {
          __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_6 = __Pyx_UnpackItem(__pyx_t_7, 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_8 = __Pyx_UnpackItem(__pyx_t_7, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_8);
          if (__Pyx_EndUnpack(__pyx_t_7, 2) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_v_prefix);
          __pyx_v_prefix = __pyx_t_6;
          __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_v_ns_uri);
          __pyx_v_ns_uri = __pyx_t_8;
          __pyx_t_8 = 0;
        }

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":79
 *                 ns = []
 *                 for prefix, ns_uri in namespaces:
 *                     if prefix is None or not prefix:             # <<<<<<<<<<<<<<
 *                         raise TypeError, \
 *                             u"empty namespace prefix is not supported in XPath"
 */
        __pyx_t_2 = (__pyx_v_prefix == Py_None);
        if (!__pyx_t_2) {
          __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_v_prefix); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __pyx_t_13 = (!__pyx_t_12);
          __pyx_t_12 = __pyx_t_13;
        } else {
          __pyx_t_12 = __pyx_t_2;
        }
        if (__pyx_t_12) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":80
 *                 for prefix, ns_uri in namespaces:
 *                     if prefix is None or not prefix:
 *                         raise TypeError, \             # <<<<<<<<<<<<<<
 *                             u"empty namespace prefix is not supported in XPath"
 *                     if ns_uri is None or not ns_uri:
 */
          __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_u_297), 0);
          {__pyx_filename = __pyx_f[6]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          goto __pyx_L18;
        }
        __pyx_L18:;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":82
 *                         raise TypeError, \
 *                             u"empty namespace prefix is not supported in XPath"
 *                     if ns_uri is None or not ns_uri:             # <<<<<<<<<<<<<<
 *                         raise TypeError, \
 *                             u"setting default namespace is not supported in XPath"
 */
        __pyx_t_12 = (__pyx_v_ns_uri == Py_None);
        if (!__pyx_t_12) {
          __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_ns_uri); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __pyx_t_13 = (!__pyx_t_2);
          __pyx_t_2 = __pyx_t_13;
        } else {
          __pyx_t_2 = __pyx_t_12;
        }
        if (__pyx_t_2) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":83
 *                             u"empty namespace prefix is not supported in XPath"
 *                     if ns_uri is None or not ns_uri:
 *                         raise TypeError, \             # <<<<<<<<<<<<<<
 *                             u"setting default namespace is not supported in XPath"
 *                     prefix_utf = self._to_utf(prefix)
 */
          __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_u_298), 0);
          {__pyx_filename = __pyx_f[6]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          goto __pyx_L19;
        }
        __pyx_L19:;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":85
 *                         raise TypeError, \
 *                             u"setting default namespace is not supported in XPath"
 *                     prefix_utf = self._to_utf(prefix)             # <<<<<<<<<<<<<<
 *                     ns_uri_utf = self._to_utf(ns_uri)
 *                     ns.append( (prefix_utf, ns_uri_utf) )
 */
        __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseContext *)((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)->__pyx_vtab)->_to_utf(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self), __pyx_v_prefix); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_v_prefix_utf);
        __pyx_v_prefix_utf = __pyx_t_1;
        __pyx_t_1 = 0;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":86
 *                             u"setting default namespace is not supported in XPath"
 *                     prefix_utf = self._to_utf(prefix)
 *                     ns_uri_utf = self._to_utf(ns_uri)             # <<<<<<<<<<<<<<
 *                     ns.append( (prefix_utf, ns_uri_utf) )
 *                 namespaces = ns
 */
        __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseContext *)((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)->__pyx_vtab)->_to_utf(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self), __pyx_v_ns_uri); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_v_ns_uri_utf);
        __pyx_v_ns_uri_utf = __pyx_t_1;
        __pyx_t_1 = 0;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":87
 *                     prefix_utf = self._to_utf(prefix)
 *                     ns_uri_utf = self._to_utf(ns_uri)
 *                     ns.append( (prefix_utf, ns_uri_utf) )             # <<<<<<<<<<<<<<
 *                 namespaces = ns
 *             else:
 */
        if (unlikely(__pyx_v_ns == Py_None)) {
          PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
        }
        __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_1));
        __Pyx_INCREF(__pyx_v_prefix_utf);
        PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_prefix_utf);
        __Pyx_GIVEREF(__pyx_v_prefix_utf);
        __Pyx_INCREF(__pyx_v_ns_uri_utf);
        PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_ns_uri_utf);
        __Pyx_GIVEREF(__pyx_v_ns_uri_utf);
        __pyx_t_14 = PyList_Append(__pyx_v_ns, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":88
 *                     ns_uri_utf = self._to_utf(ns_uri)
 *                     ns.append( (prefix_utf, ns_uri_utf) )
 *                 namespaces = ns             # <<<<<<<<<<<<<<
 *             else:
 *                 namespaces = None
 */
      __Pyx_INCREF(((PyObject *)__pyx_v_ns));
      __Pyx_DECREF(__pyx_v_namespaces);
      __pyx_v_namespaces = ((PyObject *)__pyx_v_ns);
      goto __pyx_L15;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":90
 *                 namespaces = ns
 *             else:
 *                 namespaces = None             # <<<<<<<<<<<<<<
 * 
 *         self._doc        = None
 */
      __Pyx_INCREF(Py_None);
      __Pyx_DECREF(__pyx_v_namespaces);
      __pyx_v_namespaces = Py_None;
    }
    __pyx_L15:;
    goto __pyx_L13;
  }
  __pyx_L13:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":92
 *                 namespaces = None
 * 
 *         self._doc        = None             # <<<<<<<<<<<<<<
 *         self._exc        = _ExceptionContext()
 *         self._extensions = extensions
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)->_doc);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)->_doc));
  ((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)->_doc = ((struct LxmlDocument *)Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":93
 * 
 *         self._doc        = None
 *         self._exc        = _ExceptionContext()             # <<<<<<<<<<<<<<
 *         self._extensions = extensions
 *         self._namespaces = namespaces
 */
  __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ExceptionContext)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)->_exc);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)->_exc));
  ((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)->_exc = ((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":94
 *         self._doc        = None
 *         self._exc        = _ExceptionContext()
 *         self._extensions = extensions             # <<<<<<<<<<<<<<
 *         self._namespaces = namespaces
 *         self._temp_refs  = _TempStore()
 */
  if (!(likely(PyDict_CheckExact(__pyx_v_extensions))||((__pyx_v_extensions) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected dict, got %.200s", Py_TYPE(__pyx_v_extensions)->tp_name), 0))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_extensions);
  __Pyx_GIVEREF(__pyx_v_extensions);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)->_extensions);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)->_extensions));
  ((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)->_extensions = ((PyObject*)__pyx_v_extensions);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":95
 *         self._exc        = _ExceptionContext()
 *         self._extensions = extensions
 *         self._namespaces = namespaces             # <<<<<<<<<<<<<<
 *         self._temp_refs  = _TempStore()
 *         self._temp_documents  = set()
 */
  if (!(likely(PyList_CheckExact(__pyx_v_namespaces))||((__pyx_v_namespaces) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_v_namespaces)->tp_name), 0))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_namespaces);
  __Pyx_GIVEREF(__pyx_v_namespaces);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)->_namespaces);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)->_namespaces));
  ((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)->_namespaces = ((PyObject*)__pyx_v_namespaces);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":96
 *         self._extensions = extensions
 *         self._namespaces = namespaces
 *         self._temp_refs  = _TempStore()             # <<<<<<<<<<<<<<
 *         self._temp_documents  = set()
 *         self._build_smart_strings = build_smart_strings
 */
  __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__TempStore)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)->_temp_refs);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)->_temp_refs));
  ((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)->_temp_refs = ((struct __pyx_obj_4lxml_5etree__TempStore *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":97
 *         self._namespaces = namespaces
 *         self._temp_refs  = _TempStore()
 *         self._temp_documents  = set()             # <<<<<<<<<<<<<<
 *         self._build_smart_strings = build_smart_strings
 * 
 */
  __pyx_t_4 = PySet_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)->_temp_documents);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)->_temp_documents));
  ((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)->_temp_documents = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":98
 *         self._temp_refs  = _TempStore()
 *         self._temp_documents  = set()
 *         self._build_smart_strings = build_smart_strings             # <<<<<<<<<<<<<<
 * 
 *         if enable_regexp:
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_build_smart_strings); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)->_build_smart_strings = __pyx_t_2;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":100
 *         self._build_smart_strings = build_smart_strings
 * 
 *         if enable_regexp:             # <<<<<<<<<<<<<<
 *             _regexp = _ExsltRegExp()
 *             _regexp._register_in_context(self)
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_enable_regexp); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":101
 * 
 *         if enable_regexp:
 *             _regexp = _ExsltRegExp()             # <<<<<<<<<<<<<<
 *             _regexp._register_in_context(self)
 * 
 */
    __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ExsltRegExp)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(((PyObject *)__pyx_v__regexp));
    __pyx_v__regexp = ((struct __pyx_obj_4lxml_5etree__ExsltRegExp *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":102
 *         if enable_regexp:
 *             _regexp = _ExsltRegExp()
 *             _regexp._register_in_context(self)             # <<<<<<<<<<<<<<
 * 
 *     cdef _BaseContext _copy(self):
 */
    __pyx_t_4 = ((struct __pyx_vtabstruct_4lxml_5etree__ExsltRegExp *)__pyx_v__regexp->__pyx_vtab)->_register_in_context(__pyx_v__regexp, ((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L20;
  }
  __pyx_L20:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("lxml.etree._BaseContext.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v__regexp);
  __Pyx_DECREF(__pyx_v_new_extensions);
  __Pyx_DECREF(__pyx_v_ns);
  __Pyx_DECREF(__pyx_v_extension);
  __Pyx_DECREF(__pyx_v_ns_uri);
  __Pyx_DECREF(__pyx_v_name);
  __Pyx_DECREF(__pyx_v_function);
  __Pyx_DECREF(__pyx_v_ns_utf);
  __Pyx_DECREF(__pyx_v_name_utf);
  __Pyx_DECREF(__pyx_v_prefix);
  __Pyx_DECREF(__pyx_v_prefix_utf);
  __Pyx_DECREF(__pyx_v_ns_uri_utf);
  __Pyx_DECREF(__pyx_v_namespaces);
  __Pyx_DECREF(__pyx_v_extensions);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":104
 *             _regexp._register_in_context(self)
 * 
 *     cdef _BaseContext _copy(self):             # <<<<<<<<<<<<<<
 *         cdef _BaseContext context
 *         if self._namespaces is not None:
 */

static  struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_f_4lxml_5etree_12_BaseContext__copy(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_context;
  PyObject *__pyx_v_namespaces;
  struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("_copy");
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__BaseContext *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_namespaces = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":106
 *     cdef _BaseContext _copy(self):
 *         cdef _BaseContext context
 *         if self._namespaces is not None:             # <<<<<<<<<<<<<<
 *             namespaces = self._namespaces[:]
 *         context = self.__class__(namespaces, None, False,
 */
  __pyx_t_1 = (__pyx_v_self->_namespaces != ((PyObject*)Py_None));
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":107
 *         cdef _BaseContext context
 *         if self._namespaces is not None:
 *             namespaces = self._namespaces[:]             # <<<<<<<<<<<<<<
 *         context = self.__class__(namespaces, None, False,
 *                                  self._build_smart_strings)
 */
    __pyx_t_2 = __Pyx_PySequence_GetSlice(((PyObject *)__pyx_v_self->_namespaces), 0, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __Pyx_DECREF(((PyObject *)__pyx_v_namespaces));
    __pyx_v_namespaces = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":108
 *         if self._namespaces is not None:
 *             namespaces = self._namespaces[:]
 *         context = self.__class__(namespaces, None, False,             # <<<<<<<<<<<<<<
 *                                  self._build_smart_strings)
 *         if self._extensions is not None:
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":109
 *             namespaces = self._namespaces[:]
 *         context = self.__class__(namespaces, None, False,
 *                                  self._build_smart_strings)             # <<<<<<<<<<<<<<
 *         if self._extensions is not None:
 *             context._extensions = self._extensions.copy()
 */
  __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_self->_build_smart_strings); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  __Pyx_INCREF(((PyObject *)__pyx_v_namespaces));
  PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_namespaces));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_namespaces));
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_5, 1, Py_None);
  __Pyx_GIVEREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4lxml_5etree__BaseContext))))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_v_context));
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":110
 *         context = self.__class__(namespaces, None, False,
 *                                  self._build_smart_strings)
 *         if self._extensions is not None:             # <<<<<<<<<<<<<<
 *             context._extensions = self._extensions.copy()
 *         return context
 */
  __pyx_t_1 = (__pyx_v_self->_extensions != ((PyObject*)Py_None));
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":111
 *                                  self._build_smart_strings)
 *         if self._extensions is not None:
 *             context._extensions = self._extensions.copy()             # <<<<<<<<<<<<<<
 *         return context
 * 
 */
    if (unlikely(__pyx_v_self->_extensions == Py_None)) {
      PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'copy'"); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_4 = ((PyObject *)PyDict_Copy(__pyx_v_self->_extensions)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __Pyx_GOTREF(__pyx_v_context->_extensions);
    __Pyx_DECREF(((PyObject *)__pyx_v_context->_extensions));
    __pyx_v_context->_extensions = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":112
 *         if self._extensions is not None:
 *             context._extensions = self._extensions.copy()
 *         return context             # <<<<<<<<<<<<<<
 * 
 *     cdef object _to_utf(self, s):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_context));
  __pyx_r = __pyx_v_context;
  goto __pyx_L0;

  __pyx_r = ((struct __pyx_obj_4lxml_5etree__BaseContext *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._BaseContext._copy");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_context);
  __Pyx_DECREF(__pyx_v_namespaces);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":114
 *         return context
 * 
 *     cdef object _to_utf(self, s):             # <<<<<<<<<<<<<<
 *         u"Convert to UTF-8 and keep a reference to the encoded string"
 *         cdef python.PyObject* dict_result
 */

static  PyObject *__pyx_f_4lxml_5etree_12_BaseContext__to_utf(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, PyObject *__pyx_v_s) {
  PyObject *__pyx_v_dict_result;
  PyObject *__pyx_v_utf;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_to_utf");
  __pyx_v_utf = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":117
 *         u"Convert to UTF-8 and keep a reference to the encoded string"
 *         cdef python.PyObject* dict_result
 *         if s is None:             # <<<<<<<<<<<<<<
 *             return None
 *         dict_result = python.PyDict_GetItem(self._utf_refs, s)
 */
  __pyx_t_1 = (__pyx_v_s == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":118
 *         cdef python.PyObject* dict_result
 *         if s is None:
 *             return None             # <<<<<<<<<<<<<<
 *         dict_result = python.PyDict_GetItem(self._utf_refs, s)
 *         if dict_result is not NULL:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":119
 *         if s is None:
 *             return None
 *         dict_result = python.PyDict_GetItem(self._utf_refs, s)             # <<<<<<<<<<<<<<
 *         if dict_result is not NULL:
 *             return <object>dict_result
 */
  __pyx_t_2 = ((PyObject *)__pyx_v_self->_utf_refs);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_dict_result = PyDict_GetItem(__pyx_t_2, __pyx_v_s);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":120
 *             return None
 *         dict_result = python.PyDict_GetItem(self._utf_refs, s)
 *         if dict_result is not NULL:             # <<<<<<<<<<<<<<
 *             return <object>dict_result
 *         utf = _utf8(s)
 */
  __pyx_t_1 = (__pyx_v_dict_result != NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":121
 *         dict_result = python.PyDict_GetItem(self._utf_refs, s)
 *         if dict_result is not NULL:
 *             return <object>dict_result             # <<<<<<<<<<<<<<
 *         utf = _utf8(s)
 *         self._utf_refs[s] = utf
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_dict_result));
    __pyx_r = ((PyObject *)__pyx_v_dict_result);
    goto __pyx_L0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":122
 *         if dict_result is not NULL:
 *             return <object>dict_result
 *         utf = _utf8(s)             # <<<<<<<<<<<<<<
 *         self._utf_refs[s] = utf
 *         return utf
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_v_s)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_v_utf));
  __pyx_v_utf = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":123
 *             return <object>dict_result
 *         utf = _utf8(s)
 *         self._utf_refs[s] = utf             # <<<<<<<<<<<<<<
 *         return utf
 * 
 */
  if (PyDict_SetItem(((PyObject *)__pyx_v_self->_utf_refs), __pyx_v_s, ((PyObject *)__pyx_v_utf)) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":124
 *         utf = _utf8(s)
 *         self._utf_refs[s] = utf
 *         return utf             # <<<<<<<<<<<<<<
 * 
 *     cdef void _set_xpath_context(self, xpath.xmlXPathContext* xpathCtxt):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_utf));
  __pyx_r = ((PyObject *)__pyx_v_utf);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._BaseContext._to_utf");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_utf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":126
 *         return utf
 * 
 *     cdef void _set_xpath_context(self, xpath.xmlXPathContext* xpathCtxt):             # <<<<<<<<<<<<<<
 *         self._xpathCtxt = xpathCtxt
 *         xpathCtxt.userData = <void*>self
 */

static  void __pyx_f_4lxml_5etree_12_BaseContext__set_xpath_context(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, xmlXPathContext *__pyx_v_xpathCtxt) {
  __Pyx_RefNannySetupContext("_set_xpath_context");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":127
 * 
 *     cdef void _set_xpath_context(self, xpath.xmlXPathContext* xpathCtxt):
 *         self._xpathCtxt = xpathCtxt             # <<<<<<<<<<<<<<
 *         xpathCtxt.userData = <void*>self
 * 
 */
  __pyx_v_self->_xpathCtxt = __pyx_v_xpathCtxt;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":128
 *     cdef void _set_xpath_context(self, xpath.xmlXPathContext* xpathCtxt):
 *         self._xpathCtxt = xpathCtxt
 *         xpathCtxt.userData = <void*>self             # <<<<<<<<<<<<<<
 * 
 *     cdef _register_context(self, _Document doc):
 */
  __pyx_v_xpathCtxt->userData = ((void *)__pyx_v_self);

  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":130
 *         xpathCtxt.userData = <void*>self
 * 
 *     cdef _register_context(self, _Document doc):             # <<<<<<<<<<<<<<
 *         self._doc = doc
 *         self._exc.clear()
 */

static  PyObject *__pyx_f_4lxml_5etree_12_BaseContext__register_context(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, struct LxmlDocument *__pyx_v_doc) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("_register_context");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":131
 * 
 *     cdef _register_context(self, _Document doc):
 *         self._doc = doc             # <<<<<<<<<<<<<<
 *         self._exc.clear()
 * 
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_doc));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_doc));
  __Pyx_GOTREF(__pyx_v_self->_doc);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_doc));
  __pyx_v_self->_doc = __pyx_v_doc;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":132
 *     cdef _register_context(self, _Document doc):
 *         self._doc = doc
 *         self._exc.clear()             # <<<<<<<<<<<<<<
 * 
 *     cdef _cleanup_context(self):
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext *)__pyx_v_self->_exc->__pyx_vtab)->clear(__pyx_v_self->_exc);

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":134
 *         self._exc.clear()
 * 
 *     cdef _cleanup_context(self):             # <<<<<<<<<<<<<<
 *         #xpath.xmlXPathRegisteredNsCleanup(self._xpathCtxt)
 *         #self.unregisterGlobalNamespaces()
 */

static  PyObject *__pyx_f_4lxml_5etree_12_BaseContext__cleanup_context(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("_cleanup_context");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":137
 *         #xpath.xmlXPathRegisteredNsCleanup(self._xpathCtxt)
 *         #self.unregisterGlobalNamespaces()
 *         python.PyDict_Clear(self._utf_refs)             # <<<<<<<<<<<<<<
 *         self._eval_context_dict = None
 *         self._doc = None
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_utf_refs);
  __Pyx_INCREF(__pyx_t_1);
  PyDict_Clear(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":138
 *         #self.unregisterGlobalNamespaces()
 *         python.PyDict_Clear(self._utf_refs)
 *         self._eval_context_dict = None             # <<<<<<<<<<<<<<
 *         self._doc = None
 * 
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_eval_context_dict);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_eval_context_dict));
  __pyx_v_self->_eval_context_dict = ((PyObject*)Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":139
 *         python.PyDict_Clear(self._utf_refs)
 *         self._eval_context_dict = None
 *         self._doc = None             # <<<<<<<<<<<<<<
 * 
 *     cdef _release_context(self):
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_doc);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_doc));
  __pyx_v_self->_doc = ((struct LxmlDocument *)Py_None);

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":141
 *         self._doc = None
 * 
 *     cdef _release_context(self):             # <<<<<<<<<<<<<<
 *         if self._xpathCtxt is not NULL:
 *             self._xpathCtxt.userData = NULL
 */

static  PyObject *__pyx_f_4lxml_5etree_12_BaseContext__release_context(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_release_context");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":142
 * 
 *     cdef _release_context(self):
 *         if self._xpathCtxt is not NULL:             # <<<<<<<<<<<<<<
 *             self._xpathCtxt.userData = NULL
 *             self._xpathCtxt = NULL
 */
  __pyx_t_1 = (__pyx_v_self->_xpathCtxt != NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":143
 *     cdef _release_context(self):
 *         if self._xpathCtxt is not NULL:
 *             self._xpathCtxt.userData = NULL             # <<<<<<<<<<<<<<
 *             self._xpathCtxt = NULL
 * 
 */
    __pyx_v_self->_xpathCtxt->userData = NULL;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":144
 *         if self._xpathCtxt is not NULL:
 *             self._xpathCtxt.userData = NULL
 *             self._xpathCtxt = NULL             # <<<<<<<<<<<<<<
 * 
 *     # namespaces (internal UTF-8 methods with leading '_')
 */
    __pyx_v_self->_xpathCtxt = NULL;
    goto __pyx_L3;
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":148
 *     # namespaces (internal UTF-8 methods with leading '_')
 * 
 *     cdef addNamespace(self, prefix, ns_uri):             # <<<<<<<<<<<<<<
 *         cdef list namespaces
 *         if prefix is None:
 */

static  PyObject *__pyx_f_4lxml_5etree_12_BaseContext_addNamespace(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, PyObject *__pyx_v_prefix, PyObject *__pyx_v_ns_uri) {
  PyObject *__pyx_v_namespaces;
  PyObject *__pyx_v_prefix_utf;
  PyObject *__pyx_v_ns_uri_utf;
  PyObject *__pyx_v_new_item;
  PyObject *__pyx_v_item;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("addNamespace");
  __pyx_v_namespaces = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_prefix_utf = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_ns_uri_utf = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_new_item = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_item = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":150
 *     cdef addNamespace(self, prefix, ns_uri):
 *         cdef list namespaces
 *         if prefix is None:             # <<<<<<<<<<<<<<
 *             raise TypeError, u"empty prefix is not supported in XPath"
 *         prefix_utf = self._to_utf(prefix)
 */
  __pyx_t_1 = (__pyx_v_prefix == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":151
 *         cdef list namespaces
 *         if prefix is None:
 *             raise TypeError, u"empty prefix is not supported in XPath"             # <<<<<<<<<<<<<<
 *         prefix_utf = self._to_utf(prefix)
 *         ns_uri_utf = self._to_utf(ns_uri)
 */
    __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_u_301), 0);
    {__pyx_filename = __pyx_f[6]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":152
 *         if prefix is None:
 *             raise TypeError, u"empty prefix is not supported in XPath"
 *         prefix_utf = self._to_utf(prefix)             # <<<<<<<<<<<<<<
 *         ns_uri_utf = self._to_utf(ns_uri)
 *         new_item = (prefix_utf, ns_uri_utf)
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseContext *)__pyx_v_self->__pyx_vtab)->_to_utf(__pyx_v_self, __pyx_v_prefix); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_v_prefix_utf);
  __pyx_v_prefix_utf = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":153
 *             raise TypeError, u"empty prefix is not supported in XPath"
 *         prefix_utf = self._to_utf(prefix)
 *         ns_uri_utf = self._to_utf(ns_uri)             # <<<<<<<<<<<<<<
 *         new_item = (prefix_utf, ns_uri_utf)
 *         if self._namespaces is None:
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseContext *)__pyx_v_self->__pyx_vtab)->_to_utf(__pyx_v_self, __pyx_v_ns_uri); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_v_ns_uri_utf);
  __pyx_v_ns_uri_utf = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":154
 *         prefix_utf = self._to_utf(prefix)
 *         ns_uri_utf = self._to_utf(ns_uri)
 *         new_item = (prefix_utf, ns_uri_utf)             # <<<<<<<<<<<<<<
 *         if self._namespaces is None:
 *             self._namespaces = [new_item]
 */
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(__pyx_v_prefix_utf);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_prefix_utf);
  __Pyx_GIVEREF(__pyx_v_prefix_utf);
  __Pyx_INCREF(__pyx_v_ns_uri_utf);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_ns_uri_utf);
  __Pyx_GIVEREF(__pyx_v_ns_uri_utf);
  __Pyx_DECREF(__pyx_v_new_item);
  __pyx_v_new_item = ((PyObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":155
 *         ns_uri_utf = self._to_utf(ns_uri)
 *         new_item = (prefix_utf, ns_uri_utf)
 *         if self._namespaces is None:             # <<<<<<<<<<<<<<
 *             self._namespaces = [new_item]
 *         else:
 */
  __pyx_t_1 = (__pyx_v_self->_namespaces == ((PyObject*)Py_None));
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":156
 *         new_item = (prefix_utf, ns_uri_utf)
 *         if self._namespaces is None:
 *             self._namespaces = [new_item]             # <<<<<<<<<<<<<<
 *         else:
 *             namespaces = []
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __Pyx_INCREF(__pyx_v_new_item);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_v_new_item);
    __Pyx_GIVEREF(__pyx_v_new_item);
    __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
    __Pyx_GOTREF(__pyx_v_self->_namespaces);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->_namespaces));
    __pyx_v_self->_namespaces = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":158
 *             self._namespaces = [new_item]
 *         else:
 *             namespaces = []             # <<<<<<<<<<<<<<
 *             for item in self._namespaces:
 *                 if item[0] == prefix_utf:
 */
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __Pyx_DECREF(((PyObject *)__pyx_v_namespaces));
    __pyx_v_namespaces = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":159
 *         else:
 *             namespaces = []
 *             for item in self._namespaces:             # <<<<<<<<<<<<<<
 *                 if item[0] == prefix_utf:
 *                     item = new_item
 */
    if (unlikely(__pyx_v_self->_namespaces == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_3 = 0; __pyx_t_2 = ((PyObject *)__pyx_v_self->_namespaces); __Pyx_INCREF(__pyx_t_2);
    for (;;) {
      if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++;
      __Pyx_DECREF(__pyx_v_item);
      __pyx_v_item = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":160
 *             namespaces = []
 *             for item in self._namespaces:
 *                 if item[0] == prefix_utf:             # <<<<<<<<<<<<<<
 *                     item = new_item
 *                     new_item = None
 */
      __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_item, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_v_prefix_utf, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_1) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":161
 *             for item in self._namespaces:
 *                 if item[0] == prefix_utf:
 *                     item = new_item             # <<<<<<<<<<<<<<
 *                     new_item = None
 *                 namespaces.append(item)
 */
        __Pyx_INCREF(__pyx_v_new_item);
        __Pyx_DECREF(__pyx_v_item);
        __pyx_v_item = __pyx_v_new_item;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":162
 *                 if item[0] == prefix_utf:
 *                     item = new_item
 *                     new_item = None             # <<<<<<<<<<<<<<
 *                 namespaces.append(item)
 *             if new_item is not None:
 */
        __Pyx_INCREF(Py_None);
        __Pyx_DECREF(__pyx_v_new_item);
        __pyx_v_new_item = Py_None;
        goto __pyx_L7;
      }
      __pyx_L7:;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":163
 *                     item = new_item
 *                     new_item = None
 *                 namespaces.append(item)             # <<<<<<<<<<<<<<
 *             if new_item is not None:
 *                 namespaces.append(new_item)
 */
      if (unlikely(__pyx_v_namespaces == Py_None)) {
        PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
      }
      __pyx_t_6 = PyList_Append(__pyx_v_namespaces, __pyx_v_item); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":164
 *                     new_item = None
 *                 namespaces.append(item)
 *             if new_item is not None:             # <<<<<<<<<<<<<<
 *                 namespaces.append(new_item)
 *             self._namespaces = namespaces
 */
    __pyx_t_1 = (__pyx_v_new_item != Py_None);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":165
 *                 namespaces.append(item)
 *             if new_item is not None:
 *                 namespaces.append(new_item)             # <<<<<<<<<<<<<<
 *             self._namespaces = namespaces
 *         if self._xpathCtxt is not NULL:
 */
      if (unlikely(__pyx_v_namespaces == Py_None)) {
        PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
      }
      __pyx_t_6 = PyList_Append(__pyx_v_namespaces, __pyx_v_new_item); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":166
 *             if new_item is not None:
 *                 namespaces.append(new_item)
 *             self._namespaces = namespaces             # <<<<<<<<<<<<<<
 *         if self._xpathCtxt is not NULL:
 *             xpath.xmlXPathRegisterNs(
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_namespaces));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_namespaces));
    __Pyx_GOTREF(__pyx_v_self->_namespaces);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->_namespaces));
    __pyx_v_self->_namespaces = __pyx_v_namespaces;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":167
 *                 namespaces.append(new_item)
 *             self._namespaces = namespaces
 *         if self._xpathCtxt is not NULL:             # <<<<<<<<<<<<<<
 *             xpath.xmlXPathRegisterNs(
 *                 self._xpathCtxt, _cstr(prefix_utf), _cstr(ns_uri_utf))
 */
  __pyx_t_1 = (__pyx_v_self->_xpathCtxt != NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":169
 *         if self._xpathCtxt is not NULL:
 *             xpath.xmlXPathRegisterNs(
 *                 self._xpathCtxt, _cstr(prefix_utf), _cstr(ns_uri_utf))             # <<<<<<<<<<<<<<
 * 
 *     cdef registerNamespace(self, prefix, ns_uri):
 */
    xmlXPathRegisterNs(__pyx_v_self->_xpathCtxt, PyBytes_AS_STRING(__pyx_v_prefix_utf), PyBytes_AS_STRING(__pyx_v_ns_uri_utf));
    goto __pyx_L9;
  }
  __pyx_L9:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._BaseContext.addNamespace");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_namespaces);
  __Pyx_DECREF(__pyx_v_prefix_utf);
  __Pyx_DECREF(__pyx_v_ns_uri_utf);
  __Pyx_DECREF(__pyx_v_new_item);
  __Pyx_DECREF(__pyx_v_item);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":171
 *                 self._xpathCtxt, _cstr(prefix_utf), _cstr(ns_uri_utf))
 * 
 *     cdef registerNamespace(self, prefix, ns_uri):             # <<<<<<<<<<<<<<
 *         if prefix is None:
 *             raise TypeError, u"empty prefix is not supported in XPath"
 */

static  PyObject *__pyx_f_4lxml_5etree_12_BaseContext_registerNamespace(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, PyObject *__pyx_v_prefix, PyObject *__pyx_v_ns_uri) {
  PyObject *__pyx_v_prefix_utf;
  PyObject *__pyx_v_ns_uri_utf;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("registerNamespace");
  __pyx_v_prefix_utf = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_ns_uri_utf = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":172
 * 
 *     cdef registerNamespace(self, prefix, ns_uri):
 *         if prefix is None:             # <<<<<<<<<<<<<<
 *             raise TypeError, u"empty prefix is not supported in XPath"
 *         prefix_utf = self._to_utf(prefix)
 */
  __pyx_t_1 = (__pyx_v_prefix == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":173
 *     cdef registerNamespace(self, prefix, ns_uri):
 *         if prefix is None:
 *             raise TypeError, u"empty prefix is not supported in XPath"             # <<<<<<<<<<<<<<
 *         prefix_utf = self._to_utf(prefix)
 *         ns_uri_utf = self._to_utf(ns_uri)
 */
    __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_u_301), 0);
    {__pyx_filename = __pyx_f[6]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":174
 *         if prefix is None:
 *             raise TypeError, u"empty prefix is not supported in XPath"
 *         prefix_utf = self._to_utf(prefix)             # <<<<<<<<<<<<<<
 *         ns_uri_utf = self._to_utf(ns_uri)
 *         self._global_namespaces.append(prefix_utf)
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseContext *)__pyx_v_self->__pyx_vtab)->_to_utf(__pyx_v_self, __pyx_v_prefix); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_v_prefix_utf);
  __pyx_v_prefix_utf = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":175
 *             raise TypeError, u"empty prefix is not supported in XPath"
 *         prefix_utf = self._to_utf(prefix)
 *         ns_uri_utf = self._to_utf(ns_uri)             # <<<<<<<<<<<<<<
 *         self._global_namespaces.append(prefix_utf)
 *         xpath.xmlXPathRegisterNs(self._xpathCtxt,
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseContext *)__pyx_v_self->__pyx_vtab)->_to_utf(__pyx_v_self, __pyx_v_ns_uri); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_v_ns_uri_utf);
  __pyx_v_ns_uri_utf = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":176
 *         prefix_utf = self._to_utf(prefix)
 *         ns_uri_utf = self._to_utf(ns_uri)
 *         self._global_namespaces.append(prefix_utf)             # <<<<<<<<<<<<<<
 *         xpath.xmlXPathRegisterNs(self._xpathCtxt,
 *                                  _cstr(prefix_utf), _cstr(ns_uri_utf))
 */
  if (unlikely(__pyx_v_self->_global_namespaces == Py_None)) {
    PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_3 = PyList_Append(__pyx_v_self->_global_namespaces, __pyx_v_prefix_utf); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":178
 *         self._global_namespaces.append(prefix_utf)
 *         xpath.xmlXPathRegisterNs(self._xpathCtxt,
 *                                  _cstr(prefix_utf), _cstr(ns_uri_utf))             # <<<<<<<<<<<<<<
 * 
 *     cdef registerLocalNamespaces(self):
 */
  xmlXPathRegisterNs(__pyx_v_self->_xpathCtxt, PyBytes_AS_STRING(__pyx_v_prefix_utf), PyBytes_AS_STRING(__pyx_v_ns_uri_utf));

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._BaseContext.registerNamespace");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_prefix_utf);
  __Pyx_DECREF(__pyx_v_ns_uri_utf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":180
 *                                  _cstr(prefix_utf), _cstr(ns_uri_utf))
 * 
 *     cdef registerLocalNamespaces(self):             # <<<<<<<<<<<<<<
 *         if self._namespaces is None:
 *             return
 */

static  PyObject *__pyx_f_4lxml_5etree_12_BaseContext_registerLocalNamespaces(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self) {
  PyObject *__pyx_v_prefix_utf;
  PyObject *__pyx_v_ns_uri_utf;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("registerLocalNamespaces");
  __pyx_v_prefix_utf = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_ns_uri_utf = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":181
 * 
 *     cdef registerLocalNamespaces(self):
 *         if self._namespaces is None:             # <<<<<<<<<<<<<<
 *             return
 *         for prefix_utf, ns_uri_utf in self._namespaces:
 */
  __pyx_t_1 = (__pyx_v_self->_namespaces == ((PyObject*)Py_None));
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":182
 *     cdef registerLocalNamespaces(self):
 *         if self._namespaces is None:
 *             return             # <<<<<<<<<<<<<<
 *         for prefix_utf, ns_uri_utf in self._namespaces:
 *             xpath.xmlXPathRegisterNs(
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":183
 *         if self._namespaces is None:
 *             return
 *         for prefix_utf, ns_uri_utf in self._namespaces:             # <<<<<<<<<<<<<<
 *             xpath.xmlXPathRegisterNs(
 *                 self._xpathCtxt, _cstr(prefix_utf), _cstr(ns_uri_utf))
 */
  if (unlikely(__pyx_v_self->_namespaces == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_2 = 0; __pyx_t_3 = ((PyObject *)__pyx_v_self->_namespaces); __Pyx_INCREF(__pyx_t_3);
  for (;;) {
    if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_3)) break;
    __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++;
    if (PyTuple_CheckExact(__pyx_t_4) && likely(PyTuple_GET_SIZE(__pyx_t_4) == 2)) {
      PyObject* tuple = __pyx_t_4;
      __pyx_t_5 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_5);
      __pyx_t_6 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_v_prefix_utf);
      __pyx_v_prefix_utf = __pyx_t_5;
      __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_v_ns_uri_utf);
      __pyx_v_ns_uri_utf = __pyx_t_6;
      __pyx_t_6 = 0;
    } else {
      __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_5 = __Pyx_UnpackItem(__pyx_t_7, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_UnpackItem(__pyx_t_7, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_EndUnpack(__pyx_t_7, 2) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_v_prefix_utf);
      __pyx_v_prefix_utf = __pyx_t_5;
      __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_v_ns_uri_utf);
      __pyx_v_ns_uri_utf = __pyx_t_6;
      __pyx_t_6 = 0;
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":185
 *         for prefix_utf, ns_uri_utf in self._namespaces:
 *             xpath.xmlXPathRegisterNs(
 *                 self._xpathCtxt, _cstr(prefix_utf), _cstr(ns_uri_utf))             # <<<<<<<<<<<<<<
 * 
 *     cdef registerGlobalNamespaces(self):
 */
    xmlXPathRegisterNs(__pyx_v_self->_xpathCtxt, PyBytes_AS_STRING(__pyx_v_prefix_utf), PyBytes_AS_STRING(__pyx_v_ns_uri_utf));
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree._BaseContext.registerLocalNamespaces");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_prefix_utf);
  __Pyx_DECREF(__pyx_v_ns_uri_utf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":187
 *                 self._xpathCtxt, _cstr(prefix_utf), _cstr(ns_uri_utf))
 * 
 *     cdef registerGlobalNamespaces(self):             # <<<<<<<<<<<<<<
 *         cdef list ns_prefixes = _find_all_extension_prefixes()
 *         if python.PyList_GET_SIZE(ns_prefixes) > 0:
 */

static  PyObject *__pyx_f_4lxml_5etree_12_BaseContext_registerGlobalNamespaces(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self) {
  PyObject *__pyx_v_ns_prefixes = 0;
  PyObject *__pyx_v_prefix_utf;
  PyObject *__pyx_v_ns_uri_utf;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  __Pyx_RefNannySetupContext("registerGlobalNamespaces");
  __pyx_v_prefix_utf = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_ns_uri_utf = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":188
 * 
 *     cdef registerGlobalNamespaces(self):
 *         cdef list ns_prefixes = _find_all_extension_prefixes()             # <<<<<<<<<<<<<<
 *         if python.PyList_GET_SIZE(ns_prefixes) > 0:
 *             for prefix_utf, ns_uri_utf in ns_prefixes:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__find_all_extension_prefixes()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ns_prefixes = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":189
 *     cdef registerGlobalNamespaces(self):
 *         cdef list ns_prefixes = _find_all_extension_prefixes()
 *         if python.PyList_GET_SIZE(ns_prefixes) > 0:             # <<<<<<<<<<<<<<
 *             for prefix_utf, ns_uri_utf in ns_prefixes:
 *                 self._global_namespaces.append(prefix_utf)
 */
  __pyx_t_2 = (PyList_GET_SIZE(((PyObject *)__pyx_v_ns_prefixes)) > 0);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":190
 *         cdef list ns_prefixes = _find_all_extension_prefixes()
 *         if python.PyList_GET_SIZE(ns_prefixes) > 0:
 *             for prefix_utf, ns_uri_utf in ns_prefixes:             # <<<<<<<<<<<<<<
 *                 self._global_namespaces.append(prefix_utf)
 *                 xpath.xmlXPathRegisterNs(
 */
    if (unlikely(__pyx_v_ns_prefixes == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_3 = 0; __pyx_t_1 = ((PyObject *)__pyx_v_ns_prefixes); __Pyx_INCREF(__pyx_t_1);
    for (;;) {
      if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
      __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++;
      if (PyTuple_CheckExact(__pyx_t_4) && likely(PyTuple_GET_SIZE(__pyx_t_4) == 2)) {
        PyObject* tuple = __pyx_t_4;
        __pyx_t_5 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_5);
        __pyx_t_6 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_v_prefix_utf);
        __pyx_v_prefix_utf = __pyx_t_5;
        __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_v_ns_uri_utf);
        __pyx_v_ns_uri_utf = __pyx_t_6;
        __pyx_t_6 = 0;
      } else {
        __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_5 = __Pyx_UnpackItem(__pyx_t_7, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_6 = __Pyx_UnpackItem(__pyx_t_7, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        if (__Pyx_EndUnpack(__pyx_t_7, 2) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_v_prefix_utf);
        __pyx_v_prefix_utf = __pyx_t_5;
        __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_v_ns_uri_utf);
        __pyx_v_ns_uri_utf = __pyx_t_6;
        __pyx_t_6 = 0;
      }

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":191
 *         if python.PyList_GET_SIZE(ns_prefixes) > 0:
 *             for prefix_utf, ns_uri_utf in ns_prefixes:
 *                 self._global_namespaces.append(prefix_utf)             # <<<<<<<<<<<<<<
 *                 xpath.xmlXPathRegisterNs(
 *                     self._xpathCtxt, _cstr(prefix_utf), _cstr(ns_uri_utf))
 */
      if (unlikely(__pyx_v_self->_global_namespaces == Py_None)) {
        PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
      }
      __pyx_t_8 = PyList_Append(__pyx_v_self->_global_namespaces, __pyx_v_prefix_utf); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":193
 *                 self._global_namespaces.append(prefix_utf)
 *                 xpath.xmlXPathRegisterNs(
 *                     self._xpathCtxt, _cstr(prefix_utf), _cstr(ns_uri_utf))             # <<<<<<<<<<<<<<
 * 
 *     cdef unregisterGlobalNamespaces(self):
 */
      xmlXPathRegisterNs(__pyx_v_self->_xpathCtxt, PyBytes_AS_STRING(__pyx_v_prefix_utf), PyBytes_AS_STRING(__pyx_v_ns_uri_utf));
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree._BaseContext.registerGlobalNamespaces");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ns_prefixes);
  __Pyx_DECREF(__pyx_v_prefix_utf);
  __Pyx_DECREF(__pyx_v_ns_uri_utf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":195
 *                     self._xpathCtxt, _cstr(prefix_utf), _cstr(ns_uri_utf))
 * 
 *     cdef unregisterGlobalNamespaces(self):             # <<<<<<<<<<<<<<
 *         if python.PyList_GET_SIZE(self._global_namespaces) > 0:
 *             for prefix_utf in self._global_namespaces:
 */

static  PyObject *__pyx_f_4lxml_5etree_12_BaseContext_unregisterGlobalNamespaces(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self) {
  PyObject *__pyx_v_prefix_utf;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("unregisterGlobalNamespaces");
  __pyx_v_prefix_utf = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":196
 * 
 *     cdef unregisterGlobalNamespaces(self):
 *         if python.PyList_GET_SIZE(self._global_namespaces) > 0:             # <<<<<<<<<<<<<<
 *             for prefix_utf in self._global_namespaces:
 *                 xpath.xmlXPathRegisterNs(self._xpathCtxt,
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_global_namespaces);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = (PyList_GET_SIZE(__pyx_t_1) > 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":197
 *     cdef unregisterGlobalNamespaces(self):
 *         if python.PyList_GET_SIZE(self._global_namespaces) > 0:
 *             for prefix_utf in self._global_namespaces:             # <<<<<<<<<<<<<<
 *                 xpath.xmlXPathRegisterNs(self._xpathCtxt,
 *                                          _cstr(prefix_utf), NULL)
 */
    if (unlikely(__pyx_v_self->_global_namespaces == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_3 = 0; __pyx_t_1 = ((PyObject *)__pyx_v_self->_global_namespaces); __Pyx_INCREF(__pyx_t_1);
    for (;;) {
      if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
      __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++;
      __Pyx_DECREF(__pyx_v_prefix_utf);
      __pyx_v_prefix_utf = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":199
 *             for prefix_utf in self._global_namespaces:
 *                 xpath.xmlXPathRegisterNs(self._xpathCtxt,
 *                                          _cstr(prefix_utf), NULL)             # <<<<<<<<<<<<<<
 *             del self._global_namespaces[:]
 * 
 */
      xmlXPathRegisterNs(__pyx_v_self->_xpathCtxt, PyBytes_AS_STRING(__pyx_v_prefix_utf), NULL);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":200
 *                 xpath.xmlXPathRegisterNs(self._xpathCtxt,
 *                                          _cstr(prefix_utf), NULL)
 *             del self._global_namespaces[:]             # <<<<<<<<<<<<<<
 * 
 *     cdef void _unregisterNamespace(self, prefix_utf):
 */
    if (__Pyx_PySequence_DelSlice(((PyObject *)__pyx_v_self->_global_namespaces), 0, PY_SSIZE_T_MAX) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._BaseContext.unregisterGlobalNamespaces");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_prefix_utf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":202
 *             del self._global_namespaces[:]
 * 
 *     cdef void _unregisterNamespace(self, prefix_utf):             # <<<<<<<<<<<<<<
 *         xpath.xmlXPathRegisterNs(self._xpathCtxt,
 *                                  _cstr(prefix_utf), NULL)
 */

static  void __pyx_f_4lxml_5etree_12_BaseContext__unregisterNamespace(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, PyObject *__pyx_v_prefix_utf) {
  __Pyx_RefNannySetupContext("_unregisterNamespace");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":204
 *     cdef void _unregisterNamespace(self, prefix_utf):
 *         xpath.xmlXPathRegisterNs(self._xpathCtxt,
 *                                  _cstr(prefix_utf), NULL)             # <<<<<<<<<<<<<<
 * 
 *     # extension functions
 */
  xmlXPathRegisterNs(__pyx_v_self->_xpathCtxt, PyBytes_AS_STRING(__pyx_v_prefix_utf), NULL);

  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":208
 *     # extension functions
 * 
 *     cdef void _addLocalExtensionFunction(self, ns_utf, name_utf, function):             # <<<<<<<<<<<<<<
 *         if self._extensions is None:
 *             self._extensions = {}
 */

static  void __pyx_f_4lxml_5etree_12_BaseContext__addLocalExtensionFunction(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, PyObject *__pyx_v_ns_utf, PyObject *__pyx_v_name_utf, PyObject *__pyx_v_function) {
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_addLocalExtensionFunction");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":209
 * 
 *     cdef void _addLocalExtensionFunction(self, ns_utf, name_utf, function):
 *         if self._extensions is None:             # <<<<<<<<<<<<<<
 *             self._extensions = {}
 *         self._extensions[(ns_utf, name_utf)] = function
 */
  __pyx_t_1 = (__pyx_v_self->_extensions == ((PyObject*)Py_None));
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":210
 *     cdef void _addLocalExtensionFunction(self, ns_utf, name_utf, function):
 *         if self._extensions is None:
 *             self._extensions = {}             # <<<<<<<<<<<<<<
 *         self._extensions[(ns_utf, name_utf)] = function
 * 
 */
    __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
    __Pyx_GOTREF(__pyx_v_self->_extensions);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->_extensions));
    __pyx_v_self->_extensions = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":211
 *         if self._extensions is None:
 *             self._extensions = {}
 *         self._extensions[(ns_utf, name_utf)] = function             # <<<<<<<<<<<<<<
 * 
 *     cdef void registerGlobalFunctions(self, void* ctxt,
 */
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(__pyx_v_ns_utf);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_ns_utf);
  __Pyx_GIVEREF(__pyx_v_ns_utf);
  __Pyx_INCREF(__pyx_v_name_utf);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_name_utf);
  __Pyx_GIVEREF(__pyx_v_name_utf);
  if (PyDict_SetItem(((PyObject *)__pyx_v_self->_extensions), ((PyObject *)__pyx_t_2), __pyx_v_function) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_WriteUnraisable("lxml.etree._BaseContext._addLocalExtensionFunction");
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":213
 *         self._extensions[(ns_utf, name_utf)] = function
 * 
 *     cdef void registerGlobalFunctions(self, void* ctxt,             # <<<<<<<<<<<<<<
 *                                       _register_function reg_func):
 *         cdef python.PyObject* dict_result
 */

static  void __pyx_f_4lxml_5etree_12_BaseContext_registerGlobalFunctions(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, void *__pyx_v_ctxt, __pyx_t_4lxml_5etree__register_function __pyx_v_reg_func) {
  PyObject *__pyx_v_dict_result;
  PyObject *__pyx_v_d;
  PyObject *__pyx_v_ns_utf;
  PyObject *__pyx_v_ns_functions;
  PyObject *__pyx_v_name_utf;
  PyObject *__pyx_v_function;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  void *__pyx_t_3;
  void *__pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  __Pyx_RefNannySetupContext("registerGlobalFunctions");
  __pyx_v_d = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_ns_utf = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_ns_functions = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_name_utf = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_function = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":217
 *         cdef python.PyObject* dict_result
 *         cdef dict d
 *         for ns_utf, ns_functions in __FUNCTION_NAMESPACE_REGISTRIES.iteritems():             # <<<<<<<<<<<<<<
 *             dict_result = python.PyDict_GetItem(
 *                 self._function_cache, ns_utf)
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_4lxml_5etree___FUNCTION_NAMESPACE_REGISTRIES));
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = ((PyObject *)__pyx_v_4lxml_5etree___FUNCTION_NAMESPACE_REGISTRIES);
  __pyx_t_2 = 0;
  while (1) {
    if (!PyDict_Next(__pyx_t_1, (&__pyx_t_2), ((PyObject **)(&__pyx_t_3)), ((PyObject **)(&__pyx_t_4)))) break;
    __Pyx_INCREF(((PyObject *)__pyx_t_3));
    __Pyx_DECREF(__pyx_v_ns_utf);
    __pyx_v_ns_utf = ((PyObject *)__pyx_t_3);
    __Pyx_INCREF(((PyObject *)__pyx_t_4));
    __Pyx_DECREF(__pyx_v_ns_functions);
    __pyx_v_ns_functions = ((PyObject *)__pyx_t_4);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":219
 *         for ns_utf, ns_functions in __FUNCTION_NAMESPACE_REGISTRIES.iteritems():
 *             dict_result = python.PyDict_GetItem(
 *                 self._function_cache, ns_utf)             # <<<<<<<<<<<<<<
 *             if dict_result is not NULL:
 *                 d = <dict>dict_result
 */
    __pyx_t_5 = ((PyObject *)__pyx_v_self->_function_cache);
    __Pyx_INCREF(__pyx_t_5);
    __pyx_v_dict_result = PyDict_GetItem(__pyx_t_5, __pyx_v_ns_utf);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":220
 *             dict_result = python.PyDict_GetItem(
 *                 self._function_cache, ns_utf)
 *             if dict_result is not NULL:             # <<<<<<<<<<<<<<
 *                 d = <dict>dict_result
 *             else:
 */
    __pyx_t_6 = (__pyx_v_dict_result != NULL);
    if (__pyx_t_6) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":221
 *                 self._function_cache, ns_utf)
 *             if dict_result is not NULL:
 *                 d = <dict>dict_result             # <<<<<<<<<<<<<<
 *             else:
 *                 d = {}
 */
      __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_v_dict_result)));
      __Pyx_DECREF(((PyObject *)__pyx_v_d));
      __pyx_v_d = ((PyObject*)__pyx_v_dict_result);
      goto __pyx_L5;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":223
 *                 d = <dict>dict_result
 *             else:
 *                 d = {}             # <<<<<<<<<<<<<<
 *                 self._function_cache[ns_utf] = d
 *             for name_utf, function in ns_functions.iteritems():
 */
      __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
      __Pyx_DECREF(((PyObject *)__pyx_v_d));
      __pyx_v_d = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":224
 *             else:
 *                 d = {}
 *                 self._function_cache[ns_utf] = d             # <<<<<<<<<<<<<<
 *             for name_utf, function in ns_functions.iteritems():
 *                 d[name_utf] = function
 */
      if (PyDict_SetItem(((PyObject *)__pyx_v_self->_function_cache), __pyx_v_ns_utf, ((PyObject *)__pyx_v_d)) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_L5:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":225
 *                 d = {}
 *                 self._function_cache[ns_utf] = d
 *             for name_utf, function in ns_functions.iteritems():             # <<<<<<<<<<<<<<
 *                 d[name_utf] = function
 *                 reg_func(ctxt, name_utf, ns_utf)
 */
    __pyx_t_5 = PyObject_GetAttr(__pyx_v_ns_functions, __pyx_n_s__iteritems); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_8 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (PyList_CheckExact(__pyx_t_8) || PyTuple_CheckExact(__pyx_t_8)) {
      __pyx_t_7 = 0; __pyx_t_5 = __pyx_t_8; __Pyx_INCREF(__pyx_t_5);
    } else {
      __pyx_t_7 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    for (;;) {
      if (likely(PyList_CheckExact(__pyx_t_5))) {
        if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_5)) break;
        __pyx_t_8 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_8); __pyx_t_7++;
      } else if (likely(PyTuple_CheckExact(__pyx_t_5))) {
        if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
        __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_8); __pyx_t_7++;
      } else {
        __pyx_t_8 = PyIter_Next(__pyx_t_5);
        if (!__pyx_t_8) {
          if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          break;
        }
        __Pyx_GOTREF(__pyx_t_8);
      }
      if (PyTuple_CheckExact(__pyx_t_8) && likely(PyTuple_GET_SIZE(__pyx_t_8) == 2)) {
        PyObject* tuple = __pyx_t_8;
        __pyx_t_9 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_9);
        __pyx_t_10 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_v_name_utf);
        __pyx_v_name_utf = __pyx_t_9;
        __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_v_function);
        __pyx_v_function = __pyx_t_10;
        __pyx_t_10 = 0;
      } else {
        __pyx_t_11 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_9 = __Pyx_UnpackItem(__pyx_t_11, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_10 = __Pyx_UnpackItem(__pyx_t_11, 1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_10);
        if (__Pyx_EndUnpack(__pyx_t_11, 2) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_DECREF(__pyx_v_name_utf);
        __pyx_v_name_utf = __pyx_t_9;
        __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_v_function);
        __pyx_v_function = __pyx_t_10;
        __pyx_t_10 = 0;
      }

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":226
 *                 self._function_cache[ns_utf] = d
 *             for name_utf, function in ns_functions.iteritems():
 *                 d[name_utf] = function             # <<<<<<<<<<<<<<
 *                 reg_func(ctxt, name_utf, ns_utf)
 * 
 */
      if (PyDict_SetItem(((PyObject *)__pyx_v_d), __pyx_v_name_utf, __pyx_v_function) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":227
 *             for name_utf, function in ns_functions.iteritems():
 *                 d[name_utf] = function
 *                 reg_func(ctxt, name_utf, ns_utf)             # <<<<<<<<<<<<<<
 * 
 *     cdef void registerLocalFunctions(self, void* ctxt,
 */
      __pyx_v_reg_func(__pyx_v_ctxt, __pyx_v_name_utf, __pyx_v_ns_utf);
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_WriteUnraisable("lxml.etree._BaseContext.registerGlobalFunctions");
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_d);
  __Pyx_DECREF(__pyx_v_ns_utf);
  __Pyx_DECREF(__pyx_v_ns_functions);
  __Pyx_DECREF(__pyx_v_name_utf);
  __Pyx_DECREF(__pyx_v_function);
  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":229
 *                 reg_func(ctxt, name_utf, ns_utf)
 * 
 *     cdef void registerLocalFunctions(self, void* ctxt,             # <<<<<<<<<<<<<<
 *                                       _register_function reg_func):
 *         cdef python.PyObject* dict_result
 */

static  void __pyx_f_4lxml_5etree_12_BaseContext_registerLocalFunctions(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, void *__pyx_v_ctxt, __pyx_t_4lxml_5etree__register_function __pyx_v_reg_func) {
  PyObject *__pyx_v_dict_result;
  PyObject *__pyx_v_d;
  PyObject *__pyx_v_last_ns;
  PyObject *__pyx_v_ns_utf;
  PyObject *__pyx_v_name_utf;
  PyObject *__pyx_v_function;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  void *__pyx_t_4;
  void *__pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_t_10;
  __Pyx_RefNannySetupContext("registerLocalFunctions");
  __pyx_v_d = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_last_ns = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_ns_utf = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_name_utf = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_function = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":233
 *         cdef python.PyObject* dict_result
 *         cdef dict d
 *         if self._extensions is None:             # <<<<<<<<<<<<<<
 *             return # done
 *         last_ns = None
 */
  __pyx_t_1 = (__pyx_v_self->_extensions == ((PyObject*)Py_None));
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":234
 *         cdef dict d
 *         if self._extensions is None:
 *             return # done             # <<<<<<<<<<<<<<
 *         last_ns = None
 *         d = None
 */
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":235
 *         if self._extensions is None:
 *             return # done
 *         last_ns = None             # <<<<<<<<<<<<<<
 *         d = None
 *         for (ns_utf, name_utf), function in self._extensions.iteritems():
 */
  __Pyx_INCREF(Py_None);
  __Pyx_DECREF(__pyx_v_last_ns);
  __pyx_v_last_ns = Py_None;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":236
 *             return # done
 *         last_ns = None
 *         d = None             # <<<<<<<<<<<<<<
 *         for (ns_utf, name_utf), function in self._extensions.iteritems():
 *             if ns_utf is not last_ns or d is None:
 */
  __Pyx_INCREF(Py_None);
  __Pyx_DECREF(((PyObject *)__pyx_v_d));
  __pyx_v_d = ((PyObject*)Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":237
 *         last_ns = None
 *         d = None
 *         for (ns_utf, name_utf), function in self._extensions.iteritems():             # <<<<<<<<<<<<<<
 *             if ns_utf is not last_ns or d is None:
 *                 last_ns = ns_utf
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_extensions));
  __Pyx_XDECREF(__pyx_t_2);
  __pyx_t_2 = ((PyObject *)__pyx_v_self->_extensions);
  __pyx_t_3 = 0;
  while (1) {
    if (!PyDict_Next(__pyx_t_2, (&__pyx_t_3), ((PyObject **)(&__pyx_t_4)), ((PyObject **)(&__pyx_t_5)))) break;
    if (PyTuple_CheckExact(((PyObject *)__pyx_t_4)) && likely(PyTuple_GET_SIZE(((PyObject *)__pyx_t_4)) == 2)) {
      PyObject* tuple = ((PyObject *)__pyx_t_4);
      __pyx_t_6 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_6);
      __pyx_t_7 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_v_ns_utf);
      __pyx_v_ns_utf = __pyx_t_6;
      __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_v_name_utf);
      __pyx_v_name_utf = __pyx_t_7;
      __pyx_t_7 = 0;
    } else {
      __pyx_t_8 = PyObject_GetIter(((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_6 = __Pyx_UnpackItem(__pyx_t_8, 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_UnpackItem(__pyx_t_8, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      if (__Pyx_EndUnpack(__pyx_t_8, 2) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_v_ns_utf);
      __pyx_v_ns_utf = __pyx_t_6;
      __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_v_name_utf);
      __pyx_v_name_utf = __pyx_t_7;
      __pyx_t_7 = 0;
    }
    __Pyx_INCREF(((PyObject *)__pyx_t_5));
    __Pyx_DECREF(__pyx_v_function);
    __pyx_v_function = ((PyObject *)__pyx_t_5);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":238
 *         d = None
 *         for (ns_utf, name_utf), function in self._extensions.iteritems():
 *             if ns_utf is not last_ns or d is None:             # <<<<<<<<<<<<<<
 *                 last_ns = ns_utf
 *                 dict_result = python.PyDict_GetItem(
 */
    __pyx_t_1 = (__pyx_v_ns_utf != __pyx_v_last_ns);
    if (!__pyx_t_1) {
      __pyx_t_9 = (__pyx_v_d == ((PyObject*)Py_None));
      __pyx_t_10 = __pyx_t_9;
    } else {
      __pyx_t_10 = __pyx_t_1;
    }
    if (__pyx_t_10) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":239
 *         for (ns_utf, name_utf), function in self._extensions.iteritems():
 *             if ns_utf is not last_ns or d is None:
 *                 last_ns = ns_utf             # <<<<<<<<<<<<<<
 *                 dict_result = python.PyDict_GetItem(
 *                     self._function_cache, ns_utf)
 */
      __Pyx_INCREF(__pyx_v_ns_utf);
      __Pyx_DECREF(__pyx_v_last_ns);
      __pyx_v_last_ns = __pyx_v_ns_utf;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":241
 *                 last_ns = ns_utf
 *                 dict_result = python.PyDict_GetItem(
 *                     self._function_cache, ns_utf)             # <<<<<<<<<<<<<<
 *                 if dict_result is not NULL:
 *                     d = <dict>dict_result
 */
      __pyx_t_7 = ((PyObject *)__pyx_v_self->_function_cache);
      __Pyx_INCREF(__pyx_t_7);
      __pyx_v_dict_result = PyDict_GetItem(__pyx_t_7, __pyx_v_ns_utf);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":242
 *                 dict_result = python.PyDict_GetItem(
 *                     self._function_cache, ns_utf)
 *                 if dict_result is not NULL:             # <<<<<<<<<<<<<<
 *                     d = <dict>dict_result
 *                 else:
 */
      __pyx_t_10 = (__pyx_v_dict_result != NULL);
      if (__pyx_t_10) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":243
 *                     self._function_cache, ns_utf)
 *                 if dict_result is not NULL:
 *                     d = <dict>dict_result             # <<<<<<<<<<<<<<
 *                 else:
 *                     d = {}
 */
        __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_v_dict_result)));
        __Pyx_DECREF(((PyObject *)__pyx_v_d));
        __pyx_v_d = ((PyObject*)__pyx_v_dict_result);
        goto __pyx_L7;
      }
      /*else*/ {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":245
 *                     d = <dict>dict_result
 *                 else:
 *                     d = {}             # <<<<<<<<<<<<<<
 *                     self._function_cache[ns_utf] = d
 *             d[name_utf] = function
 */
        __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_7));
        __Pyx_DECREF(((PyObject *)__pyx_v_d));
        __pyx_v_d = __pyx_t_7;
        __pyx_t_7 = 0;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":246
 *                 else:
 *                     d = {}
 *                     self._function_cache[ns_utf] = d             # <<<<<<<<<<<<<<
 *             d[name_utf] = function
 *             reg_func(ctxt, name_utf, ns_utf)
 */
        if (PyDict_SetItem(((PyObject *)__pyx_v_self->_function_cache), __pyx_v_ns_utf, ((PyObject *)__pyx_v_d)) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_L7:;
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":247
 *                     d = {}
 *                     self._function_cache[ns_utf] = d
 *             d[name_utf] = function             # <<<<<<<<<<<<<<
 *             reg_func(ctxt, name_utf, ns_utf)
 * 
 */
    if (PyDict_SetItem(((PyObject *)__pyx_v_d), __pyx_v_name_utf, __pyx_v_function) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":248
 *                     self._function_cache[ns_utf] = d
 *             d[name_utf] = function
 *             reg_func(ctxt, name_utf, ns_utf)             # <<<<<<<<<<<<<<
 * 
 *     cdef unregisterAllFunctions(self, void* ctxt,
 */
    __pyx_v_reg_func(__pyx_v_ctxt, __pyx_v_name_utf, __pyx_v_ns_utf);
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_WriteUnraisable("lxml.etree._BaseContext.registerLocalFunctions");
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_d);
  __Pyx_DECREF(__pyx_v_last_ns);
  __Pyx_DECREF(__pyx_v_ns_utf);
  __Pyx_DECREF(__pyx_v_name_utf);
  __Pyx_DECREF(__pyx_v_function);
  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":250
 *             reg_func(ctxt, name_utf, ns_utf)
 * 
 *     cdef unregisterAllFunctions(self, void* ctxt,             # <<<<<<<<<<<<<<
 *                                       _register_function unreg_func):
 *         for ns_utf, functions in self._function_cache.iteritems():
 */

static  PyObject *__pyx_f_4lxml_5etree_12_BaseContext_unregisterAllFunctions(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, void *__pyx_v_ctxt, __pyx_t_4lxml_5etree__register_function __pyx_v_unreg_func) {
  PyObject *__pyx_v_ns_utf;
  PyObject *__pyx_v_functions;
  PyObject *__pyx_v_name_utf;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  void *__pyx_t_3;
  void *__pyx_t_4;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("unregisterAllFunctions");
  __pyx_v_ns_utf = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_functions = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_name_utf = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":252
 *     cdef unregisterAllFunctions(self, void* ctxt,
 *                                       _register_function unreg_func):
 *         for ns_utf, functions in self._function_cache.iteritems():             # <<<<<<<<<<<<<<
 *             for name_utf in functions:
 *                 unreg_func(ctxt, name_utf, ns_utf)
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_function_cache));
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_function_cache);
  __pyx_t_2 = 0;
  while (1) {
    if (!PyDict_Next(__pyx_t_1, (&__pyx_t_2), ((PyObject **)(&__pyx_t_3)), ((PyObject **)(&__pyx_t_4)))) break;
    __Pyx_INCREF(((PyObject *)__pyx_t_3));
    __Pyx_DECREF(__pyx_v_ns_utf);
    __pyx_v_ns_utf = ((PyObject *)__pyx_t_3);
    __Pyx_INCREF(((PyObject *)__pyx_t_4));
    __Pyx_DECREF(__pyx_v_functions);
    __pyx_v_functions = ((PyObject *)__pyx_t_4);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":253
 *                                       _register_function unreg_func):
 *         for ns_utf, functions in self._function_cache.iteritems():
 *             for name_utf in functions:             # <<<<<<<<<<<<<<
 *                 unreg_func(ctxt, name_utf, ns_utf)
 * 
 */
    if (PyList_CheckExact(__pyx_v_functions) || PyTuple_CheckExact(__pyx_v_functions)) {
      __pyx_t_5 = 0; __pyx_t_6 = __pyx_v_functions; __Pyx_INCREF(__pyx_t_6);
    } else {
      __pyx_t_5 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_functions); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
    }
    for (;;) {
      if (likely(PyList_CheckExact(__pyx_t_6))) {
        if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_6)) break;
        __pyx_t_7 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++;
      } else if (likely(PyTuple_CheckExact(__pyx_t_6))) {
        if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
        __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++;
      } else {
        __pyx_t_7 = PyIter_Next(__pyx_t_6);
        if (!__pyx_t_7) {
          if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          break;
        }
        __Pyx_GOTREF(__pyx_t_7);
      }
      __Pyx_DECREF(__pyx_v_name_utf);
      __pyx_v_name_utf = __pyx_t_7;
      __pyx_t_7 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":254
 *         for ns_utf, functions in self._function_cache.iteritems():
 *             for name_utf in functions:
 *                 unreg_func(ctxt, name_utf, ns_utf)             # <<<<<<<<<<<<<<
 * 
 *     cdef unregisterGlobalFunctions(self, void* ctxt,
 */
      __pyx_v_unreg_func(__pyx_v_ctxt, __pyx_v_name_utf, __pyx_v_ns_utf);
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree._BaseContext.unregisterAllFunctions");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_ns_utf);
  __Pyx_DECREF(__pyx_v_functions);
  __Pyx_DECREF(__pyx_v_name_utf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":256
 *                 unreg_func(ctxt, name_utf, ns_utf)
 * 
 *     cdef unregisterGlobalFunctions(self, void* ctxt,             # <<<<<<<<<<<<<<
 *                                          _register_function unreg_func):
 *         for ns_utf, functions in self._function_cache.items():
 */

static  PyObject *__pyx_f_4lxml_5etree_12_BaseContext_unregisterGlobalFunctions(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, void *__pyx_v_ctxt, __pyx_t_4lxml_5etree__register_function __pyx_v_unreg_func) {
  PyObject *__pyx_v_ns_utf;
  PyObject *__pyx_v_functions;
  PyObject *__pyx_v_name_utf;
  PyObject *__pyx_r = NULL;
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  __Pyx_RefNannySetupContext("unregisterGlobalFunctions");
  __pyx_v_ns_utf = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_functions = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_name_utf = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":258
 *     cdef unregisterGlobalFunctions(self, void* ctxt,
 *                                          _register_function unreg_func):
 *         for ns_utf, functions in self._function_cache.items():             # <<<<<<<<<<<<<<
 *             for name_utf in functions:
 *                 if self._extensions is None or \
 */
  if (unlikely(__pyx_v_self->_function_cache == Py_None)) {
    PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'items'"); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_2 = PyDict_Items(__pyx_v_self->_function_cache); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
    __pyx_t_1 = 0; __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3);
  } else {
    __pyx_t_1 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  for (;;) {
    if (likely(PyList_CheckExact(__pyx_t_3))) {
      if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_3)) break;
      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_2); __pyx_t_1++;
    } else if (likely(PyTuple_CheckExact(__pyx_t_3))) {
      if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_2); __pyx_t_1++;
    } else {
      __pyx_t_2 = PyIter_Next(__pyx_t_3);
      if (!__pyx_t_2) {
        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    if (PyTuple_CheckExact(__pyx_t_2) && likely(PyTuple_GET_SIZE(__pyx_t_2) == 2)) {
      PyObject* tuple = __pyx_t_2;
      __pyx_t_4 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_4);
      __pyx_t_5 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_v_ns_utf);
      __pyx_v_ns_utf = __pyx_t_4;
      __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_v_functions);
      __pyx_v_functions = __pyx_t_5;
      __pyx_t_5 = 0;
    } else {
      __pyx_t_6 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_4 = __Pyx_UnpackItem(__pyx_t_6, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_UnpackItem(__pyx_t_6, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_EndUnpack(__pyx_t_6, 2) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_v_ns_utf);
      __pyx_v_ns_utf = __pyx_t_4;
      __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_v_functions);
      __pyx_v_functions = __pyx_t_5;
      __pyx_t_5 = 0;
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":259
 *                                          _register_function unreg_func):
 *         for ns_utf, functions in self._function_cache.items():
 *             for name_utf in functions:             # <<<<<<<<<<<<<<
 *                 if self._extensions is None or \
 *                        (ns_utf, name_utf) not in self._extensions:
 */
    if (PyList_CheckExact(__pyx_v_functions) || PyTuple_CheckExact(__pyx_v_functions)) {
      __pyx_t_7 = 0; __pyx_t_2 = __pyx_v_functions; __Pyx_INCREF(__pyx_t_2);
    } else {
      __pyx_t_7 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_functions); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
    }
    for (;;) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_2)) break;
        __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_5); __pyx_t_7++;
      } else if (likely(PyTuple_CheckExact(__pyx_t_2))) {
        if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_5); __pyx_t_7++;
      } else {
        __pyx_t_5 = PyIter_Next(__pyx_t_2);
        if (!__pyx_t_5) {
          if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          break;
        }
        __Pyx_GOTREF(__pyx_t_5);
      }
      __Pyx_DECREF(__pyx_v_name_utf);
      __pyx_v_name_utf = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":260
 *         for ns_utf, functions in self._function_cache.items():
 *             for name_utf in functions:
 *                 if self._extensions is None or \             # <<<<<<<<<<<<<<
 *                        (ns_utf, name_utf) not in self._extensions:
 *                     unreg_func(ctxt, name_utf, ns_utf)
 */
      __pyx_t_8 = (__pyx_v_self->_extensions == ((PyObject*)Py_None));
      if (!__pyx_t_8) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":261
 *             for name_utf in functions:
 *                 if self._extensions is None or \
 *                        (ns_utf, name_utf) not in self._extensions:             # <<<<<<<<<<<<<<
 *                     unreg_func(ctxt, name_utf, ns_utf)
 * 
 */
        __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_5));
        __Pyx_INCREF(__pyx_v_ns_utf);
        PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_ns_utf);
        __Pyx_GIVEREF(__pyx_v_ns_utf);
        __Pyx_INCREF(__pyx_v_name_utf);
        PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_name_utf);
        __Pyx_GIVEREF(__pyx_v_name_utf);
        if (unlikely(__pyx_v_self->_extensions == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
        }
        __pyx_t_9 = (__Pyx_NegateNonNeg(PyDict_Contains(((PyObject *)__pyx_v_self->_extensions), ((PyObject *)__pyx_t_5)))); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
        __pyx_t_10 = __pyx_t_9;
      } else {
        __pyx_t_10 = __pyx_t_8;
      }
      if (__pyx_t_10) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":262
 *                 if self._extensions is None or \
 *                        (ns_utf, name_utf) not in self._extensions:
 *                     unreg_func(ctxt, name_utf, ns_utf)             # <<<<<<<<<<<<<<
 * 
 *     cdef _find_cached_function(self, char* c_ns_uri, char* c_name):
 */
        __pyx_v_unreg_func(__pyx_v_ctxt, __pyx_v_name_utf, __pyx_v_ns_utf);
        goto __pyx_L7;
      }
      __pyx_L7:;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._BaseContext.unregisterGlobalFunctions");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_ns_utf);
  __Pyx_DECREF(__pyx_v_functions);
  __Pyx_DECREF(__pyx_v_name_utf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":264
 *                     unreg_func(ctxt, name_utf, ns_utf)
 * 
 *     cdef _find_cached_function(self, char* c_ns_uri, char* c_name):             # <<<<<<<<<<<<<<
 *         u"""Lookup an extension function in the cache and return it.
 * 
 */

static  PyObject *__pyx_f_4lxml_5etree_12_BaseContext__find_cached_function(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, char *__pyx_v_c_ns_uri, char *__pyx_v_c_name) {
  PyObject *__pyx_v_c_dict;
  PyObject *__pyx_v_dict_result;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("_find_cached_function");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":271
 *         cdef python.PyObject* c_dict
 *         cdef python.PyObject* dict_result
 *         if c_ns_uri is NULL:             # <<<<<<<<<<<<<<
 *             c_dict = python.PyDict_GetItem(
 *                 self._function_cache, None)
 */
  __pyx_t_1 = (__pyx_v_c_ns_uri == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":273
 *         if c_ns_uri is NULL:
 *             c_dict = python.PyDict_GetItem(
 *                 self._function_cache, None)             # <<<<<<<<<<<<<<
 *         else:
 *             c_dict = python.PyDict_GetItem(
 */
    __pyx_t_2 = ((PyObject *)__pyx_v_self->_function_cache);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v_c_dict = PyDict_GetItem(__pyx_t_2, Py_None);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":276
 *         else:
 *             c_dict = python.PyDict_GetItem(
 *                 self._function_cache, c_ns_uri)             # <<<<<<<<<<<<<<
 * 
 *         if c_dict is not NULL:
 */
    __pyx_t_2 = ((PyObject *)__pyx_v_self->_function_cache);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = PyBytes_FromString(__pyx_v_c_ns_uri); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __pyx_v_c_dict = PyDict_GetItem(__pyx_t_2, ((PyObject *)__pyx_t_3));
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":278
 *                 self._function_cache, c_ns_uri)
 * 
 *         if c_dict is not NULL:             # <<<<<<<<<<<<<<
 *             dict_result = python.PyDict_GetItem(
 *                 <object>c_dict, c_name)
 */
  __pyx_t_1 = (__pyx_v_c_dict != NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":280
 *         if c_dict is not NULL:
 *             dict_result = python.PyDict_GetItem(
 *                 <object>c_dict, c_name)             # <<<<<<<<<<<<<<
 *             if dict_result is not NULL:
 *                 return <object>dict_result
 */
    __pyx_t_3 = PyBytes_FromString(__pyx_v_c_name); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __pyx_v_dict_result = PyDict_GetItem(((PyObject *)__pyx_v_c_dict), ((PyObject *)__pyx_t_3));
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":281
 *             dict_result = python.PyDict_GetItem(
 *                 <object>c_dict, c_name)
 *             if dict_result is not NULL:             # <<<<<<<<<<<<<<
 *                 return <object>dict_result
 *         return None
 */
    __pyx_t_1 = (__pyx_v_dict_result != NULL);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":282
 *                 <object>c_dict, c_name)
 *             if dict_result is not NULL:
 *                 return <object>dict_result             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_dict_result));
      __pyx_r = ((PyObject *)__pyx_v_dict_result);
      goto __pyx_L0;
      goto __pyx_L5;
    }
    __pyx_L5:;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":283
 *             if dict_result is not NULL:
 *                 return <object>dict_result
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     # Python access to the XPath context for extension functions
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_None);
  __pyx_r = Py_None;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._BaseContext._find_cached_function");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":288
 * 
 *     property context_node:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef xmlNode* c_node
 *             if self._xpathCtxt is NULL:
 */

static PyObject *__pyx_pf_4lxml_5etree_12_BaseContext_12context_node___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_12_BaseContext_12context_node___get__(PyObject *__pyx_v_self) {
  xmlNode *__pyx_v_c_node;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__get__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":290
 *         def __get__(self):
 *             cdef xmlNode* c_node
 *             if self._xpathCtxt is NULL:             # <<<<<<<<<<<<<<
 *                 raise XPathError, \
 *                     u"XPath context is only usable during the evaluation"
 */
  __pyx_t_1 = (((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)->_xpathCtxt == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":291
 *             cdef xmlNode* c_node
 *             if self._xpathCtxt is NULL:
 *                 raise XPathError, \             # <<<<<<<<<<<<<<
 *                     u"XPath context is only usable during the evaluation"
 *             c_node = self._xpathCtxt.node
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__XPathError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, ((PyObject *)__pyx_kp_u_302), 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[6]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":293
 *                 raise XPathError, \
 *                     u"XPath context is only usable during the evaluation"
 *             c_node = self._xpathCtxt.node             # <<<<<<<<<<<<<<
 *             if c_node is NULL:
 *                 raise XPathError, u"no context node"
 */
  __pyx_v_c_node = ((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)->_xpathCtxt->node;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":294
 *                     u"XPath context is only usable during the evaluation"
 *             c_node = self._xpathCtxt.node
 *             if c_node is NULL:             # <<<<<<<<<<<<<<
 *                 raise XPathError, u"no context node"
 *             if c_node.doc != self._xpathCtxt.doc:
 */
  __pyx_t_1 = (__pyx_v_c_node == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":295
 *             c_node = self._xpathCtxt.node
 *             if c_node is NULL:
 *                 raise XPathError, u"no context node"             # <<<<<<<<<<<<<<
 *             if c_node.doc != self._xpathCtxt.doc:
 *                 raise XPathError, \
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__XPathError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, ((PyObject *)__pyx_kp_u_303), 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[6]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":296
 *             if c_node is NULL:
 *                 raise XPathError, u"no context node"
 *             if c_node.doc != self._xpathCtxt.doc:             # <<<<<<<<<<<<<<
 *                 raise XPathError, \
 *                     u"document-external context nodes are not supported"
 */
  __pyx_t_1 = (__pyx_v_c_node->doc != ((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)->_xpathCtxt->doc);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":297
 *                 raise XPathError, u"no context node"
 *             if c_node.doc != self._xpathCtxt.doc:
 *                 raise XPathError, \             # <<<<<<<<<<<<<<
 *                     u"document-external context nodes are not supported"
 *             if self._doc is None:
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__XPathError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, ((PyObject *)__pyx_kp_u_304), 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[6]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":299
 *                 raise XPathError, \
 *                     u"document-external context nodes are not supported"
 *             if self._doc is None:             # <<<<<<<<<<<<<<
 *                 raise XPathError, u"document context is missing"
 *             return _elementFactory(self._doc, c_node)
 */
  __pyx_t_1 = (((PyObject *)((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)->_doc) == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":300
 *                     u"document-external context nodes are not supported"
 *             if self._doc is None:
 *                 raise XPathError, u"document context is missing"             # <<<<<<<<<<<<<<
 *             return _elementFactory(self._doc, c_node)
 * 
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__XPathError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, ((PyObject *)__pyx_kp_u_305), 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[6]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L8;
  }
  __pyx_L8:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":301
 *             if self._doc is None:
 *                 raise XPathError, u"document context is missing"
 *             return _elementFactory(self._doc, c_node)             # <<<<<<<<<<<<<<
 * 
 *     property eval_context:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)->_doc);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_2), __pyx_v_c_node)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._BaseContext.context_node.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":304
 * 
 *     property eval_context:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if self._eval_context_dict is None:
 *                 self._eval_context_dict = {}
 */

static PyObject *__pyx_pf_4lxml_5etree_12_BaseContext_12eval_context___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_12_BaseContext_12eval_context___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__get__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":305
 *     property eval_context:
 *         def __get__(self):
 *             if self._eval_context_dict is None:             # <<<<<<<<<<<<<<
 *                 self._eval_context_dict = {}
 *             return self._eval_context_dict
 */
  __pyx_t_1 = (((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)->_eval_context_dict == ((PyObject*)Py_None));
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":306
 *         def __get__(self):
 *             if self._eval_context_dict is None:
 *                 self._eval_context_dict = {}             # <<<<<<<<<<<<<<
 *             return self._eval_context_dict
 * 
 */
    __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
    __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)->_eval_context_dict);
    __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)->_eval_context_dict));
    ((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)->_eval_context_dict = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":307
 *             if self._eval_context_dict is None:
 *                 self._eval_context_dict = {}
 *             return self._eval_context_dict             # <<<<<<<<<<<<<<
 * 
 *     # Python reference keeping during XPath function evaluation
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)->_eval_context_dict));
  __pyx_r = ((PyObject *)((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)->_eval_context_dict);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._BaseContext.eval_context.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":311
 *     # Python reference keeping during XPath function evaluation
 * 
 *     cdef _release_temp_refs(self):             # <<<<<<<<<<<<<<
 *         u"Free temporarily referenced objects from this context."
 *         self._temp_refs.clear()
 */

static  PyObject *__pyx_f_4lxml_5etree_12_BaseContext__release_temp_refs(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_release_temp_refs");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":313
 *     cdef _release_temp_refs(self):
 *         u"Free temporarily referenced objects from this context."
 *         self._temp_refs.clear()             # <<<<<<<<<<<<<<
 *         self._temp_documents.clear()
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__TempStore *)__pyx_v_self->_temp_refs->__pyx_vtab)->clear(__pyx_v_self->_temp_refs); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":314
 *         u"Free temporarily referenced objects from this context."
 *         self._temp_refs.clear()
 *         self._temp_documents.clear()             # <<<<<<<<<<<<<<
 * 
 *     cdef _hold(self, obj):
 */
  if (unlikely(__pyx_v_self->_temp_documents == Py_None)) {
    PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'clear'"); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_1 = PySet_Clear(__pyx_v_self->_temp_documents); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._BaseContext._release_temp_refs");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":316
 *         self._temp_documents.clear()
 * 
 *     cdef _hold(self, obj):             # <<<<<<<<<<<<<<
 *         u"""A way to temporarily hold references to nodes in the evaluator.
 * 
 */

static  PyObject *__pyx_f_4lxml_5etree_12_BaseContext__hold(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, PyObject *__pyx_v_obj) {
  PyObject *__pyx_v_o;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("_hold");
  __pyx_v_o = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":324
 *         """
 *         cdef _Element element
 *         if isinstance(obj, _Element):             # <<<<<<<<<<<<<<
 *             self._temp_refs.add(obj)
 *             self._temp_documents.add((<_Element>obj)._doc)
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, ((PyObject*)__pyx_ptype_4lxml_5etree__Element)); 
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":325
 *         cdef _Element element
 *         if isinstance(obj, _Element):
 *             self._temp_refs.add(obj)             # <<<<<<<<<<<<<<
 *             self._temp_documents.add((<_Element>obj)._doc)
 *             return
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__TempStore *)__pyx_v_self->_temp_refs->__pyx_vtab)->add(__pyx_v_self->_temp_refs, __pyx_v_obj); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":326
 *         if isinstance(obj, _Element):
 *             self._temp_refs.add(obj)
 *             self._temp_documents.add((<_Element>obj)._doc)             # <<<<<<<<<<<<<<
 *             return
 *         elif _isString(obj) or not python.PySequence_Check(obj):
 */
    if (unlikely(__pyx_v_self->_temp_documents == Py_None)) {
      PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'add'"); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_3 = ((PyObject *)((struct LxmlElement *)__pyx_v_obj)->_doc);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_2 = PySet_Add(__pyx_v_self->_temp_documents, __pyx_t_3); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":327
 *             self._temp_refs.add(obj)
 *             self._temp_documents.add((<_Element>obj)._doc)
 *             return             # <<<<<<<<<<<<<<
 *         elif _isString(obj) or not python.PySequence_Check(obj):
 *             return
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":328
 *             self._temp_documents.add((<_Element>obj)._doc)
 *             return
 *         elif _isString(obj) or not python.PySequence_Check(obj):             # <<<<<<<<<<<<<<
 *             return
 *         for o in obj:
 */
  __pyx_t_1 = _isString(__pyx_v_obj);
  if (!__pyx_t_1) {
    __pyx_t_4 = (!PySequence_Check(__pyx_v_obj));
    __pyx_t_5 = __pyx_t_4;
  } else {
    __pyx_t_5 = __pyx_t_1;
  }
  if (__pyx_t_5) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":329
 *             return
 *         elif _isString(obj) or not python.PySequence_Check(obj):
 *             return             # <<<<<<<<<<<<<<
 *         for o in obj:
 *             if isinstance(o, _Element):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":330
 *         elif _isString(obj) or not python.PySequence_Check(obj):
 *             return
 *         for o in obj:             # <<<<<<<<<<<<<<
 *             if isinstance(o, _Element):
 *                 #print "Holding element:", <int>element._c_node
 */
  if (PyList_CheckExact(__pyx_v_obj) || PyTuple_CheckExact(__pyx_v_obj)) {
    __pyx_t_6 = 0; __pyx_t_3 = __pyx_v_obj; __Pyx_INCREF(__pyx_t_3);
  } else {
    __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_obj); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
  }
  for (;;) {
    if (likely(PyList_CheckExact(__pyx_t_3))) {
      if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_3)) break;
      __pyx_t_7 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_7); __pyx_t_6++;
    } else if (likely(PyTuple_CheckExact(__pyx_t_3))) {
      if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
      __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_7); __pyx_t_6++;
    } else {
      __pyx_t_7 = PyIter_Next(__pyx_t_3);
      if (!__pyx_t_7) {
        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        break;
      }
      __Pyx_GOTREF(__pyx_t_7);
    }
    __Pyx_DECREF(__pyx_v_o);
    __pyx_v_o = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":331
 *             return
 *         for o in obj:
 *             if isinstance(o, _Element):             # <<<<<<<<<<<<<<
 *                 #print "Holding element:", <int>element._c_node
 *                 self._temp_refs.add(o)
 */
    __pyx_t_5 = __Pyx_TypeCheck(__pyx_v_o, ((PyObject*)__pyx_ptype_4lxml_5etree__Element)); 
    if (__pyx_t_5) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":333
 *             if isinstance(o, _Element):
 *                 #print "Holding element:", <int>element._c_node
 *                 self._temp_refs.add(o)             # <<<<<<<<<<<<<<
 *                 #print "Holding document:", <int>element._doc._c_doc
 *                 self._temp_documents.add((<_Element>o)._doc)
 */
      __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__TempStore *)__pyx_v_self->_temp_refs->__pyx_vtab)->add(__pyx_v_self->_temp_refs, __pyx_v_o); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":335
 *                 self._temp_refs.add(o)
 *                 #print "Holding document:", <int>element._doc._c_doc
 *                 self._temp_documents.add((<_Element>o)._doc)             # <<<<<<<<<<<<<<
 * 
 *     cdef _Document _findDocumentForNode(self, xmlNode* c_node):
 */
      if (unlikely(__pyx_v_self->_temp_documents == Py_None)) {
        PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'add'"); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
      }
      __pyx_t_7 = ((PyObject *)((struct LxmlElement *)__pyx_v_o)->_doc);
      __Pyx_INCREF(__pyx_t_7);
      __pyx_t_2 = PySet_Add(__pyx_v_self->_temp_documents, __pyx_t_7); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L6;
    }
    __pyx_L6:;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree._BaseContext._hold");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_o);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":337
 *                 self._temp_documents.add((<_Element>o)._doc)
 * 
 *     cdef _Document _findDocumentForNode(self, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *         u"""If an XPath expression returns an element from a different
 *         document than the current context document, we call this to
 */

static  struct LxmlDocument *__pyx_f_4lxml_5etree_12_BaseContext__findDocumentForNode(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, xmlNode *__pyx_v_c_node) {
  struct LxmlDocument *__pyx_v_doc;
  struct LxmlDocument *__pyx_r = NULL;
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("_findDocumentForNode");
  __pyx_v_doc = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":344
 *         """
 *         cdef _Document doc
 *         for doc in self._temp_documents:             # <<<<<<<<<<<<<<
 *             if doc is not None and doc._c_doc is c_node.doc:
 *                 return doc
 */
  __pyx_t_1 = -1; __pyx_t_2 = PyObject_GetIter(((PyObject *)__pyx_v_self->_temp_documents)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  for (;;) {
    {
      __pyx_t_3 = PyIter_Next(__pyx_t_2);
      if (!__pyx_t_3) {
        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_4lxml_5etree__Document))))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_v_doc));
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":345
 *         cdef _Document doc
 *         for doc in self._temp_documents:
 *             if doc is not None and doc._c_doc is c_node.doc:             # <<<<<<<<<<<<<<
 *                 return doc
 *         return None
 */
    __pyx_t_4 = (((PyObject *)__pyx_v_doc) != Py_None);
    if (__pyx_t_4) {
      __pyx_t_5 = (__pyx_v_doc->_c_doc == __pyx_v_c_node->doc);
      __pyx_t_6 = __pyx_t_5;
    } else {
      __pyx_t_6 = __pyx_t_4;
    }
    if (__pyx_t_6) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":346
 *         for doc in self._temp_documents:
 *             if doc is not None and doc._c_doc is c_node.doc:
 *                 return doc             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __Pyx_INCREF(((PyObject *)__pyx_v_doc));
      __pyx_r = __pyx_v_doc;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L0;
      goto __pyx_L5;
    }
    __pyx_L5:;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":347
 *             if doc is not None and doc._c_doc is c_node.doc:
 *                 return doc
 *         return None             # <<<<<<<<<<<<<<
 * 
 * def Extension(module, function_mapping=None, *, ns=None):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(Py_None);
  __pyx_r = ((struct LxmlDocument *)Py_None);
  goto __pyx_L0;

  __pyx_r = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._BaseContext._findDocumentForNode");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_doc);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":349
 *         return None
 * 
 * def Extension(module, function_mapping=None, *, ns=None):             # <<<<<<<<<<<<<<
 *     u"""Extension(module, function_mapping=None, ns=None)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_30Extension(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_30Extension[] = "Extension(module, function_mapping=None, ns=None)\n\n    Build a dictionary of extension functions from the functions\n    defined in a module or the methods of an object.\n\n    As second argument, you can pass an additional mapping of\n    attribute names to XPath function names, or a list of function\n    names that should be taken.\n\n    The ``ns`` keyword argument accepts a namespace URI for the XPath\n    functions.\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_30Extension = {__Pyx_NAMESTR("Extension"), (PyCFunction)__pyx_pf_4lxml_5etree_30Extension, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_30Extension)};
static PyObject *__pyx_pf_4lxml_5etree_30Extension(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_module = 0;
  PyObject *__pyx_v_function_mapping = 0;
  PyObject *__pyx_v_ns = 0;
  PyObject *__pyx_v_functions = 0;
  PyObject *__pyx_v_function_name;
  PyObject *__pyx_v_xpath_name;
  PyObject *__pyx_v_name;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__module,&__pyx_n_s__function_mapping,&__pyx_n_s__ns,0};
  __Pyx_RefNannySetupContext("Extension");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__module);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__function_mapping);
        if (value) { values[1] = value; kw_args--; }
      }
    }
    while (kw_args > 0) {
      PyObject* value;
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ns);
      if (value) { values[2] = value; if (!(--kw_args)) break; }
      break;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "Extension") < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_module = values[0];
    __pyx_v_function_mapping = values[1];
    __pyx_v_ns = values[2];
  } else {
    __pyx_v_function_mapping = ((PyObject *)Py_None);
    __pyx_v_ns = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_function_mapping = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v_module = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("Extension", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.Extension");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF(__pyx_v_function_mapping);
  __pyx_v_function_name = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_xpath_name = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_name = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":362
 *     functions.
 *     """
 *     cdef dict functions = {}             # <<<<<<<<<<<<<<
 *     if python.PyDict_Check(function_mapping):
 *         for function_name, xpath_name in function_mapping.items():
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_functions = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":363
 *     """
 *     cdef dict functions = {}
 *     if python.PyDict_Check(function_mapping):             # <<<<<<<<<<<<<<
 *         for function_name, xpath_name in function_mapping.items():
 *             functions[(ns, xpath_name)] = getattr(module, function_name)
 */
  __pyx_t_2 = PyDict_Check(__pyx_v_function_mapping);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":364
 *     cdef dict functions = {}
 *     if python.PyDict_Check(function_mapping):
 *         for function_name, xpath_name in function_mapping.items():             # <<<<<<<<<<<<<<
 *             functions[(ns, xpath_name)] = getattr(module, function_name)
 *     else:
 */
    __pyx_t_1 = PyObject_GetAttr(__pyx_v_function_mapping, __pyx_n_s__items); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (PyList_CheckExact(__pyx_t_4) || PyTuple_CheckExact(__pyx_t_4)) {
      __pyx_t_3 = 0; __pyx_t_1 = __pyx_t_4; __Pyx_INCREF(__pyx_t_1);
    } else {
      __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    for (;;) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++;
      } else if (likely(PyTuple_CheckExact(__pyx_t_1))) {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++;
      } else {
        __pyx_t_4 = PyIter_Next(__pyx_t_1);
        if (!__pyx_t_4) {
          if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          break;
        }
        __Pyx_GOTREF(__pyx_t_4);
      }
      if (PyTuple_CheckExact(__pyx_t_4) && likely(PyTuple_GET_SIZE(__pyx_t_4) == 2)) {
        PyObject* tuple = __pyx_t_4;
        __pyx_t_5 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_5);
        __pyx_t_6 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_v_function_name);
        __pyx_v_function_name = __pyx_t_5;
        __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_v_xpath_name);
        __pyx_v_xpath_name = __pyx_t_6;
        __pyx_t_6 = 0;
      } else {
        __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_5 = __Pyx_UnpackItem(__pyx_t_7, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_6 = __Pyx_UnpackItem(__pyx_t_7, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        if (__Pyx_EndUnpack(__pyx_t_7, 2) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_v_function_name);
        __pyx_v_function_name = __pyx_t_5;
        __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_v_xpath_name);
        __pyx_v_xpath_name = __pyx_t_6;
        __pyx_t_6 = 0;
      }

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":365
 *     if python.PyDict_Check(function_mapping):
 *         for function_name, xpath_name in function_mapping.items():
 *             functions[(ns, xpath_name)] = getattr(module, function_name)             # <<<<<<<<<<<<<<
 *     else:
 *         if function_mapping is None:
 */
      __pyx_t_4 = PyObject_GetAttr(__pyx_v_module, __pyx_v_function_name); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
      __Pyx_INCREF(__pyx_v_ns);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_ns);
      __Pyx_GIVEREF(__pyx_v_ns);
      __Pyx_INCREF(__pyx_v_xpath_name);
      PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_xpath_name);
      __Pyx_GIVEREF(__pyx_v_xpath_name);
      if (PyDict_SetItem(((PyObject *)__pyx_v_functions), ((PyObject *)__pyx_t_6), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":367
 *             functions[(ns, xpath_name)] = getattr(module, function_name)
 *     else:
 *         if function_mapping is None:             # <<<<<<<<<<<<<<
 *             function_mapping = [ name for name in dir(module)
 *                                  if not name.startswith(u'_') ]
 */
    __pyx_t_2 = (__pyx_v_function_mapping == Py_None);
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":368
 *     else:
 *         if function_mapping is None:
 *             function_mapping = [ name for name in dir(module)             # <<<<<<<<<<<<<<
 *                                  if not name.startswith(u'_') ]
 *         for function_name in function_mapping:
 */
      __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      __pyx_t_4 = PyObject_Dir(__pyx_v_module); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      if (PyList_CheckExact(__pyx_t_4) || PyTuple_CheckExact(__pyx_t_4)) {
        __pyx_t_3 = 0; __pyx_t_6 = __pyx_t_4; __Pyx_INCREF(__pyx_t_6);
      } else {
        __pyx_t_3 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      for (;;) {
        if (likely(PyList_CheckExact(__pyx_t_6))) {
          if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_6)) break;
          __pyx_t_4 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++;
        } else if (likely(PyTuple_CheckExact(__pyx_t_6))) {
          if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
          __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++;
        } else {
          __pyx_t_4 = PyIter_Next(__pyx_t_6);
          if (!__pyx_t_4) {
            if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            break;
          }
          __Pyx_GOTREF(__pyx_t_4);
        }
        __Pyx_DECREF(__pyx_v_name);
        __pyx_v_name = __pyx_t_4;
        __pyx_t_4 = 0;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":369
 *         if function_mapping is None:
 *             function_mapping = [ name for name in dir(module)
 *                                  if not name.startswith(u'_') ]             # <<<<<<<<<<<<<<
 *         for function_name in function_mapping:
 *             functions[(ns, function_name)] = getattr(module, function_name)
 */
        __pyx_t_4 = PyObject_GetAttr(__pyx_v_name, __pyx_n_s__startswith); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_306), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_8 = (!__pyx_t_2);
        if (__pyx_t_8) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":368
 *     else:
 *         if function_mapping is None:
 *             function_mapping = [ name for name in dir(module)             # <<<<<<<<<<<<<<
 *                                  if not name.startswith(u'_') ]
 *         for function_name in function_mapping:
 */
          if (unlikely(PyList_Append(__pyx_t_1, (PyObject*)__pyx_v_name))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          goto __pyx_L12;
        }
        __pyx_L12:;
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_INCREF(((PyObject *)__pyx_t_1));
      __Pyx_DECREF(__pyx_v_function_mapping);
      __pyx_v_function_mapping = ((PyObject *)__pyx_t_1);
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
      goto __pyx_L9;
    }
    __pyx_L9:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":370
 *             function_mapping = [ name for name in dir(module)
 *                                  if not name.startswith(u'_') ]
 *         for function_name in function_mapping:             # <<<<<<<<<<<<<<
 *             functions[(ns, function_name)] = getattr(module, function_name)
 *     return functions
 */
    if (PyList_CheckExact(__pyx_v_function_mapping) || PyTuple_CheckExact(__pyx_v_function_mapping)) {
      __pyx_t_3 = 0; __pyx_t_1 = __pyx_v_function_mapping; __Pyx_INCREF(__pyx_t_1);
    } else {
      __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_function_mapping); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
    }
    for (;;) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
        __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_6); __pyx_t_3++;
      } else if (likely(PyTuple_CheckExact(__pyx_t_1))) {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_6); __pyx_t_3++;
      } else {
        __pyx_t_6 = PyIter_Next(__pyx_t_1);
        if (!__pyx_t_6) {
          if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          break;
        }
        __Pyx_GOTREF(__pyx_t_6);
      }
      __Pyx_DECREF(__pyx_v_function_name);
      __pyx_v_function_name = __pyx_t_6;
      __pyx_t_6 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":371
 *                                  if not name.startswith(u'_') ]
 *         for function_name in function_mapping:
 *             functions[(ns, function_name)] = getattr(module, function_name)             # <<<<<<<<<<<<<<
 *     return functions
 * 
 */
      __pyx_t_6 = PyObject_GetAttr(__pyx_v_module, __pyx_v_function_name); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
      __Pyx_INCREF(__pyx_v_ns);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_ns);
      __Pyx_GIVEREF(__pyx_v_ns);
      __Pyx_INCREF(__pyx_v_function_name);
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_function_name);
      __Pyx_GIVEREF(__pyx_v_function_name);
      if (PyDict_SetItem(((PyObject *)__pyx_v_functions), ((PyObject *)__pyx_t_5), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":372
 *         for function_name in function_mapping:
 *             functions[(ns, function_name)] = getattr(module, function_name)
 *     return functions             # <<<<<<<<<<<<<<
 * 
 * ################################################################################
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_functions));
  __pyx_r = ((PyObject *)__pyx_v_functions);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree.Extension");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_functions);
  __Pyx_DECREF(__pyx_v_function_name);
  __Pyx_DECREF(__pyx_v_xpath_name);
  __Pyx_DECREF(__pyx_v_name);
  __Pyx_DECREF(__pyx_v_function_mapping);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":379
 * cdef class _ExsltRegExp:
 *     cdef dict _compile_map
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._compile_map = {}
 * 
 */

static int __pyx_pf_4lxml_5etree_12_ExsltRegExp___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_12_ExsltRegExp___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__cinit__");
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":380
 *     cdef dict _compile_map
 *     def __cinit__(self):
 *         self._compile_map = {}             # <<<<<<<<<<<<<<
 * 
 *     cdef _make_string(self, value):
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__ExsltRegExp *)__pyx_v_self)->_compile_map);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__ExsltRegExp *)__pyx_v_self)->_compile_map));
  ((struct __pyx_obj_4lxml_5etree__ExsltRegExp *)__pyx_v_self)->_compile_map = __pyx_t_1;
  __pyx_t_1 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ExsltRegExp.__cinit__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":382
 *         self._compile_map = {}
 * 
 *     cdef _make_string(self, value):             # <<<<<<<<<<<<<<
 *         cdef char* c_text
 *         if _isString(value):
 */

static  PyObject *__pyx_f_4lxml_5etree_12_ExsltRegExp__make_string(struct __pyx_obj_4lxml_5etree__ExsltRegExp *__pyx_v_self, PyObject *__pyx_v_value) {
  char *__pyx_v_c_text;
  PyObject *__pyx_v_firstnode;
  PyObject *__pyx_v_s;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("_make_string");
  __pyx_v_firstnode = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_s = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":384
 *     cdef _make_string(self, value):
 *         cdef char* c_text
 *         if _isString(value):             # <<<<<<<<<<<<<<
 *             return value
 *         elif python.PyList_Check(value):
 */
  __pyx_t_1 = _isString(__pyx_v_value);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":385
 *         cdef char* c_text
 *         if _isString(value):
 *             return value             # <<<<<<<<<<<<<<
 *         elif python.PyList_Check(value):
 *             # node set: take recursive text concatenation of first element
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_value);
    __pyx_r = __pyx_v_value;
    goto __pyx_L0;
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":386
 *         if _isString(value):
 *             return value
 *         elif python.PyList_Check(value):             # <<<<<<<<<<<<<<
 *             # node set: take recursive text concatenation of first element
 *             if python.PyList_GET_SIZE(value) == 0:
 */
  __pyx_t_1 = PyList_Check(__pyx_v_value);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":388
 *         elif python.PyList_Check(value):
 *             # node set: take recursive text concatenation of first element
 *             if python.PyList_GET_SIZE(value) == 0:             # <<<<<<<<<<<<<<
 *                 return u''
 *             firstnode = value[0]
 */
    __pyx_t_1 = (PyList_GET_SIZE(__pyx_v_value) == 0);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":389
 *             # node set: take recursive text concatenation of first element
 *             if python.PyList_GET_SIZE(value) == 0:
 *                 return u''             # <<<<<<<<<<<<<<
 *             firstnode = value[0]
 *             if _isString(firstnode):
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_kp_u_25));
      __pyx_r = ((PyObject *)__pyx_kp_u_25);
      goto __pyx_L0;
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":390
 *             if python.PyList_GET_SIZE(value) == 0:
 *                 return u''
 *             firstnode = value[0]             # <<<<<<<<<<<<<<
 *             if _isString(firstnode):
 *                 return firstnode
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_v_firstnode);
    __pyx_v_firstnode = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":391
 *                 return u''
 *             firstnode = value[0]
 *             if _isString(firstnode):             # <<<<<<<<<<<<<<
 *                 return firstnode
 *             elif isinstance(firstnode, _Element):
 */
    __pyx_t_1 = _isString(__pyx_v_firstnode);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":392
 *             firstnode = value[0]
 *             if _isString(firstnode):
 *                 return firstnode             # <<<<<<<<<<<<<<
 *             elif isinstance(firstnode, _Element):
 *                 c_text = tree.xmlNodeGetContent((<_Element>firstnode)._c_node)
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_firstnode);
      __pyx_r = __pyx_v_firstnode;
      goto __pyx_L0;
      goto __pyx_L5;
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":393
 *             if _isString(firstnode):
 *                 return firstnode
 *             elif isinstance(firstnode, _Element):             # <<<<<<<<<<<<<<
 *                 c_text = tree.xmlNodeGetContent((<_Element>firstnode)._c_node)
 *                 if c_text is NULL:
 */
    __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_firstnode, ((PyObject*)__pyx_ptype_4lxml_5etree__Element)); 
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":394
 *                 return firstnode
 *             elif isinstance(firstnode, _Element):
 *                 c_text = tree.xmlNodeGetContent((<_Element>firstnode)._c_node)             # <<<<<<<<<<<<<<
 *                 if c_text is NULL:
 *                     python.PyErr_NoMemory()
 */
      __pyx_v_c_text = xmlNodeGetContent(((struct LxmlElement *)__pyx_v_firstnode)->_c_node);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":395
 *             elif isinstance(firstnode, _Element):
 *                 c_text = tree.xmlNodeGetContent((<_Element>firstnode)._c_node)
 *                 if c_text is NULL:             # <<<<<<<<<<<<<<
 *                     python.PyErr_NoMemory()
 *                 try:
 */
      __pyx_t_1 = (__pyx_v_c_text == NULL);
      if (__pyx_t_1) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":396
 *                 c_text = tree.xmlNodeGetContent((<_Element>firstnode)._c_node)
 *                 if c_text is NULL:
 *                     python.PyErr_NoMemory()             # <<<<<<<<<<<<<<
 *                 try:
 *                     s = funicode(c_text)
 */
        __pyx_t_2 = PyErr_NoMemory(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        goto __pyx_L6;
      }
      __pyx_L6:;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":397
 *                 if c_text is NULL:
 *                     python.PyErr_NoMemory()
 *                 try:             # <<<<<<<<<<<<<<
 *                     s = funicode(c_text)
 *                 finally:
 */
      /*try:*/ {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":398
 *                     python.PyErr_NoMemory()
 *                 try:
 *                     s = funicode(c_text)             # <<<<<<<<<<<<<<
 *                 finally:
 *                     tree.xmlFree(c_text)
 */
        __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_text); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L8;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_v_s);
        __pyx_v_s = __pyx_t_2;
        __pyx_t_2 = 0;
      }

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":400
 *                     s = funicode(c_text)
 *                 finally:
 *                     tree.xmlFree(c_text)             # <<<<<<<<<<<<<<
 *                 return s
 *             else:
 */
      /*finally:*/ {
        int __pyx_why;
        PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
        int __pyx_exc_lineno;
        __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
        __pyx_why = 0; goto __pyx_L9;
        __pyx_L8: {
          __pyx_why = 4;
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
          __pyx_exc_lineno = __pyx_lineno;
          goto __pyx_L9;
        }
        __pyx_L9:;
        xmlFree(__pyx_v_c_text);
        switch (__pyx_why) {
          case 4: {
            __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
            __pyx_lineno = __pyx_exc_lineno;
            __pyx_exc_type = 0;
            __pyx_exc_value = 0;
            __pyx_exc_tb = 0;
            goto __pyx_L1_error;
          }
        }
      }

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":401
 *                 finally:
 *                     tree.xmlFree(c_text)
 *                 return s             # <<<<<<<<<<<<<<
 *             else:
 *                 return unicode(firstnode)
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_s);
      __pyx_r = __pyx_v_s;
      goto __pyx_L0;
      goto __pyx_L5;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":403
 *                 return s
 *             else:
 *                 return unicode(firstnode)             # <<<<<<<<<<<<<<
 *         else:
 *             return unicode(value)
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __Pyx_INCREF(__pyx_v_firstnode);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_firstnode);
      __Pyx_GIVEREF(__pyx_v_firstnode);
      __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L0;
    }
    __pyx_L5:;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":405
 *                 return unicode(firstnode)
 *         else:
 *             return unicode(value)             # <<<<<<<<<<<<<<
 * 
 *     cdef _compile(self, rexp, ignore_case):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_INCREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_value);
    __Pyx_GIVEREF(__pyx_v_value);
    __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ExsltRegExp._make_string");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_firstnode);
  __Pyx_DECREF(__pyx_v_s);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":407
 *             return unicode(value)
 * 
 *     cdef _compile(self, rexp, ignore_case):             # <<<<<<<<<<<<<<
 *         cdef python.PyObject* c_result
 *         rexp = self._make_string(rexp)
 */

static  PyObject *__pyx_f_4lxml_5etree_12_ExsltRegExp__compile(struct __pyx_obj_4lxml_5etree__ExsltRegExp *__pyx_v_self, PyObject *__pyx_v_rexp, PyObject *__pyx_v_ignore_case) {
  PyObject *__pyx_v_c_result;
  PyObject *__pyx_v_key;
  PyObject *__pyx_v_py_flags;
  PyObject *__pyx_v_rexp_compiled;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("_compile");
  __Pyx_INCREF(__pyx_v_rexp);
  __pyx_v_key = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_py_flags = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_rexp_compiled = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":409
 *     cdef _compile(self, rexp, ignore_case):
 *         cdef python.PyObject* c_result
 *         rexp = self._make_string(rexp)             # <<<<<<<<<<<<<<
 *         key = (rexp, ignore_case)
 *         c_result = python.PyDict_GetItem(self._compile_map, key)
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ExsltRegExp *)__pyx_v_self->__pyx_vtab)->_make_string(__pyx_v_self, __pyx_v_rexp); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_v_rexp);
  __pyx_v_rexp = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":410
 *         cdef python.PyObject* c_result
 *         rexp = self._make_string(rexp)
 *         key = (rexp, ignore_case)             # <<<<<<<<<<<<<<
 *         c_result = python.PyDict_GetItem(self._compile_map, key)
 *         if c_result is not NULL:
 */
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_rexp);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_rexp);
  __Pyx_GIVEREF(__pyx_v_rexp);
  __Pyx_INCREF(__pyx_v_ignore_case);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_ignore_case);
  __Pyx_GIVEREF(__pyx_v_ignore_case);
  __Pyx_DECREF(((PyObject *)__pyx_v_key));
  __pyx_v_key = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":411
 *         rexp = self._make_string(rexp)
 *         key = (rexp, ignore_case)
 *         c_result = python.PyDict_GetItem(self._compile_map, key)             # <<<<<<<<<<<<<<
 *         if c_result is not NULL:
 *             return <object>c_result
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_compile_map);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_c_result = PyDict_GetItem(__pyx_t_1, ((PyObject *)__pyx_v_key));
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":412
 *         key = (rexp, ignore_case)
 *         c_result = python.PyDict_GetItem(self._compile_map, key)
 *         if c_result is not NULL:             # <<<<<<<<<<<<<<
 *             return <object>c_result
 *         py_flags = re.UNICODE
 */
  __pyx_t_2 = (__pyx_v_c_result != NULL);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":413
 *         c_result = python.PyDict_GetItem(self._compile_map, key)
 *         if c_result is not NULL:
 *             return <object>c_result             # <<<<<<<<<<<<<<
 *         py_flags = re.UNICODE
 *         if ignore_case:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_c_result));
    __pyx_r = ((PyObject *)__pyx_v_c_result);
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":414
 *         if c_result is not NULL:
 *             return <object>c_result
 *         py_flags = re.UNICODE             # <<<<<<<<<<<<<<
 *         if ignore_case:
 *             py_flags = py_flags | re.IGNORECASE
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_4lxml_5etree_re, __pyx_n_s__UNICODE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_v_py_flags);
  __pyx_v_py_flags = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":415
 *             return <object>c_result
 *         py_flags = re.UNICODE
 *         if ignore_case:             # <<<<<<<<<<<<<<
 *             py_flags = py_flags | re.IGNORECASE
 *         rexp_compiled = re.compile(rexp, py_flags)
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_ignore_case); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":416
 *         py_flags = re.UNICODE
 *         if ignore_case:
 *             py_flags = py_flags | re.IGNORECASE             # <<<<<<<<<<<<<<
 *         rexp_compiled = re.compile(rexp, py_flags)
 *         self._compile_map[key] = rexp_compiled
 */
    __pyx_t_1 = PyObject_GetAttr(__pyx_v_4lxml_5etree_re, __pyx_n_s__IGNORECASE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyNumber_Or(__pyx_v_py_flags, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_v_py_flags);
    __pyx_v_py_flags = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":417
 *         if ignore_case:
 *             py_flags = py_flags | re.IGNORECASE
 *         rexp_compiled = re.compile(rexp, py_flags)             # <<<<<<<<<<<<<<
 *         self._compile_map[key] = rexp_compiled
 *         return rexp_compiled
 */
  __pyx_t_3 = PyObject_GetAttr(__pyx_v_4lxml_5etree_re, __pyx_n_s__compile); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_rexp);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_rexp);
  __Pyx_GIVEREF(__pyx_v_rexp);
  __Pyx_INCREF(__pyx_v_py_flags);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_py_flags);
  __Pyx_GIVEREF(__pyx_v_py_flags);
  __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_v_rexp_compiled);
  __pyx_v_rexp_compiled = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":418
 *             py_flags = py_flags | re.IGNORECASE
 *         rexp_compiled = re.compile(rexp, py_flags)
 *         self._compile_map[key] = rexp_compiled             # <<<<<<<<<<<<<<
 *         return rexp_compiled
 * 
 */
  if (PyDict_SetItem(((PyObject *)__pyx_v_self->_compile_map), ((PyObject *)__pyx_v_key), __pyx_v_rexp_compiled) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":419
 *         rexp_compiled = re.compile(rexp, py_flags)
 *         self._compile_map[key] = rexp_compiled
 *         return rexp_compiled             # <<<<<<<<<<<<<<
 * 
 *     def test(self, ctxt, s, rexp, flags=u''):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_rexp_compiled);
  __pyx_r = __pyx_v_rexp_compiled;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._ExsltRegExp._compile");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_key);
  __Pyx_DECREF(__pyx_v_py_flags);
  __Pyx_DECREF(__pyx_v_rexp_compiled);
  __Pyx_DECREF(__pyx_v_rexp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":421
 *         return rexp_compiled
 * 
 *     def test(self, ctxt, s, rexp, flags=u''):             # <<<<<<<<<<<<<<
 *         flags = self._make_string(flags)
 *         s = self._make_string(s)
 */

static PyObject *__pyx_pf_4lxml_5etree_12_ExsltRegExp_1test(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_12_ExsltRegExp_1test(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_ctxt = 0;
  PyObject *__pyx_v_s = 0;
  PyObject *__pyx_v_rexp = 0;
  PyObject *__pyx_v_flags = 0;
  PyObject *__pyx_v_rexpc;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__ctxt,&__pyx_n_s__s,&__pyx_n_s__rexp,&__pyx_n_s__flags,0};
  __Pyx_RefNannySetupContext("test");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[4] = {0,0,0,0};
    values[3] = ((PyObject *)__pyx_kp_u_25);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ctxt);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__s);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("test", 0, 3, 4, 1); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__rexp);
      if (likely(values[2])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("test", 0, 3, 4, 2); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  3:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags);
        if (value) { values[3] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "test") < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_ctxt = values[0];
    __pyx_v_s = values[1];
    __pyx_v_rexp = values[2];
    __pyx_v_flags = values[3];
  } else {
    __pyx_v_flags = ((PyObject *)__pyx_kp_u_25);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  4:
      __pyx_v_flags = PyTuple_GET_ITEM(__pyx_args, 3);
      case  3:
      __pyx_v_rexp = PyTuple_GET_ITEM(__pyx_args, 2);
      __pyx_v_s = PyTuple_GET_ITEM(__pyx_args, 1);
      __pyx_v_ctxt = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("test", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._ExsltRegExp.test");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF(__pyx_v_s);
  __Pyx_INCREF(__pyx_v_flags);
  __pyx_v_rexpc = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":422
 * 
 *     def test(self, ctxt, s, rexp, flags=u''):
 *         flags = self._make_string(flags)             # <<<<<<<<<<<<<<
 *         s = self._make_string(s)
 *         rexpc = self._compile(rexp, u'i' in flags)
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ExsltRegExp *)((struct __pyx_obj_4lxml_5etree__ExsltRegExp *)__pyx_v_self)->__pyx_vtab)->_make_string(((struct __pyx_obj_4lxml_5etree__ExsltRegExp *)__pyx_v_self), __pyx_v_flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_v_flags);
  __pyx_v_flags = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":423
 *     def test(self, ctxt, s, rexp, flags=u''):
 *         flags = self._make_string(flags)
 *         s = self._make_string(s)             # <<<<<<<<<<<<<<
 *         rexpc = self._compile(rexp, u'i' in flags)
 *         if rexpc.search(s) is None:
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ExsltRegExp *)((struct __pyx_obj_4lxml_5etree__ExsltRegExp *)__pyx_v_self)->__pyx_vtab)->_make_string(((struct __pyx_obj_4lxml_5etree__ExsltRegExp *)__pyx_v_self), __pyx_v_s); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_v_s);
  __pyx_v_s = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":424
 *         flags = self._make_string(flags)
 *         s = self._make_string(s)
 *         rexpc = self._compile(rexp, u'i' in flags)             # <<<<<<<<<<<<<<
 *         if rexpc.search(s) is None:
 *             return False
 */
  __pyx_t_2 = ((PySequence_Contains(__pyx_v_flags, ((PyObject *)__pyx_n_u__i)))); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree__ExsltRegExp *)((struct __pyx_obj_4lxml_5etree__ExsltRegExp *)__pyx_v_self)->__pyx_vtab)->_compile(((struct __pyx_obj_4lxml_5etree__ExsltRegExp *)__pyx_v_self), __pyx_v_rexp, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_v_rexpc);
  __pyx_v_rexpc = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":425
 *         s = self._make_string(s)
 *         rexpc = self._compile(rexp, u'i' in flags)
 *         if rexpc.search(s) is None:             # <<<<<<<<<<<<<<
 *             return False
 *         else:
 */
  __pyx_t_3 = PyObject_GetAttr(__pyx_v_rexpc, __pyx_n_s__search); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_s);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_s);
  __Pyx_GIVEREF(__pyx_v_s);
  __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_t_2 = (__pyx_t_4 == Py_None);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":426
 *         rexpc = self._compile(rexp, u'i' in flags)
 *         if rexpc.search(s) is None:
 *             return False             # <<<<<<<<<<<<<<
 *         else:
 *             return True
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":428
 *             return False
 *         else:
 *             return True             # <<<<<<<<<<<<<<
 * 
 *     def match(self, ctxt, s, rexp, flags=u''):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }
  __pyx_L6:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._ExsltRegExp.test");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_rexpc);
  __Pyx_DECREF(__pyx_v_s);
  __Pyx_DECREF(__pyx_v_flags);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":430
 *             return True
 * 
 *     def match(self, ctxt, s, rexp, flags=u''):             # <<<<<<<<<<<<<<
 *         cdef list result_list
 *         flags = self._make_string(flags)
 */

static PyObject *__pyx_pf_4lxml_5etree_12_ExsltRegExp_2match(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_12_ExsltRegExp_2match(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_ctxt = 0;
  PyObject *__pyx_v_s = 0;
  PyObject *__pyx_v_rexp = 0;
  PyObject *__pyx_v_flags = 0;
  PyObject *__pyx_v_result_list;
  PyObject *__pyx_v_rexpc;
  PyObject *__pyx_v_results;
  PyObject *__pyx_v_result;
  PyObject *__pyx_v_root;
  PyObject *__pyx_v_join_groups;
  PyObject *__pyx_v_s_match;
  PyObject *__pyx_v_elem;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__ctxt,&__pyx_n_s__s,&__pyx_n_s__rexp,&__pyx_n_s__flags,0};
  __Pyx_RefNannySetupContext("match");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[4] = {0,0,0,0};
    values[3] = ((PyObject *)__pyx_kp_u_25);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ctxt);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__s);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("match", 0, 3, 4, 1); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__rexp);
      if (likely(values[2])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("match", 0, 3, 4, 2); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  3:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags);
        if (value) { values[3] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "match") < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_ctxt = values[0];
    __pyx_v_s = values[1];
    __pyx_v_rexp = values[2];
    __pyx_v_flags = values[3];
  } else {
    __pyx_v_flags = ((PyObject *)__pyx_kp_u_25);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  4:
      __pyx_v_flags = PyTuple_GET_ITEM(__pyx_args, 3);
      case  3:
      __pyx_v_rexp = PyTuple_GET_ITEM(__pyx_args, 2);
      __pyx_v_s = PyTuple_GET_ITEM(__pyx_args, 1);
      __pyx_v_ctxt = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("match", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._ExsltRegExp.match");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF(__pyx_v_s);
  __Pyx_INCREF(__pyx_v_flags);
  __pyx_v_result_list = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_rexpc = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_results = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_result = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_root = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_join_groups = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_s_match = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_elem = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":432
 *     def match(self, ctxt, s, rexp, flags=u''):
 *         cdef list result_list
 *         flags = self._make_string(flags)             # <<<<<<<<<<<<<<
 *         s = self._make_string(s)
 *         rexpc = self._compile(rexp, u'i' in flags)
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ExsltRegExp *)((struct __pyx_obj_4lxml_5etree__ExsltRegExp *)__pyx_v_self)->__pyx_vtab)->_make_string(((struct __pyx_obj_4lxml_5etree__ExsltRegExp *)__pyx_v_self), __pyx_v_flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_v_flags);
  __pyx_v_flags = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":433
 *         cdef list result_list
 *         flags = self._make_string(flags)
 *         s = self._make_string(s)             # <<<<<<<<<<<<<<
 *         rexpc = self._compile(rexp, u'i' in flags)
 *         if u'g' in flags:
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ExsltRegExp *)((struct __pyx_obj_4lxml_5etree__ExsltRegExp *)__pyx_v_self)->__pyx_vtab)->_make_string(((struct __pyx_obj_4lxml_5etree__ExsltRegExp *)__pyx_v_self), __pyx_v_s); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_v_s);
  __pyx_v_s = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":434
 *         flags = self._make_string(flags)
 *         s = self._make_string(s)
 *         rexpc = self._compile(rexp, u'i' in flags)             # <<<<<<<<<<<<<<
 *         if u'g' in flags:
 *             results = rexpc.findall(s)
 */
  __pyx_t_2 = ((PySequence_Contains(__pyx_v_flags, ((PyObject *)__pyx_n_u__i)))); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree__ExsltRegExp *)((struct __pyx_obj_4lxml_5etree__ExsltRegExp *)__pyx_v_self)->__pyx_vtab)->_compile(((struct __pyx_obj_4lxml_5etree__ExsltRegExp *)__pyx_v_self), __pyx_v_rexp, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_v_rexpc);
  __pyx_v_rexpc = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":435
 *         s = self._make_string(s)
 *         rexpc = self._compile(rexp, u'i' in flags)
 *         if u'g' in flags:             # <<<<<<<<<<<<<<
 *             results = rexpc.findall(s)
 *             if not results:
 */
  __pyx_t_2 = ((PySequence_Contains(__pyx_v_flags, ((PyObject *)__pyx_n_u__g)))); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":436
 *         rexpc = self._compile(rexp, u'i' in flags)
 *         if u'g' in flags:
 *             results = rexpc.findall(s)             # <<<<<<<<<<<<<<
 *             if not results:
 *                 return ()
 */
    __pyx_t_3 = PyObject_GetAttr(__pyx_v_rexpc, __pyx_n_s__findall); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __Pyx_INCREF(__pyx_v_s);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_s);
    __Pyx_GIVEREF(__pyx_v_s);
    __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_v_results);
    __pyx_v_results = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":437
 *         if u'g' in flags:
 *             results = rexpc.findall(s)
 *             if not results:             # <<<<<<<<<<<<<<
 *                 return ()
 *         else:
 */
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_results); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = (!__pyx_t_2);
    if (__pyx_t_5) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":438
 *             results = rexpc.findall(s)
 *             if not results:
 *                 return ()             # <<<<<<<<<<<<<<
 *         else:
 *             result = rexpc.search(s)
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_empty_tuple));
      __pyx_r = ((PyObject *)__pyx_empty_tuple);
      goto __pyx_L0;
      goto __pyx_L7;
    }
    __pyx_L7:;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":440
 *                 return ()
 *         else:
 *             result = rexpc.search(s)             # <<<<<<<<<<<<<<
 *             if not result:
 *                 return ()
 */
    __pyx_t_4 = PyObject_GetAttr(__pyx_v_rexpc, __pyx_n_s__search); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __Pyx_INCREF(__pyx_v_s);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_s);
    __Pyx_GIVEREF(__pyx_v_s);
    __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_v_result);
    __pyx_v_result = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":441
 *         else:
 *             result = rexpc.search(s)
 *             if not result:             # <<<<<<<<<<<<<<
 *                 return ()
 *             results = [ result.group() ]
 */
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_result); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = (!__pyx_t_5);
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":442
 *             result = rexpc.search(s)
 *             if not result:
 *                 return ()             # <<<<<<<<<<<<<<
 *             results = [ result.group() ]
 *             results.extend( result.groups(u'') )
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_empty_tuple));
      __pyx_r = ((PyObject *)__pyx_empty_tuple);
      goto __pyx_L0;
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":443
 *             if not result:
 *                 return ()
 *             results = [ result.group() ]             # <<<<<<<<<<<<<<
 *             results.extend( result.groups(u'') )
 *         result_list = []
 */
    __pyx_t_3 = PyObject_GetAttr(__pyx_v_result, __pyx_n_s__group); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_v_results);
    __pyx_v_results = ((PyObject *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":444
 *                 return ()
 *             results = [ result.group() ]
 *             results.extend( result.groups(u'') )             # <<<<<<<<<<<<<<
 *         result_list = []
 *         root = Element(u'matches')
 */
    __pyx_t_3 = PyObject_GetAttr(__pyx_v_results, __pyx_n_s__extend); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyObject_GetAttr(__pyx_v_result, __pyx_n_s__groups); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_307), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":445
 *             results = [ result.group() ]
 *             results.extend( result.groups(u'') )
 *         result_list = []             # <<<<<<<<<<<<<<
 *         root = Element(u'matches')
 *         join_groups = u''.join
 */
  __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  __Pyx_DECREF(((PyObject *)__pyx_v_result_list));
  __pyx_v_result_list = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":446
 *             results.extend( result.groups(u'') )
 *         result_list = []
 *         root = Element(u'matches')             # <<<<<<<<<<<<<<
 *         join_groups = u''.join
 *         for s_match in results:
 */
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__Element); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_308), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_v_root);
  __pyx_v_root = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":447
 *         result_list = []
 *         root = Element(u'matches')
 *         join_groups = u''.join             # <<<<<<<<<<<<<<
 *         for s_match in results:
 *             if python.PyTuple_CheckExact(s_match):
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_u_25), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_v_join_groups);
  __pyx_v_join_groups = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":448
 *         root = Element(u'matches')
 *         join_groups = u''.join
 *         for s_match in results:             # <<<<<<<<<<<<<<
 *             if python.PyTuple_CheckExact(s_match):
 *                 s_match = join_groups(s_match)
 */
  if (PyList_CheckExact(__pyx_v_results) || PyTuple_CheckExact(__pyx_v_results)) {
    __pyx_t_6 = 0; __pyx_t_1 = __pyx_v_results; __Pyx_INCREF(__pyx_t_1);
  } else {
    __pyx_t_6 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_results); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
  }
  for (;;) {
    if (likely(PyList_CheckExact(__pyx_t_1))) {
      if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_1)) break;
      __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++;
    } else if (likely(PyTuple_CheckExact(__pyx_t_1))) {
      if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
      __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++;
    } else {
      __pyx_t_4 = PyIter_Next(__pyx_t_1);
      if (!__pyx_t_4) {
        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_DECREF(__pyx_v_s_match);
    __pyx_v_s_match = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":449
 *         join_groups = u''.join
 *         for s_match in results:
 *             if python.PyTuple_CheckExact(s_match):             # <<<<<<<<<<<<<<
 *                 s_match = join_groups(s_match)
 *             elem = SubElement(root, u'match')
 */
    __pyx_t_2 = PyTuple_CheckExact(__pyx_v_s_match);
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":450
 *         for s_match in results:
 *             if python.PyTuple_CheckExact(s_match):
 *                 s_match = join_groups(s_match)             # <<<<<<<<<<<<<<
 *             elem = SubElement(root, u'match')
 *             elem.text = s_match
 */
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      __Pyx_INCREF(__pyx_v_s_match);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_s_match);
      __Pyx_GIVEREF(__pyx_v_s_match);
      __pyx_t_3 = PyObject_Call(__pyx_v_join_groups, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_v_s_match);
      __pyx_v_s_match = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L11;
    }
    __pyx_L11:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":451
 *             if python.PyTuple_CheckExact(s_match):
 *                 s_match = join_groups(s_match)
 *             elem = SubElement(root, u'match')             # <<<<<<<<<<<<<<
 *             elem.text = s_match
 *             result_list.append(elem)
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__SubElement); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_INCREF(__pyx_v_root);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_root);
    __Pyx_GIVEREF(__pyx_v_root);
    __Pyx_INCREF(((PyObject *)__pyx_n_u__match));
    PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_n_u__match));
    __Pyx_GIVEREF(((PyObject *)__pyx_n_u__match));
    __pyx_t_7 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_v_elem);
    __pyx_v_elem = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":452
 *                 s_match = join_groups(s_match)
 *             elem = SubElement(root, u'match')
 *             elem.text = s_match             # <<<<<<<<<<<<<<
 *             result_list.append(elem)
 *         return result_list
 */
    if (PyObject_SetAttr(__pyx_v_elem, __pyx_n_s__text, __pyx_v_s_match) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":453
 *             elem = SubElement(root, u'match')
 *             elem.text = s_match
 *             result_list.append(elem)             # <<<<<<<<<<<<<<
 *         return result_list
 * 
 */
    if (unlikely(__pyx_v_result_list == Py_None)) {
      PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_8 = PyList_Append(__pyx_v_result_list, __pyx_v_elem); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":454
 *             elem.text = s_match
 *             result_list.append(elem)
 *         return result_list             # <<<<<<<<<<<<<<
 * 
 *     def replace(self, ctxt, s, rexp, flags, replacement):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result_list));
  __pyx_r = ((PyObject *)__pyx_v_result_list);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree._ExsltRegExp.match");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_result_list);
  __Pyx_DECREF(__pyx_v_rexpc);
  __Pyx_DECREF(__pyx_v_results);
  __Pyx_DECREF(__pyx_v_result);
  __Pyx_DECREF(__pyx_v_root);
  __Pyx_DECREF(__pyx_v_join_groups);
  __Pyx_DECREF(__pyx_v_s_match);
  __Pyx_DECREF(__pyx_v_elem);
  __Pyx_DECREF(__pyx_v_s);
  __Pyx_DECREF(__pyx_v_flags);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":456
 *         return result_list
 * 
 *     def replace(self, ctxt, s, rexp, flags, replacement):             # <<<<<<<<<<<<<<
 *         replacement = self._make_string(replacement)
 *         flags = self._make_string(flags)
 */

static PyObject *__pyx_pf_4lxml_5etree_12_ExsltRegExp_3replace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_12_ExsltRegExp_3replace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_ctxt = 0;
  PyObject *__pyx_v_s = 0;
  PyObject *__pyx_v_rexp = 0;
  PyObject *__pyx_v_flags = 0;
  PyObject *__pyx_v_replacement = 0;
  PyObject *__pyx_v_rexpc;
  long __pyx_v_count;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__ctxt,&__pyx_n_s__s,&__pyx_n_s__rexp,&__pyx_n_s__flags,&__pyx_n_s__replacement,0};
  __Pyx_RefNannySetupContext("replace");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[5] = {0,0,0,0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ctxt);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__s);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("replace", 1, 5, 5, 1); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__rexp);
      if (likely(values[2])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("replace", 1, 5, 5, 2); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  3:
      values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags);
      if (likely(values[3])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("replace", 1, 5, 5, 3); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  4:
      values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__replacement);
      if (likely(values[4])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("replace", 1, 5, 5, 4); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "replace") < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_ctxt = values[0];
    __pyx_v_s = values[1];
    __pyx_v_rexp = values[2];
    __pyx_v_flags = values[3];
    __pyx_v_replacement = values[4];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_ctxt = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_s = PyTuple_GET_ITEM(__pyx_args, 1);
    __pyx_v_rexp = PyTuple_GET_ITEM(__pyx_args, 2);
    __pyx_v_flags = PyTuple_GET_ITEM(__pyx_args, 3);
    __pyx_v_replacement = PyTuple_GET_ITEM(__pyx_args, 4);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("replace", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._ExsltRegExp.replace");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF(__pyx_v_s);
  __Pyx_INCREF(__pyx_v_flags);
  __Pyx_INCREF(__pyx_v_replacement);
  __pyx_v_rexpc = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":457
 * 
 *     def replace(self, ctxt, s, rexp, flags, replacement):
 *         replacement = self._make_string(replacement)             # <<<<<<<<<<<<<<
 *         flags = self._make_string(flags)
 *         s = self._make_string(s)
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ExsltRegExp *)((struct __pyx_obj_4lxml_5etree__ExsltRegExp *)__pyx_v_self)->__pyx_vtab)->_make_string(((struct __pyx_obj_4lxml_5etree__ExsltRegExp *)__pyx_v_self), __pyx_v_replacement); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_v_replacement);
  __pyx_v_replacement = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":458
 *     def replace(self, ctxt, s, rexp, flags, replacement):
 *         replacement = self._make_string(replacement)
 *         flags = self._make_string(flags)             # <<<<<<<<<<<<<<
 *         s = self._make_string(s)
 *         rexpc = self._compile(rexp, u'i' in flags)
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ExsltRegExp *)((struct __pyx_obj_4lxml_5etree__ExsltRegExp *)__pyx_v_self)->__pyx_vtab)->_make_string(((struct __pyx_obj_4lxml_5etree__ExsltRegExp *)__pyx_v_self), __pyx_v_flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_v_flags);
  __pyx_v_flags = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":459
 *         replacement = self._make_string(replacement)
 *         flags = self._make_string(flags)
 *         s = self._make_string(s)             # <<<<<<<<<<<<<<
 *         rexpc = self._compile(rexp, u'i' in flags)
 *         if u'g' in flags:
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ExsltRegExp *)((struct __pyx_obj_4lxml_5etree__ExsltRegExp *)__pyx_v_self)->__pyx_vtab)->_make_string(((struct __pyx_obj_4lxml_5etree__ExsltRegExp *)__pyx_v_self), __pyx_v_s); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_v_s);
  __pyx_v_s = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":460
 *         flags = self._make_string(flags)
 *         s = self._make_string(s)
 *         rexpc = self._compile(rexp, u'i' in flags)             # <<<<<<<<<<<<<<
 *         if u'g' in flags:
 *             count = 0
 */
  __pyx_t_2 = ((PySequence_Contains(__pyx_v_flags, ((PyObject *)__pyx_n_u__i)))); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree__ExsltRegExp *)((struct __pyx_obj_4lxml_5etree__ExsltRegExp *)__pyx_v_self)->__pyx_vtab)->_compile(((struct __pyx_obj_4lxml_5etree__ExsltRegExp *)__pyx_v_self), __pyx_v_rexp, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_v_rexpc);
  __pyx_v_rexpc = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":461
 *         s = self._make_string(s)
 *         rexpc = self._compile(rexp, u'i' in flags)
 *         if u'g' in flags:             # <<<<<<<<<<<<<<
 *             count = 0
 *         else:
 */
  __pyx_t_2 = ((PySequence_Contains(__pyx_v_flags, ((PyObject *)__pyx_n_u__g)))); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":462
 *         rexpc = self._compile(rexp, u'i' in flags)
 *         if u'g' in flags:
 *             count = 0             # <<<<<<<<<<<<<<
 *         else:
 *             count = 1
 */
    __pyx_v_count = 0;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":464
 *             count = 0
 *         else:
 *             count = 1             # <<<<<<<<<<<<<<
 *         return rexpc.sub(replacement, s, count)
 * 
 */
    __pyx_v_count = 1;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":465
 *         else:
 *             count = 1
 *         return rexpc.sub(replacement, s, count)             # <<<<<<<<<<<<<<
 * 
 *     cdef _register_in_context(self, _BaseContext context):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyObject_GetAttr(__pyx_v_rexpc, __pyx_n_s__sub); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyInt_FromLong(__pyx_v_count); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  __Pyx_INCREF(__pyx_v_replacement);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_replacement);
  __Pyx_GIVEREF(__pyx_v_replacement);
  __Pyx_INCREF(__pyx_v_s);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_s);
  __Pyx_GIVEREF(__pyx_v_s);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._ExsltRegExp.replace");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_rexpc);
  __Pyx_DECREF(__pyx_v_s);
  __Pyx_DECREF(__pyx_v_flags);
  __Pyx_DECREF(__pyx_v_replacement);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":467
 *         return rexpc.sub(replacement, s, count)
 * 
 *     cdef _register_in_context(self, _BaseContext context):             # <<<<<<<<<<<<<<
 *         ns = b"http://exslt.org/regular-expressions"
 *         context._addLocalExtensionFunction(ns, b"test",    self.test)
 */

static  PyObject *__pyx_f_4lxml_5etree_12_ExsltRegExp__register_in_context(struct __pyx_obj_4lxml_5etree__ExsltRegExp *__pyx_v_self, struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_context) {
  PyObject *__pyx_v_ns;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("_register_in_context");
  __pyx_v_ns = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":468
 * 
 *     cdef _register_in_context(self, _BaseContext context):
 *         ns = b"http://exslt.org/regular-expressions"             # <<<<<<<<<<<<<<
 *         context._addLocalExtensionFunction(ns, b"test",    self.test)
 *         context._addLocalExtensionFunction(ns, b"match",   self.match)
 */
  __Pyx_INCREF(((PyObject *)__pyx_kp_b_309));
  __Pyx_DECREF(((PyObject *)__pyx_v_ns));
  __pyx_v_ns = __pyx_kp_b_309;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":469
 *     cdef _register_in_context(self, _BaseContext context):
 *         ns = b"http://exslt.org/regular-expressions"
 *         context._addLocalExtensionFunction(ns, b"test",    self.test)             # <<<<<<<<<<<<<<
 *         context._addLocalExtensionFunction(ns, b"match",   self.match)
 *         context._addLocalExtensionFunction(ns, b"replace", self.replace)
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__test); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  ((struct __pyx_vtabstruct_4lxml_5etree__BaseContext *)__pyx_v_context->__pyx_vtab)->_addLocalExtensionFunction(__pyx_v_context, ((PyObject *)__pyx_v_ns), ((PyObject *)__pyx_n_b__test), __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":470
 *         ns = b"http://exslt.org/regular-expressions"
 *         context._addLocalExtensionFunction(ns, b"test",    self.test)
 *         context._addLocalExtensionFunction(ns, b"match",   self.match)             # <<<<<<<<<<<<<<
 *         context._addLocalExtensionFunction(ns, b"replace", self.replace)
 * 
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__match); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  ((struct __pyx_vtabstruct_4lxml_5etree__BaseContext *)__pyx_v_context->__pyx_vtab)->_addLocalExtensionFunction(__pyx_v_context, ((PyObject *)__pyx_v_ns), ((PyObject *)__pyx_n_b__match), __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":471
 *         context._addLocalExtensionFunction(ns, b"test",    self.test)
 *         context._addLocalExtensionFunction(ns, b"match",   self.match)
 *         context._addLocalExtensionFunction(ns, b"replace", self.replace)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__replace); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  ((struct __pyx_vtabstruct_4lxml_5etree__BaseContext *)__pyx_v_context->__pyx_vtab)->_addLocalExtensionFunction(__pyx_v_context, ((PyObject *)__pyx_v_ns), ((PyObject *)__pyx_n_b__replace), __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ExsltRegExp._register_in_context");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_ns);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":477
 * # helper functions
 * 
 * cdef xpath.xmlXPathObject* _wrapXPathObject(object obj, _Document doc,             # <<<<<<<<<<<<<<
 *                                             _BaseContext context) except NULL:
 *     cdef xpath.xmlNodeSet* resultSet
 */

static  xmlXPathObject *__pyx_f_4lxml_5etree__wrapXPathObject(PyObject *__pyx_v_obj, struct LxmlDocument *__pyx_v_doc, struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_context) {
  xmlNodeSet *__pyx_v_resultSet;
  struct LxmlElement *__pyx_v_fake_node = 0;
  xmlNode *__pyx_v_c_node;
  PyObject *__pyx_v_value;
  xmlXPathObject *__pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  double __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  __Pyx_RefNannySetupContext("_wrapXPathObject");
  __Pyx_INCREF(__pyx_v_obj);
  __pyx_v_value = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":480
 *                                             _BaseContext context) except NULL:
 *     cdef xpath.xmlNodeSet* resultSet
 *     cdef _Element fake_node = None             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 * 
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_fake_node = ((struct LxmlElement *)Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":483
 *     cdef xmlNode* c_node
 * 
 *     if python.PyUnicode_Check(obj):             # <<<<<<<<<<<<<<
 *         obj = _utf8(obj)
 *     if python.PyBytes_Check(obj):
 */
  __pyx_t_1 = PyUnicode_Check(__pyx_v_obj);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":484
 * 
 *     if python.PyUnicode_Check(obj):
 *         obj = _utf8(obj)             # <<<<<<<<<<<<<<
 *     if python.PyBytes_Check(obj):
 *         # libxml2 copies the string value
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_v_obj)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_v_obj);
    __pyx_v_obj = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":485
 *     if python.PyUnicode_Check(obj):
 *         obj = _utf8(obj)
 *     if python.PyBytes_Check(obj):             # <<<<<<<<<<<<<<
 *         # libxml2 copies the string value
 *         return xpath.xmlXPathNewCString(_cstr(obj))
 */
  __pyx_t_1 = PyBytes_Check(__pyx_v_obj);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":487
 *     if python.PyBytes_Check(obj):
 *         # libxml2 copies the string value
 *         return xpath.xmlXPathNewCString(_cstr(obj))             # <<<<<<<<<<<<<<
 *     if python.PyBool_Check(obj):
 *         return xpath.xmlXPathNewBoolean(obj)
 */
    __pyx_r = xmlXPathNewCString(PyBytes_AS_STRING(__pyx_v_obj));
    goto __pyx_L0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":488
 *         # libxml2 copies the string value
 *         return xpath.xmlXPathNewCString(_cstr(obj))
 *     if python.PyBool_Check(obj):             # <<<<<<<<<<<<<<
 *         return xpath.xmlXPathNewBoolean(obj)
 *     if python.PyNumber_Check(obj):
 */
  __pyx_t_1 = PyBool_Check(__pyx_v_obj);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":489
 *         return xpath.xmlXPathNewCString(_cstr(obj))
 *     if python.PyBool_Check(obj):
 *         return xpath.xmlXPathNewBoolean(obj)             # <<<<<<<<<<<<<<
 *     if python.PyNumber_Check(obj):
 *         return xpath.xmlXPathNewFloat(obj)
 */
    __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_v_obj); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_r = xmlXPathNewBoolean(__pyx_t_3);
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":490
 *     if python.PyBool_Check(obj):
 *         return xpath.xmlXPathNewBoolean(obj)
 *     if python.PyNumber_Check(obj):             # <<<<<<<<<<<<<<
 *         return xpath.xmlXPathNewFloat(obj)
 *     if obj is None:
 */
  __pyx_t_1 = PyNumber_Check(__pyx_v_obj);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":491
 *         return xpath.xmlXPathNewBoolean(obj)
 *     if python.PyNumber_Check(obj):
 *         return xpath.xmlXPathNewFloat(obj)             # <<<<<<<<<<<<<<
 *     if obj is None:
 *         resultSet = xpath.xmlXPathNodeSetCreate(NULL)
 */
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_obj); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_r = xmlXPathNewFloat(__pyx_t_4);
    goto __pyx_L0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":492
 *     if python.PyNumber_Check(obj):
 *         return xpath.xmlXPathNewFloat(obj)
 *     if obj is None:             # <<<<<<<<<<<<<<
 *         resultSet = xpath.xmlXPathNodeSetCreate(NULL)
 *     elif isinstance(obj, _Element):
 */
  __pyx_t_1 = (__pyx_v_obj == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":493
 *         return xpath.xmlXPathNewFloat(obj)
 *     if obj is None:
 *         resultSet = xpath.xmlXPathNodeSetCreate(NULL)             # <<<<<<<<<<<<<<
 *     elif isinstance(obj, _Element):
 *         resultSet = xpath.xmlXPathNodeSetCreate((<_Element>obj)._c_node)
 */
    __pyx_v_resultSet = xmlXPathNodeSetCreate(NULL);
    goto __pyx_L7;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":494
 *     if obj is None:
 *         resultSet = xpath.xmlXPathNodeSetCreate(NULL)
 *     elif isinstance(obj, _Element):             # <<<<<<<<<<<<<<
 *         resultSet = xpath.xmlXPathNodeSetCreate((<_Element>obj)._c_node)
 *     elif python.PySequence_Check(obj):
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, ((PyObject*)__pyx_ptype_4lxml_5etree__Element)); 
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":495
 *         resultSet = xpath.xmlXPathNodeSetCreate(NULL)
 *     elif isinstance(obj, _Element):
 *         resultSet = xpath.xmlXPathNodeSetCreate((<_Element>obj)._c_node)             # <<<<<<<<<<<<<<
 *     elif python.PySequence_Check(obj):
 *         resultSet = xpath.xmlXPathNodeSetCreate(NULL)
 */
    __pyx_v_resultSet = xmlXPathNodeSetCreate(((struct LxmlElement *)__pyx_v_obj)->_c_node);
    goto __pyx_L7;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":496
 *     elif isinstance(obj, _Element):
 *         resultSet = xpath.xmlXPathNodeSetCreate((<_Element>obj)._c_node)
 *     elif python.PySequence_Check(obj):             # <<<<<<<<<<<<<<
 *         resultSet = xpath.xmlXPathNodeSetCreate(NULL)
 *         try:
 */
  __pyx_t_1 = PySequence_Check(__pyx_v_obj);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":497
 *         resultSet = xpath.xmlXPathNodeSetCreate((<_Element>obj)._c_node)
 *     elif python.PySequence_Check(obj):
 *         resultSet = xpath.xmlXPathNodeSetCreate(NULL)             # <<<<<<<<<<<<<<
 *         try:
 *             for value in obj:
 */
    __pyx_v_resultSet = xmlXPathNodeSetCreate(NULL);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":498
 *     elif python.PySequence_Check(obj):
 *         resultSet = xpath.xmlXPathNodeSetCreate(NULL)
 *         try:             # <<<<<<<<<<<<<<
 *             for value in obj:
 *                 if isinstance(value, _Element):
 */
    {
      PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
      __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
      __Pyx_XGOTREF(__pyx_save_exc_type);
      __Pyx_XGOTREF(__pyx_save_exc_value);
      __Pyx_XGOTREF(__pyx_save_exc_tb);
      /*try:*/ {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":499
 *         resultSet = xpath.xmlXPathNodeSetCreate(NULL)
 *         try:
 *             for value in obj:             # <<<<<<<<<<<<<<
 *                 if isinstance(value, _Element):
 *                     if context is not None:
 */
        if (PyList_CheckExact(__pyx_v_obj) || PyTuple_CheckExact(__pyx_v_obj)) {
          __pyx_t_5 = 0; __pyx_t_2 = __pyx_v_obj; __Pyx_INCREF(__pyx_t_2);
        } else {
          __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_obj); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
          __Pyx_GOTREF(__pyx_t_2);
        }
        for (;;) {
          if (likely(PyList_CheckExact(__pyx_t_2))) {
            if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_2)) break;
            __pyx_t_6 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_6); __pyx_t_5++;
          } else if (likely(PyTuple_CheckExact(__pyx_t_2))) {
            if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
            __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_6); __pyx_t_5++;
          } else {
            __pyx_t_6 = PyIter_Next(__pyx_t_2);
            if (!__pyx_t_6) {
              if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
              break;
            }
            __Pyx_GOTREF(__pyx_t_6);
          }
          __Pyx_DECREF(__pyx_v_value);
          __pyx_v_value = __pyx_t_6;
          __pyx_t_6 = 0;

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":500
 *         try:
 *             for value in obj:
 *                 if isinstance(value, _Element):             # <<<<<<<<<<<<<<
 *                     if context is not None:
 *                         context._hold(value)
 */
          __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_value, ((PyObject*)__pyx_ptype_4lxml_5etree__Element)); 
          if (__pyx_t_1) {

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":501
 *             for value in obj:
 *                 if isinstance(value, _Element):
 *                     if context is not None:             # <<<<<<<<<<<<<<
 *                         context._hold(value)
 *                     xpath.xmlXPathNodeSetAdd(resultSet, (<_Element>value)._c_node)
 */
            __pyx_t_1 = (((PyObject *)__pyx_v_context) != Py_None);
            if (__pyx_t_1) {

              /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":502
 *                 if isinstance(value, _Element):
 *                     if context is not None:
 *                         context._hold(value)             # <<<<<<<<<<<<<<
 *                     xpath.xmlXPathNodeSetAdd(resultSet, (<_Element>value)._c_node)
 *                 else:
 */
              __pyx_t_6 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseContext *)__pyx_v_context->__pyx_vtab)->_hold(__pyx_v_context, __pyx_v_value); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
              __Pyx_GOTREF(__pyx_t_6);
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
              goto __pyx_L19;
            }
            __pyx_L19:;

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":503
 *                     if context is not None:
 *                         context._hold(value)
 *                     xpath.xmlXPathNodeSetAdd(resultSet, (<_Element>value)._c_node)             # <<<<<<<<<<<<<<
 *                 else:
 *                     if context is None or doc is None:
 */
            xmlXPathNodeSetAdd(__pyx_v_resultSet, ((struct LxmlElement *)__pyx_v_value)->_c_node);
            goto __pyx_L18;
          }
          /*else*/ {

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":505
 *                     xpath.xmlXPathNodeSetAdd(resultSet, (<_Element>value)._c_node)
 *                 else:
 *                     if context is None or doc is None:             # <<<<<<<<<<<<<<
 *                         raise XPathResultError, \
 *                               u"Non-Element values not supported at this point - got %r" % value
 */
            __pyx_t_1 = (((PyObject *)__pyx_v_context) == Py_None);
            if (!__pyx_t_1) {
              __pyx_t_7 = (((PyObject *)__pyx_v_doc) == Py_None);
              __pyx_t_8 = __pyx_t_7;
            } else {
              __pyx_t_8 = __pyx_t_1;
            }
            if (__pyx_t_8) {

              /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":506
 *                 else:
 *                     if context is None or doc is None:
 *                         raise XPathResultError, \             # <<<<<<<<<<<<<<
 *                               u"Non-Element values not supported at this point - got %r" % value
 *                     # support strings by appending text nodes to an Element
 */
              __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__XPathResultError); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
              __Pyx_GOTREF(__pyx_t_6);

              /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":507
 *                     if context is None or doc is None:
 *                         raise XPathResultError, \
 *                               u"Non-Element values not supported at this point - got %r" % value             # <<<<<<<<<<<<<<
 *                     # support strings by appending text nodes to an Element
 *                     if python.PyUnicode_Check(value):
 */
              __pyx_t_9 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_311), __pyx_v_value); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
              __Pyx_GOTREF(((PyObject *)__pyx_t_9));
              __Pyx_Raise(__pyx_t_6, ((PyObject *)__pyx_t_9), 0);
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
              __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
              {__pyx_filename = __pyx_f[6]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
              goto __pyx_L20;
            }
            __pyx_L20:;

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":509
 *                               u"Non-Element values not supported at this point - got %r" % value
 *                     # support strings by appending text nodes to an Element
 *                     if python.PyUnicode_Check(value):             # <<<<<<<<<<<<<<
 *                         value = _utf8(value)
 *                     if python.PyBytes_Check(value):
 */
            __pyx_t_8 = PyUnicode_Check(__pyx_v_value);
            if (__pyx_t_8) {

              /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":510
 *                     # support strings by appending text nodes to an Element
 *                     if python.PyUnicode_Check(value):
 *                         value = _utf8(value)             # <<<<<<<<<<<<<<
 *                     if python.PyBytes_Check(value):
 *                         if fake_node is None:
 */
              __pyx_t_9 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_v_value)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
              __Pyx_GOTREF(__pyx_t_9);
              __Pyx_DECREF(__pyx_v_value);
              __pyx_v_value = __pyx_t_9;
              __pyx_t_9 = 0;
              goto __pyx_L21;
            }
            __pyx_L21:;

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":511
 *                     if python.PyUnicode_Check(value):
 *                         value = _utf8(value)
 *                     if python.PyBytes_Check(value):             # <<<<<<<<<<<<<<
 *                         if fake_node is None:
 *                             fake_node = _makeElement("text-root", NULL, doc, None,
 */
            __pyx_t_8 = PyBytes_Check(__pyx_v_value);
            if (__pyx_t_8) {

              /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":512
 *                         value = _utf8(value)
 *                     if python.PyBytes_Check(value):
 *                         if fake_node is None:             # <<<<<<<<<<<<<<
 *                             fake_node = _makeElement("text-root", NULL, doc, None,
 *                                                      None, None, None, None, None)
 */
              __pyx_t_8 = (((PyObject *)__pyx_v_fake_node) == Py_None);
              if (__pyx_t_8) {

                /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":514
 *                         if fake_node is None:
 *                             fake_node = _makeElement("text-root", NULL, doc, None,
 *                                                      None, None, None, None, None)             # <<<<<<<<<<<<<<
 *                             context._hold(fake_node)
 *                         else:
 */
                __pyx_t_9 = ((PyObject *)__pyx_f_4lxml_5etree__makeElement(((PyObject *)__pyx_kp_s_312), NULL, __pyx_v_doc, ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None), Py_None, Py_None, Py_None, Py_None, Py_None)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
                __Pyx_GOTREF(__pyx_t_9);
                __Pyx_DECREF(((PyObject *)__pyx_v_fake_node));
                __pyx_v_fake_node = ((struct LxmlElement *)__pyx_t_9);
                __pyx_t_9 = 0;

                /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":515
 *                             fake_node = _makeElement("text-root", NULL, doc, None,
 *                                                      None, None, None, None, None)
 *                             context._hold(fake_node)             # <<<<<<<<<<<<<<
 *                         else:
 *                             # append a comment node to keep the text nodes separate
 */
                __pyx_t_9 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseContext *)__pyx_v_context->__pyx_vtab)->_hold(__pyx_v_context, ((PyObject *)__pyx_v_fake_node)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
                __Pyx_GOTREF(__pyx_t_9);
                __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
                goto __pyx_L23;
              }
              /*else*/ {

                /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":518
 *                         else:
 *                             # append a comment node to keep the text nodes separate
 *                             c_node = tree.xmlNewDocComment(doc._c_doc, "")             # <<<<<<<<<<<<<<
 *                             if c_node is NULL:
 *                                 python.PyErr_NoMemory()
 */
                __pyx_v_c_node = xmlNewDocComment(__pyx_v_doc->_c_doc, __pyx_k_25);

                /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":519
 *                             # append a comment node to keep the text nodes separate
 *                             c_node = tree.xmlNewDocComment(doc._c_doc, "")
 *                             if c_node is NULL:             # <<<<<<<<<<<<<<
 *                                 python.PyErr_NoMemory()
 *                             tree.xmlAddChild(fake_node._c_node, c_node)
 */
                __pyx_t_8 = (__pyx_v_c_node == NULL);
                if (__pyx_t_8) {

                  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":520
 *                             c_node = tree.xmlNewDocComment(doc._c_doc, "")
 *                             if c_node is NULL:
 *                                 python.PyErr_NoMemory()             # <<<<<<<<<<<<<<
 *                             tree.xmlAddChild(fake_node._c_node, c_node)
 *                         context._hold(value)
 */
                  __pyx_t_9 = PyErr_NoMemory(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
                  __Pyx_GOTREF(__pyx_t_9);
                  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
                  goto __pyx_L24;
                }
                __pyx_L24:;

                /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":521
 *                             if c_node is NULL:
 *                                 python.PyErr_NoMemory()
 *                             tree.xmlAddChild(fake_node._c_node, c_node)             # <<<<<<<<<<<<<<
 *                         context._hold(value)
 *                         c_node = tree.xmlNewDocText(doc._c_doc, _cstr(value))
 */
                xmlAddChild(__pyx_v_fake_node->_c_node, __pyx_v_c_node);
              }
              __pyx_L23:;

              /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":522
 *                                 python.PyErr_NoMemory()
 *                             tree.xmlAddChild(fake_node._c_node, c_node)
 *                         context._hold(value)             # <<<<<<<<<<<<<<
 *                         c_node = tree.xmlNewDocText(doc._c_doc, _cstr(value))
 *                         if c_node is NULL:
 */
              __pyx_t_9 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseContext *)__pyx_v_context->__pyx_vtab)->_hold(__pyx_v_context, __pyx_v_value); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
              __Pyx_GOTREF(__pyx_t_9);
              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

              /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":523
 *                             tree.xmlAddChild(fake_node._c_node, c_node)
 *                         context._hold(value)
 *                         c_node = tree.xmlNewDocText(doc._c_doc, _cstr(value))             # <<<<<<<<<<<<<<
 *                         if c_node is NULL:
 *                             python.PyErr_NoMemory()
 */
              __pyx_v_c_node = xmlNewDocText(__pyx_v_doc->_c_doc, PyBytes_AS_STRING(__pyx_v_value));

              /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":524
 *                         context._hold(value)
 *                         c_node = tree.xmlNewDocText(doc._c_doc, _cstr(value))
 *                         if c_node is NULL:             # <<<<<<<<<<<<<<
 *                             python.PyErr_NoMemory()
 *                         tree.xmlAddChild(fake_node._c_node, c_node)
 */
              __pyx_t_8 = (__pyx_v_c_node == NULL);
              if (__pyx_t_8) {

                /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":525
 *                         c_node = tree.xmlNewDocText(doc._c_doc, _cstr(value))
 *                         if c_node is NULL:
 *                             python.PyErr_NoMemory()             # <<<<<<<<<<<<<<
 *                         tree.xmlAddChild(fake_node._c_node, c_node)
 *                         xpath.xmlXPathNodeSetAdd(resultSet, c_node)
 */
                __pyx_t_9 = PyErr_NoMemory(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
                __Pyx_GOTREF(__pyx_t_9);
                __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
                goto __pyx_L25;
              }
              __pyx_L25:;

              /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":526
 *                         if c_node is NULL:
 *                             python.PyErr_NoMemory()
 *                         tree.xmlAddChild(fake_node._c_node, c_node)             # <<<<<<<<<<<<<<
 *                         xpath.xmlXPathNodeSetAdd(resultSet, c_node)
 *                     else:
 */
              xmlAddChild(__pyx_v_fake_node->_c_node, __pyx_v_c_node);

              /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":527
 *                             python.PyErr_NoMemory()
 *                         tree.xmlAddChild(fake_node._c_node, c_node)
 *                         xpath.xmlXPathNodeSetAdd(resultSet, c_node)             # <<<<<<<<<<<<<<
 *                     else:
 *                         raise XPathResultError, \
 */
              xmlXPathNodeSetAdd(__pyx_v_resultSet, __pyx_v_c_node);
              goto __pyx_L22;
            }
            /*else*/ {

              /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":529
 *                         xpath.xmlXPathNodeSetAdd(resultSet, c_node)
 *                     else:
 *                         raise XPathResultError, \             # <<<<<<<<<<<<<<
 *                               u"This is not a supported node-set result: %r" % value
 *         except:
 */
              __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__XPathResultError); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
              __Pyx_GOTREF(__pyx_t_9);

              /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":530
 *                     else:
 *                         raise XPathResultError, \
 *                               u"This is not a supported node-set result: %r" % value             # <<<<<<<<<<<<<<
 *         except:
 *             xpath.xmlXPathFreeNodeSet(resultSet)
 */
              __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_313), __pyx_v_value); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
              __Pyx_GOTREF(((PyObject *)__pyx_t_6));
              __Pyx_Raise(__pyx_t_9, ((PyObject *)__pyx_t_6), 0);
              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
              __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
              {__pyx_filename = __pyx_f[6]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            }
            __pyx_L22:;
          }
          __pyx_L18:;
        }
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
      __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
      __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
      __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
      goto __pyx_L15_try_end;
      __pyx_L8_error:;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":531
 *                         raise XPathResultError, \
 *                               u"This is not a supported node-set result: %r" % value
 *         except:             # <<<<<<<<<<<<<<
 *             xpath.xmlXPathFreeNodeSet(resultSet)
 *             raise
 */
      /*except:*/ {
        __Pyx_AddTraceback("lxml.etree._wrapXPathObject");
        if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_6, &__pyx_t_9) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GOTREF(__pyx_t_9);

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":532
 *                               u"This is not a supported node-set result: %r" % value
 *         except:
 *             xpath.xmlXPathFreeNodeSet(resultSet)             # <<<<<<<<<<<<<<
 *             raise
 *     else:
 */
        xmlXPathFreeNodeSet(__pyx_v_resultSet);

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":533
 *         except:
 *             xpath.xmlXPathFreeNodeSet(resultSet)
 *             raise             # <<<<<<<<<<<<<<
 *     else:
 *         raise XPathResultError, u"Unknown return type: %s" % \
 */
        __Pyx_GIVEREF(__pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_9);
        __Pyx_ErrRestore(__pyx_t_2, __pyx_t_6, __pyx_t_9);
        __pyx_t_2 = 0; __pyx_t_6 = 0; __pyx_t_9 = 0; 
        {__pyx_filename = __pyx_f[6]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L9_exception_handled;
      }
      __pyx_L10_except_error:;
      __Pyx_XGIVEREF(__pyx_save_exc_type);
      __Pyx_XGIVEREF(__pyx_save_exc_value);
      __Pyx_XGIVEREF(__pyx_save_exc_tb);
      __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
      goto __pyx_L1_error;
      __pyx_L9_exception_handled:;
      __Pyx_XGIVEREF(__pyx_save_exc_type);
      __Pyx_XGIVEREF(__pyx_save_exc_value);
      __Pyx_XGIVEREF(__pyx_save_exc_tb);
      __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
      __pyx_L15_try_end:;
    }
    goto __pyx_L7;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":535
 *             raise
 *     else:
 *         raise XPathResultError, u"Unknown return type: %s" % \             # <<<<<<<<<<<<<<
 *             python._fqtypename(obj)
 *     return xpath.xmlXPathWrapNodeSet(resultSet)
 */
    __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__XPathResultError); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":536
 *     else:
 *         raise XPathResultError, u"Unknown return type: %s" % \
 *             python._fqtypename(obj)             # <<<<<<<<<<<<<<
 *     return xpath.xmlXPathWrapNodeSet(resultSet)
 * 
 */
    __pyx_t_6 = PyBytes_FromString(_fqtypename(__pyx_v_obj)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_314), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
    __Pyx_Raise(__pyx_t_9, ((PyObject *)__pyx_t_2), 0);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[6]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L7:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":537
 *         raise XPathResultError, u"Unknown return type: %s" % \
 *             python._fqtypename(obj)
 *     return xpath.xmlXPathWrapNodeSet(resultSet)             # <<<<<<<<<<<<<<
 * 
 * cdef object _unwrapXPathObject(xpath.xmlXPathObject* xpathObj,
 */
  __pyx_r = xmlXPathWrapNodeSet(__pyx_v_resultSet);
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("lxml.etree._wrapXPathObject");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_fake_node);
  __Pyx_DECREF(__pyx_v_value);
  __Pyx_DECREF(__pyx_v_obj);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":539
 *     return xpath.xmlXPathWrapNodeSet(resultSet)
 * 
 * cdef object _unwrapXPathObject(xpath.xmlXPathObject* xpathObj,             # <<<<<<<<<<<<<<
 *                                _Document doc, _BaseContext context):
 *     if xpathObj.type == xpath.XPATH_UNDEFINED:
 */

static  PyObject *__pyx_f_4lxml_5etree__unwrapXPathObject(xmlXPathObject *__pyx_v_xpathObj, struct LxmlDocument *__pyx_v_doc, struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_context) {
  PyObject *__pyx_v_stringval;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("_unwrapXPathObject");
  __pyx_v_stringval = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":541
 * cdef object _unwrapXPathObject(xpath.xmlXPathObject* xpathObj,
 *                                _Document doc, _BaseContext context):
 *     if xpathObj.type == xpath.XPATH_UNDEFINED:             # <<<<<<<<<<<<<<
 *         raise XPathResultError, u"Undefined xpath result"
 *     elif xpathObj.type == xpath.XPATH_NODESET:
 */
  __pyx_t_1 = (__pyx_v_xpathObj->type == XPATH_UNDEFINED);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":542
 *                                _Document doc, _BaseContext context):
 *     if xpathObj.type == xpath.XPATH_UNDEFINED:
 *         raise XPathResultError, u"Undefined xpath result"             # <<<<<<<<<<<<<<
 *     elif xpathObj.type == xpath.XPATH_NODESET:
 *         return _createNodeSetResult(xpathObj, doc, context)
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__XPathResultError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, ((PyObject *)__pyx_kp_u_315), 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[6]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":543
 *     if xpathObj.type == xpath.XPATH_UNDEFINED:
 *         raise XPathResultError, u"Undefined xpath result"
 *     elif xpathObj.type == xpath.XPATH_NODESET:             # <<<<<<<<<<<<<<
 *         return _createNodeSetResult(xpathObj, doc, context)
 *     elif xpathObj.type == xpath.XPATH_BOOLEAN:
 */
  __pyx_t_1 = (__pyx_v_xpathObj->type == XPATH_NODESET);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":544
 *         raise XPathResultError, u"Undefined xpath result"
 *     elif xpathObj.type == xpath.XPATH_NODESET:
 *         return _createNodeSetResult(xpathObj, doc, context)             # <<<<<<<<<<<<<<
 *     elif xpathObj.type == xpath.XPATH_BOOLEAN:
 *         return xpathObj.boolval
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __pyx_f_4lxml_5etree__createNodeSetResult(__pyx_v_xpathObj, __pyx_v_doc, __pyx_v_context); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":545
 *     elif xpathObj.type == xpath.XPATH_NODESET:
 *         return _createNodeSetResult(xpathObj, doc, context)
 *     elif xpathObj.type == xpath.XPATH_BOOLEAN:             # <<<<<<<<<<<<<<
 *         return xpathObj.boolval
 *     elif xpathObj.type == xpath.XPATH_NUMBER:
 */
  __pyx_t_1 = (__pyx_v_xpathObj->type == XPATH_BOOLEAN);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":546
 *         return _createNodeSetResult(xpathObj, doc, context)
 *     elif xpathObj.type == xpath.XPATH_BOOLEAN:
 *         return xpathObj.boolval             # <<<<<<<<<<<<<<
 *     elif xpathObj.type == xpath.XPATH_NUMBER:
 *         return xpathObj.floatval
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_xpathObj->boolval); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":547
 *     elif xpathObj.type == xpath.XPATH_BOOLEAN:
 *         return xpathObj.boolval
 *     elif xpathObj.type == xpath.XPATH_NUMBER:             # <<<<<<<<<<<<<<
 *         return xpathObj.floatval
 *     elif xpathObj.type == xpath.XPATH_STRING:
 */
  __pyx_t_1 = (__pyx_v_xpathObj->type == XPATH_NUMBER);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":548
 *         return xpathObj.boolval
 *     elif xpathObj.type == xpath.XPATH_NUMBER:
 *         return xpathObj.floatval             # <<<<<<<<<<<<<<
 *     elif xpathObj.type == xpath.XPATH_STRING:
 *         stringval = funicode(xpathObj.stringval)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_xpathObj->floatval); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":549
 *     elif xpathObj.type == xpath.XPATH_NUMBER:
 *         return xpathObj.floatval
 *     elif xpathObj.type == xpath.XPATH_STRING:             # <<<<<<<<<<<<<<
 *         stringval = funicode(xpathObj.stringval)
 *         if context._build_smart_strings:
 */
  __pyx_t_1 = (__pyx_v_xpathObj->type == XPATH_STRING);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":550
 *         return xpathObj.floatval
 *     elif xpathObj.type == xpath.XPATH_STRING:
 *         stringval = funicode(xpathObj.stringval)             # <<<<<<<<<<<<<<
 *         if context._build_smart_strings:
 *             stringval = _elementStringResultFactory(
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_xpathObj->stringval); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_v_stringval);
    __pyx_v_stringval = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":551
 *     elif xpathObj.type == xpath.XPATH_STRING:
 *         stringval = funicode(xpathObj.stringval)
 *         if context._build_smart_strings:             # <<<<<<<<<<<<<<
 *             stringval = _elementStringResultFactory(
 *                 stringval, None, None, 0)
 */
    if (__pyx_v_context->_build_smart_strings) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":553
 *         if context._build_smart_strings:
 *             stringval = _elementStringResultFactory(
 *                 stringval, None, None, 0)             # <<<<<<<<<<<<<<
 *         return stringval
 *     elif xpathObj.type == xpath.XPATH_POINT:
 */
      __pyx_t_2 = __pyx_f_4lxml_5etree__elementStringResultFactory(__pyx_v_stringval, ((struct LxmlElement *)Py_None), Py_None, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_v_stringval);
      __pyx_v_stringval = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":554
 *             stringval = _elementStringResultFactory(
 *                 stringval, None, None, 0)
 *         return stringval             # <<<<<<<<<<<<<<
 *     elif xpathObj.type == xpath.XPATH_POINT:
 *         raise NotImplementedError, u"XPATH_POINT"
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_stringval);
    __pyx_r = __pyx_v_stringval;
    goto __pyx_L0;
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":555
 *                 stringval, None, None, 0)
 *         return stringval
 *     elif xpathObj.type == xpath.XPATH_POINT:             # <<<<<<<<<<<<<<
 *         raise NotImplementedError, u"XPATH_POINT"
 *     elif xpathObj.type == xpath.XPATH_RANGE:
 */
  __pyx_t_1 = (__pyx_v_xpathObj->type == XPATH_POINT);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":556
 *         return stringval
 *     elif xpathObj.type == xpath.XPATH_POINT:
 *         raise NotImplementedError, u"XPATH_POINT"             # <<<<<<<<<<<<<<
 *     elif xpathObj.type == xpath.XPATH_RANGE:
 *         raise NotImplementedError, u"XPATH_RANGE"
 */
    __Pyx_Raise(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_n_u__XPATH_POINT), 0);
    {__pyx_filename = __pyx_f[6]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":557
 *     elif xpathObj.type == xpath.XPATH_POINT:
 *         raise NotImplementedError, u"XPATH_POINT"
 *     elif xpathObj.type == xpath.XPATH_RANGE:             # <<<<<<<<<<<<<<
 *         raise NotImplementedError, u"XPATH_RANGE"
 *     elif xpathObj.type == xpath.XPATH_LOCATIONSET:
 */
  __pyx_t_1 = (__pyx_v_xpathObj->type == XPATH_RANGE);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":558
 *         raise NotImplementedError, u"XPATH_POINT"
 *     elif xpathObj.type == xpath.XPATH_RANGE:
 *         raise NotImplementedError, u"XPATH_RANGE"             # <<<<<<<<<<<<<<
 *     elif xpathObj.type == xpath.XPATH_LOCATIONSET:
 *         raise NotImplementedError, u"XPATH_LOCATIONSET"
 */
    __Pyx_Raise(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_n_u__XPATH_RANGE), 0);
    {__pyx_filename = __pyx_f[6]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":559
 *     elif xpathObj.type == xpath.XPATH_RANGE:
 *         raise NotImplementedError, u"XPATH_RANGE"
 *     elif xpathObj.type == xpath.XPATH_LOCATIONSET:             # <<<<<<<<<<<<<<
 *         raise NotImplementedError, u"XPATH_LOCATIONSET"
 *     elif xpathObj.type == xpath.XPATH_USERS:
 */
  __pyx_t_1 = (__pyx_v_xpathObj->type == XPATH_LOCATIONSET);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":560
 *         raise NotImplementedError, u"XPATH_RANGE"
 *     elif xpathObj.type == xpath.XPATH_LOCATIONSET:
 *         raise NotImplementedError, u"XPATH_LOCATIONSET"             # <<<<<<<<<<<<<<
 *     elif xpathObj.type == xpath.XPATH_USERS:
 *         raise NotImplementedError, u"XPATH_USERS"
 */
    __Pyx_Raise(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_n_u__XPATH_LOCATIONSET), 0);
    {__pyx_filename = __pyx_f[6]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":561
 *     elif xpathObj.type == xpath.XPATH_LOCATIONSET:
 *         raise NotImplementedError, u"XPATH_LOCATIONSET"
 *     elif xpathObj.type == xpath.XPATH_USERS:             # <<<<<<<<<<<<<<
 *         raise NotImplementedError, u"XPATH_USERS"
 *     elif xpathObj.type == xpath.XPATH_XSLT_TREE:
 */
  __pyx_t_1 = (__pyx_v_xpathObj->type == XPATH_USERS);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":562
 *         raise NotImplementedError, u"XPATH_LOCATIONSET"
 *     elif xpathObj.type == xpath.XPATH_USERS:
 *         raise NotImplementedError, u"XPATH_USERS"             # <<<<<<<<<<<<<<
 *     elif xpathObj.type == xpath.XPATH_XSLT_TREE:
 *         return _createNodeSetResult(xpathObj, doc, context)
 */
    __Pyx_Raise(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_n_u__XPATH_USERS), 0);
    {__pyx_filename = __pyx_f[6]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":563
 *     elif xpathObj.type == xpath.XPATH_USERS:
 *         raise NotImplementedError, u"XPATH_USERS"
 *     elif xpathObj.type == xpath.XPATH_XSLT_TREE:             # <<<<<<<<<<<<<<
 *         return _createNodeSetResult(xpathObj, doc, context)
 *     else:
 */
  __pyx_t_1 = (__pyx_v_xpathObj->type == XPATH_XSLT_TREE);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":564
 *         raise NotImplementedError, u"XPATH_USERS"
 *     elif xpathObj.type == xpath.XPATH_XSLT_TREE:
 *         return _createNodeSetResult(xpathObj, doc, context)             # <<<<<<<<<<<<<<
 *     else:
 *         raise XPathResultError, u"Unknown xpath result %s" % unicode(xpathObj.type)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __pyx_f_4lxml_5etree__createNodeSetResult(__pyx_v_xpathObj, __pyx_v_doc, __pyx_v_context); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":566
 *         return _createNodeSetResult(xpathObj, doc, context)
 *     else:
 *         raise XPathResultError, u"Unknown xpath result %s" % unicode(xpathObj.type)             # <<<<<<<<<<<<<<
 * 
 * cdef object _createNodeSetResult(xpath.xmlXPathObject* xpathObj, _Document doc,
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__XPathResultError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyInt_FromLong(__pyx_v_xpathObj->type); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_316), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_2, ((PyObject *)__pyx_t_4), 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[6]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._unwrapXPathObject");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_stringval);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":568
 *         raise XPathResultError, u"Unknown xpath result %s" % unicode(xpathObj.type)
 * 
 * cdef object _createNodeSetResult(xpath.xmlXPathObject* xpathObj, _Document doc,             # <<<<<<<<<<<<<<
 *                                  _BaseContext context):
 *     cdef xmlNode* c_node
 */

static  PyObject *__pyx_f_4lxml_5etree__createNodeSetResult(xmlXPathObject *__pyx_v_xpathObj, struct LxmlDocument *__pyx_v_doc, struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_context) {
  xmlNode *__pyx_v_c_node;
  int __pyx_v_i;
  PyObject *__pyx_v_result;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("_createNodeSetResult");
  __pyx_v_result = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":573
 *     cdef int i
 *     cdef list result
 *     result = []             # <<<<<<<<<<<<<<
 *     if xpathObj.nodesetval is NULL:
 *         return result
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_DECREF(((PyObject *)__pyx_v_result));
  __pyx_v_result = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":574
 *     cdef list result
 *     result = []
 *     if xpathObj.nodesetval is NULL:             # <<<<<<<<<<<<<<
 *         return result
 *     for i in range(xpathObj.nodesetval.nodeNr):
 */
  __pyx_t_2 = (__pyx_v_xpathObj->nodesetval == NULL);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":575
 *     result = []
 *     if xpathObj.nodesetval is NULL:
 *         return result             # <<<<<<<<<<<<<<
 *     for i in range(xpathObj.nodesetval.nodeNr):
 *         c_node = xpathObj.nodesetval.nodeTab[i]
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_result));
    __pyx_r = ((PyObject *)__pyx_v_result);
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":576
 *     if xpathObj.nodesetval is NULL:
 *         return result
 *     for i in range(xpathObj.nodesetval.nodeNr):             # <<<<<<<<<<<<<<
 *         c_node = xpathObj.nodesetval.nodeTab[i]
 *         _unpackNodeSetEntry(result, c_node, doc, context,
 */
  __pyx_t_3 = __pyx_v_xpathObj->nodesetval->nodeNr;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":577
 *         return result
 *     for i in range(xpathObj.nodesetval.nodeNr):
 *         c_node = xpathObj.nodesetval.nodeTab[i]             # <<<<<<<<<<<<<<
 *         _unpackNodeSetEntry(result, c_node, doc, context,
 *                             xpathObj.type == xpath.XPATH_XSLT_TREE)
 */
    __pyx_v_c_node = (__pyx_v_xpathObj->nodesetval->nodeTab[__pyx_v_i]);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":579
 *         c_node = xpathObj.nodesetval.nodeTab[i]
 *         _unpackNodeSetEntry(result, c_node, doc, context,
 *                             xpathObj.type == xpath.XPATH_XSLT_TREE)             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree__unpackNodeSetEntry(__pyx_v_result, __pyx_v_c_node, __pyx_v_doc, __pyx_v_context, (__pyx_v_xpathObj->type == XPATH_XSLT_TREE)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":580
 *         _unpackNodeSetEntry(result, c_node, doc, context,
 *                             xpathObj.type == xpath.XPATH_XSLT_TREE)
 *     return result             # <<<<<<<<<<<<<<
 * 
 * cdef _unpackNodeSetEntry(list results, xmlNode* c_node, _Document doc,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._createNodeSetResult");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":582
 *     return result
 * 
 * cdef _unpackNodeSetEntry(list results, xmlNode* c_node, _Document doc,             # <<<<<<<<<<<<<<
 *                          _BaseContext context, bint is_fragment):
 *     cdef xmlNode* c_child
 */

static  PyObject *__pyx_f_4lxml_5etree__unpackNodeSetEntry(PyObject *__pyx_v_results, xmlNode *__pyx_v_c_node, struct LxmlDocument *__pyx_v_doc, struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_context, int __pyx_v_is_fragment) {
  xmlNode *__pyx_v_c_child;
  char *__pyx_v_s;
  PyObject *__pyx_v_href;
  PyObject *__pyx_v_prefix;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("_unpackNodeSetEntry");
  __pyx_v_href = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_prefix = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":586
 *     cdef xmlNode* c_child
 *     cdef char* s
 *     if _isElement(c_node):             # <<<<<<<<<<<<<<
 *         if c_node.doc != doc._c_doc and c_node.doc._private is NULL:
 *             # XXX: works, but maybe not always the right thing to do?
 */
  __pyx_t_1 = _isElement(__pyx_v_c_node);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":587
 *     cdef char* s
 *     if _isElement(c_node):
 *         if c_node.doc != doc._c_doc and c_node.doc._private is NULL:             # <<<<<<<<<<<<<<
 *             # XXX: works, but maybe not always the right thing to do?
 *             # XPath: only runs when extensions create or copy trees
 */
    __pyx_t_1 = (__pyx_v_c_node->doc != __pyx_v_doc->_c_doc);
    if (__pyx_t_1) {
      __pyx_t_2 = (__pyx_v_c_node->doc->_private == NULL);
      __pyx_t_3 = __pyx_t_2;
    } else {
      __pyx_t_3 = __pyx_t_1;
    }
    if (__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":592
 *             #        -> we store Python refs to these, so that is OK
 *             # XSLT: can it leak when merging trees from multiple sources?
 *             c_node = tree.xmlDocCopyNode(c_node, doc._c_doc, 1)             # <<<<<<<<<<<<<<
 *             # FIXME: call _instantiateElementFromXPath() instead?
 *         results.append(
 */
      __pyx_v_c_node = xmlDocCopyNode(__pyx_v_c_node, __pyx_v_doc->_c_doc, 1);
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":594
 *             c_node = tree.xmlDocCopyNode(c_node, doc._c_doc, 1)
 *             # FIXME: call _instantiateElementFromXPath() instead?
 *         results.append(             # <<<<<<<<<<<<<<
 *             _fakeDocElementFactory(doc, c_node))
 *     elif c_node.type == tree.XML_TEXT_NODE or \
 */
    if (unlikely(__pyx_v_results == Py_None)) {
      PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":595
 *             # FIXME: call _instantiateElementFromXPath() instead?
 *         results.append(
 *             _fakeDocElementFactory(doc, c_node))             # <<<<<<<<<<<<<<
 *     elif c_node.type == tree.XML_TEXT_NODE or \
 *              c_node.type == tree.XML_CDATA_SECTION_NODE or \
 */
    __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__fakeDocElementFactory(__pyx_v_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyList_Append(__pyx_v_results, __pyx_t_4); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":596
 *         results.append(
 *             _fakeDocElementFactory(doc, c_node))
 *     elif c_node.type == tree.XML_TEXT_NODE or \             # <<<<<<<<<<<<<<
 *              c_node.type == tree.XML_CDATA_SECTION_NODE or \
 *              c_node.type == tree.XML_ATTRIBUTE_NODE:
 */
  __pyx_t_3 = (__pyx_v_c_node->type == XML_TEXT_NODE);
  if (!__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":597
 *             _fakeDocElementFactory(doc, c_node))
 *     elif c_node.type == tree.XML_TEXT_NODE or \
 *              c_node.type == tree.XML_CDATA_SECTION_NODE or \             # <<<<<<<<<<<<<<
 *              c_node.type == tree.XML_ATTRIBUTE_NODE:
 *         results.append(
 */
    __pyx_t_1 = (__pyx_v_c_node->type == XML_CDATA_SECTION_NODE);
    if (!__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":598
 *     elif c_node.type == tree.XML_TEXT_NODE or \
 *              c_node.type == tree.XML_CDATA_SECTION_NODE or \
 *              c_node.type == tree.XML_ATTRIBUTE_NODE:             # <<<<<<<<<<<<<<
 *         results.append(
 *             _buildElementStringResult(doc, c_node, context))
 */
      __pyx_t_2 = (__pyx_v_c_node->type == XML_ATTRIBUTE_NODE);
      __pyx_t_6 = __pyx_t_2;
    } else {
      __pyx_t_6 = __pyx_t_1;
    }
    __pyx_t_1 = __pyx_t_6;
  } else {
    __pyx_t_1 = __pyx_t_3;
  }
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":599
 *              c_node.type == tree.XML_CDATA_SECTION_NODE or \
 *              c_node.type == tree.XML_ATTRIBUTE_NODE:
 *         results.append(             # <<<<<<<<<<<<<<
 *             _buildElementStringResult(doc, c_node, context))
 *     elif c_node.type == tree.XML_NAMESPACE_DECL:
 */
    if (unlikely(__pyx_v_results == Py_None)) {
      PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":600
 *              c_node.type == tree.XML_ATTRIBUTE_NODE:
 *         results.append(
 *             _buildElementStringResult(doc, c_node, context))             # <<<<<<<<<<<<<<
 *     elif c_node.type == tree.XML_NAMESPACE_DECL:
 *         s = (<xmlNs*>c_node).href
 */
    __pyx_t_4 = __pyx_f_4lxml_5etree__buildElementStringResult(__pyx_v_doc, __pyx_v_c_node, __pyx_v_context); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyList_Append(__pyx_v_results, __pyx_t_4); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":601
 *         results.append(
 *             _buildElementStringResult(doc, c_node, context))
 *     elif c_node.type == tree.XML_NAMESPACE_DECL:             # <<<<<<<<<<<<<<
 *         s = (<xmlNs*>c_node).href
 *         if s is NULL:
 */
  __pyx_t_1 = (__pyx_v_c_node->type == XML_NAMESPACE_DECL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":602
 *             _buildElementStringResult(doc, c_node, context))
 *     elif c_node.type == tree.XML_NAMESPACE_DECL:
 *         s = (<xmlNs*>c_node).href             # <<<<<<<<<<<<<<
 *         if s is NULL:
 *             href = None
 */
    __pyx_v_s = ((xmlNs *)__pyx_v_c_node)->href;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":603
 *     elif c_node.type == tree.XML_NAMESPACE_DECL:
 *         s = (<xmlNs*>c_node).href
 *         if s is NULL:             # <<<<<<<<<<<<<<
 *             href = None
 *         else:
 */
    __pyx_t_1 = (__pyx_v_s == NULL);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":604
 *         s = (<xmlNs*>c_node).href
 *         if s is NULL:
 *             href = None             # <<<<<<<<<<<<<<
 *         else:
 *             href = funicode(s)
 */
      __Pyx_INCREF(Py_None);
      __Pyx_DECREF(__pyx_v_href);
      __pyx_v_href = Py_None;
      goto __pyx_L5;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":606
 *             href = None
 *         else:
 *             href = funicode(s)             # <<<<<<<<<<<<<<
 *         s = (<xmlNs*>c_node).prefix
 *         if s is NULL:
 */
      __pyx_t_4 = __pyx_f_4lxml_5etree_funicode(__pyx_v_s); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_v_href);
      __pyx_v_href = __pyx_t_4;
      __pyx_t_4 = 0;
    }
    __pyx_L5:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":607
 *         else:
 *             href = funicode(s)
 *         s = (<xmlNs*>c_node).prefix             # <<<<<<<<<<<<<<
 *         if s is NULL:
 *             prefix = None
 */
    __pyx_v_s = ((xmlNs *)__pyx_v_c_node)->prefix;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":608
 *             href = funicode(s)
 *         s = (<xmlNs*>c_node).prefix
 *         if s is NULL:             # <<<<<<<<<<<<<<
 *             prefix = None
 *         else:
 */
    __pyx_t_1 = (__pyx_v_s == NULL);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":609
 *         s = (<xmlNs*>c_node).prefix
 *         if s is NULL:
 *             prefix = None             # <<<<<<<<<<<<<<
 *         else:
 *             prefix = funicode(s)
 */
      __Pyx_INCREF(Py_None);
      __Pyx_DECREF(__pyx_v_prefix);
      __pyx_v_prefix = Py_None;
      goto __pyx_L6;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":611
 *             prefix = None
 *         else:
 *             prefix = funicode(s)             # <<<<<<<<<<<<<<
 *         results.append( (prefix, href) )
 *     elif c_node.type == tree.XML_DOCUMENT_NODE or \
 */
      __pyx_t_4 = __pyx_f_4lxml_5etree_funicode(__pyx_v_s); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_v_prefix);
      __pyx_v_prefix = __pyx_t_4;
      __pyx_t_4 = 0;
    }
    __pyx_L6:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":612
 *         else:
 *             prefix = funicode(s)
 *         results.append( (prefix, href) )             # <<<<<<<<<<<<<<
 *     elif c_node.type == tree.XML_DOCUMENT_NODE or \
 *             c_node.type == tree.XML_HTML_DOCUMENT_NODE:
 */
    if (unlikely(__pyx_v_results == Py_None)) {
      PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_INCREF(__pyx_v_prefix);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_prefix);
    __Pyx_GIVEREF(__pyx_v_prefix);
    __Pyx_INCREF(__pyx_v_href);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_href);
    __Pyx_GIVEREF(__pyx_v_href);
    __pyx_t_5 = PyList_Append(__pyx_v_results, ((PyObject *)__pyx_t_4)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":613
 *             prefix = funicode(s)
 *         results.append( (prefix, href) )
 *     elif c_node.type == tree.XML_DOCUMENT_NODE or \             # <<<<<<<<<<<<<<
 *             c_node.type == tree.XML_HTML_DOCUMENT_NODE:
 *         # ignored for everything but result tree fragments
 */
  __pyx_t_1 = (__pyx_v_c_node->type == XML_DOCUMENT_NODE);
  if (!__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":614
 *         results.append( (prefix, href) )
 *     elif c_node.type == tree.XML_DOCUMENT_NODE or \
 *             c_node.type == tree.XML_HTML_DOCUMENT_NODE:             # <<<<<<<<<<<<<<
 *         # ignored for everything but result tree fragments
 *         if is_fragment:
 */
    __pyx_t_3 = (__pyx_v_c_node->type == XML_HTML_DOCUMENT_NODE);
    __pyx_t_6 = __pyx_t_3;
  } else {
    __pyx_t_6 = __pyx_t_1;
  }
  if (__pyx_t_6) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":616
 *             c_node.type == tree.XML_HTML_DOCUMENT_NODE:
 *         # ignored for everything but result tree fragments
 *         if is_fragment:             # <<<<<<<<<<<<<<
 *             c_child = c_node.children
 *             while c_child is not NULL:
 */
    if (__pyx_v_is_fragment) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":617
 *         # ignored for everything but result tree fragments
 *         if is_fragment:
 *             c_child = c_node.children             # <<<<<<<<<<<<<<
 *             while c_child is not NULL:
 *                 _unpackNodeSetEntry(results, c_child, doc, context, 0)
 */
      __pyx_v_c_child = __pyx_v_c_node->children;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":618
 *         if is_fragment:
 *             c_child = c_node.children
 *             while c_child is not NULL:             # <<<<<<<<<<<<<<
 *                 _unpackNodeSetEntry(results, c_child, doc, context, 0)
 *                 c_child = c_child.next
 */
      while (1) {
        __pyx_t_6 = (__pyx_v_c_child != NULL);
        if (!__pyx_t_6) break;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":619
 *             c_child = c_node.children
 *             while c_child is not NULL:
 *                 _unpackNodeSetEntry(results, c_child, doc, context, 0)             # <<<<<<<<<<<<<<
 *                 c_child = c_child.next
 *     elif c_node.type == tree.XML_XINCLUDE_START or \
 */
        __pyx_t_4 = __pyx_f_4lxml_5etree__unpackNodeSetEntry(__pyx_v_results, __pyx_v_c_child, __pyx_v_doc, __pyx_v_context, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":620
 *             while c_child is not NULL:
 *                 _unpackNodeSetEntry(results, c_child, doc, context, 0)
 *                 c_child = c_child.next             # <<<<<<<<<<<<<<
 *     elif c_node.type == tree.XML_XINCLUDE_START or \
 *             c_node.type == tree.XML_XINCLUDE_END:
 */
        __pyx_v_c_child = __pyx_v_c_child->next;
      }
      goto __pyx_L7;
    }
    __pyx_L7:;
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":621
 *                 _unpackNodeSetEntry(results, c_child, doc, context, 0)
 *                 c_child = c_child.next
 *     elif c_node.type == tree.XML_XINCLUDE_START or \             # <<<<<<<<<<<<<<
 *             c_node.type == tree.XML_XINCLUDE_END:
 *         pass
 */
  __pyx_t_6 = (__pyx_v_c_node->type == XML_XINCLUDE_START);
  if (!__pyx_t_6) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":622
 *                 c_child = c_child.next
 *     elif c_node.type == tree.XML_XINCLUDE_START or \
 *             c_node.type == tree.XML_XINCLUDE_END:             # <<<<<<<<<<<<<<
 *         pass
 *     else:
 */
    __pyx_t_1 = (__pyx_v_c_node->type == XML_XINCLUDE_END);
    __pyx_t_3 = __pyx_t_1;
  } else {
    __pyx_t_3 = __pyx_t_6;
  }
  if (__pyx_t_3) {
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":626
 *     else:
 *         raise NotImplementedError, \
 *             u"Not yet implemented result node type: %d" % c_node.type             # <<<<<<<<<<<<<<
 * 
 * cdef void _freeXPathObject(xpath.xmlXPathObject* xpathObj):
 */
    __pyx_t_4 = PyInt_FromLong(__pyx_v_c_node->type); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_317), __pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_7));
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_t_7), 0);
    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
    {__pyx_filename = __pyx_f[6]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree._unpackNodeSetEntry");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_href);
  __Pyx_DECREF(__pyx_v_prefix);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":628
 *             u"Not yet implemented result node type: %d" % c_node.type
 * 
 * cdef void _freeXPathObject(xpath.xmlXPathObject* xpathObj):             # <<<<<<<<<<<<<<
 *     u"""Free the XPath object, but *never* free the *content* of node sets.
 *     Python dealloc will do that for us.
 */

static  void __pyx_f_4lxml_5etree__freeXPathObject(xmlXPathObject *__pyx_v_xpathObj) {
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_freeXPathObject");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":632
 *     Python dealloc will do that for us.
 *     """
 *     if xpathObj.nodesetval is not NULL:             # <<<<<<<<<<<<<<
 *         xpath.xmlXPathFreeNodeSet(xpathObj.nodesetval)
 *         xpathObj.nodesetval = NULL
 */
  __pyx_t_1 = (__pyx_v_xpathObj->nodesetval != NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":633
 *     """
 *     if xpathObj.nodesetval is not NULL:
 *         xpath.xmlXPathFreeNodeSet(xpathObj.nodesetval)             # <<<<<<<<<<<<<<
 *         xpathObj.nodesetval = NULL
 *     xpath.xmlXPathFreeObject(xpathObj)
 */
    xmlXPathFreeNodeSet(__pyx_v_xpathObj->nodesetval);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":634
 *     if xpathObj.nodesetval is not NULL:
 *         xpath.xmlXPathFreeNodeSet(xpathObj.nodesetval)
 *         xpathObj.nodesetval = NULL             # <<<<<<<<<<<<<<
 *     xpath.xmlXPathFreeObject(xpathObj)
 * 
 */
    __pyx_v_xpathObj->nodesetval = NULL;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":635
 *         xpath.xmlXPathFreeNodeSet(xpathObj.nodesetval)
 *         xpathObj.nodesetval = NULL
 *     xpath.xmlXPathFreeObject(xpathObj)             # <<<<<<<<<<<<<<
 * 
 * cdef _Element _instantiateElementFromXPath(xmlNode* c_node, _Document doc,
 */
  xmlXPathFreeObject(__pyx_v_xpathObj);

  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":637
 *     xpath.xmlXPathFreeObject(xpathObj)
 * 
 * cdef _Element _instantiateElementFromXPath(xmlNode* c_node, _Document doc,             # <<<<<<<<<<<<<<
 *                                            _BaseContext context):
 *     # NOTE: this may copy the element - only call this when it can't leak
 */

static  struct LxmlElement *__pyx_f_4lxml_5etree__instantiateElementFromXPath(xmlNode *__pyx_v_c_node, struct LxmlDocument *__pyx_v_doc, struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_context) {
  struct LxmlElement *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("_instantiateElementFromXPath");
  __Pyx_INCREF((PyObject *)__pyx_v_doc);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":640
 *                                            _BaseContext context):
 *     # NOTE: this may copy the element - only call this when it can't leak
 *     if c_node.doc != doc._c_doc and c_node.doc._private is NULL:             # <<<<<<<<<<<<<<
 *         # not from the context document and not from a fake document
 *         # either => may still be from a known document, e.g. one
 */
  __pyx_t_1 = (__pyx_v_c_node->doc != __pyx_v_doc->_c_doc);
  if (__pyx_t_1) {
    __pyx_t_2 = (__pyx_v_c_node->doc->_private == NULL);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":644
 *         # either => may still be from a known document, e.g. one
 *         # created by an extension function
 *         doc = context._findDocumentForNode(c_node)             # <<<<<<<<<<<<<<
 *         if doc is None:
 *             # not from a known document at all! => can only make a
 */
    __pyx_t_4 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__BaseContext *)__pyx_v_context->__pyx_vtab)->_findDocumentForNode(__pyx_v_context, __pyx_v_c_node)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(((PyObject *)__pyx_v_doc));
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":645
 *         # created by an extension function
 *         doc = context._findDocumentForNode(c_node)
 *         if doc is None:             # <<<<<<<<<<<<<<
 *             # not from a known document at all! => can only make a
 *             # safety copy here
 */
    __pyx_t_3 = (((PyObject *)__pyx_v_doc) == Py_None);
    if (__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":648
 *             # not from a known document at all! => can only make a
 *             # safety copy here
 *             c_node = tree.xmlDocCopyNode(c_node, doc._c_doc, 1)             # <<<<<<<<<<<<<<
 *     return _fakeDocElementFactory(doc, c_node)
 * 
 */
      __pyx_v_c_node = xmlDocCopyNode(__pyx_v_c_node, __pyx_v_doc->_c_doc, 1);
      goto __pyx_L4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":649
 *             # safety copy here
 *             c_node = tree.xmlDocCopyNode(c_node, doc._c_doc, 1)
 *     return _fakeDocElementFactory(doc, c_node)             # <<<<<<<<<<<<<<
 * 
 * ################################################################################
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__fakeDocElementFactory(__pyx_v_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = ((struct LxmlElement *)__pyx_t_4);
  __pyx_t_4 = 0;
  goto __pyx_L0;

  __pyx_r = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._instantiateElementFromXPath");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_doc);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":661
 *     cdef readonly object attrname
 * 
 *     def getparent(self):             # <<<<<<<<<<<<<<
 *         return self._parent
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_21_ElementUnicodeResult_getparent(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_21_ElementUnicodeResult_getparent(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("getparent");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":662
 * 
 *     def getparent(self):
 *         return self._parent             # <<<<<<<<<<<<<<
 * 
 * class _ElementStringResult(bytes):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *)__pyx_v_self)->_parent));
  __pyx_r = ((PyObject *)((struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *)__pyx_v_self)->_parent);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":656
 * cdef class _ElementUnicodeResult(unicode):
 *     cdef _Element _parent
 *     cdef readonly object is_tail             # <<<<<<<<<<<<<<
 *     cdef readonly object is_text
 *     cdef readonly object is_attribute
 */

static PyObject *__pyx_pf_4lxml_5etree_21_ElementUnicodeResult_7is_tail___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_21_ElementUnicodeResult_7is_tail___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *)__pyx_v_self)->is_tail);
  __pyx_r = ((struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *)__pyx_v_self)->is_tail;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":657
 *     cdef _Element _parent
 *     cdef readonly object is_tail
 *     cdef readonly object is_text             # <<<<<<<<<<<<<<
 *     cdef readonly object is_attribute
 *     cdef readonly object attrname
 */

static PyObject *__pyx_pf_4lxml_5etree_21_ElementUnicodeResult_7is_text___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_21_ElementUnicodeResult_7is_text___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *)__pyx_v_self)->is_text);
  __pyx_r = ((struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *)__pyx_v_self)->is_text;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":658
 *     cdef readonly object is_tail
 *     cdef readonly object is_text
 *     cdef readonly object is_attribute             # <<<<<<<<<<<<<<
 *     cdef readonly object attrname
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_21_ElementUnicodeResult_12is_attribute___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_21_ElementUnicodeResult_12is_attribute___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *)__pyx_v_self)->is_attribute);
  __pyx_r = ((struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *)__pyx_v_self)->is_attribute;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":659
 *     cdef readonly object is_text
 *     cdef readonly object is_attribute
 *     cdef readonly object attrname             # <<<<<<<<<<<<<<
 * 
 *     def getparent(self):
 */

static PyObject *__pyx_pf_4lxml_5etree_21_ElementUnicodeResult_8attrname___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_21_ElementUnicodeResult_8attrname___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *)__pyx_v_self)->attrname);
  __pyx_r = ((struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *)__pyx_v_self)->attrname;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":667
 *     # we need to use a Python class here, bytes cannot be C-subclassed
 *     # in Pyrex/Cython
 *     def getparent(self):             # <<<<<<<<<<<<<<
 *         return self._parent
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_20_ElementStringResult_getparent(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_20_ElementStringResult_getparent = {__Pyx_NAMESTR("getparent"), (PyCFunction)__pyx_pf_4lxml_5etree_20_ElementStringResult_getparent, METH_O, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pf_4lxml_5etree_20_ElementStringResult_getparent(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getparent");
  __pyx_self = __pyx_self;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":668
 *     # in Pyrex/Cython
 *     def getparent(self):
 *         return self._parent             # <<<<<<<<<<<<<<
 * 
 * cdef object _elementStringResultFactory(string_value, _Element parent,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___parent); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ElementStringResult.getparent");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":670
 *         return self._parent
 * 
 * cdef object _elementStringResultFactory(string_value, _Element parent,             # <<<<<<<<<<<<<<
 *                                         attrname, bint is_tail):
 *     cdef _ElementUnicodeResult uresult
 */

static  PyObject *__pyx_f_4lxml_5etree__elementStringResultFactory(PyObject *__pyx_v_string_value, struct LxmlElement *__pyx_v_parent, PyObject *__pyx_v_attrname, int __pyx_v_is_tail) {
  struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *__pyx_v_uresult;
  int __pyx_v_is_text;
  int __pyx_v_is_attribute;
  PyObject *__pyx_v_result;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("_elementStringResultFactory");
  __pyx_v_uresult = ((struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_result = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":674
 *     cdef _ElementUnicodeResult uresult
 *     cdef bint is_text
 *     cdef bint is_attribute = attrname is not None             # <<<<<<<<<<<<<<
 *     if parent is None:
 *         is_text = 0
 */
  __pyx_t_1 = (__pyx_v_attrname != Py_None);
  __pyx_v_is_attribute = __pyx_t_1;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":675
 *     cdef bint is_text
 *     cdef bint is_attribute = attrname is not None
 *     if parent is None:             # <<<<<<<<<<<<<<
 *         is_text = 0
 *     else:
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_parent) == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":676
 *     cdef bint is_attribute = attrname is not None
 *     if parent is None:
 *         is_text = 0             # <<<<<<<<<<<<<<
 *     else:
 *         is_text = not (is_tail or is_attribute)
 */
    __pyx_v_is_text = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":678
 *         is_text = 0
 *     else:
 *         is_text = not (is_tail or is_attribute)             # <<<<<<<<<<<<<<
 * 
 *     if python.PyBytes_CheckExact(string_value):
 */
    if (!__pyx_v_is_tail) {
      __pyx_t_1 = __pyx_v_is_attribute;
    } else {
      __pyx_t_1 = __pyx_v_is_tail;
    }
    __pyx_v_is_text = (!__pyx_t_1);
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":680
 *         is_text = not (is_tail or is_attribute)
 * 
 *     if python.PyBytes_CheckExact(string_value):             # <<<<<<<<<<<<<<
 *         result = _ElementStringResult(string_value)
 *         result._parent = parent
 */
  __pyx_t_1 = PyBytes_CheckExact(__pyx_v_string_value);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":681
 * 
 *     if python.PyBytes_CheckExact(string_value):
 *         result = _ElementStringResult(string_value)             # <<<<<<<<<<<<<<
 *         result._parent = parent
 *         result.is_attribute = is_attribute
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s_319); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_INCREF(__pyx_v_string_value);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_string_value);
    __Pyx_GIVEREF(__pyx_v_string_value);
    __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_v_result);
    __pyx_v_result = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":682
 *     if python.PyBytes_CheckExact(string_value):
 *         result = _ElementStringResult(string_value)
 *         result._parent = parent             # <<<<<<<<<<<<<<
 *         result.is_attribute = is_attribute
 *         result.is_tail = is_tail
 */
    if (PyObject_SetAttr(__pyx_v_result, __pyx_n_s___parent, ((PyObject *)__pyx_v_parent)) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":683
 *         result = _ElementStringResult(string_value)
 *         result._parent = parent
 *         result.is_attribute = is_attribute             # <<<<<<<<<<<<<<
 *         result.is_tail = is_tail
 *         result.is_text = is_text
 */
    __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_is_attribute); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 683; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    if (PyObject_SetAttr(__pyx_v_result, __pyx_n_s__is_attribute, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 683; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":684
 *         result._parent = parent
 *         result.is_attribute = is_attribute
 *         result.is_tail = is_tail             # <<<<<<<<<<<<<<
 *         result.is_text = is_text
 *         result.attrname = attrname
 */
    __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_is_tail); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    if (PyObject_SetAttr(__pyx_v_result, __pyx_n_s__is_tail, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":685
 *         result.is_attribute = is_attribute
 *         result.is_tail = is_tail
 *         result.is_text = is_text             # <<<<<<<<<<<<<<
 *         result.attrname = attrname
 *         return result
 */
    __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_is_text); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    if (PyObject_SetAttr(__pyx_v_result, __pyx_n_s__is_text, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":686
 *         result.is_tail = is_tail
 *         result.is_text = is_text
 *         result.attrname = attrname             # <<<<<<<<<<<<<<
 *         return result
 *     else:
 */
    if (PyObject_SetAttr(__pyx_v_result, __pyx_n_s__attrname, __pyx_v_attrname) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":687
 *         result.is_text = is_text
 *         result.attrname = attrname
 *         return result             # <<<<<<<<<<<<<<
 *     else:
 *         uresult = _ElementUnicodeResult(string_value)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_result);
    __pyx_r = __pyx_v_result;
    goto __pyx_L0;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":689
 *         return result
 *     else:
 *         uresult = _ElementUnicodeResult(string_value)             # <<<<<<<<<<<<<<
 *         uresult._parent = parent
 *         uresult.is_attribute = is_attribute
 */
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_INCREF(__pyx_v_string_value);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_string_value);
    __Pyx_GIVEREF(__pyx_v_string_value);
    __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ElementUnicodeResult)), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_v_uresult));
    __pyx_v_uresult = ((struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":690
 *     else:
 *         uresult = _ElementUnicodeResult(string_value)
 *         uresult._parent = parent             # <<<<<<<<<<<<<<
 *         uresult.is_attribute = is_attribute
 *         uresult.is_tail = is_tail
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_parent));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_parent));
    __Pyx_GOTREF(__pyx_v_uresult->_parent);
    __Pyx_DECREF(((PyObject *)__pyx_v_uresult->_parent));
    __pyx_v_uresult->_parent = __pyx_v_parent;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":691
 *         uresult = _ElementUnicodeResult(string_value)
 *         uresult._parent = parent
 *         uresult.is_attribute = is_attribute             # <<<<<<<<<<<<<<
 *         uresult.is_tail = is_tail
 *         uresult.is_text = is_text
 */
    __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_v_is_attribute); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF(__pyx_v_uresult->is_attribute);
    __Pyx_DECREF(__pyx_v_uresult->is_attribute);
    __pyx_v_uresult->is_attribute = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":692
 *         uresult._parent = parent
 *         uresult.is_attribute = is_attribute
 *         uresult.is_tail = is_tail             # <<<<<<<<<<<<<<
 *         uresult.is_text = is_text
 *         uresult.attrname = attrname
 */
    __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_v_is_tail); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF(__pyx_v_uresult->is_tail);
    __Pyx_DECREF(__pyx_v_uresult->is_tail);
    __pyx_v_uresult->is_tail = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":693
 *         uresult.is_attribute = is_attribute
 *         uresult.is_tail = is_tail
 *         uresult.is_text = is_text             # <<<<<<<<<<<<<<
 *         uresult.attrname = attrname
 *         return uresult
 */
    __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_v_is_text); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 693; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF(__pyx_v_uresult->is_text);
    __Pyx_DECREF(__pyx_v_uresult->is_text);
    __pyx_v_uresult->is_text = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":694
 *         uresult.is_tail = is_tail
 *         uresult.is_text = is_text
 *         uresult.attrname = attrname             # <<<<<<<<<<<<<<
 *         return uresult
 * 
 */
    __Pyx_INCREF(__pyx_v_attrname);
    __Pyx_GIVEREF(__pyx_v_attrname);
    __Pyx_GOTREF(__pyx_v_uresult->attrname);
    __Pyx_DECREF(__pyx_v_uresult->attrname);
    __pyx_v_uresult->attrname = __pyx_v_attrname;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":695
 *         uresult.is_text = is_text
 *         uresult.attrname = attrname
 *         return uresult             # <<<<<<<<<<<<<<
 * 
 * cdef object _buildElementStringResult(_Document doc, xmlNode* c_node,
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_uresult));
    __pyx_r = ((PyObject *)__pyx_v_uresult);
    goto __pyx_L0;
  }
  __pyx_L4:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._elementStringResultFactory");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_uresult);
  __Pyx_DECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":697
 *         return uresult
 * 
 * cdef object _buildElementStringResult(_Document doc, xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                                       _BaseContext context):
 *     cdef _Element parent = None
 */

static  PyObject *__pyx_f_4lxml_5etree__buildElementStringResult(struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node, struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_context) {
  struct LxmlElement *__pyx_v_parent = 0;
  PyObject *__pyx_v_attrname = 0;
  xmlNode *__pyx_v_c_element;
  char *__pyx_v_s;
  int __pyx_v_is_tail;
  PyObject *__pyx_v_value;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("_buildElementStringResult");
  __pyx_v_value = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":699
 * cdef object _buildElementStringResult(_Document doc, xmlNode* c_node,
 *                                       _BaseContext context):
 *     cdef _Element parent = None             # <<<<<<<<<<<<<<
 *     cdef object attrname = None
 *     cdef xmlNode* c_element
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_parent = ((struct LxmlElement *)Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":700
 *                                       _BaseContext context):
 *     cdef _Element parent = None
 *     cdef object attrname = None             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_element
 *     cdef char* s
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_attrname = Py_None;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":705
 *     cdef bint is_tail
 * 
 *     if c_node.type == tree.XML_ATTRIBUTE_NODE:             # <<<<<<<<<<<<<<
 *         attrname = _namespacedName(c_node)
 *         is_tail = 0
 */
  __pyx_t_1 = (__pyx_v_c_node->type == XML_ATTRIBUTE_NODE);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":706
 * 
 *     if c_node.type == tree.XML_ATTRIBUTE_NODE:
 *         attrname = _namespacedName(c_node)             # <<<<<<<<<<<<<<
 *         is_tail = 0
 *         s = tree.xmlNodeGetContent(c_node)
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree__namespacedName(__pyx_v_c_node); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_v_attrname);
    __pyx_v_attrname = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":707
 *     if c_node.type == tree.XML_ATTRIBUTE_NODE:
 *         attrname = _namespacedName(c_node)
 *         is_tail = 0             # <<<<<<<<<<<<<<
 *         s = tree.xmlNodeGetContent(c_node)
 *         try:
 */
    __pyx_v_is_tail = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":708
 *         attrname = _namespacedName(c_node)
 *         is_tail = 0
 *         s = tree.xmlNodeGetContent(c_node)             # <<<<<<<<<<<<<<
 *         try:
 *             value = funicode(s)
 */
    __pyx_v_s = xmlNodeGetContent(__pyx_v_c_node);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":709
 *         is_tail = 0
 *         s = tree.xmlNodeGetContent(c_node)
 *         try:             # <<<<<<<<<<<<<<
 *             value = funicode(s)
 *         finally:
 */
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":710
 *         s = tree.xmlNodeGetContent(c_node)
 *         try:
 *             value = funicode(s)             # <<<<<<<<<<<<<<
 *         finally:
 *             tree.xmlFree(s)
 */
      __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_s); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L5;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_v_value);
      __pyx_v_value = __pyx_t_2;
      __pyx_t_2 = 0;
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":712
 *             value = funicode(s)
 *         finally:
 *             tree.xmlFree(s)             # <<<<<<<<<<<<<<
 *         c_element = NULL
 *     else:
 */
    /*finally:*/ {
      int __pyx_why;
      PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
      int __pyx_exc_lineno;
      __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
      __pyx_why = 0; goto __pyx_L6;
      __pyx_L5: {
        __pyx_why = 4;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
        __pyx_exc_lineno = __pyx_lineno;
        goto __pyx_L6;
      }
      __pyx_L6:;
      xmlFree(__pyx_v_s);
      switch (__pyx_why) {
        case 4: {
          __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
          __pyx_lineno = __pyx_exc_lineno;
          __pyx_exc_type = 0;
          __pyx_exc_value = 0;
          __pyx_exc_tb = 0;
          goto __pyx_L1_error;
        }
      }
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":713
 *         finally:
 *             tree.xmlFree(s)
 *         c_element = NULL             # <<<<<<<<<<<<<<
 *     else:
 *         #assert c_node.type == tree.XML_TEXT_NODE or c_node.type == tree.XML_CDATA_SECTION_NODE, "invalid node type"
 */
    __pyx_v_c_element = NULL;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":717
 *         #assert c_node.type == tree.XML_TEXT_NODE or c_node.type == tree.XML_CDATA_SECTION_NODE, "invalid node type"
 *         # may be tail text or normal text
 *         value = funicode(c_node.content)             # <<<<<<<<<<<<<<
 *         c_element = _previousElement(c_node)
 *         is_tail = c_element is not NULL
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_node->content); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_v_value);
    __pyx_v_value = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":718
 *         # may be tail text or normal text
 *         value = funicode(c_node.content)
 *         c_element = _previousElement(c_node)             # <<<<<<<<<<<<<<
 *         is_tail = c_element is not NULL
 * 
 */
    __pyx_v_c_element = __pyx_f_4lxml_5etree__previousElement(__pyx_v_c_node);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":719
 *         value = funicode(c_node.content)
 *         c_element = _previousElement(c_node)
 *         is_tail = c_element is not NULL             # <<<<<<<<<<<<<<
 * 
 *     if not context._build_smart_strings:
 */
    __pyx_v_is_tail = (__pyx_v_c_element != NULL);
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":721
 *         is_tail = c_element is not NULL
 * 
 *     if not context._build_smart_strings:             # <<<<<<<<<<<<<<
 *         return value
 * 
 */
  __pyx_t_1 = (!__pyx_v_context->_build_smart_strings);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":722
 * 
 *     if not context._build_smart_strings:
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     if c_element is NULL:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_value);
    __pyx_r = __pyx_v_value;
    goto __pyx_L0;
    goto __pyx_L8;
  }
  __pyx_L8:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":724
 *         return value
 * 
 *     if c_element is NULL:             # <<<<<<<<<<<<<<
 *         # non-tail text or attribute text
 *         c_element = c_node.parent
 */
  __pyx_t_1 = (__pyx_v_c_element == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":726
 *     if c_element is NULL:
 *         # non-tail text or attribute text
 *         c_element = c_node.parent             # <<<<<<<<<<<<<<
 *         while c_element is not NULL and not _isElement(c_element):
 *             c_element = c_element.parent
 */
    __pyx_v_c_element = __pyx_v_c_node->parent;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":727
 *         # non-tail text or attribute text
 *         c_element = c_node.parent
 *         while c_element is not NULL and not _isElement(c_element):             # <<<<<<<<<<<<<<
 *             c_element = c_element.parent
 * 
 */
    while (1) {
      __pyx_t_1 = (__pyx_v_c_element != NULL);
      if (__pyx_t_1) {
        __pyx_t_3 = (!_isElement(__pyx_v_c_element));
        __pyx_t_4 = __pyx_t_3;
      } else {
        __pyx_t_4 = __pyx_t_1;
      }
      if (!__pyx_t_4) break;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":728
 *         c_element = c_node.parent
 *         while c_element is not NULL and not _isElement(c_element):
 *             c_element = c_element.parent             # <<<<<<<<<<<<<<
 * 
 *     if c_element is not NULL:
 */
      __pyx_v_c_element = __pyx_v_c_element->parent;
    }
    goto __pyx_L9;
  }
  __pyx_L9:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":730
 *             c_element = c_element.parent
 * 
 *     if c_element is not NULL:             # <<<<<<<<<<<<<<
 *         parent = _instantiateElementFromXPath(c_element, doc, context)
 * 
 */
  __pyx_t_4 = (__pyx_v_c_element != NULL);
  if (__pyx_t_4) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":731
 * 
 *     if c_element is not NULL:
 *         parent = _instantiateElementFromXPath(c_element, doc, context)             # <<<<<<<<<<<<<<
 * 
 *     return _elementStringResultFactory(
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__instantiateElementFromXPath(__pyx_v_c_element, __pyx_v_doc, __pyx_v_context)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_v_parent));
    __pyx_v_parent = ((struct LxmlElement *)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L12;
  }
  __pyx_L12:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":733
 *         parent = _instantiateElementFromXPath(c_element, doc, context)
 * 
 *     return _elementStringResultFactory(             # <<<<<<<<<<<<<<
 *         value, parent, attrname, is_tail)
 * 
 */
  __Pyx_XDECREF(__pyx_r);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":734
 * 
 *     return _elementStringResultFactory(
 *         value, parent, attrname, is_tail)             # <<<<<<<<<<<<<<
 * 
 * ################################################################################
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__elementStringResultFactory(__pyx_v_value, __pyx_v_parent, __pyx_v_attrname, __pyx_v_is_tail); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._buildElementStringResult");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_parent);
  __Pyx_XDECREF(__pyx_v_attrname);
  __Pyx_DECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":739
 * # callbacks for XPath/XSLT extension functions
 * 
 * cdef void _extension_function_call(_BaseContext context, function,             # <<<<<<<<<<<<<<
 *                                    xpath.xmlXPathParserContext* ctxt, int nargs):
 *     cdef _Document doc
 */

static  void __pyx_f_4lxml_5etree__extension_function_call(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_context, PyObject *__pyx_v_function, xmlXPathParserContext *__pyx_v_ctxt, int __pyx_v_nargs) {
  struct LxmlDocument *__pyx_v_doc;
  xmlXPathObject *__pyx_v_obj;
  PyObject *__pyx_v_args;
  int __pyx_v_i;
  PyObject *__pyx_v_o;
  PyObject *__pyx_v_res;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  xmlXPathObject *__pyx_t_7;
  __Pyx_RefNannySetupContext("_extension_function_call");
  __pyx_v_doc = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_args = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_o = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_res = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":745
 *     cdef list args
 *     cdef int i
 *     doc = context._doc             # <<<<<<<<<<<<<<
 *     try:
 *         args = []
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_context->_doc));
  __Pyx_DECREF(((PyObject *)__pyx_v_doc));
  __pyx_v_doc = __pyx_v_context->_doc;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":746
 *     cdef int i
 *     doc = context._doc
 *     try:             # <<<<<<<<<<<<<<
 *         args = []
 *         for i in range(nargs):
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":747
 *     doc = context._doc
 *     try:
 *         args = []             # <<<<<<<<<<<<<<
 *         for i in range(nargs):
 *             obj = xpath.valuePop(ctxt)
 */
      __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      __Pyx_DECREF(((PyObject *)__pyx_v_args));
      __pyx_v_args = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":748
 *     try:
 *         args = []
 *         for i in range(nargs):             # <<<<<<<<<<<<<<
 *             obj = xpath.valuePop(ctxt)
 *             o = _unwrapXPathObject(obj, doc, context)
 */
      __pyx_t_2 = __pyx_v_nargs;
      for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
        __pyx_v_i = __pyx_t_3;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":749
 *         args = []
 *         for i in range(nargs):
 *             obj = xpath.valuePop(ctxt)             # <<<<<<<<<<<<<<
 *             o = _unwrapXPathObject(obj, doc, context)
 *             _freeXPathObject(obj)
 */
        __pyx_v_obj = valuePop(__pyx_v_ctxt);

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":750
 *         for i in range(nargs):
 *             obj = xpath.valuePop(ctxt)
 *             o = _unwrapXPathObject(obj, doc, context)             # <<<<<<<<<<<<<<
 *             _freeXPathObject(obj)
 *             args.append(o)
 */
        __pyx_t_1 = __pyx_f_4lxml_5etree__unwrapXPathObject(__pyx_v_obj, __pyx_v_doc, __pyx_v_context); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 750; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_v_o);
        __pyx_v_o = __pyx_t_1;
        __pyx_t_1 = 0;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":751
 *             obj = xpath.valuePop(ctxt)
 *             o = _unwrapXPathObject(obj, doc, context)
 *             _freeXPathObject(obj)             # <<<<<<<<<<<<<<
 *             args.append(o)
 *         args.reverse()
 */
        __pyx_f_4lxml_5etree__freeXPathObject(__pyx_v_obj);

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":752
 *             o = _unwrapXPathObject(obj, doc, context)
 *             _freeXPathObject(obj)
 *             args.append(o)             # <<<<<<<<<<<<<<
 *         args.reverse()
 * 
 */
        if (unlikely(__pyx_v_args == Py_None)) {
          PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L3_error;} 
        }
        __pyx_t_4 = PyList_Append(__pyx_v_args, __pyx_v_o); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":753
 *             _freeXPathObject(obj)
 *             args.append(o)
 *         args.reverse()             # <<<<<<<<<<<<<<
 * 
 *         res = function(context, *args)
 */
      if (unlikely(__pyx_v_args == Py_None)) {
        PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'reverse'"); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L3_error;} 
      }
      __pyx_t_2 = PyList_Reverse(__pyx_v_args); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L3_error;}

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":755
 *         args.reverse()
 * 
 *         res = function(context, *args)             # <<<<<<<<<<<<<<
 *         # wrap result for XPath consumption
 *         obj = _wrapXPathObject(res, doc, context)
 */
      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      __Pyx_INCREF(((PyObject *)__pyx_v_context));
      PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_context));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_context));
      __pyx_t_5 = PySequence_Tuple(((PyObject *)__pyx_v_args)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
      __pyx_t_6 = PyNumber_Add(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
      __pyx_t_5 = PyObject_Call(__pyx_v_function, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_v_res);
      __pyx_v_res = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":757
 *         res = function(context, *args)
 *         # wrap result for XPath consumption
 *         obj = _wrapXPathObject(res, doc, context)             # <<<<<<<<<<<<<<
 *         # prevent Python from deallocating elements handed to libxml2
 *         context._hold(res)
 */
      __pyx_t_7 = __pyx_f_4lxml_5etree__wrapXPathObject(__pyx_v_res, __pyx_v_doc, __pyx_v_context); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __pyx_v_obj = __pyx_t_7;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":759
 *         obj = _wrapXPathObject(res, doc, context)
 *         # prevent Python from deallocating elements handed to libxml2
 *         context._hold(res)             # <<<<<<<<<<<<<<
 *         xpath.valuePush(ctxt, obj)
 *     except:
 */
      __pyx_t_5 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseContext *)__pyx_v_context->__pyx_vtab)->_hold(__pyx_v_context, __pyx_v_res); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":760
 *         # prevent Python from deallocating elements handed to libxml2
 *         context._hold(res)
 *         xpath.valuePush(ctxt, obj)             # <<<<<<<<<<<<<<
 *     except:
 *         xpath.xmlXPathErr(ctxt, xpath.XPATH_EXPR_ERROR)
 */
      valuePush(__pyx_v_ctxt, __pyx_v_obj);
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L10_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":761
 *         context._hold(res)
 *         xpath.valuePush(ctxt, obj)
 *     except:             # <<<<<<<<<<<<<<
 *         xpath.xmlXPathErr(ctxt, xpath.XPATH_EXPR_ERROR)
 *         context._exc._store_raised()
 */
    /*except:*/ {
      __Pyx_AddTraceback("lxml.etree._extension_function_call");
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 761; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_1);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":762
 *         xpath.valuePush(ctxt, obj)
 *     except:
 *         xpath.xmlXPathErr(ctxt, xpath.XPATH_EXPR_ERROR)             # <<<<<<<<<<<<<<
 *         context._exc._store_raised()
 * 
 */
      xmlXPathErr(__pyx_v_ctxt, XPATH_EXPR_ERROR);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":763
 *     except:
 *         xpath.xmlXPathErr(ctxt, xpath.XPATH_EXPR_ERROR)
 *         context._exc._store_raised()             # <<<<<<<<<<<<<<
 * 
 * # lookup the function by name and call it
 */
      ((struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext *)__pyx_v_context->_exc->__pyx_vtab)->_store_raised(__pyx_v_context->_exc);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L4_exception_handled;
    }
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L10_try_end:;
  }

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_WriteUnraisable("lxml.etree._extension_function_call");
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_doc);
  __Pyx_DECREF(__pyx_v_args);
  __Pyx_DECREF(__pyx_v_o);
  __Pyx_DECREF(__pyx_v_res);
  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":767
 * # lookup the function by name and call it
 * 
 * cdef void _xpath_function_call(xpath.xmlXPathParserContext* ctxt,             # <<<<<<<<<<<<<<
 *                                int nargs) with gil:
 *     cdef xpath.xmlXPathContext* rctxt
 */

static  void __pyx_f_4lxml_5etree__xpath_function_call(xmlXPathParserContext *__pyx_v_ctxt, int __pyx_v_nargs) {
  xmlXPathContext *__pyx_v_rctxt;
  struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_context;
  PyObject *__pyx_v_function;
  PyObject *__pyx_v_fref;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  #ifdef WITH_THREAD
  PyGILState_STATE _save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_xpath_function_call");
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__BaseContext *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_function = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_fref = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":771
 *     cdef xpath.xmlXPathContext* rctxt
 *     cdef _BaseContext context
 *     rctxt = ctxt.context             # <<<<<<<<<<<<<<
 *     context = <_BaseContext>(rctxt.userData)
 *     function = context._find_cached_function(rctxt.functionURI, rctxt.function)
 */
  __pyx_v_rctxt = __pyx_v_ctxt->context;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":772
 *     cdef _BaseContext context
 *     rctxt = ctxt.context
 *     context = <_BaseContext>(rctxt.userData)             # <<<<<<<<<<<<<<
 *     function = context._find_cached_function(rctxt.functionURI, rctxt.function)
 *     if function is not None:
 */
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_rctxt->userData)));
  __Pyx_DECREF(((PyObject *)__pyx_v_context));
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_rctxt->userData);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":773
 *     rctxt = ctxt.context
 *     context = <_BaseContext>(rctxt.userData)
 *     function = context._find_cached_function(rctxt.functionURI, rctxt.function)             # <<<<<<<<<<<<<<
 *     if function is not None:
 *         _extension_function_call(context, function, ctxt, nargs)
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseContext *)__pyx_v_context->__pyx_vtab)->_find_cached_function(__pyx_v_context, __pyx_v_rctxt->functionURI, __pyx_v_rctxt->function); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_v_function);
  __pyx_v_function = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":774
 *     context = <_BaseContext>(rctxt.userData)
 *     function = context._find_cached_function(rctxt.functionURI, rctxt.function)
 *     if function is not None:             # <<<<<<<<<<<<<<
 *         _extension_function_call(context, function, ctxt, nargs)
 *     else:
 */
  __pyx_t_2 = (__pyx_v_function != Py_None);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":775
 *     function = context._find_cached_function(rctxt.functionURI, rctxt.function)
 *     if function is not None:
 *         _extension_function_call(context, function, ctxt, nargs)             # <<<<<<<<<<<<<<
 *     else:
 *         if rctxt.functionURI is not NULL:
 */
    __pyx_f_4lxml_5etree__extension_function_call(__pyx_v_context, __pyx_v_function, __pyx_v_ctxt, __pyx_v_nargs);
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":777
 *         _extension_function_call(context, function, ctxt, nargs)
 *     else:
 *         if rctxt.functionURI is not NULL:             # <<<<<<<<<<<<<<
 *             fref = u"{%s}%s" % (rctxt.functionURI, rctxt.function)
 *         else:
 */
    __pyx_t_2 = (__pyx_v_rctxt->functionURI != NULL);
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":778
 *     else:
 *         if rctxt.functionURI is not NULL:
 *             fref = u"{%s}%s" % (rctxt.functionURI, rctxt.function)             # <<<<<<<<<<<<<<
 *         else:
 *             fref = rctxt.function
 */
      __pyx_t_1 = PyBytes_FromString(__pyx_v_rctxt->functionURI); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      __pyx_t_3 = PyBytes_FromString(__pyx_v_rctxt->function); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_1));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
      PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_t_3));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
      __pyx_t_1 = 0;
      __pyx_t_3 = 0;
      __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_40), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_v_fref);
      __pyx_v_fref = ((PyObject *)__pyx_t_3);
      __pyx_t_3 = 0;
      goto __pyx_L4;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":780
 *             fref = u"{%s}%s" % (rctxt.functionURI, rctxt.function)
 *         else:
 *             fref = rctxt.function             # <<<<<<<<<<<<<<
 *         xpath.xmlXPathErr(ctxt, xpath.XPATH_UNKNOWN_FUNC_ERROR)
 *         context._exc._store_exception(
 */
      __pyx_t_3 = PyBytes_FromString(__pyx_v_rctxt->function); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
      __Pyx_DECREF(__pyx_v_fref);
      __pyx_v_fref = ((PyObject *)__pyx_t_3);
      __pyx_t_3 = 0;
    }
    __pyx_L4:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":781
 *         else:
 *             fref = rctxt.function
 *         xpath.xmlXPathErr(ctxt, xpath.XPATH_UNKNOWN_FUNC_ERROR)             # <<<<<<<<<<<<<<
 *         context._exc._store_exception(
 *             XPathFunctionError(u"XPath function '%s' not found" % fref))
 */
    xmlXPathErr(__pyx_v_ctxt, XPATH_UNKNOWN_FUNC_ERROR);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":783
 *         xpath.xmlXPathErr(ctxt, xpath.XPATH_UNKNOWN_FUNC_ERROR)
 *         context._exc._store_exception(
 *             XPathFunctionError(u"XPath function '%s' not found" % fref))             # <<<<<<<<<<<<<<
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__XPathFunctionError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_321), __pyx_v_fref); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_4));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    ((struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext *)__pyx_v_context->_exc->__pyx_vtab)->_store_exception(__pyx_v_context->_exc, __pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_L3:;

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_WriteUnraisable("lxml.etree._xpath_function_call");
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_context);
  __Pyx_DECREF(__pyx_v_function);
  __Pyx_DECREF(__pyx_v_fref);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(_save);
  #endif
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":31
 * )
 * 
 * cdef int _register_xpath_function(void* ctxt, name_utf, ns_utf):             # <<<<<<<<<<<<<<
 *     if ns_utf is None:
 *         return xpath.xmlXPathRegisterFunc(
 */

static  int __pyx_f_4lxml_5etree__register_xpath_function(void *__pyx_v_ctxt, PyObject *__pyx_v_name_utf, PyObject *__pyx_v_ns_utf) {
  int __pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_register_xpath_function");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":32
 * 
 * cdef int _register_xpath_function(void* ctxt, name_utf, ns_utf):
 *     if ns_utf is None:             # <<<<<<<<<<<<<<
 *         return xpath.xmlXPathRegisterFunc(
 *             <xpath.xmlXPathContext*>ctxt, _cstr(name_utf),
 */
  __pyx_t_1 = (__pyx_v_ns_utf == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":35
 *         return xpath.xmlXPathRegisterFunc(
 *             <xpath.xmlXPathContext*>ctxt, _cstr(name_utf),
 *             _xpath_function_call)             # <<<<<<<<<<<<<<
 *     else:
 *         return xpath.xmlXPathRegisterFuncNS(
 */
    __pyx_r = xmlXPathRegisterFunc(((xmlXPathContext *)__pyx_v_ctxt), PyBytes_AS_STRING(__pyx_v_name_utf), __pyx_f_4lxml_5etree__xpath_function_call);
    goto __pyx_L0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":39
 *         return xpath.xmlXPathRegisterFuncNS(
 *             <xpath.xmlXPathContext*>ctxt, _cstr(name_utf), _cstr(ns_utf),
 *             _xpath_function_call)             # <<<<<<<<<<<<<<
 * 
 * cdef int _unregister_xpath_function(void* ctxt, name_utf, ns_utf):
 */
    __pyx_r = xmlXPathRegisterFuncNS(((xmlXPathContext *)__pyx_v_ctxt), PyBytes_AS_STRING(__pyx_v_name_utf), PyBytes_AS_STRING(__pyx_v_ns_utf), __pyx_f_4lxml_5etree__xpath_function_call);
    goto __pyx_L0;
  }
  __pyx_L3:;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":41
 *             _xpath_function_call)
 * 
 * cdef int _unregister_xpath_function(void* ctxt, name_utf, ns_utf):             # <<<<<<<<<<<<<<
 *     if ns_utf is None:
 *         return xpath.xmlXPathRegisterFunc(
 */

static  int __pyx_f_4lxml_5etree__unregister_xpath_function(void *__pyx_v_ctxt, PyObject *__pyx_v_name_utf, PyObject *__pyx_v_ns_utf) {
  int __pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_unregister_xpath_function");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":42
 * 
 * cdef int _unregister_xpath_function(void* ctxt, name_utf, ns_utf):
 *     if ns_utf is None:             # <<<<<<<<<<<<<<
 *         return xpath.xmlXPathRegisterFunc(
 *             <xpath.xmlXPathContext*>ctxt, _cstr(name_utf), NULL)
 */
  __pyx_t_1 = (__pyx_v_ns_utf == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":44
 *     if ns_utf is None:
 *         return xpath.xmlXPathRegisterFunc(
 *             <xpath.xmlXPathContext*>ctxt, _cstr(name_utf), NULL)             # <<<<<<<<<<<<<<
 *     else:
 *         return xpath.xmlXPathRegisterFuncNS(
 */
    __pyx_r = xmlXPathRegisterFunc(((xmlXPathContext *)__pyx_v_ctxt), PyBytes_AS_STRING(__pyx_v_name_utf), NULL);
    goto __pyx_L0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":47
 *     else:
 *         return xpath.xmlXPathRegisterFuncNS(
 *             <xpath.xmlXPathContext*>ctxt, _cstr(name_utf), _cstr(ns_utf), NULL)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_r = xmlXPathRegisterFuncNS(((xmlXPathContext *)__pyx_v_ctxt), PyBytes_AS_STRING(__pyx_v_name_utf), PyBytes_AS_STRING(__pyx_v_ns_utf), NULL);
    goto __pyx_L0;
  }
  __pyx_L3:;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":52
 * cdef class _XPathContext(_BaseContext):
 *     cdef object _variables
 *     def __init__(self, namespaces, extensions, enable_regexp, variables,             # <<<<<<<<<<<<<<
 *                  build_smart_strings):
 *         self._variables = variables
 */

static int __pyx_pf_4lxml_5etree_13_XPathContext___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_13_XPathContext___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_namespaces = 0;
  PyObject *__pyx_v_extensions = 0;
  PyObject *__pyx_v_enable_regexp = 0;
  PyObject *__pyx_v_variables = 0;
  PyObject *__pyx_v_build_smart_strings = 0;
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__namespaces,&__pyx_n_s__extensions,&__pyx_n_s__enable_regexp,&__pyx_n_s__variables,&__pyx_n_s__build_smart_strings,0};
  __Pyx_RefNannySetupContext("__init__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[5] = {0,0,0,0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__namespaces);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__extensions);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 1); {__pyx_filename = __pyx_f[17]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__enable_regexp);
      if (likely(values[2])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 2); {__pyx_filename = __pyx_f[17]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  3:
      values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__variables);
      if (likely(values[3])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 3); {__pyx_filename = __pyx_f[17]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  4:
      values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__build_smart_strings);
      if (likely(values[4])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 4); {__pyx_filename = __pyx_f[17]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_namespaces = values[0];
    __pyx_v_extensions = values[1];
    __pyx_v_enable_regexp = values[2];
    __pyx_v_variables = values[3];
    __pyx_v_build_smart_strings = values[4];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_namespaces = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_extensions = PyTuple_GET_ITEM(__pyx_args, 1);
    __pyx_v_enable_regexp = PyTuple_GET_ITEM(__pyx_args, 2);
    __pyx_v_variables = PyTuple_GET_ITEM(__pyx_args, 3);
    __pyx_v_build_smart_strings = PyTuple_GET_ITEM(__pyx_args, 4);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[17]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._XPathContext.__init__");
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":54
 *     def __init__(self, namespaces, extensions, enable_regexp, variables,
 *                  build_smart_strings):
 *         self._variables = variables             # <<<<<<<<<<<<<<
 *         _BaseContext.__init__(self, namespaces, extensions, enable_regexp,
 *                               build_smart_strings)
 */
  __Pyx_INCREF(__pyx_v_variables);
  __Pyx_GIVEREF(__pyx_v_variables);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__XPathContext *)__pyx_v_self)->_variables);
  __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree__XPathContext *)__pyx_v_self)->_variables);
  ((struct __pyx_obj_4lxml_5etree__XPathContext *)__pyx_v_self)->_variables = __pyx_v_variables;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":55
 *                  build_smart_strings):
 *         self._variables = variables
 *         _BaseContext.__init__(self, namespaces, extensions, enable_regexp,             # <<<<<<<<<<<<<<
 *                               build_smart_strings)
 * 
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__BaseContext)), __pyx_n_s____init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":56
 *         self._variables = variables
 *         _BaseContext.__init__(self, namespaces, extensions, enable_regexp,
 *                               build_smart_strings)             # <<<<<<<<<<<<<<
 * 
 *     cdef set_context(self, xpath.xmlXPathContext* xpathCtxt):
 */
  __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __Pyx_INCREF(__pyx_v_namespaces);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_namespaces);
  __Pyx_GIVEREF(__pyx_v_namespaces);
  __Pyx_INCREF(__pyx_v_extensions);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_extensions);
  __Pyx_GIVEREF(__pyx_v_extensions);
  __Pyx_INCREF(__pyx_v_enable_regexp);
  PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_enable_regexp);
  __Pyx_GIVEREF(__pyx_v_enable_regexp);
  __Pyx_INCREF(__pyx_v_build_smart_strings);
  PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_v_build_smart_strings);
  __Pyx_GIVEREF(__pyx_v_build_smart_strings);
  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._XPathContext.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":58
 *                               build_smart_strings)
 * 
 *     cdef set_context(self, xpath.xmlXPathContext* xpathCtxt):             # <<<<<<<<<<<<<<
 *         self._set_xpath_context(xpathCtxt)
 *         self._setupDict(xpathCtxt)
 */

static  PyObject *__pyx_f_4lxml_5etree_13_XPathContext_set_context(struct __pyx_obj_4lxml_5etree__XPathContext *__pyx_v_self, xmlXPathContext *__pyx_v_xpathCtxt) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("set_context");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":59
 * 
 *     cdef set_context(self, xpath.xmlXPathContext* xpathCtxt):
 *         self._set_xpath_context(xpathCtxt)             # <<<<<<<<<<<<<<
 *         self._setupDict(xpathCtxt)
 *         self.registerLocalNamespaces()
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__XPathContext *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._set_xpath_context(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self), __pyx_v_xpathCtxt);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":60
 *     cdef set_context(self, xpath.xmlXPathContext* xpathCtxt):
 *         self._set_xpath_context(xpathCtxt)
 *         self._setupDict(xpathCtxt)             # <<<<<<<<<<<<<<
 *         self.registerLocalNamespaces()
 *         self.registerLocalFunctions(xpathCtxt, _register_xpath_function)
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__XPathContext *)__pyx_v_self->__pyx_base.__pyx_vtab)->_setupDict(__pyx_v_self, __pyx_v_xpathCtxt);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":61
 *         self._set_xpath_context(xpathCtxt)
 *         self._setupDict(xpathCtxt)
 *         self.registerLocalNamespaces()             # <<<<<<<<<<<<<<
 *         self.registerLocalFunctions(xpathCtxt, _register_xpath_function)
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__XPathContext *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.registerLocalNamespaces(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":62
 *         self._setupDict(xpathCtxt)
 *         self.registerLocalNamespaces()
 *         self.registerLocalFunctions(xpathCtxt, _register_xpath_function)             # <<<<<<<<<<<<<<
 * 
 *     cdef register_context(self, _Document doc):
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__XPathContext *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.registerLocalFunctions(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self), __pyx_v_xpathCtxt, __pyx_f_4lxml_5etree__register_xpath_function);

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._XPathContext.set_context");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":64
 *         self.registerLocalFunctions(xpathCtxt, _register_xpath_function)
 * 
 *     cdef register_context(self, _Document doc):             # <<<<<<<<<<<<<<
 *         self._register_context(doc)
 *         self.registerGlobalNamespaces()
 */

static  PyObject *__pyx_f_4lxml_5etree_13_XPathContext_register_context(struct __pyx_obj_4lxml_5etree__XPathContext *__pyx_v_self, struct LxmlDocument *__pyx_v_doc) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("register_context");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":65
 * 
 *     cdef register_context(self, _Document doc):
 *         self._register_context(doc)             # <<<<<<<<<<<<<<
 *         self.registerGlobalNamespaces()
 *         self.registerGlobalFunctions(self._xpathCtxt, _register_xpath_function)
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__XPathContext *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._register_context(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self), __pyx_v_doc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":66
 *     cdef register_context(self, _Document doc):
 *         self._register_context(doc)
 *         self.registerGlobalNamespaces()             # <<<<<<<<<<<<<<
 *         self.registerGlobalFunctions(self._xpathCtxt, _register_xpath_function)
 *         self.registerExsltFunctions()
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__XPathContext *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.registerGlobalNamespaces(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":67
 *         self._register_context(doc)
 *         self.registerGlobalNamespaces()
 *         self.registerGlobalFunctions(self._xpathCtxt, _register_xpath_function)             # <<<<<<<<<<<<<<
 *         self.registerExsltFunctions()
 *         if self._variables is not None:
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__XPathContext *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.registerGlobalFunctions(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self), __pyx_v_self->__pyx_base._xpathCtxt, __pyx_f_4lxml_5etree__register_xpath_function);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":68
 *         self.registerGlobalNamespaces()
 *         self.registerGlobalFunctions(self._xpathCtxt, _register_xpath_function)
 *         self.registerExsltFunctions()             # <<<<<<<<<<<<<<
 *         if self._variables is not None:
 *             self.registerVariables(self._variables)
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__XPathContext *)__pyx_v_self->__pyx_base.__pyx_vtab)->registerExsltFunctions(__pyx_v_self);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":69
 *         self.registerGlobalFunctions(self._xpathCtxt, _register_xpath_function)
 *         self.registerExsltFunctions()
 *         if self._variables is not None:             # <<<<<<<<<<<<<<
 *             self.registerVariables(self._variables)
 * 
 */
  __pyx_t_2 = (__pyx_v_self->_variables != Py_None);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":70
 *         self.registerExsltFunctions()
 *         if self._variables is not None:
 *             self.registerVariables(self._variables)             # <<<<<<<<<<<<<<
 * 
 *     cdef unregister_context(self):
 */
    __pyx_t_1 = __pyx_v_self->_variables;
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree__XPathContext *)__pyx_v_self->__pyx_base.__pyx_vtab)->registerVariables(__pyx_v_self, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._XPathContext.register_context");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":72
 *             self.registerVariables(self._variables)
 * 
 *     cdef unregister_context(self):             # <<<<<<<<<<<<<<
 *         self.unregisterGlobalFunctions(
 *             self._xpathCtxt, _unregister_xpath_function)
 */

static  PyObject *__pyx_f_4lxml_5etree_13_XPathContext_unregister_context(struct __pyx_obj_4lxml_5etree__XPathContext *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("unregister_context");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":74
 *     cdef unregister_context(self):
 *         self.unregisterGlobalFunctions(
 *             self._xpathCtxt, _unregister_xpath_function)             # <<<<<<<<<<<<<<
 *         self.unregisterGlobalNamespaces()
 *         xpath.xmlXPathRegisteredVariablesCleanup(self._xpathCtxt)
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__XPathContext *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.unregisterGlobalFunctions(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self), __pyx_v_self->__pyx_base._xpathCtxt, __pyx_f_4lxml_5etree__unregister_xpath_function); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":75
 *         self.unregisterGlobalFunctions(
 *             self._xpathCtxt, _unregister_xpath_function)
 *         self.unregisterGlobalNamespaces()             # <<<<<<<<<<<<<<
 *         xpath.xmlXPathRegisteredVariablesCleanup(self._xpathCtxt)
 *         self._cleanup_context()
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__XPathContext *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.unregisterGlobalNamespaces(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":76
 *             self._xpathCtxt, _unregister_xpath_function)
 *         self.unregisterGlobalNamespaces()
 *         xpath.xmlXPathRegisteredVariablesCleanup(self._xpathCtxt)             # <<<<<<<<<<<<<<
 *         self._cleanup_context()
 * 
 */
  xmlXPathRegisteredVariablesCleanup(__pyx_v_self->__pyx_base._xpathCtxt);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":77
 *         self.unregisterGlobalNamespaces()
 *         xpath.xmlXPathRegisteredVariablesCleanup(self._xpathCtxt)
 *         self._cleanup_context()             # <<<<<<<<<<<<<<
 * 
 *     cdef void registerExsltFunctions(self):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__XPathContext *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._cleanup_context(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._XPathContext.unregister_context");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":79
 *         self._cleanup_context()
 * 
 *     cdef void registerExsltFunctions(self):             # <<<<<<<<<<<<<<
 *         cdef xpath.xmlXPathContext* ctxt = self._xpathCtxt
 *         cdef int i
 */

static  void __pyx_f_4lxml_5etree_13_XPathContext_registerExsltFunctions(struct __pyx_obj_4lxml_5etree__XPathContext *__pyx_v_self) {
  xmlXPathContext *__pyx_v_ctxt;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("registerExsltFunctions");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":80
 * 
 *     cdef void registerExsltFunctions(self):
 *         cdef xpath.xmlXPathContext* ctxt = self._xpathCtxt             # <<<<<<<<<<<<<<
 *         cdef int i
 *         cdef char* c_href
 */
  __pyx_v_ctxt = __pyx_v_self->__pyx_base._xpathCtxt;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":83
 *         cdef int i
 *         cdef char* c_href
 *         if xslt.LIBXSLT_VERSION < 10125:             # <<<<<<<<<<<<<<
 *             # we'd only execute dummy functions anyway
 *             return
 */
  __pyx_t_1 = (LIBXSLT_VERSION < 10125);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":85
 *         if xslt.LIBXSLT_VERSION < 10125:
 *             # we'd only execute dummy functions anyway
 *             return             # <<<<<<<<<<<<<<
 *         tree.xmlHashScan(
 *             self._xpathCtxt.nsHash, _registerExsltFunctionsForNamespaces,
 */
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":88
 *         tree.xmlHashScan(
 *             self._xpathCtxt.nsHash, _registerExsltFunctionsForNamespaces,
 *             self._xpathCtxt)             # <<<<<<<<<<<<<<
 * 
 *     cdef registerVariables(self, variable_dict):
 */
  xmlHashScan(__pyx_v_self->__pyx_base._xpathCtxt->nsHash, __pyx_f_4lxml_5etree__registerExsltFunctionsForNamespaces, __pyx_v_self->__pyx_base._xpathCtxt);

  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":90
 *             self._xpathCtxt)
 * 
 *     cdef registerVariables(self, variable_dict):             # <<<<<<<<<<<<<<
 *         for name, value in variable_dict.items():
 *             name_utf = self._to_utf(name)
 */

static  PyObject *__pyx_f_4lxml_5etree_13_XPathContext_registerVariables(struct __pyx_obj_4lxml_5etree__XPathContext *__pyx_v_self, PyObject *__pyx_v_variable_dict) {
  PyObject *__pyx_v_name;
  PyObject *__pyx_v_value;
  PyObject *__pyx_v_name_utf;
  PyObject *__pyx_r = NULL;
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  xmlXPathObject *__pyx_t_7;
  __Pyx_RefNannySetupContext("registerVariables");
  __pyx_v_name = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_value = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_name_utf = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":91
 * 
 *     cdef registerVariables(self, variable_dict):
 *         for name, value in variable_dict.items():             # <<<<<<<<<<<<<<
 *             name_utf = self._to_utf(name)
 *             xpath.xmlXPathRegisterVariable(
 */
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_variable_dict, __pyx_n_s__items); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) {
    __pyx_t_1 = 0; __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2);
  } else {
    __pyx_t_1 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  for (;;) {
    if (likely(PyList_CheckExact(__pyx_t_2))) {
      if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++;
    } else if (likely(PyTuple_CheckExact(__pyx_t_2))) {
      if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++;
    } else {
      __pyx_t_3 = PyIter_Next(__pyx_t_2);
      if (!__pyx_t_3) {
        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    if (PyTuple_CheckExact(__pyx_t_3) && likely(PyTuple_GET_SIZE(__pyx_t_3) == 2)) {
      PyObject* tuple = __pyx_t_3;
      __pyx_t_4 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_4);
      __pyx_t_5 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_v_name);
      __pyx_v_name = __pyx_t_4;
      __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_v_value);
      __pyx_v_value = __pyx_t_5;
      __pyx_t_5 = 0;
    } else {
      __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_4 = __Pyx_UnpackItem(__pyx_t_6, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_UnpackItem(__pyx_t_6, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_EndUnpack(__pyx_t_6, 2) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_v_name);
      __pyx_v_name = __pyx_t_4;
      __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_v_value);
      __pyx_v_value = __pyx_t_5;
      __pyx_t_5 = 0;
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":92
 *     cdef registerVariables(self, variable_dict):
 *         for name, value in variable_dict.items():
 *             name_utf = self._to_utf(name)             # <<<<<<<<<<<<<<
 *             xpath.xmlXPathRegisterVariable(
 *                 self._xpathCtxt, _cstr(name_utf), _wrapXPathObject(value, None, None))
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree__XPathContext *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._to_utf(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self), __pyx_v_name); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_v_name_utf);
    __pyx_v_name_utf = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":94
 *             name_utf = self._to_utf(name)
 *             xpath.xmlXPathRegisterVariable(
 *                 self._xpathCtxt, _cstr(name_utf), _wrapXPathObject(value, None, None))             # <<<<<<<<<<<<<<
 * 
 *     cdef registerVariable(self, name, value):
 */
    __pyx_t_7 = __pyx_f_4lxml_5etree__wrapXPathObject(__pyx_v_value, ((struct LxmlDocument *)Py_None), ((struct __pyx_obj_4lxml_5etree__BaseContext *)Py_None)); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    xmlXPathRegisterVariable(__pyx_v_self->__pyx_base._xpathCtxt, PyBytes_AS_STRING(__pyx_v_name_utf), __pyx_t_7);
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._XPathContext.registerVariables");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_name);
  __Pyx_DECREF(__pyx_v_value);
  __Pyx_DECREF(__pyx_v_name_utf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":96
 *                 self._xpathCtxt, _cstr(name_utf), _wrapXPathObject(value, None, None))
 * 
 *     cdef registerVariable(self, name, value):             # <<<<<<<<<<<<<<
 *         name_utf = self._to_utf(name)
 *         xpath.xmlXPathRegisterVariable(
 */

static  PyObject *__pyx_f_4lxml_5etree_13_XPathContext_registerVariable(struct __pyx_obj_4lxml_5etree__XPathContext *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value) {
  PyObject *__pyx_v_name_utf;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  xmlXPathObject *__pyx_t_2;
  __Pyx_RefNannySetupContext("registerVariable");
  __pyx_v_name_utf = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":97
 * 
 *     cdef registerVariable(self, name, value):
 *         name_utf = self._to_utf(name)             # <<<<<<<<<<<<<<
 *         xpath.xmlXPathRegisterVariable(
 *             self._xpathCtxt, _cstr(name_utf), _wrapXPathObject(value, None, None))
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__XPathContext *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._to_utf(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self), __pyx_v_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_v_name_utf);
  __pyx_v_name_utf = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":99
 *         name_utf = self._to_utf(name)
 *         xpath.xmlXPathRegisterVariable(
 *             self._xpathCtxt, _cstr(name_utf), _wrapXPathObject(value, None, None))             # <<<<<<<<<<<<<<
 * 
 *     cdef void _registerVariable(self, name_utf, value):
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__wrapXPathObject(__pyx_v_value, ((struct LxmlDocument *)Py_None), ((struct __pyx_obj_4lxml_5etree__BaseContext *)Py_None)); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  xmlXPathRegisterVariable(__pyx_v_self->__pyx_base._xpathCtxt, PyBytes_AS_STRING(__pyx_v_name_utf), __pyx_t_2);

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._XPathContext.registerVariable");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_name_utf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":101
 *             self._xpathCtxt, _cstr(name_utf), _wrapXPathObject(value, None, None))
 * 
 *     cdef void _registerVariable(self, name_utf, value):             # <<<<<<<<<<<<<<
 *         xpath.xmlXPathRegisterVariable(
 *             self._xpathCtxt, _cstr(name_utf), _wrapXPathObject(value, None, None))
 */

static  void __pyx_f_4lxml_5etree_13_XPathContext__registerVariable(struct __pyx_obj_4lxml_5etree__XPathContext *__pyx_v_self, PyObject *__pyx_v_name_utf, PyObject *__pyx_v_value) {
  xmlXPathObject *__pyx_t_1;
  __Pyx_RefNannySetupContext("_registerVariable");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":103
 *     cdef void _registerVariable(self, name_utf, value):
 *         xpath.xmlXPathRegisterVariable(
 *             self._xpathCtxt, _cstr(name_utf), _wrapXPathObject(value, None, None))             # <<<<<<<<<<<<<<
 * 
 *     cdef void _setupDict(self, xpath.xmlXPathContext* xpathCtxt):
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__wrapXPathObject(__pyx_v_value, ((struct LxmlDocument *)Py_None), ((struct __pyx_obj_4lxml_5etree__BaseContext *)Py_None)); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  xmlXPathRegisterVariable(__pyx_v_self->__pyx_base._xpathCtxt, PyBytes_AS_STRING(__pyx_v_name_utf), __pyx_t_1);

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("lxml.etree._XPathContext._registerVariable");
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":105
 *             self._xpathCtxt, _cstr(name_utf), _wrapXPathObject(value, None, None))
 * 
 *     cdef void _setupDict(self, xpath.xmlXPathContext* xpathCtxt):             # <<<<<<<<<<<<<<
 *         __GLOBAL_PARSER_CONTEXT.initXPathParserDict(xpathCtxt)
 * 
 */

static  void __pyx_f_4lxml_5etree_13_XPathContext__setupDict(struct __pyx_obj_4lxml_5etree__XPathContext *__pyx_v_self, xmlXPathContext *__pyx_v_xpathCtxt) {
  __Pyx_RefNannySetupContext("_setupDict");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":106
 * 
 *     cdef void _setupDict(self, xpath.xmlXPathContext* xpathCtxt):
 *         __GLOBAL_PARSER_CONTEXT.initXPathParserDict(xpathCtxt)             # <<<<<<<<<<<<<<
 * 
 * cdef void _registerExsltFunctionsForNamespaces(
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext *)__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT->__pyx_vtab)->initXPathParserDict(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, __pyx_v_xpathCtxt);

  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":108
 *         __GLOBAL_PARSER_CONTEXT.initXPathParserDict(xpathCtxt)
 * 
 * cdef void _registerExsltFunctionsForNamespaces(             # <<<<<<<<<<<<<<
 *         void* _c_href, void* _ctxt, char* c_prefix):
 *     cdef char* c_href = <char*> _c_href
 */

static  void __pyx_f_4lxml_5etree__registerExsltFunctionsForNamespaces(void *__pyx_v__c_href, void *__pyx_v__ctxt, char *__pyx_v_c_prefix) {
  char *__pyx_v_c_href;
  xmlXPathContext *__pyx_v_ctxt;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_registerExsltFunctionsForNamespaces");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":110
 * cdef void _registerExsltFunctionsForNamespaces(
 *         void* _c_href, void* _ctxt, char* c_prefix):
 *     cdef char* c_href = <char*> _c_href             # <<<<<<<<<<<<<<
 *     cdef xpath.xmlXPathContext* ctxt = <xpath.xmlXPathContext*> _ctxt
 * 
 */
  __pyx_v_c_href = ((char *)__pyx_v__c_href);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":111
 *         void* _c_href, void* _ctxt, char* c_prefix):
 *     cdef char* c_href = <char*> _c_href
 *     cdef xpath.xmlXPathContext* ctxt = <xpath.xmlXPathContext*> _ctxt             # <<<<<<<<<<<<<<
 * 
 *     if cstd.strcmp(c_href, xslt.EXSLT_DATE_NAMESPACE) == 0:
 */
  __pyx_v_ctxt = ((xmlXPathContext *)__pyx_v__ctxt);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":113
 *     cdef xpath.xmlXPathContext* ctxt = <xpath.xmlXPathContext*> _ctxt
 * 
 *     if cstd.strcmp(c_href, xslt.EXSLT_DATE_NAMESPACE) == 0:             # <<<<<<<<<<<<<<
 *         xslt.exsltDateXpathCtxtRegister(ctxt, c_prefix)
 *     elif cstd.strcmp(c_href, xslt.EXSLT_SETS_NAMESPACE) == 0:
 */
  __pyx_t_1 = (strcmp(__pyx_v_c_href, EXSLT_DATE_NAMESPACE) == 0);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":114
 * 
 *     if cstd.strcmp(c_href, xslt.EXSLT_DATE_NAMESPACE) == 0:
 *         xslt.exsltDateXpathCtxtRegister(ctxt, c_prefix)             # <<<<<<<<<<<<<<
 *     elif cstd.strcmp(c_href, xslt.EXSLT_SETS_NAMESPACE) == 0:
 *         xslt.exsltSetsXpathCtxtRegister(ctxt, c_prefix)
 */
    exsltDateXpathCtxtRegister(__pyx_v_ctxt, __pyx_v_c_prefix);
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":115
 *     if cstd.strcmp(c_href, xslt.EXSLT_DATE_NAMESPACE) == 0:
 *         xslt.exsltDateXpathCtxtRegister(ctxt, c_prefix)
 *     elif cstd.strcmp(c_href, xslt.EXSLT_SETS_NAMESPACE) == 0:             # <<<<<<<<<<<<<<
 *         xslt.exsltSetsXpathCtxtRegister(ctxt, c_prefix)
 *     elif cstd.strcmp(c_href, xslt.EXSLT_MATH_NAMESPACE) == 0:
 */
  __pyx_t_1 = (strcmp(__pyx_v_c_href, EXSLT_SETS_NAMESPACE) == 0);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":116
 *         xslt.exsltDateXpathCtxtRegister(ctxt, c_prefix)
 *     elif cstd.strcmp(c_href, xslt.EXSLT_SETS_NAMESPACE) == 0:
 *         xslt.exsltSetsXpathCtxtRegister(ctxt, c_prefix)             # <<<<<<<<<<<<<<
 *     elif cstd.strcmp(c_href, xslt.EXSLT_MATH_NAMESPACE) == 0:
 *         xslt.exsltMathXpathCtxtRegister(ctxt, c_prefix)
 */
    exsltSetsXpathCtxtRegister(__pyx_v_ctxt, __pyx_v_c_prefix);
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":117
 *     elif cstd.strcmp(c_href, xslt.EXSLT_SETS_NAMESPACE) == 0:
 *         xslt.exsltSetsXpathCtxtRegister(ctxt, c_prefix)
 *     elif cstd.strcmp(c_href, xslt.EXSLT_MATH_NAMESPACE) == 0:             # <<<<<<<<<<<<<<
 *         xslt.exsltMathXpathCtxtRegister(ctxt, c_prefix)
 *     elif cstd.strcmp(c_href, xslt.EXSLT_STRINGS_NAMESPACE) == 0:
 */
  __pyx_t_1 = (strcmp(__pyx_v_c_href, EXSLT_MATH_NAMESPACE) == 0);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":118
 *         xslt.exsltSetsXpathCtxtRegister(ctxt, c_prefix)
 *     elif cstd.strcmp(c_href, xslt.EXSLT_MATH_NAMESPACE) == 0:
 *         xslt.exsltMathXpathCtxtRegister(ctxt, c_prefix)             # <<<<<<<<<<<<<<
 *     elif cstd.strcmp(c_href, xslt.EXSLT_STRINGS_NAMESPACE) == 0:
 *         xslt.exsltStrXpathCtxtRegister(ctxt, c_prefix)
 */
    exsltMathXpathCtxtRegister(__pyx_v_ctxt, __pyx_v_c_prefix);
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":119
 *     elif cstd.strcmp(c_href, xslt.EXSLT_MATH_NAMESPACE) == 0:
 *         xslt.exsltMathXpathCtxtRegister(ctxt, c_prefix)
 *     elif cstd.strcmp(c_href, xslt.EXSLT_STRINGS_NAMESPACE) == 0:             # <<<<<<<<<<<<<<
 *         xslt.exsltStrXpathCtxtRegister(ctxt, c_prefix)
 * 
 */
  __pyx_t_1 = (strcmp(__pyx_v_c_href, EXSLT_STRINGS_NAMESPACE) == 0);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":120
 *         xslt.exsltMathXpathCtxtRegister(ctxt, c_prefix)
 *     elif cstd.strcmp(c_href, xslt.EXSLT_STRINGS_NAMESPACE) == 0:
 *         xslt.exsltStrXpathCtxtRegister(ctxt, c_prefix)             # <<<<<<<<<<<<<<
 * 
 * cdef bint _XPATH_VERSION_WARNING_REQUIRED
 */
    exsltStrXpathCtxtRegister(__pyx_v_ctxt, __pyx_v_c_prefix);
    goto __pyx_L3;
  }
  __pyx_L3:;

  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":133
 *     cdef python.PyThread_type_lock _eval_lock
 *     cdef _ErrorLog _error_log
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._xpathCtxt = NULL
 *         if config.ENABLE_THREADING:
 */

static int __pyx_pf_4lxml_5etree_19_XPathEvaluatorBase___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_19_XPathEvaluatorBase___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__cinit__");
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":134
 *     cdef _ErrorLog _error_log
 *     def __cinit__(self):
 *         self._xpathCtxt = NULL             # <<<<<<<<<<<<<<
 *         if config.ENABLE_THREADING:
 *             self._eval_lock = python.PyThread_allocate_lock()
 */
  ((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self)->_xpathCtxt = NULL;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":135
 *     def __cinit__(self):
 *         self._xpathCtxt = NULL
 *         if config.ENABLE_THREADING:             # <<<<<<<<<<<<<<
 *             self._eval_lock = python.PyThread_allocate_lock()
 *             if self._eval_lock is NULL:
 */
  if (ENABLE_THREADING) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":136
 *         self._xpathCtxt = NULL
 *         if config.ENABLE_THREADING:
 *             self._eval_lock = python.PyThread_allocate_lock()             # <<<<<<<<<<<<<<
 *             if self._eval_lock is NULL:
 *                 python.PyErr_NoMemory()
 */
    ((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self)->_eval_lock = PyThread_allocate_lock();

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":137
 *         if config.ENABLE_THREADING:
 *             self._eval_lock = python.PyThread_allocate_lock()
 *             if self._eval_lock is NULL:             # <<<<<<<<<<<<<<
 *                 python.PyErr_NoMemory()
 *         self._error_log = _ErrorLog()
 */
    __pyx_t_1 = (((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self)->_eval_lock == NULL);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":138
 *             self._eval_lock = python.PyThread_allocate_lock()
 *             if self._eval_lock is NULL:
 *                 python.PyErr_NoMemory()             # <<<<<<<<<<<<<<
 *         self._error_log = _ErrorLog()
 * 
 */
      __pyx_t_2 = PyErr_NoMemory(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L6;
    }
    __pyx_L6:;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":139
 *             if self._eval_lock is NULL:
 *                 python.PyErr_NoMemory()
 *         self._error_log = _ErrorLog()             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, namespaces, extensions, enable_regexp,
 */
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ErrorLog)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self)->_error_log);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self)->_error_log));
  ((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self)->_error_log = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_t_2);
  __pyx_t_2 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._XPathEvaluatorBase.__cinit__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":141
 *         self._error_log = _ErrorLog()
 * 
 *     def __init__(self, namespaces, extensions, enable_regexp,             # <<<<<<<<<<<<<<
 *                  smart_strings):
 *         global _XPATH_VERSION_WARNING_REQUIRED
 */

static int __pyx_pf_4lxml_5etree_19_XPathEvaluatorBase_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_19_XPathEvaluatorBase_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_namespaces = 0;
  PyObject *__pyx_v_extensions = 0;
  PyObject *__pyx_v_enable_regexp = 0;
  PyObject *__pyx_v_smart_strings = 0;
  PyObject *__pyx_v_warnings;
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__namespaces,&__pyx_n_s__extensions,&__pyx_n_s__enable_regexp,&__pyx_n_s__smart_strings,0};
  __Pyx_RefNannySetupContext("__init__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[4] = {0,0,0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__namespaces);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__extensions);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 1); {__pyx_filename = __pyx_f[17]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__enable_regexp);
      if (likely(values[2])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 2); {__pyx_filename = __pyx_f[17]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  3:
      values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__smart_strings);
      if (likely(values[3])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 3); {__pyx_filename = __pyx_f[17]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_namespaces = values[0];
    __pyx_v_extensions = values[1];
    __pyx_v_enable_regexp = values[2];
    __pyx_v_smart_strings = values[3];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_namespaces = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_extensions = PyTuple_GET_ITEM(__pyx_args, 1);
    __pyx_v_enable_regexp = PyTuple_GET_ITEM(__pyx_args, 2);
    __pyx_v_smart_strings = PyTuple_GET_ITEM(__pyx_args, 3);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[17]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._XPathEvaluatorBase.__init__");
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_warnings = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":144
 *                  smart_strings):
 *         global _XPATH_VERSION_WARNING_REQUIRED
 *         if _XPATH_VERSION_WARNING_REQUIRED:             # <<<<<<<<<<<<<<
 *             _XPATH_VERSION_WARNING_REQUIRED = 0
 *             import warnings
 */
  if (__pyx_v_4lxml_5etree__XPATH_VERSION_WARNING_REQUIRED) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":145
 *         global _XPATH_VERSION_WARNING_REQUIRED
 *         if _XPATH_VERSION_WARNING_REQUIRED:
 *             _XPATH_VERSION_WARNING_REQUIRED = 0             # <<<<<<<<<<<<<<
 *             import warnings
 *             warnings.warn(u"This version of libxml2 has a known XPath bug. "
 */
    __pyx_v_4lxml_5etree__XPATH_VERSION_WARNING_REQUIRED = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":146
 *         if _XPATH_VERSION_WARNING_REQUIRED:
 *             _XPATH_VERSION_WARNING_REQUIRED = 0
 *             import warnings             # <<<<<<<<<<<<<<
 *             warnings.warn(u"This version of libxml2 has a known XPath bug. "
 *                           u"Use it at your own risk.")
 */
    __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__warnings), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_v_warnings);
    __pyx_v_warnings = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":147
 *             _XPATH_VERSION_WARNING_REQUIRED = 0
 *             import warnings
 *             warnings.warn(u"This version of libxml2 has a known XPath bug. "             # <<<<<<<<<<<<<<
 *                           u"Use it at your own risk.")
 *         self._context = _XPathContext(namespaces, extensions,
 */
    __pyx_t_1 = PyObject_GetAttr(__pyx_v_warnings, __pyx_n_s__warn); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_330), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":151
 *         self._context = _XPathContext(namespaces, extensions,
 *                                       enable_regexp, None,
 *                                       smart_strings)             # <<<<<<<<<<<<<<
 * 
 *     property error_log:
 */
  __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(__pyx_v_namespaces);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_namespaces);
  __Pyx_GIVEREF(__pyx_v_namespaces);
  __Pyx_INCREF(__pyx_v_extensions);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_extensions);
  __Pyx_GIVEREF(__pyx_v_extensions);
  __Pyx_INCREF(__pyx_v_enable_regexp);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_enable_regexp);
  __Pyx_GIVEREF(__pyx_v_enable_regexp);
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_2, 3, Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_INCREF(__pyx_v_smart_strings);
  PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_v_smart_strings);
  __Pyx_GIVEREF(__pyx_v_smart_strings);
  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__XPathContext)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":149
 *             warnings.warn(u"This version of libxml2 has a known XPath bug. "
 *                           u"Use it at your own risk.")
 *         self._context = _XPathContext(namespaces, extensions,             # <<<<<<<<<<<<<<
 *                                       enable_regexp, None,
 *                                       smart_strings)
 */
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self)->_context);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self)->_context));
  ((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self)->_context = ((struct __pyx_obj_4lxml_5etree__XPathContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._XPathEvaluatorBase.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_warnings);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":154
 * 
 *     property error_log:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             assert self._error_log is not None, "XPath evaluator not initialised"
 *             return self._error_log.copy()
 */

static PyObject *__pyx_pf_4lxml_5etree_19_XPathEvaluatorBase_9error_log___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_19_XPathEvaluatorBase_9error_log___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__get__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":155
 *     property error_log:
 *         def __get__(self):
 *             assert self._error_log is not None, "XPath evaluator not initialised"             # <<<<<<<<<<<<<<
 *             return self._error_log.copy()
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  __pyx_t_1 = (((PyObject *)((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self)->_error_log) != Py_None);
  if (unlikely(!__pyx_t_1)) {
    PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_293));
    {__pyx_filename = __pyx_f[17]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":156
 *         def __get__(self):
 *             assert self._error_log is not None, "XPath evaluator not initialised"
 *             return self._error_log.copy()             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self)->_error_log), __pyx_n_s__copy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._XPathEvaluatorBase.error_log.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":158
 *             return self._error_log.copy()
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._xpathCtxt is not NULL:
 *             xpath.xmlXPathFreeContext(self._xpathCtxt)
 */

static void __pyx_pf_4lxml_5etree_19_XPathEvaluatorBase_2__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pf_4lxml_5etree_19_XPathEvaluatorBase_2__dealloc__(PyObject *__pyx_v_self) {
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__dealloc__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":159
 * 
 *     def __dealloc__(self):
 *         if self._xpathCtxt is not NULL:             # <<<<<<<<<<<<<<
 *             xpath.xmlXPathFreeContext(self._xpathCtxt)
 *         if config.ENABLE_THREADING:
 */
  __pyx_t_1 = (((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self)->_xpathCtxt != NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":160
 *     def __dealloc__(self):
 *         if self._xpathCtxt is not NULL:
 *             xpath.xmlXPathFreeContext(self._xpathCtxt)             # <<<<<<<<<<<<<<
 *         if config.ENABLE_THREADING:
 *             if self._eval_lock is not NULL:
 */
    xmlXPathFreeContext(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self)->_xpathCtxt);
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":161
 *         if self._xpathCtxt is not NULL:
 *             xpath.xmlXPathFreeContext(self._xpathCtxt)
 *         if config.ENABLE_THREADING:             # <<<<<<<<<<<<<<
 *             if self._eval_lock is not NULL:
 *                 python.PyThread_free_lock(self._eval_lock)
 */
  if (ENABLE_THREADING) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":162
 *             xpath.xmlXPathFreeContext(self._xpathCtxt)
 *         if config.ENABLE_THREADING:
 *             if self._eval_lock is not NULL:             # <<<<<<<<<<<<<<
 *                 python.PyThread_free_lock(self._eval_lock)
 * 
 */
    __pyx_t_1 = (((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self)->_eval_lock != NULL);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":163
 *         if config.ENABLE_THREADING:
 *             if self._eval_lock is not NULL:
 *                 python.PyThread_free_lock(self._eval_lock)             # <<<<<<<<<<<<<<
 * 
 *     cdef set_context(self, xpath.xmlXPathContext* xpathCtxt):
 */
      PyThread_free_lock(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self)->_eval_lock);
      goto __pyx_L7;
    }
    __pyx_L7:;
    goto __pyx_L6;
  }
  __pyx_L6:;

  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":165
 *                 python.PyThread_free_lock(self._eval_lock)
 * 
 *     cdef set_context(self, xpath.xmlXPathContext* xpathCtxt):             # <<<<<<<<<<<<<<
 *         self._xpathCtxt = xpathCtxt
 *         self._context.set_context(xpathCtxt)
 */

static  PyObject *__pyx_f_4lxml_5etree_19_XPathEvaluatorBase_set_context(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *__pyx_v_self, xmlXPathContext *__pyx_v_xpathCtxt) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("set_context");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":166
 * 
 *     cdef set_context(self, xpath.xmlXPathContext* xpathCtxt):
 *         self._xpathCtxt = xpathCtxt             # <<<<<<<<<<<<<<
 *         self._context.set_context(xpathCtxt)
 * 
 */
  __pyx_v_self->_xpathCtxt = __pyx_v_xpathCtxt;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":167
 *     cdef set_context(self, xpath.xmlXPathContext* xpathCtxt):
 *         self._xpathCtxt = xpathCtxt
 *         self._context.set_context(xpathCtxt)             # <<<<<<<<<<<<<<
 * 
 *     def evaluate(self, _eval_arg, **_variables):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__XPathContext *)__pyx_v_self->_context->__pyx_base.__pyx_vtab)->set_context(__pyx_v_self->_context, __pyx_v_xpathCtxt); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._XPathEvaluatorBase.set_context");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":169
 *         self._context.set_context(xpathCtxt)
 * 
 *     def evaluate(self, _eval_arg, **_variables):             # <<<<<<<<<<<<<<
 *         u"""evaluate(self, _eval_arg, **_variables)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_19_XPathEvaluatorBase_3evaluate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_19_XPathEvaluatorBase_3evaluate[] = "evaluate(self, _eval_arg, **_variables)\n\n        Evaluate an XPath expression.\n\n        Instead of calling this method, you can also call the evaluator object\n        itself.\n\n        Variables may be provided as keyword arguments.  Note that namespaces\n        are currently not supported for variables.\n\n        :deprecated: call the object, not its method.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_19_XPathEvaluatorBase_3evaluate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v__eval_arg = 0;
  PyObject *__pyx_v__variables = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s___eval_arg,0};
  __Pyx_RefNannySetupContext("evaluate");
  __pyx_v__variables = PyDict_New(); if (unlikely(!__pyx_v__variables)) return NULL;
  __Pyx_GOTREF(__pyx_v__variables);
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[1] = {0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s___eval_arg);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v__variables, values, PyTuple_GET_SIZE(__pyx_args), "evaluate") < 0)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v__eval_arg = values[0];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v__eval_arg = PyTuple_GET_ITEM(__pyx_args, 0);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("evaluate", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[17]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v__variables);
  __Pyx_AddTraceback("lxml.etree._XPathEvaluatorBase.evaluate");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":182
 *         :deprecated: call the object, not its method.
 *         """
 *         return self(_eval_arg, **_variables)             # <<<<<<<<<<<<<<
 * 
 *     cdef bint _checkAbsolutePath(self, char* path):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v__eval_arg);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__eval_arg);
  __Pyx_GIVEREF(__pyx_v__eval_arg);
  __pyx_t_2 = PyEval_CallObjectWithKeywords(__pyx_v_self, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_v__variables)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._XPathEvaluatorBase.evaluate");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v__variables);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":184
 *         return self(_eval_arg, **_variables)
 * 
 *     cdef bint _checkAbsolutePath(self, char* path):             # <<<<<<<<<<<<<<
 *         cdef char c
 *         if path is NULL:
 */

static  int __pyx_f_4lxml_5etree_19_XPathEvaluatorBase__checkAbsolutePath(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *__pyx_v_self, char *__pyx_v_path) {
  char __pyx_v_c;
  int __pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_checkAbsolutePath");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":186
 *     cdef bint _checkAbsolutePath(self, char* path):
 *         cdef char c
 *         if path is NULL:             # <<<<<<<<<<<<<<
 *             return 0
 *         c = path[0]
 */
  __pyx_t_1 = (__pyx_v_path == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":187
 *         cdef char c
 *         if path is NULL:
 *             return 0             # <<<<<<<<<<<<<<
 *         c = path[0]
 *         while c == c' ' or c == c'\t':
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":188
 *         if path is NULL:
 *             return 0
 *         c = path[0]             # <<<<<<<<<<<<<<
 *         while c == c' ' or c == c'\t':
 *             path = path + 1
 */
  __pyx_v_c = (__pyx_v_path[0]);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":189
 *             return 0
 *         c = path[0]
 *         while c == c' ' or c == c'\t':             # <<<<<<<<<<<<<<
 *             path = path + 1
 *             c = path[0]
 */
  while (1) {
    switch (__pyx_v_c) {
      case ' ':
      case '\t':
      __pyx_t_1 = 1;
      break;
      default:
      __pyx_t_1 = 0;
      break;
    }
    if (!__pyx_t_1) break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":190
 *         c = path[0]
 *         while c == c' ' or c == c'\t':
 *             path = path + 1             # <<<<<<<<<<<<<<
 *             c = path[0]
 *         return c == c'/'
 */
    __pyx_v_path = (__pyx_v_path + 1);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":191
 *         while c == c' ' or c == c'\t':
 *             path = path + 1
 *             c = path[0]             # <<<<<<<<<<<<<<
 *         return c == c'/'
 * 
 */
    __pyx_v_c = (__pyx_v_path[0]);
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":192
 *             path = path + 1
 *             c = path[0]
 *         return c == c'/'             # <<<<<<<<<<<<<<
 * 
 *     cdef int _lock(self) except -1:
 */
  __pyx_r = (__pyx_v_c == '/');
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":194
 *         return c == c'/'
 * 
 *     cdef int _lock(self) except -1:             # <<<<<<<<<<<<<<
 *         cdef int result
 *         if config.ENABLE_THREADING and self._eval_lock != NULL:
 */

static  int __pyx_f_4lxml_5etree_19_XPathEvaluatorBase__lock(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *__pyx_v_self) {
  int __pyx_v_result;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("_lock");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":196
 *     cdef int _lock(self) except -1:
 *         cdef int result
 *         if config.ENABLE_THREADING and self._eval_lock != NULL:             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 result = python.PyThread_acquire_lock(
 */
  if (ENABLE_THREADING) {
    __pyx_t_1 = (__pyx_v_self->_eval_lock != NULL);
    __pyx_t_2 = __pyx_t_1;
  } else {
    __pyx_t_2 = ENABLE_THREADING;
  }
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":197
 *         cdef int result
 *         if config.ENABLE_THREADING and self._eval_lock != NULL:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 result = python.PyThread_acquire_lock(
 *                     self._eval_lock, python.WAIT_LOCK)
 */
    {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      #endif
      Py_UNBLOCK_THREADS
      /*try:*/ {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":199
 *             with nogil:
 *                 result = python.PyThread_acquire_lock(
 *                     self._eval_lock, python.WAIT_LOCK)             # <<<<<<<<<<<<<<
 *             if result == 0:
 *                 raise XPathError, u"XPath evaluator locking failed"
 */
        __pyx_v_result = PyThread_acquire_lock(__pyx_v_self->_eval_lock, WAIT_LOCK);
      }

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":197
 *         cdef int result
 *         if config.ENABLE_THREADING and self._eval_lock != NULL:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 result = python.PyThread_acquire_lock(
 *                     self._eval_lock, python.WAIT_LOCK)
 */
      /*finally:*/ {
        Py_BLOCK_THREADS
      }
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":200
 *                 result = python.PyThread_acquire_lock(
 *                     self._eval_lock, python.WAIT_LOCK)
 *             if result == 0:             # <<<<<<<<<<<<<<
 *                 raise XPathError, u"XPath evaluator locking failed"
 *         return 0
 */
    __pyx_t_2 = (__pyx_v_result == 0);
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":201
 *                     self._eval_lock, python.WAIT_LOCK)
 *             if result == 0:
 *                 raise XPathError, u"XPath evaluator locking failed"             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
      __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__XPathError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_Raise(__pyx_t_3, ((PyObject *)__pyx_kp_u_331), 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      {__pyx_filename = __pyx_f[17]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L7;
    }
    __pyx_L7:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":202
 *             if result == 0:
 *                 raise XPathError, u"XPath evaluator locking failed"
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cdef void _unlock(self):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._XPathEvaluatorBase._lock");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":204
 *         return 0
 * 
 *     cdef void _unlock(self):             # <<<<<<<<<<<<<<
 *         if config.ENABLE_THREADING and self._eval_lock != NULL:
 *             python.PyThread_release_lock(self._eval_lock)
 */

static  void __pyx_f_4lxml_5etree_19_XPathEvaluatorBase__unlock(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *__pyx_v_self) {
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("_unlock");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":205
 * 
 *     cdef void _unlock(self):
 *         if config.ENABLE_THREADING and self._eval_lock != NULL:             # <<<<<<<<<<<<<<
 *             python.PyThread_release_lock(self._eval_lock)
 * 
 */
  if (ENABLE_THREADING) {
    __pyx_t_1 = (__pyx_v_self->_eval_lock != NULL);
    __pyx_t_2 = __pyx_t_1;
  } else {
    __pyx_t_2 = ENABLE_THREADING;
  }
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":206
 *     cdef void _unlock(self):
 *         if config.ENABLE_THREADING and self._eval_lock != NULL:
 *             python.PyThread_release_lock(self._eval_lock)             # <<<<<<<<<<<<<<
 * 
 *     cdef _raise_parse_error(self):
 */
    PyThread_release_lock(__pyx_v_self->_eval_lock);
    goto __pyx_L3;
  }
  __pyx_L3:;

  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":208
 *             python.PyThread_release_lock(self._eval_lock)
 * 
 *     cdef _raise_parse_error(self):             # <<<<<<<<<<<<<<
 *         cdef _BaseErrorLog entries
 *         entries = self._error_log.filter_types(_XPATH_SYNTAX_ERRORS)
 */

static  PyObject *__pyx_f_4lxml_5etree_19_XPathEvaluatorBase__raise_parse_error(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_entries;
  PyObject *__pyx_v_message;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("_raise_parse_error");
  __pyx_v_entries = ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_message = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":210
 *     cdef _raise_parse_error(self):
 *         cdef _BaseErrorLog entries
 *         entries = self._error_log.filter_types(_XPATH_SYNTAX_ERRORS)             # <<<<<<<<<<<<<<
 *         if entries:
 *             message = entries._buildExceptionMessage(None)
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self->_error_log), __pyx_n_s__filter_types); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(__pyx_v_4lxml_5etree__XPATH_SYNTAX_ERRORS);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_4lxml_5etree__XPATH_SYNTAX_ERRORS);
  __Pyx_GIVEREF(__pyx_v_4lxml_5etree__XPATH_SYNTAX_ERRORS);
  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_4lxml_5etree__BaseErrorLog))))) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_v_entries));
  __pyx_v_entries = ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":211
 *         cdef _BaseErrorLog entries
 *         entries = self._error_log.filter_types(_XPATH_SYNTAX_ERRORS)
 *         if entries:             # <<<<<<<<<<<<<<
 *             message = entries._buildExceptionMessage(None)
 *             if message is not None:
 */
  __pyx_t_4 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_entries)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_4) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":212
 *         entries = self._error_log.filter_types(_XPATH_SYNTAX_ERRORS)
 *         if entries:
 *             message = entries._buildExceptionMessage(None)             # <<<<<<<<<<<<<<
 *             if message is not None:
 *                 raise XPathSyntaxError(message, self._error_log)
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseErrorLog *)__pyx_v_entries->__pyx_vtab)->_buildExceptionMessage(__pyx_v_entries, Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_v_message);
    __pyx_v_message = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":213
 *         if entries:
 *             message = entries._buildExceptionMessage(None)
 *             if message is not None:             # <<<<<<<<<<<<<<
 *                 raise XPathSyntaxError(message, self._error_log)
 *         raise XPathSyntaxError(self._error_log._buildExceptionMessage(
 */
    __pyx_t_4 = (__pyx_v_message != Py_None);
    if (__pyx_t_4) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":214
 *             message = entries._buildExceptionMessage(None)
 *             if message is not None:
 *                 raise XPathSyntaxError(message, self._error_log)             # <<<<<<<<<<<<<<
 *         raise XPathSyntaxError(self._error_log._buildExceptionMessage(
 *                 u"Error in xpath expression"),
 */
      __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__XPathSyntaxError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __Pyx_INCREF(__pyx_v_message);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_message);
      __Pyx_GIVEREF(__pyx_v_message);
      __Pyx_INCREF(((PyObject *)__pyx_v_self->_error_log));
      PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self->_error_log));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_self->_error_log));
      __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      __Pyx_Raise(__pyx_t_1, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      {__pyx_filename = __pyx_f[17]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":215
 *             if message is not None:
 *                 raise XPathSyntaxError(message, self._error_log)
 *         raise XPathSyntaxError(self._error_log._buildExceptionMessage(             # <<<<<<<<<<<<<<
 *                 u"Error in xpath expression"),
 *                                self._error_log)
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__XPathSyntaxError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)__pyx_v_self->_error_log->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._buildExceptionMessage(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self->_error_log), ((PyObject *)__pyx_kp_u_332)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":217
 *         raise XPathSyntaxError(self._error_log._buildExceptionMessage(
 *                 u"Error in xpath expression"),
 *                                self._error_log)             # <<<<<<<<<<<<<<
 * 
 *     cdef _raise_eval_error(self):
 */
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_error_log));
  PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_self->_error_log));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->_error_log));
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_Raise(__pyx_t_2, 0, 0);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  {__pyx_filename = __pyx_f[17]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._XPathEvaluatorBase._raise_parse_error");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_entries);
  __Pyx_DECREF(__pyx_v_message);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":219
 *                                self._error_log)
 * 
 *     cdef _raise_eval_error(self):             # <<<<<<<<<<<<<<
 *         cdef _BaseErrorLog entries
 *         entries = self._error_log.filter_types(_XPATH_EVAL_ERRORS)
 */

static  PyObject *__pyx_f_4lxml_5etree_19_XPathEvaluatorBase__raise_eval_error(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_entries;
  PyObject *__pyx_v_message;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("_raise_eval_error");
  __pyx_v_entries = ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_message = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":221
 *     cdef _raise_eval_error(self):
 *         cdef _BaseErrorLog entries
 *         entries = self._error_log.filter_types(_XPATH_EVAL_ERRORS)             # <<<<<<<<<<<<<<
 *         if not entries:
 *             entries = self._error_log.filter_types(_XPATH_SYNTAX_ERRORS)
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self->_error_log), __pyx_n_s__filter_types); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(__pyx_v_4lxml_5etree__XPATH_EVAL_ERRORS);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_4lxml_5etree__XPATH_EVAL_ERRORS);
  __Pyx_GIVEREF(__pyx_v_4lxml_5etree__XPATH_EVAL_ERRORS);
  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_4lxml_5etree__BaseErrorLog))))) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_v_entries));
  __pyx_v_entries = ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":222
 *         cdef _BaseErrorLog entries
 *         entries = self._error_log.filter_types(_XPATH_EVAL_ERRORS)
 *         if not entries:             # <<<<<<<<<<<<<<
 *             entries = self._error_log.filter_types(_XPATH_SYNTAX_ERRORS)
 *         if entries:
 */
  __pyx_t_4 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_entries)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = (!__pyx_t_4);
  if (__pyx_t_5) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":223
 *         entries = self._error_log.filter_types(_XPATH_EVAL_ERRORS)
 *         if not entries:
 *             entries = self._error_log.filter_types(_XPATH_SYNTAX_ERRORS)             # <<<<<<<<<<<<<<
 *         if entries:
 *             message = entries._buildExceptionMessage(None)
 */
    __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_self->_error_log), __pyx_n_s__filter_types); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __Pyx_INCREF(__pyx_v_4lxml_5etree__XPATH_SYNTAX_ERRORS);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_4lxml_5etree__XPATH_SYNTAX_ERRORS);
    __Pyx_GIVEREF(__pyx_v_4lxml_5etree__XPATH_SYNTAX_ERRORS);
    __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__BaseErrorLog))))) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_v_entries));
    __pyx_v_entries = ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":224
 *         if not entries:
 *             entries = self._error_log.filter_types(_XPATH_SYNTAX_ERRORS)
 *         if entries:             # <<<<<<<<<<<<<<
 *             message = entries._buildExceptionMessage(None)
 *             if message is not None:
 */
  __pyx_t_5 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_entries)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_5) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":225
 *             entries = self._error_log.filter_types(_XPATH_SYNTAX_ERRORS)
 *         if entries:
 *             message = entries._buildExceptionMessage(None)             # <<<<<<<<<<<<<<
 *             if message is not None:
 *                 raise XPathEvalError(message, self._error_log)
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseErrorLog *)__pyx_v_entries->__pyx_vtab)->_buildExceptionMessage(__pyx_v_entries, Py_None); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_v_message);
    __pyx_v_message = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":226
 *         if entries:
 *             message = entries._buildExceptionMessage(None)
 *             if message is not None:             # <<<<<<<<<<<<<<
 *                 raise XPathEvalError(message, self._error_log)
 *         raise XPathEvalError(self._error_log._buildExceptionMessage(
 */
    __pyx_t_5 = (__pyx_v_message != Py_None);
    if (__pyx_t_5) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":227
 *             message = entries._buildExceptionMessage(None)
 *             if message is not None:
 *                 raise XPathEvalError(message, self._error_log)             # <<<<<<<<<<<<<<
 *         raise XPathEvalError(self._error_log._buildExceptionMessage(
 *                 u"Error in xpath expression"),
 */
      __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__XPathEvalError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __Pyx_INCREF(__pyx_v_message);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_message);
      __Pyx_GIVEREF(__pyx_v_message);
      __Pyx_INCREF(((PyObject *)__pyx_v_self->_error_log));
      PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self->_error_log));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_self->_error_log));
      __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      __Pyx_Raise(__pyx_t_3, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      {__pyx_filename = __pyx_f[17]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L5;
    }
    __pyx_L5:;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":228
 *             if message is not None:
 *                 raise XPathEvalError(message, self._error_log)
 *         raise XPathEvalError(self._error_log._buildExceptionMessage(             # <<<<<<<<<<<<<<
 *                 u"Error in xpath expression"),
 *                              self._error_log)
 */
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__XPathEvalError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)__pyx_v_self->_error_log->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._buildExceptionMessage(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self->_error_log), ((PyObject *)__pyx_kp_u_332)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":230
 *         raise XPathEvalError(self._error_log._buildExceptionMessage(
 *                 u"Error in xpath expression"),
 *                              self._error_log)             # <<<<<<<<<<<<<<
 * 
 *     cdef object _handle_result(self, xpath.xmlXPathObject* xpathObj, _Document doc):
 */
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_error_log));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self->_error_log));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->_error_log));
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_Raise(__pyx_t_2, 0, 0);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  {__pyx_filename = __pyx_f[17]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._XPathEvaluatorBase._raise_eval_error");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_entries);
  __Pyx_DECREF(__pyx_v_message);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":232
 *                              self._error_log)
 * 
 *     cdef object _handle_result(self, xpath.xmlXPathObject* xpathObj, _Document doc):             # <<<<<<<<<<<<<<
 *         if self._context._exc._has_raised():
 *             if xpathObj is not NULL:
 */

static  PyObject *__pyx_f_4lxml_5etree_19_XPathEvaluatorBase__handle_result(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *__pyx_v_self, xmlXPathObject *__pyx_v_xpathObj, struct LxmlDocument *__pyx_v_doc) {
  PyObject *__pyx_v_result;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("_handle_result");
  __pyx_v_result = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":233
 * 
 *     cdef object _handle_result(self, xpath.xmlXPathObject* xpathObj, _Document doc):
 *         if self._context._exc._has_raised():             # <<<<<<<<<<<<<<
 *             if xpathObj is not NULL:
 *                 _freeXPathObject(xpathObj)
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext *)__pyx_v_self->_context->__pyx_base._exc->__pyx_vtab)->_has_raised(__pyx_v_self->_context->__pyx_base._exc);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":234
 *     cdef object _handle_result(self, xpath.xmlXPathObject* xpathObj, _Document doc):
 *         if self._context._exc._has_raised():
 *             if xpathObj is not NULL:             # <<<<<<<<<<<<<<
 *                 _freeXPathObject(xpathObj)
 *                 xpathObj = NULL
 */
    __pyx_t_1 = (__pyx_v_xpathObj != NULL);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":235
 *         if self._context._exc._has_raised():
 *             if xpathObj is not NULL:
 *                 _freeXPathObject(xpathObj)             # <<<<<<<<<<<<<<
 *                 xpathObj = NULL
 *             self._context._release_temp_refs()
 */
      __pyx_f_4lxml_5etree__freeXPathObject(__pyx_v_xpathObj);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":236
 *             if xpathObj is not NULL:
 *                 _freeXPathObject(xpathObj)
 *                 xpathObj = NULL             # <<<<<<<<<<<<<<
 *             self._context._release_temp_refs()
 *             self._context._exc._raise_if_stored()
 */
      __pyx_v_xpathObj = NULL;
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":237
 *                 _freeXPathObject(xpathObj)
 *                 xpathObj = NULL
 *             self._context._release_temp_refs()             # <<<<<<<<<<<<<<
 *             self._context._exc._raise_if_stored()
 * 
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__XPathContext *)__pyx_v_self->_context->__pyx_base.__pyx_vtab)->__pyx_base._release_temp_refs(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self->_context)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":238
 *                 xpathObj = NULL
 *             self._context._release_temp_refs()
 *             self._context._exc._raise_if_stored()             # <<<<<<<<<<<<<<
 * 
 *         if xpathObj is NULL:
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext *)__pyx_v_self->_context->__pyx_base._exc->__pyx_vtab)->_raise_if_stored(__pyx_v_self->_context->__pyx_base._exc); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":240
 *             self._context._exc._raise_if_stored()
 * 
 *         if xpathObj is NULL:             # <<<<<<<<<<<<<<
 *             self._context._release_temp_refs()
 *             self._raise_eval_error()
 */
  __pyx_t_1 = (__pyx_v_xpathObj == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":241
 * 
 *         if xpathObj is NULL:
 *             self._context._release_temp_refs()             # <<<<<<<<<<<<<<
 *             self._raise_eval_error()
 * 
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__XPathContext *)__pyx_v_self->_context->__pyx_base.__pyx_vtab)->__pyx_base._release_temp_refs(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self->_context)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":242
 *         if xpathObj is NULL:
 *             self._context._release_temp_refs()
 *             self._raise_eval_error()             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self->__pyx_vtab)->_raise_eval_error(__pyx_v_self); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":244
 *             self._raise_eval_error()
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             result = _unwrapXPathObject(xpathObj, doc, self._context)
 *         finally:
 */
  /*try:*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":245
 * 
 *         try:
 *             result = _unwrapXPathObject(xpathObj, doc, self._context)             # <<<<<<<<<<<<<<
 *         finally:
 *             _freeXPathObject(xpathObj)
 */
    __pyx_t_2 = ((PyObject *)__pyx_v_self->_context);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_4 = __pyx_f_4lxml_5etree__unwrapXPathObject(__pyx_v_xpathObj, __pyx_v_doc, ((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_t_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_v_result);
    __pyx_v_result = __pyx_t_4;
    __pyx_t_4 = 0;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":247
 *             result = _unwrapXPathObject(xpathObj, doc, self._context)
 *         finally:
 *             _freeXPathObject(xpathObj)             # <<<<<<<<<<<<<<
 *             self._context._release_temp_refs()
 * 
 */
  /*finally:*/ {
    int __pyx_why;
    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
    int __pyx_exc_lineno;
    __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 0; goto __pyx_L8;
    __pyx_L7: {
      __pyx_why = 4;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
      __pyx_exc_lineno = __pyx_lineno;
      goto __pyx_L8;
    }
    __pyx_L8:;
    __pyx_f_4lxml_5etree__freeXPathObject(__pyx_v_xpathObj);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":248
 *         finally:
 *             _freeXPathObject(xpathObj)
 *             self._context._release_temp_refs()             # <<<<<<<<<<<<<<
 * 
 *         return result
 */
    __pyx_t_4 = ((struct __pyx_vtabstruct_4lxml_5etree__XPathContext *)__pyx_v_self->_context->__pyx_base.__pyx_vtab)->__pyx_base._release_temp_refs(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self->_context)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L10;
    __pyx_L9_error:;
    if (__pyx_why == 4) {
      Py_XDECREF(__pyx_exc_type);
      Py_XDECREF(__pyx_exc_value);
      Py_XDECREF(__pyx_exc_tb);
    }
    goto __pyx_L1_error;
    __pyx_L10:;
    switch (__pyx_why) {
      case 4: {
        __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
        __pyx_lineno = __pyx_exc_lineno;
        __pyx_exc_type = 0;
        __pyx_exc_value = 0;
        __pyx_exc_tb = 0;
        goto __pyx_L1_error;
      }
    }
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":250
 *             self._context._release_temp_refs()
 * 
 *         return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._XPathEvaluatorBase._handle_result");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":267
 *     """
 *     cdef _Element _element
 *     def __init__(self, _Element element not None, *, namespaces=None,             # <<<<<<<<<<<<<<
 *                  extensions=None, regexp=True, smart_strings=True):
 *         cdef xpath.xmlXPathContext* xpathCtxt
 */

static int __pyx_pf_4lxml_5etree_21XPathElementEvaluator___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_21XPathElementEvaluator___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct LxmlElement *__pyx_v_element = 0;
  PyObject *__pyx_v_namespaces = 0;
  PyObject *__pyx_v_extensions = 0;
  PyObject *__pyx_v_regexp = 0;
  PyObject *__pyx_v_smart_strings = 0;
  xmlXPathContext *__pyx_v_xpathCtxt;
  struct LxmlDocument *__pyx_v_doc;
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__element,&__pyx_n_s__namespaces,&__pyx_n_s__extensions,&__pyx_n_s__regexp,&__pyx_n_s__smart_strings,0};
  __Pyx_RefNannySetupContext("__init__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[5] = {0,0,0,0,0};
    values[1] = ((PyObject *)Py_None);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":268
 *     cdef _Element _element
 *     def __init__(self, _Element element not None, *, namespaces=None,
 *                  extensions=None, regexp=True, smart_strings=True):             # <<<<<<<<<<<<<<
 *         cdef xpath.xmlXPathContext* xpathCtxt
 *         cdef int ns_register_status
 */
    values[2] = ((PyObject *)Py_None);
    values[3] = __pyx_k_333;
    values[4] = __pyx_k_334;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__element);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
    }
    while (kw_args > 0) {
      PyObject* value;
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__namespaces);
      if (value) { values[1] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__extensions);
      if (value) { values[2] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__regexp);
      if (value) { values[3] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__smart_strings);
      if (value) { values[4] = value; if (!(--kw_args)) break; }
      break;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_element = ((struct LxmlElement *)values[0]);
    __pyx_v_namespaces = values[1];
    __pyx_v_extensions = values[2];
    __pyx_v_regexp = values[3];
    __pyx_v_smart_strings = values[4];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_element = ((struct LxmlElement *)PyTuple_GET_ITEM(__pyx_args, 0));

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":267
 *     """
 *     cdef _Element _element
 *     def __init__(self, _Element element not None, *, namespaces=None,             # <<<<<<<<<<<<<<
 *                  extensions=None, regexp=True, smart_strings=True):
 *         cdef xpath.xmlXPathContext* xpathCtxt
 */
    __pyx_v_namespaces = ((PyObject *)Py_None);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":268
 *     cdef _Element _element
 *     def __init__(self, _Element element not None, *, namespaces=None,
 *                  extensions=None, regexp=True, smart_strings=True):             # <<<<<<<<<<<<<<
 *         cdef xpath.xmlXPathContext* xpathCtxt
 *         cdef int ns_register_status
 */
    __pyx_v_extensions = ((PyObject *)Py_None);
    __pyx_v_regexp = __pyx_k_333;
    __pyx_v_smart_strings = __pyx_k_334;
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[17]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.XPathElementEvaluator.__init__");
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_doc = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_element), __pyx_ptype_4lxml_5etree__Element, 0, "element", 0))) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":272
 *         cdef int ns_register_status
 *         cdef _Document doc
 *         _assertValidNode(element)             # <<<<<<<<<<<<<<
 *         _assertValidDoc(element._doc)
 *         self._element = element
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":273
 *         cdef _Document doc
 *         _assertValidNode(element)
 *         _assertValidDoc(element._doc)             # <<<<<<<<<<<<<<
 *         self._element = element
 *         doc = element._doc
 */
  __pyx_t_2 = ((PyObject *)__pyx_v_element->_doc);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDoc(((struct LxmlDocument *)__pyx_t_2)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":274
 *         _assertValidNode(element)
 *         _assertValidDoc(element._doc)
 *         self._element = element             # <<<<<<<<<<<<<<
 *         doc = element._doc
 *         _XPathEvaluatorBase.__init__(self, namespaces, extensions,
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_element));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_element));
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *)__pyx_v_self)->_element);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *)__pyx_v_self)->_element));
  ((struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *)__pyx_v_self)->_element = __pyx_v_element;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":275
 *         _assertValidDoc(element._doc)
 *         self._element = element
 *         doc = element._doc             # <<<<<<<<<<<<<<
 *         _XPathEvaluatorBase.__init__(self, namespaces, extensions,
 *                                      regexp, smart_strings)
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_element->_doc));
  __Pyx_DECREF(((PyObject *)__pyx_v_doc));
  __pyx_v_doc = __pyx_v_element->_doc;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":276
 *         self._element = element
 *         doc = element._doc
 *         _XPathEvaluatorBase.__init__(self, namespaces, extensions,             # <<<<<<<<<<<<<<
 *                                      regexp, smart_strings)
 *         xpathCtxt = xpath.xmlXPathNewContext(doc._c_doc)
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__XPathEvaluatorBase)), __pyx_n_s____init__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":277
 *         doc = element._doc
 *         _XPathEvaluatorBase.__init__(self, namespaces, extensions,
 *                                      regexp, smart_strings)             # <<<<<<<<<<<<<<
 *         xpathCtxt = xpath.xmlXPathNewContext(doc._c_doc)
 *         if xpathCtxt is NULL:
 */
  __pyx_t_3 = PyTuple_New(5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __Pyx_INCREF(__pyx_v_namespaces);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_namespaces);
  __Pyx_GIVEREF(__pyx_v_namespaces);
  __Pyx_INCREF(__pyx_v_extensions);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_extensions);
  __Pyx_GIVEREF(__pyx_v_extensions);
  __Pyx_INCREF(__pyx_v_regexp);
  PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_v_regexp);
  __Pyx_GIVEREF(__pyx_v_regexp);
  __Pyx_INCREF(__pyx_v_smart_strings);
  PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_v_smart_strings);
  __Pyx_GIVEREF(__pyx_v_smart_strings);
  __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":278
 *         _XPathEvaluatorBase.__init__(self, namespaces, extensions,
 *                                      regexp, smart_strings)
 *         xpathCtxt = xpath.xmlXPathNewContext(doc._c_doc)             # <<<<<<<<<<<<<<
 *         if xpathCtxt is NULL:
 *             python.PyErr_NoMemory()
 */
  __pyx_v_xpathCtxt = xmlXPathNewContext(__pyx_v_doc->_c_doc);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":279
 *                                      regexp, smart_strings)
 *         xpathCtxt = xpath.xmlXPathNewContext(doc._c_doc)
 *         if xpathCtxt is NULL:             # <<<<<<<<<<<<<<
 *             python.PyErr_NoMemory()
 *         self.set_context(xpathCtxt)
 */
  __pyx_t_5 = (__pyx_v_xpathCtxt == NULL);
  if (__pyx_t_5) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":280
 *         xpathCtxt = xpath.xmlXPathNewContext(doc._c_doc)
 *         if xpathCtxt is NULL:
 *             python.PyErr_NoMemory()             # <<<<<<<<<<<<<<
 *         self.set_context(xpathCtxt)
 * 
 */
    __pyx_t_4 = PyErr_NoMemory(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":281
 *         if xpathCtxt is NULL:
 *             python.PyErr_NoMemory()
 *         self.set_context(xpathCtxt)             # <<<<<<<<<<<<<<
 * 
 *     def register_namespace(self, prefix, uri):
 */
  __pyx_t_4 = ((struct __pyx_vtabstruct_4lxml_5etree_XPathElementEvaluator *)((struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.set_context(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self), __pyx_v_xpathCtxt); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.XPathElementEvaluator.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_doc);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":283
 *         self.set_context(xpathCtxt)
 * 
 *     def register_namespace(self, prefix, uri):             # <<<<<<<<<<<<<<
 *         u"""Register a namespace with the XPath context.
 *         """
 */

static PyObject *__pyx_pf_4lxml_5etree_21XPathElementEvaluator_1register_namespace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_21XPathElementEvaluator_1register_namespace[] = "Register a namespace with the XPath context.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_21XPathElementEvaluator_1register_namespace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_prefix = 0;
  PyObject *__pyx_v_uri = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__prefix,&__pyx_n_s__uri,0};
  __Pyx_RefNannySetupContext("register_namespace");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__prefix);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__uri);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("register_namespace", 1, 2, 2, 1); {__pyx_filename = __pyx_f[17]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "register_namespace") < 0)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_prefix = values[0];
    __pyx_v_uri = values[1];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_prefix = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_uri = PyTuple_GET_ITEM(__pyx_args, 1);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("register_namespace", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[17]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.XPathElementEvaluator.register_namespace");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":286
 *         u"""Register a namespace with the XPath context.
 *         """
 *         assert self._xpathCtxt is not NULL, "XPath context not initialised"             # <<<<<<<<<<<<<<
 *         self._context.addNamespace(prefix, uri)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!(((struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *)__pyx_v_self)->__pyx_base._xpathCtxt != NULL))) {
    PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_335));
    {__pyx_filename = __pyx_f[17]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":287
 *         """
 *         assert self._xpathCtxt is not NULL, "XPath context not initialised"
 *         self._context.addNamespace(prefix, uri)             # <<<<<<<<<<<<<<
 * 
 *     def register_namespaces(self, namespaces):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__XPathContext *)((struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *)__pyx_v_self)->__pyx_base._context->__pyx_base.__pyx_vtab)->__pyx_base.addNamespace(((struct __pyx_obj_4lxml_5etree__BaseContext *)((struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *)__pyx_v_self)->__pyx_base._context), __pyx_v_prefix, __pyx_v_uri); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.XPathElementEvaluator.register_namespace");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":289
 *         self._context.addNamespace(prefix, uri)
 * 
 *     def register_namespaces(self, namespaces):             # <<<<<<<<<<<<<<
 *         u"""Register a prefix -> uri dict.
 *         """
 */

static PyObject *__pyx_pf_4lxml_5etree_21XPathElementEvaluator_2register_namespaces(PyObject *__pyx_v_self, PyObject *__pyx_v_namespaces); /*proto*/
static char __pyx_doc_4lxml_5etree_21XPathElementEvaluator_2register_namespaces[] = "Register a prefix -> uri dict.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_21XPathElementEvaluator_2register_namespaces(PyObject *__pyx_v_self, PyObject *__pyx_v_namespaces) {
  PyObject *__pyx_v_prefix;
  PyObject *__pyx_v_uri;
  PyObject *__pyx_r = NULL;
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("register_namespaces");
  __pyx_v_prefix = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_uri = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":292
 *         u"""Register a prefix -> uri dict.
 *         """
 *         assert self._xpathCtxt is not NULL, "XPath context not initialised"             # <<<<<<<<<<<<<<
 *         for prefix, uri in namespaces.items():
 *             self._context.addNamespace(prefix, uri)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!(((struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *)__pyx_v_self)->__pyx_base._xpathCtxt != NULL))) {
    PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_335));
    {__pyx_filename = __pyx_f[17]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":293
 *         """
 *         assert self._xpathCtxt is not NULL, "XPath context not initialised"
 *         for prefix, uri in namespaces.items():             # <<<<<<<<<<<<<<
 *             self._context.addNamespace(prefix, uri)
 * 
 */
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_namespaces, __pyx_n_s__items); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) {
    __pyx_t_1 = 0; __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2);
  } else {
    __pyx_t_1 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  for (;;) {
    if (likely(PyList_CheckExact(__pyx_t_2))) {
      if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++;
    } else if (likely(PyTuple_CheckExact(__pyx_t_2))) {
      if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++;
    } else {
      __pyx_t_3 = PyIter_Next(__pyx_t_2);
      if (!__pyx_t_3) {
        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    if (PyTuple_CheckExact(__pyx_t_3) && likely(PyTuple_GET_SIZE(__pyx_t_3) == 2)) {
      PyObject* tuple = __pyx_t_3;
      __pyx_t_4 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_4);
      __pyx_t_5 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_v_prefix);
      __pyx_v_prefix = __pyx_t_4;
      __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_v_uri);
      __pyx_v_uri = __pyx_t_5;
      __pyx_t_5 = 0;
    } else {
      __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_4 = __Pyx_UnpackItem(__pyx_t_6, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_UnpackItem(__pyx_t_6, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_EndUnpack(__pyx_t_6, 2) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_v_prefix);
      __pyx_v_prefix = __pyx_t_4;
      __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_v_uri);
      __pyx_v_uri = __pyx_t_5;
      __pyx_t_5 = 0;
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":294
 *         assert self._xpathCtxt is not NULL, "XPath context not initialised"
 *         for prefix, uri in namespaces.items():
 *             self._context.addNamespace(prefix, uri)             # <<<<<<<<<<<<<<
 * 
 *     def __call__(self, _path, **_variables):
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree__XPathContext *)((struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *)__pyx_v_self)->__pyx_base._context->__pyx_base.__pyx_vtab)->__pyx_base.addNamespace(((struct __pyx_obj_4lxml_5etree__BaseContext *)((struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *)__pyx_v_self)->__pyx_base._context), __pyx_v_prefix, __pyx_v_uri); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree.XPathElementEvaluator.register_namespaces");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_prefix);
  __Pyx_DECREF(__pyx_v_uri);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":296
 *             self._context.addNamespace(prefix, uri)
 * 
 *     def __call__(self, _path, **_variables):             # <<<<<<<<<<<<<<
 *         u"""__call__(self, _path, **_variables)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_21XPathElementEvaluator_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_21XPathElementEvaluator_3__call__[] = "__call__(self, _path, **_variables)\n\n        Evaluate an XPath expression on the document.\n\n        Variables may be provided as keyword arguments.  Note that namespaces\n        are currently not supported for variables.\n\n        Absolute XPath expressions (starting with '/') will be evaluated\n        against the ElementTree as returned by getroottree().\n        ";
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_21XPathElementEvaluator_3__call__;
static PyObject *__pyx_pf_4lxml_5etree_21XPathElementEvaluator_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v__path = 0;
  PyObject *__pyx_v__variables = 0;
  xmlXPathObject *__pyx_v_xpathObj;
  struct LxmlDocument *__pyx_v_doc;
  char *__pyx_v_c_path;
  PyObject *__pyx_v_path;
  PyObject *__pyx_v_result;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s___path,0};
  __Pyx_RefNannySetupContext("__call__");
  __pyx_v__variables = PyDict_New(); if (unlikely(!__pyx_v__variables)) return NULL;
  __Pyx_GOTREF(__pyx_v__variables);
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[1] = {0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s___path);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v__variables, values, PyTuple_GET_SIZE(__pyx_args), "__call__") < 0)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v__path = values[0];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v__path = PyTuple_GET_ITEM(__pyx_args, 0);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[17]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v__variables);
  __Pyx_AddTraceback("lxml.etree.XPathElementEvaluator.__call__");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_doc = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_path = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_result = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":310
 *         cdef _Document doc
 *         cdef char* c_path
 *         assert self._xpathCtxt is not NULL, "XPath context not initialised"             # <<<<<<<<<<<<<<
 *         path = _utf8(_path)
 *         doc = self._element._doc
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!(((struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *)__pyx_v_self)->__pyx_base._xpathCtxt != NULL))) {
    PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_335));
    {__pyx_filename = __pyx_f[17]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":311
 *         cdef char* c_path
 *         assert self._xpathCtxt is not NULL, "XPath context not initialised"
 *         path = _utf8(_path)             # <<<<<<<<<<<<<<
 *         doc = self._element._doc
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_v__path)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_path));
  __pyx_v_path = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":312
 *         assert self._xpathCtxt is not NULL, "XPath context not initialised"
 *         path = _utf8(_path)
 *         doc = self._element._doc             # <<<<<<<<<<<<<<
 * 
 *         self._lock()
 */
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *)__pyx_v_self)->_element->_doc));
  __Pyx_DECREF(((PyObject *)__pyx_v_doc));
  __pyx_v_doc = ((struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *)__pyx_v_self)->_element->_doc;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":314
 *         doc = self._element._doc
 * 
 *         self._lock()             # <<<<<<<<<<<<<<
 *         self._error_log.connect()
 *         self._xpathCtxt.node = self._element._c_node
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree_XPathElementEvaluator *)((struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base._lock(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":315
 * 
 *         self._lock()
 *         self._error_log.connect()             # <<<<<<<<<<<<<<
 *         self._xpathCtxt.node = self._element._c_node
 *         try:
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)((struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *)__pyx_v_self)->__pyx_base._error_log->__pyx_base.__pyx_base.__pyx_vtab)->connect(((struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *)__pyx_v_self)->__pyx_base._error_log);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":316
 *         self._lock()
 *         self._error_log.connect()
 *         self._xpathCtxt.node = self._element._c_node             # <<<<<<<<<<<<<<
 *         try:
 *             self._context.register_context(doc)
 */
  ((struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *)__pyx_v_self)->__pyx_base._xpathCtxt->node = ((struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *)__pyx_v_self)->_element->_c_node;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":317
 *         self._error_log.connect()
 *         self._xpathCtxt.node = self._element._c_node
 *         try:             # <<<<<<<<<<<<<<
 *             self._context.register_context(doc)
 *             self._context.registerVariables(_variables)
 */
  /*try:*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":318
 *         self._xpathCtxt.node = self._element._c_node
 *         try:
 *             self._context.register_context(doc)             # <<<<<<<<<<<<<<
 *             self._context.registerVariables(_variables)
 *             c_path = _cstr(path)
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__XPathContext *)((struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *)__pyx_v_self)->__pyx_base._context->__pyx_base.__pyx_vtab)->register_context(((struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *)__pyx_v_self)->__pyx_base._context, __pyx_v_doc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":319
 *         try:
 *             self._context.register_context(doc)
 *             self._context.registerVariables(_variables)             # <<<<<<<<<<<<<<
 *             c_path = _cstr(path)
 *             with nogil:
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__XPathContext *)((struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *)__pyx_v_self)->__pyx_base._context->__pyx_base.__pyx_vtab)->registerVariables(((struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *)__pyx_v_self)->__pyx_base._context, ((PyObject *)__pyx_v__variables)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":320
 *             self._context.register_context(doc)
 *             self._context.registerVariables(_variables)
 *             c_path = _cstr(path)             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 xpathObj = xpath.xmlXPathEvalExpression(
 */
    __pyx_v_c_path = PyBytes_AS_STRING(((PyObject *)__pyx_v_path));

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":321
 *             self._context.registerVariables(_variables)
 *             c_path = _cstr(path)
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 xpathObj = xpath.xmlXPathEvalExpression(
 *                     c_path, self._xpathCtxt)
 */
    {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      #endif
      Py_UNBLOCK_THREADS
      /*try:*/ {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":323
 *             with nogil:
 *                 xpathObj = xpath.xmlXPathEvalExpression(
 *                     c_path, self._xpathCtxt)             # <<<<<<<<<<<<<<
 *             result = self._handle_result(xpathObj, doc)
 *         finally:
 */
        __pyx_v_xpathObj = xmlXPathEvalExpression(__pyx_v_c_path, ((struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *)__pyx_v_self)->__pyx_base._xpathCtxt);
      }

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":321
 *             self._context.registerVariables(_variables)
 *             c_path = _cstr(path)
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 xpathObj = xpath.xmlXPathEvalExpression(
 *                     c_path, self._xpathCtxt)
 */
      /*finally:*/ {
        Py_BLOCK_THREADS
      }
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":324
 *                 xpathObj = xpath.xmlXPathEvalExpression(
 *                     c_path, self._xpathCtxt)
 *             result = self._handle_result(xpathObj, doc)             # <<<<<<<<<<<<<<
 *         finally:
 *             self._error_log.disconnect()
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree_XPathElementEvaluator *)((struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base._handle_result(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self), __pyx_v_xpathObj, __pyx_v_doc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_v_result);
    __pyx_v_result = __pyx_t_1;
    __pyx_t_1 = 0;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":326
 *             result = self._handle_result(xpathObj, doc)
 *         finally:
 *             self._error_log.disconnect()             # <<<<<<<<<<<<<<
 *             self._context.unregister_context()
 *             self._unlock()
 */
  /*finally:*/ {
    int __pyx_why;
    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
    int __pyx_exc_lineno;
    __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 0; goto __pyx_L8;
    __pyx_L7: {
      __pyx_why = 4;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
      __pyx_exc_lineno = __pyx_lineno;
      goto __pyx_L8;
    }
    __pyx_L8:;
    ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)((struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *)__pyx_v_self)->__pyx_base._error_log->__pyx_base.__pyx_base.__pyx_vtab)->disconnect(((struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *)__pyx_v_self)->__pyx_base._error_log);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":327
 *         finally:
 *             self._error_log.disconnect()
 *             self._context.unregister_context()             # <<<<<<<<<<<<<<
 *             self._unlock()
 * 
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__XPathContext *)((struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *)__pyx_v_self)->__pyx_base._context->__pyx_base.__pyx_vtab)->unregister_context(((struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *)__pyx_v_self)->__pyx_base._context); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":328
 *             self._error_log.disconnect()
 *             self._context.unregister_context()
 *             self._unlock()             # <<<<<<<<<<<<<<
 * 
 *         return result
 */
    ((struct __pyx_vtabstruct_4lxml_5etree_XPathElementEvaluator *)((struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base._unlock(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self));
    goto __pyx_L13;
    __pyx_L12_error:;
    if (__pyx_why == 4) {
      Py_XDECREF(__pyx_exc_type);
      Py_XDECREF(__pyx_exc_value);
      Py_XDECREF(__pyx_exc_tb);
    }
    goto __pyx_L1_error;
    __pyx_L13:;
    switch (__pyx_why) {
      case 4: {
        __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
        __pyx_lineno = __pyx_exc_lineno;
        __pyx_exc_type = 0;
        __pyx_exc_value = 0;
        __pyx_exc_tb = 0;
        goto __pyx_L1_error;
      }
    }
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":330
 *             self._unlock()
 * 
 *         return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.XPathElementEvaluator.__call__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v__variables);
  __Pyx_DECREF((PyObject *)__pyx_v_doc);
  __Pyx_DECREF(__pyx_v_path);
  __Pyx_DECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":343
 *     you pass ``smart_strings=False``.
 *     """
 *     def __init__(self, _ElementTree etree not None, *, namespaces=None,             # <<<<<<<<<<<<<<
 *                  extensions=None, regexp=True, smart_strings=True):
 *         XPathElementEvaluator.__init__(
 */

static int __pyx_pf_4lxml_5etree_22XPathDocumentEvaluator___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_22XPathDocumentEvaluator___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct LxmlElementTree *__pyx_v_etree = 0;
  PyObject *__pyx_v_namespaces = 0;
  PyObject *__pyx_v_extensions = 0;
  PyObject *__pyx_v_regexp = 0;
  PyObject *__pyx_v_smart_strings = 0;
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__etree,&__pyx_n_s__namespaces,&__pyx_n_s__extensions,&__pyx_n_s__regexp,&__pyx_n_s__smart_strings,0};
  __Pyx_RefNannySetupContext("__init__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[5] = {0,0,0,0,0};
    values[1] = ((PyObject *)Py_None);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":344
 *     """
 *     def __init__(self, _ElementTree etree not None, *, namespaces=None,
 *                  extensions=None, regexp=True, smart_strings=True):             # <<<<<<<<<<<<<<
 *         XPathElementEvaluator.__init__(
 *             self, etree._context_node, namespaces=namespaces,
 */
    values[2] = ((PyObject *)Py_None);
    values[3] = __pyx_k_336;
    values[4] = __pyx_k_337;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__etree);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
    }
    while (kw_args > 0) {
      PyObject* value;
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__namespaces);
      if (value) { values[1] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__extensions);
      if (value) { values[2] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__regexp);
      if (value) { values[3] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__smart_strings);
      if (value) { values[4] = value; if (!(--kw_args)) break; }
      break;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_etree = ((struct LxmlElementTree *)values[0]);
    __pyx_v_namespaces = values[1];
    __pyx_v_extensions = values[2];
    __pyx_v_regexp = values[3];
    __pyx_v_smart_strings = values[4];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_etree = ((struct LxmlElementTree *)PyTuple_GET_ITEM(__pyx_args, 0));

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":343
 *     you pass ``smart_strings=False``.
 *     """
 *     def __init__(self, _ElementTree etree not None, *, namespaces=None,             # <<<<<<<<<<<<<<
 *                  extensions=None, regexp=True, smart_strings=True):
 *         XPathElementEvaluator.__init__(
 */
    __pyx_v_namespaces = ((PyObject *)Py_None);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":344
 *     """
 *     def __init__(self, _ElementTree etree not None, *, namespaces=None,
 *                  extensions=None, regexp=True, smart_strings=True):             # <<<<<<<<<<<<<<
 *         XPathElementEvaluator.__init__(
 *             self, etree._context_node, namespaces=namespaces,
 */
    __pyx_v_extensions = ((PyObject *)Py_None);
    __pyx_v_regexp = __pyx_k_336;
    __pyx_v_smart_strings = __pyx_k_337;
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[17]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.XPathDocumentEvaluator.__init__");
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_etree), __pyx_ptype_4lxml_5etree__ElementTree, 0, "etree", 0))) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":345
 *     def __init__(self, _ElementTree etree not None, *, namespaces=None,
 *                  extensions=None, regexp=True, smart_strings=True):
 *         XPathElementEvaluator.__init__(             # <<<<<<<<<<<<<<
 *             self, etree._context_node, namespaces=namespaces,
 *             extensions=extensions, regexp=regexp,
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_XPathElementEvaluator)), __pyx_n_s____init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":346
 *                  extensions=None, regexp=True, smart_strings=True):
 *         XPathElementEvaluator.__init__(
 *             self, etree._context_node, namespaces=namespaces,             # <<<<<<<<<<<<<<
 *             extensions=extensions, regexp=regexp,
 *             smart_strings=smart_strings)
 */
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __Pyx_INCREF(((PyObject *)__pyx_v_etree->_context_node));
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_etree->_context_node));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_etree->_context_node));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":345
 *     def __init__(self, _ElementTree etree not None, *, namespaces=None,
 *                  extensions=None, regexp=True, smart_strings=True):
 *         XPathElementEvaluator.__init__(             # <<<<<<<<<<<<<<
 *             self, etree._context_node, namespaces=namespaces,
 *             extensions=extensions, regexp=regexp,
 */
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":346
 *                  extensions=None, regexp=True, smart_strings=True):
 *         XPathElementEvaluator.__init__(
 *             self, etree._context_node, namespaces=namespaces,             # <<<<<<<<<<<<<<
 *             extensions=extensions, regexp=regexp,
 *             smart_strings=smart_strings)
 */
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__namespaces), __pyx_v_namespaces) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":347
 *         XPathElementEvaluator.__init__(
 *             self, etree._context_node, namespaces=namespaces,
 *             extensions=extensions, regexp=regexp,             # <<<<<<<<<<<<<<
 *             smart_strings=smart_strings)
 * 
 */
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__extensions), __pyx_v_extensions) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__regexp), __pyx_v_regexp) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":348
 *             self, etree._context_node, namespaces=namespaces,
 *             extensions=extensions, regexp=regexp,
 *             smart_strings=smart_strings)             # <<<<<<<<<<<<<<
 * 
 *     def __call__(self, _path, **_variables):
 */
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__smart_strings), __pyx_v_smart_strings) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.XPathDocumentEvaluator.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":350
 *             smart_strings=smart_strings)
 * 
 *     def __call__(self, _path, **_variables):             # <<<<<<<<<<<<<<
 *         u"""__call__(self, _path, **_variables)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_22XPathDocumentEvaluator_1__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_22XPathDocumentEvaluator_1__call__[] = "__call__(self, _path, **_variables)\n\n        Evaluate an XPath expression on the document.\n\n        Variables may be provided as keyword arguments.  Note that namespaces\n        are currently not supported for variables.\n        ";
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_22XPathDocumentEvaluator_1__call__;
static PyObject *__pyx_pf_4lxml_5etree_22XPathDocumentEvaluator_1__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v__path = 0;
  PyObject *__pyx_v__variables = 0;
  xmlXPathObject *__pyx_v_xpathObj;
  xmlDoc *__pyx_v_c_doc;
  struct LxmlDocument *__pyx_v_doc;
  char *__pyx_v_c_path;
  PyObject *__pyx_v_path;
  PyObject *__pyx_v_result;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  xmlDoc *__pyx_t_3;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s___path,0};
  __Pyx_RefNannySetupContext("__call__");
  __pyx_v__variables = PyDict_New(); if (unlikely(!__pyx_v__variables)) return NULL;
  __Pyx_GOTREF(__pyx_v__variables);
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[1] = {0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s___path);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v__variables, values, PyTuple_GET_SIZE(__pyx_args), "__call__") < 0)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v__path = values[0];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v__path = PyTuple_GET_ITEM(__pyx_args, 0);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[17]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v__variables);
  __Pyx_AddTraceback("lxml.etree.XPathDocumentEvaluator.__call__");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_doc = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_path = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_result = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":362
 *         cdef _Document doc
 *         cdef char* c_path
 *         assert self._xpathCtxt is not NULL, "XPath context not initialised"             # <<<<<<<<<<<<<<
 *         path = _utf8(_path)
 *         doc = self._element._doc
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!(((struct __pyx_obj_4lxml_5etree_XPathDocumentEvaluator *)__pyx_v_self)->__pyx_base.__pyx_base._xpathCtxt != NULL))) {
    PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_335));
    {__pyx_filename = __pyx_f[17]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":363
 *         cdef char* c_path
 *         assert self._xpathCtxt is not NULL, "XPath context not initialised"
 *         path = _utf8(_path)             # <<<<<<<<<<<<<<
 *         doc = self._element._doc
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_v__path)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_path));
  __pyx_v_path = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":364
 *         assert self._xpathCtxt is not NULL, "XPath context not initialised"
 *         path = _utf8(_path)
 *         doc = self._element._doc             # <<<<<<<<<<<<<<
 * 
 *         self._lock()
 */
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_XPathDocumentEvaluator *)__pyx_v_self)->__pyx_base._element->_doc));
  __Pyx_DECREF(((PyObject *)__pyx_v_doc));
  __pyx_v_doc = ((struct __pyx_obj_4lxml_5etree_XPathDocumentEvaluator *)__pyx_v_self)->__pyx_base._element->_doc;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":366
 *         doc = self._element._doc
 * 
 *         self._lock()             # <<<<<<<<<<<<<<
 *         self._error_log.connect()
 *         try:
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree_XPathDocumentEvaluator *)((struct __pyx_obj_4lxml_5etree_XPathDocumentEvaluator *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._lock(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":367
 * 
 *         self._lock()
 *         self._error_log.connect()             # <<<<<<<<<<<<<<
 *         try:
 *             self._context.register_context(doc)
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)((struct __pyx_obj_4lxml_5etree_XPathDocumentEvaluator *)__pyx_v_self)->__pyx_base.__pyx_base._error_log->__pyx_base.__pyx_base.__pyx_vtab)->connect(((struct __pyx_obj_4lxml_5etree_XPathDocumentEvaluator *)__pyx_v_self)->__pyx_base.__pyx_base._error_log);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":368
 *         self._lock()
 *         self._error_log.connect()
 *         try:             # <<<<<<<<<<<<<<
 *             self._context.register_context(doc)
 *             c_doc = _fakeRootDoc(doc._c_doc, self._element._c_node)
 */
  /*try:*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":369
 *         self._error_log.connect()
 *         try:
 *             self._context.register_context(doc)             # <<<<<<<<<<<<<<
 *             c_doc = _fakeRootDoc(doc._c_doc, self._element._c_node)
 *             try:
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__XPathContext *)((struct __pyx_obj_4lxml_5etree_XPathDocumentEvaluator *)__pyx_v_self)->__pyx_base.__pyx_base._context->__pyx_base.__pyx_vtab)->register_context(((struct __pyx_obj_4lxml_5etree_XPathDocumentEvaluator *)__pyx_v_self)->__pyx_base.__pyx_base._context, __pyx_v_doc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":370
 *         try:
 *             self._context.register_context(doc)
 *             c_doc = _fakeRootDoc(doc._c_doc, self._element._c_node)             # <<<<<<<<<<<<<<
 *             try:
 *                 self._context.registerVariables(_variables)
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree__fakeRootDoc(__pyx_v_doc->_c_doc, ((struct __pyx_obj_4lxml_5etree_XPathDocumentEvaluator *)__pyx_v_self)->__pyx_base._element->_c_node); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __pyx_v_c_doc = __pyx_t_3;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":371
 *             self._context.register_context(doc)
 *             c_doc = _fakeRootDoc(doc._c_doc, self._element._c_node)
 *             try:             # <<<<<<<<<<<<<<
 *                 self._context.registerVariables(_variables)
 *                 c_path = _cstr(path)
 */
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":372
 *             c_doc = _fakeRootDoc(doc._c_doc, self._element._c_node)
 *             try:
 *                 self._context.registerVariables(_variables)             # <<<<<<<<<<<<<<
 *                 c_path = _cstr(path)
 *                 with nogil:
 */
      __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__XPathContext *)((struct __pyx_obj_4lxml_5etree_XPathDocumentEvaluator *)__pyx_v_self)->__pyx_base.__pyx_base._context->__pyx_base.__pyx_vtab)->registerVariables(((struct __pyx_obj_4lxml_5etree_XPathDocumentEvaluator *)__pyx_v_self)->__pyx_base.__pyx_base._context, ((PyObject *)__pyx_v__variables)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L10;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":373
 *             try:
 *                 self._context.registerVariables(_variables)
 *                 c_path = _cstr(path)             # <<<<<<<<<<<<<<
 *                 with nogil:
 *                     self._xpathCtxt.doc  = c_doc
 */
      __pyx_v_c_path = PyBytes_AS_STRING(((PyObject *)__pyx_v_path));

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":374
 *                 self._context.registerVariables(_variables)
 *                 c_path = _cstr(path)
 *                 with nogil:             # <<<<<<<<<<<<<<
 *                     self._xpathCtxt.doc  = c_doc
 *                     self._xpathCtxt.node = tree.xmlDocGetRootElement(c_doc)
 */
      {
        #ifdef WITH_THREAD
        PyThreadState *_save;
        #endif
        Py_UNBLOCK_THREADS
        /*try:*/ {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":375
 *                 c_path = _cstr(path)
 *                 with nogil:
 *                     self._xpathCtxt.doc  = c_doc             # <<<<<<<<<<<<<<
 *                     self._xpathCtxt.node = tree.xmlDocGetRootElement(c_doc)
 *                     xpathObj = xpath.xmlXPathEvalExpression(
 */
          ((struct __pyx_obj_4lxml_5etree_XPathDocumentEvaluator *)__pyx_v_self)->__pyx_base.__pyx_base._xpathCtxt->doc = __pyx_v_c_doc;

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":376
 *                 with nogil:
 *                     self._xpathCtxt.doc  = c_doc
 *                     self._xpathCtxt.node = tree.xmlDocGetRootElement(c_doc)             # <<<<<<<<<<<<<<
 *                     xpathObj = xpath.xmlXPathEvalExpression(
 *                         c_path, self._xpathCtxt)
 */
          ((struct __pyx_obj_4lxml_5etree_XPathDocumentEvaluator *)__pyx_v_self)->__pyx_base.__pyx_base._xpathCtxt->node = xmlDocGetRootElement(__pyx_v_c_doc);

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":378
 *                     self._xpathCtxt.node = tree.xmlDocGetRootElement(c_doc)
 *                     xpathObj = xpath.xmlXPathEvalExpression(
 *                         c_path, self._xpathCtxt)             # <<<<<<<<<<<<<<
 *                 result = self._handle_result(xpathObj, doc)
 *             finally:
 */
          __pyx_v_xpathObj = xmlXPathEvalExpression(__pyx_v_c_path, ((struct __pyx_obj_4lxml_5etree_XPathDocumentEvaluator *)__pyx_v_self)->__pyx_base.__pyx_base._xpathCtxt);
        }

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":374
 *                 self._context.registerVariables(_variables)
 *                 c_path = _cstr(path)
 *                 with nogil:             # <<<<<<<<<<<<<<
 *                     self._xpathCtxt.doc  = c_doc
 *                     self._xpathCtxt.node = tree.xmlDocGetRootElement(c_doc)
 */
        /*finally:*/ {
          Py_BLOCK_THREADS
        }
      }

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":379
 *                     xpathObj = xpath.xmlXPathEvalExpression(
 *                         c_path, self._xpathCtxt)
 *                 result = self._handle_result(xpathObj, doc)             # <<<<<<<<<<<<<<
 *             finally:
 *                 _destroyFakeDoc(doc._c_doc, c_doc)
 */
      __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree_XPathDocumentEvaluator *)((struct __pyx_obj_4lxml_5etree_XPathDocumentEvaluator *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._handle_result(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self), __pyx_v_xpathObj, __pyx_v_doc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L10;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_v_result);
      __pyx_v_result = __pyx_t_1;
      __pyx_t_1 = 0;
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":381
 *                 result = self._handle_result(xpathObj, doc)
 *             finally:
 *                 _destroyFakeDoc(doc._c_doc, c_doc)             # <<<<<<<<<<<<<<
 *                 self._context.unregister_context()
 *         finally:
 */
    /*finally:*/ {
      int __pyx_why;
      PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
      int __pyx_exc_lineno;
      __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
      __pyx_why = 0; goto __pyx_L11;
      __pyx_L10: {
        __pyx_why = 4;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
        __pyx_exc_lineno = __pyx_lineno;
        goto __pyx_L11;
      }
      __pyx_L11:;
      __pyx_f_4lxml_5etree__destroyFakeDoc(__pyx_v_doc->_c_doc, __pyx_v_c_doc);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":382
 *             finally:
 *                 _destroyFakeDoc(doc._c_doc, c_doc)
 *                 self._context.unregister_context()             # <<<<<<<<<<<<<<
 *         finally:
 *             self._error_log.disconnect()
 */
      __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__XPathContext *)((struct __pyx_obj_4lxml_5etree_XPathDocumentEvaluator *)__pyx_v_self)->__pyx_base.__pyx_base._context->__pyx_base.__pyx_vtab)->unregister_context(((struct __pyx_obj_4lxml_5etree_XPathDocumentEvaluator *)__pyx_v_self)->__pyx_base.__pyx_base._context); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L16;
      __pyx_L15_error:;
      if (__pyx_why == 4) {
        Py_XDECREF(__pyx_exc_type);
        Py_XDECREF(__pyx_exc_value);
        Py_XDECREF(__pyx_exc_tb);
      }
      goto __pyx_L7;
      __pyx_L16:;
      switch (__pyx_why) {
        case 4: {
          __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
          __pyx_lineno = __pyx_exc_lineno;
          __pyx_exc_type = 0;
          __pyx_exc_value = 0;
          __pyx_exc_tb = 0;
          goto __pyx_L7;
        }
      }
    }
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":384
 *                 self._context.unregister_context()
 *         finally:
 *             self._error_log.disconnect()             # <<<<<<<<<<<<<<
 *             self._unlock()
 * 
 */
  /*finally:*/ {
    int __pyx_why;
    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
    int __pyx_exc_lineno;
    __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 0; goto __pyx_L8;
    __pyx_L7: {
      __pyx_why = 4;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
      __pyx_exc_lineno = __pyx_lineno;
      goto __pyx_L8;
    }
    __pyx_L8:;
    ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)((struct __pyx_obj_4lxml_5etree_XPathDocumentEvaluator *)__pyx_v_self)->__pyx_base.__pyx_base._error_log->__pyx_base.__pyx_base.__pyx_vtab)->disconnect(((struct __pyx_obj_4lxml_5etree_XPathDocumentEvaluator *)__pyx_v_self)->__pyx_base.__pyx_base._error_log);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":385
 *         finally:
 *             self._error_log.disconnect()
 *             self._unlock()             # <<<<<<<<<<<<<<
 * 
 *         return result
 */
    ((struct __pyx_vtabstruct_4lxml_5etree_XPathDocumentEvaluator *)((struct __pyx_obj_4lxml_5etree_XPathDocumentEvaluator *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._unlock(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self));
    switch (__pyx_why) {
      case 4: {
        __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
        __pyx_lineno = __pyx_exc_lineno;
        __pyx_exc_type = 0;
        __pyx_exc_value = 0;
        __pyx_exc_tb = 0;
        goto __pyx_L1_error;
      }
    }
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":387
 *             self._unlock()
 * 
 *         return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.XPathDocumentEvaluator.__call__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v__variables);
  __Pyx_DECREF((PyObject *)__pyx_v_doc);
  __Pyx_DECREF(__pyx_v_path);
  __Pyx_DECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":390
 * 
 * 
 * def XPathEvaluator(etree_or_element, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *                    regexp=True, smart_strings=True):
 *     u"""XPathEvaluator(etree_or_element, namespaces=None, extensions=None, regexp=True, smart_strings=True)
 */

static PyObject *__pyx_pf_4lxml_5etree_31XPathEvaluator(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_31XPathEvaluator[] = "XPathEvaluator(etree_or_element, namespaces=None, extensions=None, regexp=True, smart_strings=True)\n\n    Creates an XPath evaluator for an ElementTree or an Element.\n\n    The resulting object can be called with an XPath expression as argument\n    and XPath variables provided as keyword arguments.\n\n    Additional namespace declarations can be passed with the\n    'namespace' keyword argument.  EXSLT regular expression support\n    can be disabled with the 'regexp' boolean keyword (defaults to\n    True).  Smart strings will be returned for string results unless\n    you pass ``smart_strings=False``.\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_31XPathEvaluator = {__Pyx_NAMESTR("XPathEvaluator"), (PyCFunction)__pyx_pf_4lxml_5etree_31XPathEvaluator, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_31XPathEvaluator)};
static PyObject *__pyx_pf_4lxml_5etree_31XPathEvaluator(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_etree_or_element = 0;
  PyObject *__pyx_v_namespaces = 0;
  PyObject *__pyx_v_extensions = 0;
  PyObject *__pyx_v_regexp = 0;
  PyObject *__pyx_v_smart_strings = 0;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__etree_or_element,&__pyx_n_s__namespaces,&__pyx_n_s__extensions,&__pyx_n_s__regexp,&__pyx_n_s__smart_strings,0};
  __Pyx_RefNannySetupContext("XPathEvaluator");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[5] = {0,0,0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    values[3] = __pyx_k_338;
    values[4] = __pyx_k_339;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__etree_or_element);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
    }
    while (kw_args > 0) {
      PyObject* value;
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__namespaces);
      if (value) { values[1] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__extensions);
      if (value) { values[2] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__regexp);
      if (value) { values[3] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__smart_strings);
      if (value) { values[4] = value; if (!(--kw_args)) break; }
      break;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "XPathEvaluator") < 0)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_etree_or_element = values[0];
    __pyx_v_namespaces = values[1];
    __pyx_v_extensions = values[2];
    __pyx_v_regexp = values[3];
    __pyx_v_smart_strings = values[4];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_etree_or_element = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_namespaces = ((PyObject *)Py_None);
    __pyx_v_extensions = ((PyObject *)Py_None);
    __pyx_v_regexp = __pyx_k_338;
    __pyx_v_smart_strings = __pyx_k_339;
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("XPathEvaluator", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[17]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.XPathEvaluator");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":405
 *     you pass ``smart_strings=False``.
 *     """
 *     if isinstance(etree_or_element, _ElementTree):             # <<<<<<<<<<<<<<
 *         return XPathDocumentEvaluator(
 *             etree_or_element, namespaces=namespaces,
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_etree_or_element, ((PyObject*)__pyx_ptype_4lxml_5etree__ElementTree)); 
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":406
 *     """
 *     if isinstance(etree_or_element, _ElementTree):
 *         return XPathDocumentEvaluator(             # <<<<<<<<<<<<<<
 *             etree_or_element, namespaces=namespaces,
 *             extensions=extensions, regexp=regexp, smart_strings=smart_strings)
 */
    __Pyx_XDECREF(__pyx_r);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":407
 *     if isinstance(etree_or_element, _ElementTree):
 *         return XPathDocumentEvaluator(
 *             etree_or_element, namespaces=namespaces,             # <<<<<<<<<<<<<<
 *             extensions=extensions, regexp=regexp, smart_strings=smart_strings)
 *     else:
 */
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __Pyx_INCREF(__pyx_v_etree_or_element);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_etree_or_element);
    __Pyx_GIVEREF(__pyx_v_etree_or_element);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":406
 *     """
 *     if isinstance(etree_or_element, _ElementTree):
 *         return XPathDocumentEvaluator(             # <<<<<<<<<<<<<<
 *             etree_or_element, namespaces=namespaces,
 *             extensions=extensions, regexp=regexp, smart_strings=smart_strings)
 */
    __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":407
 *     if isinstance(etree_or_element, _ElementTree):
 *         return XPathDocumentEvaluator(
 *             etree_or_element, namespaces=namespaces,             # <<<<<<<<<<<<<<
 *             extensions=extensions, regexp=regexp, smart_strings=smart_strings)
 *     else:
 */
    if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__namespaces), __pyx_v_namespaces) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":408
 *         return XPathDocumentEvaluator(
 *             etree_or_element, namespaces=namespaces,
 *             extensions=extensions, regexp=regexp, smart_strings=smart_strings)             # <<<<<<<<<<<<<<
 *     else:
 *         return XPathElementEvaluator(
 */
    if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__extensions), __pyx_v_extensions) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__regexp), __pyx_v_regexp) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__smart_strings), __pyx_v_smart_strings) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_XPathDocumentEvaluator)), ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":410
 *             extensions=extensions, regexp=regexp, smart_strings=smart_strings)
 *     else:
 *         return XPathElementEvaluator(             # <<<<<<<<<<<<<<
 *             etree_or_element, namespaces=namespaces,
 *             extensions=extensions, regexp=regexp, smart_strings=smart_strings)
 */
    __Pyx_XDECREF(__pyx_r);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":411
 *     else:
 *         return XPathElementEvaluator(
 *             etree_or_element, namespaces=namespaces,             # <<<<<<<<<<<<<<
 *             extensions=extensions, regexp=regexp, smart_strings=smart_strings)
 * 
 */
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_INCREF(__pyx_v_etree_or_element);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_etree_or_element);
    __Pyx_GIVEREF(__pyx_v_etree_or_element);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":410
 *             extensions=extensions, regexp=regexp, smart_strings=smart_strings)
 *     else:
 *         return XPathElementEvaluator(             # <<<<<<<<<<<<<<
 *             etree_or_element, namespaces=namespaces,
 *             extensions=extensions, regexp=regexp, smart_strings=smart_strings)
 */
    __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":411
 *     else:
 *         return XPathElementEvaluator(
 *             etree_or_element, namespaces=namespaces,             # <<<<<<<<<<<<<<
 *             extensions=extensions, regexp=regexp, smart_strings=smart_strings)
 * 
 */
    if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__namespaces), __pyx_v_namespaces) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":412
 *         return XPathElementEvaluator(
 *             etree_or_element, namespaces=namespaces,
 *             extensions=extensions, regexp=regexp, smart_strings=smart_strings)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__extensions), __pyx_v_extensions) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__regexp), __pyx_v_regexp) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__smart_strings), __pyx_v_smart_strings) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_XPathElementEvaluator)), ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }
  __pyx_L6:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.XPathEvaluator");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":429
 *     cdef xpath.xmlXPathCompExpr* _xpath
 *     cdef bytes _path
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._xpath = NULL
 * 
 */

static int __pyx_pf_4lxml_5etree_5XPath___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_5XPath___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("__cinit__");
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":430
 *     cdef bytes _path
 *     def __cinit__(self):
 *         self._xpath = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, path, *, namespaces=None, extensions=None,
 */
  ((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_v_self)->_xpath = NULL;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":432
 *         self._xpath = NULL
 * 
 *     def __init__(self, path, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *                  regexp=True, smart_strings=True):
 *         cdef xpath.xmlXPathContext* xpathCtxt
 */

static int __pyx_pf_4lxml_5etree_5XPath_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_5XPath_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_path = 0;
  PyObject *__pyx_v_namespaces = 0;
  PyObject *__pyx_v_extensions = 0;
  PyObject *__pyx_v_regexp = 0;
  PyObject *__pyx_v_smart_strings = 0;
  xmlXPathContext *__pyx_v_xpathCtxt;
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__path,&__pyx_n_s__namespaces,&__pyx_n_s__extensions,&__pyx_n_s__regexp,&__pyx_n_s__smart_strings,0};
  __Pyx_RefNannySetupContext("__init__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[5] = {0,0,0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    values[3] = __pyx_k_340;
    values[4] = __pyx_k_341;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__path);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
    }
    while (kw_args > 0) {
      PyObject* value;
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__namespaces);
      if (value) { values[1] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__extensions);
      if (value) { values[2] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__regexp);
      if (value) { values[3] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__smart_strings);
      if (value) { values[4] = value; if (!(--kw_args)) break; }
      break;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_path = values[0];
    __pyx_v_namespaces = values[1];
    __pyx_v_extensions = values[2];
    __pyx_v_regexp = values[3];
    __pyx_v_smart_strings = values[4];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_path = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_namespaces = ((PyObject *)Py_None);
    __pyx_v_extensions = ((PyObject *)Py_None);
    __pyx_v_regexp = __pyx_k_340;
    __pyx_v_smart_strings = __pyx_k_341;
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[17]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.XPath.__init__");
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":435
 *                  regexp=True, smart_strings=True):
 *         cdef xpath.xmlXPathContext* xpathCtxt
 *         _XPathEvaluatorBase.__init__(self, namespaces, extensions,             # <<<<<<<<<<<<<<
 *                                      regexp, smart_strings)
 *         self._path = _utf8(path)
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__XPathEvaluatorBase)), __pyx_n_s____init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":436
 *         cdef xpath.xmlXPathContext* xpathCtxt
 *         _XPathEvaluatorBase.__init__(self, namespaces, extensions,
 *                                      regexp, smart_strings)             # <<<<<<<<<<<<<<
 *         self._path = _utf8(path)
 *         xpathCtxt = xpath.xmlXPathNewContext(NULL)
 */
  __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __Pyx_INCREF(__pyx_v_namespaces);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_namespaces);
  __Pyx_GIVEREF(__pyx_v_namespaces);
  __Pyx_INCREF(__pyx_v_extensions);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_extensions);
  __Pyx_GIVEREF(__pyx_v_extensions);
  __Pyx_INCREF(__pyx_v_regexp);
  PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_regexp);
  __Pyx_GIVEREF(__pyx_v_regexp);
  __Pyx_INCREF(__pyx_v_smart_strings);
  PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_v_smart_strings);
  __Pyx_GIVEREF(__pyx_v_smart_strings);
  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":437
 *         _XPathEvaluatorBase.__init__(self, namespaces, extensions,
 *                                      regexp, smart_strings)
 *         self._path = _utf8(path)             # <<<<<<<<<<<<<<
 *         xpathCtxt = xpath.xmlXPathNewContext(NULL)
 *         if xpathCtxt is NULL:
 */
  __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_v_path)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_v_self)->_path);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_v_self)->_path));
  ((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_v_self)->_path = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":438
 *                                      regexp, smart_strings)
 *         self._path = _utf8(path)
 *         xpathCtxt = xpath.xmlXPathNewContext(NULL)             # <<<<<<<<<<<<<<
 *         if xpathCtxt is NULL:
 *             python.PyErr_NoMemory()
 */
  __pyx_v_xpathCtxt = xmlXPathNewContext(NULL);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":439
 *         self._path = _utf8(path)
 *         xpathCtxt = xpath.xmlXPathNewContext(NULL)
 *         if xpathCtxt is NULL:             # <<<<<<<<<<<<<<
 *             python.PyErr_NoMemory()
 *         self.set_context(xpathCtxt)
 */
  __pyx_t_4 = (__pyx_v_xpathCtxt == NULL);
  if (__pyx_t_4) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":440
 *         xpathCtxt = xpath.xmlXPathNewContext(NULL)
 *         if xpathCtxt is NULL:
 *             python.PyErr_NoMemory()             # <<<<<<<<<<<<<<
 *         self.set_context(xpathCtxt)
 *         self._error_log.connect()
 */
    __pyx_t_3 = PyErr_NoMemory(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":441
 *         if xpathCtxt is NULL:
 *             python.PyErr_NoMemory()
 *         self.set_context(xpathCtxt)             # <<<<<<<<<<<<<<
 *         self._error_log.connect()
 *         self._xpath = xpath.xmlXPathCtxtCompile(xpathCtxt, _cstr(self._path))
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree_XPath *)((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.set_context(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self), __pyx_v_xpathCtxt); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":442
 *             python.PyErr_NoMemory()
 *         self.set_context(xpathCtxt)
 *         self._error_log.connect()             # <<<<<<<<<<<<<<
 *         self._xpath = xpath.xmlXPathCtxtCompile(xpathCtxt, _cstr(self._path))
 *         self._error_log.disconnect()
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_v_self)->__pyx_base._error_log->__pyx_base.__pyx_base.__pyx_vtab)->connect(((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_v_self)->__pyx_base._error_log);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":443
 *         self.set_context(xpathCtxt)
 *         self._error_log.connect()
 *         self._xpath = xpath.xmlXPathCtxtCompile(xpathCtxt, _cstr(self._path))             # <<<<<<<<<<<<<<
 *         self._error_log.disconnect()
 *         if self._xpath is NULL:
 */
  __pyx_t_3 = ((PyObject *)((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_v_self)->_path);
  __Pyx_INCREF(__pyx_t_3);
  ((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_v_self)->_xpath = xmlXPathCtxtCompile(__pyx_v_xpathCtxt, PyBytes_AS_STRING(__pyx_t_3));
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":444
 *         self._error_log.connect()
 *         self._xpath = xpath.xmlXPathCtxtCompile(xpathCtxt, _cstr(self._path))
 *         self._error_log.disconnect()             # <<<<<<<<<<<<<<
 *         if self._xpath is NULL:
 *             self._raise_parse_error()
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_v_self)->__pyx_base._error_log->__pyx_base.__pyx_base.__pyx_vtab)->disconnect(((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_v_self)->__pyx_base._error_log);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":445
 *         self._xpath = xpath.xmlXPathCtxtCompile(xpathCtxt, _cstr(self._path))
 *         self._error_log.disconnect()
 *         if self._xpath is NULL:             # <<<<<<<<<<<<<<
 *             self._raise_parse_error()
 * 
 */
  __pyx_t_4 = (((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_v_self)->_xpath == NULL);
  if (__pyx_t_4) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":446
 *         self._error_log.disconnect()
 *         if self._xpath is NULL:
 *             self._raise_parse_error()             # <<<<<<<<<<<<<<
 * 
 *     def __call__(self, _etree_or_element, **_variables):
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree_XPath *)((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base._raise_parse_error(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L7;
  }
  __pyx_L7:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.XPath.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":448
 *             self._raise_parse_error()
 * 
 *     def __call__(self, _etree_or_element, **_variables):             # <<<<<<<<<<<<<<
 *         u"__call__(self, _etree_or_element, **_variables)"
 *         cdef xpath.xmlXPathObject*  xpathObj
 */

static PyObject *__pyx_pf_4lxml_5etree_5XPath_2__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_5XPath_2__call__[] = "__call__(self, _etree_or_element, **_variables)";
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_5XPath_2__call__;
static PyObject *__pyx_pf_4lxml_5etree_5XPath_2__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v__etree_or_element = 0;
  PyObject *__pyx_v__variables = 0;
  xmlXPathObject *__pyx_v_xpathObj;
  struct LxmlDocument *__pyx_v_document;
  struct LxmlElement *__pyx_v_element;
  PyObject *__pyx_v_result;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s___etree_or_element,0};
  __Pyx_RefNannySetupContext("__call__");
  __pyx_v__variables = PyDict_New(); if (unlikely(!__pyx_v__variables)) return NULL;
  __Pyx_GOTREF(__pyx_v__variables);
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[1] = {0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s___etree_or_element);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v__variables, values, PyTuple_GET_SIZE(__pyx_args), "__call__") < 0)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v__etree_or_element = values[0];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v__etree_or_element = PyTuple_GET_ITEM(__pyx_args, 0);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[17]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v__variables);
  __Pyx_AddTraceback("lxml.etree.XPath.__call__");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_document = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_element = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_result = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":454
 *         cdef _Element element
 * 
 *         assert self._xpathCtxt is not NULL, "XPath context not initialised"             # <<<<<<<<<<<<<<
 *         document = _documentOrRaise(_etree_or_element)
 *         element  = _rootNodeOrRaise(_etree_or_element)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!(((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_v_self)->__pyx_base._xpathCtxt != NULL))) {
    PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_335));
    {__pyx_filename = __pyx_f[17]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":455
 * 
 *         assert self._xpathCtxt is not NULL, "XPath context not initialised"
 *         document = _documentOrRaise(_etree_or_element)             # <<<<<<<<<<<<<<
 *         element  = _rootNodeOrRaise(_etree_or_element)
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v__etree_or_element)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_document));
  __pyx_v_document = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":456
 *         assert self._xpathCtxt is not NULL, "XPath context not initialised"
 *         document = _documentOrRaise(_etree_or_element)
 *         element  = _rootNodeOrRaise(_etree_or_element)             # <<<<<<<<<<<<<<
 * 
 *         self._lock()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v__etree_or_element)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_element));
  __pyx_v_element = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":458
 *         element  = _rootNodeOrRaise(_etree_or_element)
 * 
 *         self._lock()             # <<<<<<<<<<<<<<
 *         self._error_log.connect()
 *         self._xpathCtxt.doc  = document._c_doc
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree_XPath *)((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base._lock(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":459
 * 
 *         self._lock()
 *         self._error_log.connect()             # <<<<<<<<<<<<<<
 *         self._xpathCtxt.doc  = document._c_doc
 *         self._xpathCtxt.node = element._c_node
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_v_self)->__pyx_base._error_log->__pyx_base.__pyx_base.__pyx_vtab)->connect(((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_v_self)->__pyx_base._error_log);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":460
 *         self._lock()
 *         self._error_log.connect()
 *         self._xpathCtxt.doc  = document._c_doc             # <<<<<<<<<<<<<<
 *         self._xpathCtxt.node = element._c_node
 * 
 */
  ((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_v_self)->__pyx_base._xpathCtxt->doc = __pyx_v_document->_c_doc;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":461
 *         self._error_log.connect()
 *         self._xpathCtxt.doc  = document._c_doc
 *         self._xpathCtxt.node = element._c_node             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
  ((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_v_self)->__pyx_base._xpathCtxt->node = __pyx_v_element->_c_node;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":463
 *         self._xpathCtxt.node = element._c_node
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             self._context.register_context(document)
 *             self._context.registerVariables(_variables)
 */
  /*try:*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":464
 * 
 *         try:
 *             self._context.register_context(document)             # <<<<<<<<<<<<<<
 *             self._context.registerVariables(_variables)
 *             with nogil:
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__XPathContext *)((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_v_self)->__pyx_base._context->__pyx_base.__pyx_vtab)->register_context(((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_v_self)->__pyx_base._context, __pyx_v_document); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":465
 *         try:
 *             self._context.register_context(document)
 *             self._context.registerVariables(_variables)             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 xpathObj = xpath.xmlXPathCompiledEval(
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__XPathContext *)((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_v_self)->__pyx_base._context->__pyx_base.__pyx_vtab)->registerVariables(((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_v_self)->__pyx_base._context, ((PyObject *)__pyx_v__variables)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":466
 *             self._context.register_context(document)
 *             self._context.registerVariables(_variables)
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 xpathObj = xpath.xmlXPathCompiledEval(
 *                     self._xpath, self._xpathCtxt)
 */
    {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      #endif
      Py_UNBLOCK_THREADS
      /*try:*/ {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":468
 *             with nogil:
 *                 xpathObj = xpath.xmlXPathCompiledEval(
 *                     self._xpath, self._xpathCtxt)             # <<<<<<<<<<<<<<
 *             result = self._handle_result(xpathObj, document)
 *         finally:
 */
        __pyx_v_xpathObj = xmlXPathCompiledEval(((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_v_self)->_xpath, ((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_v_self)->__pyx_base._xpathCtxt);
      }

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":466
 *             self._context.register_context(document)
 *             self._context.registerVariables(_variables)
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 xpathObj = xpath.xmlXPathCompiledEval(
 *                     self._xpath, self._xpathCtxt)
 */
      /*finally:*/ {
        Py_BLOCK_THREADS
      }
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":469
 *                 xpathObj = xpath.xmlXPathCompiledEval(
 *                     self._xpath, self._xpathCtxt)
 *             result = self._handle_result(xpathObj, document)             # <<<<<<<<<<<<<<
 *         finally:
 *             self._error_log.disconnect()
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree_XPath *)((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base._handle_result(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self), __pyx_v_xpathObj, __pyx_v_document); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_v_result);
    __pyx_v_result = __pyx_t_1;
    __pyx_t_1 = 0;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":471
 *             result = self._handle_result(xpathObj, document)
 *         finally:
 *             self._error_log.disconnect()             # <<<<<<<<<<<<<<
 *             self._context.unregister_context()
 *             self._unlock()
 */
  /*finally:*/ {
    int __pyx_why;
    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
    int __pyx_exc_lineno;
    __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 0; goto __pyx_L8;
    __pyx_L7: {
      __pyx_why = 4;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
      __pyx_exc_lineno = __pyx_lineno;
      goto __pyx_L8;
    }
    __pyx_L8:;
    ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_v_self)->__pyx_base._error_log->__pyx_base.__pyx_base.__pyx_vtab)->disconnect(((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_v_self)->__pyx_base._error_log);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":472
 *         finally:
 *             self._error_log.disconnect()
 *             self._context.unregister_context()             # <<<<<<<<<<<<<<
 *             self._unlock()
 *         return result
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__XPathContext *)((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_v_self)->__pyx_base._context->__pyx_base.__pyx_vtab)->unregister_context(((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_v_self)->__pyx_base._context); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":473
 *             self._error_log.disconnect()
 *             self._context.unregister_context()
 *             self._unlock()             # <<<<<<<<<<<<<<
 *         return result
 * 
 */
    ((struct __pyx_vtabstruct_4lxml_5etree_XPath *)((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base._unlock(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self));
    goto __pyx_L13;
    __pyx_L12_error:;
    if (__pyx_why == 4) {
      Py_XDECREF(__pyx_exc_type);
      Py_XDECREF(__pyx_exc_value);
      Py_XDECREF(__pyx_exc_tb);
    }
    goto __pyx_L1_error;
    __pyx_L13:;
    switch (__pyx_why) {
      case 4: {
        __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
        __pyx_lineno = __pyx_exc_lineno;
        __pyx_exc_type = 0;
        __pyx_exc_value = 0;
        __pyx_exc_tb = 0;
        goto __pyx_L1_error;
      }
    }
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":474
 *             self._context.unregister_context()
 *             self._unlock()
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     property path:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.XPath.__call__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v__variables);
  __Pyx_DECREF((PyObject *)__pyx_v_document);
  __Pyx_DECREF((PyObject *)__pyx_v_element);
  __Pyx_DECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":479
 *         u"""The literal XPath expression.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._path.decode(u'UTF-8')
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_5XPath_4path___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_5XPath_4path___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__get__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":480
 *         """
 *         def __get__(self):
 *             return self._path.decode(u'UTF-8')             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_v_self)->_path), __pyx_n_s__decode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_342), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.XPath.path.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":482
 *             return self._path.decode(u'UTF-8')
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._xpath is not NULL:
 *             xpath.xmlXPathFreeCompExpr(self._xpath)
 */

static void __pyx_pf_4lxml_5etree_5XPath_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pf_4lxml_5etree_5XPath_3__dealloc__(PyObject *__pyx_v_self) {
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__dealloc__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":483
 * 
 *     def __dealloc__(self):
 *         if self._xpath is not NULL:             # <<<<<<<<<<<<<<
 *             xpath.xmlXPathFreeCompExpr(self._xpath)
 * 
 */
  __pyx_t_1 = (((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_v_self)->_xpath != NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":484
 *     def __dealloc__(self):
 *         if self._xpath is not NULL:
 *             xpath.xmlXPathFreeCompExpr(self._xpath)             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
    xmlXPathFreeCompExpr(((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_v_self)->_xpath);
    goto __pyx_L5;
  }
  __pyx_L5:;

  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":486
 *             xpath.xmlXPathFreeCompExpr(self._xpath)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return self.path
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_5XPath_4__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_5XPath_4__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__repr__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":487
 * 
 *     def __repr__(self):
 *         return self.path             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__path); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.XPath.__repr__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":504
 *     you pass ``smart_strings=False``.
 *     """
 *     def __init__(self, path, *, extensions=None, regexp=True,             # <<<<<<<<<<<<<<
 *                  smart_strings=True):
 *         path, namespaces = self._nsextract_path(path)
 */

static int __pyx_pf_4lxml_5etree_7ETXPath___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_7ETXPath___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_path = 0;
  PyObject *__pyx_v_extensions = 0;
  PyObject *__pyx_v_regexp = 0;
  PyObject *__pyx_v_smart_strings = 0;
  PyObject *__pyx_v_namespaces;
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__path,&__pyx_n_s__extensions,&__pyx_n_s__regexp,&__pyx_n_s__smart_strings,0};
  __Pyx_RefNannySetupContext("__init__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[4] = {0,0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = __pyx_k_343;
    values[3] = __pyx_k_344;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__path);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
    }
    while (kw_args > 0) {
      PyObject* value;
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__extensions);
      if (value) { values[1] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__regexp);
      if (value) { values[2] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__smart_strings);
      if (value) { values[3] = value; if (!(--kw_args)) break; }
      break;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_path = values[0];
    __pyx_v_extensions = values[1];
    __pyx_v_regexp = values[2];
    __pyx_v_smart_strings = values[3];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_path = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_extensions = ((PyObject *)Py_None);
    __pyx_v_regexp = __pyx_k_343;
    __pyx_v_smart_strings = __pyx_k_344;
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[17]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.ETXPath.__init__");
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF(__pyx_v_path);
  __pyx_v_namespaces = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":506
 *     def __init__(self, path, *, extensions=None, regexp=True,
 *                  smart_strings=True):
 *         path, namespaces = self._nsextract_path(path)             # <<<<<<<<<<<<<<
 *         XPath.__init__(self, path, namespaces=namespaces,
 *                        extensions=extensions, regexp=regexp,
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree_ETXPath *)((struct __pyx_obj_4lxml_5etree_ETXPath *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_vtab)->_nsextract_path(((struct __pyx_obj_4lxml_5etree_ETXPath *)__pyx_v_self), __pyx_v_path); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyTuple_CheckExact(__pyx_t_1) && likely(PyTuple_GET_SIZE(__pyx_t_1) == 2)) {
    PyObject* tuple = __pyx_t_1;
    __pyx_t_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_v_path);
    __pyx_v_path = __pyx_t_2;
    __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_v_namespaces);
    __pyx_v_namespaces = __pyx_t_3;
    __pyx_t_3 = 0;
  } else {
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_4, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_4, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_EndUnpack(__pyx_t_4, 2) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_v_path);
    __pyx_v_path = __pyx_t_2;
    __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_v_namespaces);
    __pyx_v_namespaces = __pyx_t_3;
    __pyx_t_3 = 0;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":507
 *                  smart_strings=True):
 *         path, namespaces = self._nsextract_path(path)
 *         XPath.__init__(self, path, namespaces=namespaces,             # <<<<<<<<<<<<<<
 *                        extensions=extensions, regexp=regexp,
 *                        smart_strings=smart_strings)
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_XPath)), __pyx_n_s____init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __Pyx_INCREF(__pyx_v_path);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_path);
  __Pyx_GIVEREF(__pyx_v_path);
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__namespaces), __pyx_v_namespaces) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":508
 *         path, namespaces = self._nsextract_path(path)
 *         XPath.__init__(self, path, namespaces=namespaces,
 *                        extensions=extensions, regexp=regexp,             # <<<<<<<<<<<<<<
 *                        smart_strings=smart_strings)
 * 
 */
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__extensions), __pyx_v_extensions) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__regexp), __pyx_v_regexp) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":509
 *         XPath.__init__(self, path, namespaces=namespaces,
 *                        extensions=extensions, regexp=regexp,
 *                        smart_strings=smart_strings)             # <<<<<<<<<<<<<<
 * 
 *     cdef _nsextract_path(self, path):
 */
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__smart_strings), __pyx_v_smart_strings) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.ETXPath.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_namespaces);
  __Pyx_DECREF(__pyx_v_path);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":511
 *                        smart_strings=smart_strings)
 * 
 *     cdef _nsextract_path(self, path):             # <<<<<<<<<<<<<<
 *         # replace {namespaces} by new prefixes
 *         cdef dict namespaces = {}
 */

static  PyObject *__pyx_f_4lxml_5etree_7ETXPath__nsextract_path(struct __pyx_obj_4lxml_5etree_ETXPath *__pyx_v_self, PyObject *__pyx_v_path) {
  PyObject *__pyx_v_namespaces = 0;
  PyObject *__pyx_v_namespace_defs = 0;
  int __pyx_v_i;
  PyObject *__pyx_v_path_utf;
  PyObject *__pyx_v_stripped_path;
  PyObject *__pyx_v_namespace_def;
  PyObject *__pyx_v_prefix;
  PyObject *__pyx_v_namespace;
  PyObject *__pyx_v_prefix_str;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("_nsextract_path");
  __Pyx_INCREF(__pyx_v_path);
  __pyx_v_path_utf = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_stripped_path = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_namespace_def = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_prefix = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_namespace = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_prefix_str = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":513
 *     cdef _nsextract_path(self, path):
 *         # replace {namespaces} by new prefixes
 *         cdef dict namespaces = {}             # <<<<<<<<<<<<<<
 *         cdef list namespace_defs = []
 *         cdef int i
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_namespaces = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":514
 *         # replace {namespaces} by new prefixes
 *         cdef dict namespaces = {}
 *         cdef list namespace_defs = []             # <<<<<<<<<<<<<<
 *         cdef int i
 *         path_utf = _utf8(path)
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_namespace_defs = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":516
 *         cdef list namespace_defs = []
 *         cdef int i
 *         path_utf = _utf8(path)             # <<<<<<<<<<<<<<
 *         stripped_path = _replace_strings(b'', path_utf) # remove string literals
 *         i = 1
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_v_path)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_v_path_utf);
  __pyx_v_path_utf = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":517
 *         cdef int i
 *         path_utf = _utf8(path)
 *         stripped_path = _replace_strings(b'', path_utf) # remove string literals             # <<<<<<<<<<<<<<
 *         i = 1
 *         for namespace_def in _find_namespaces(stripped_path):
 */
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(((PyObject *)__pyx_kp_b_25));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_b_25));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_b_25));
  __Pyx_INCREF(__pyx_v_path_utf);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_path_utf);
  __Pyx_GIVEREF(__pyx_v_path_utf);
  __pyx_t_2 = PyObject_Call(__pyx_v_4lxml_5etree__replace_strings, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_v_stripped_path);
  __pyx_v_stripped_path = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":518
 *         path_utf = _utf8(path)
 *         stripped_path = _replace_strings(b'', path_utf) # remove string literals
 *         i = 1             # <<<<<<<<<<<<<<
 *         for namespace_def in _find_namespaces(stripped_path):
 *             if namespace_def not in namespace_defs:
 */
  __pyx_v_i = 1;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":519
 *         stripped_path = _replace_strings(b'', path_utf) # remove string literals
 *         i = 1
 *         for namespace_def in _find_namespaces(stripped_path):             # <<<<<<<<<<<<<<
 *             if namespace_def not in namespace_defs:
 *                 prefix = python.PyBytes_FromFormat("__xpp%02d", i)
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(__pyx_v_stripped_path);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_stripped_path);
  __Pyx_GIVEREF(__pyx_v_stripped_path);
  __pyx_t_1 = PyObject_Call(__pyx_v_4lxml_5etree__find_namespaces, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_3 = 0; __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2);
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(PyList_CheckExact(__pyx_t_2))) {
      if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++;
    } else if (likely(PyTuple_CheckExact(__pyx_t_2))) {
      if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++;
    } else {
      __pyx_t_1 = PyIter_Next(__pyx_t_2);
      if (!__pyx_t_1) {
        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_v_namespace_def);
    __pyx_v_namespace_def = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":520
 *         i = 1
 *         for namespace_def in _find_namespaces(stripped_path):
 *             if namespace_def not in namespace_defs:             # <<<<<<<<<<<<<<
 *                 prefix = python.PyBytes_FromFormat("__xpp%02d", i)
 *                 i += 1
 */
    __pyx_t_4 = (__Pyx_NegateNonNeg(PySequence_Contains(((PyObject *)__pyx_v_namespace_defs), __pyx_v_namespace_def))); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_4) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":521
 *         for namespace_def in _find_namespaces(stripped_path):
 *             if namespace_def not in namespace_defs:
 *                 prefix = python.PyBytes_FromFormat("__xpp%02d", i)             # <<<<<<<<<<<<<<
 *                 i += 1
 *                 namespace_defs.append(namespace_def)
 */
      __pyx_t_1 = ((PyObject *)PyBytes_FromFormat(__pyx_k_345, __pyx_v_i)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(((PyObject *)__pyx_v_prefix));
      __pyx_v_prefix = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":522
 *             if namespace_def not in namespace_defs:
 *                 prefix = python.PyBytes_FromFormat("__xpp%02d", i)
 *                 i += 1             # <<<<<<<<<<<<<<
 *                 namespace_defs.append(namespace_def)
 *                 namespace = namespace_def[1:-1] # remove '{}'
 */
      __pyx_v_i = (__pyx_v_i + 1);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":523
 *                 prefix = python.PyBytes_FromFormat("__xpp%02d", i)
 *                 i += 1
 *                 namespace_defs.append(namespace_def)             # <<<<<<<<<<<<<<
 *                 namespace = namespace_def[1:-1] # remove '{}'
 *                 namespace = python.PyUnicode_FromEncodedObject(
 */
      if (unlikely(__pyx_v_namespace_defs == Py_None)) {
        PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[17]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
      }
      __pyx_t_5 = PyList_Append(__pyx_v_namespace_defs, __pyx_v_namespace_def); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":524
 *                 i += 1
 *                 namespace_defs.append(namespace_def)
 *                 namespace = namespace_def[1:-1] # remove '{}'             # <<<<<<<<<<<<<<
 *                 namespace = python.PyUnicode_FromEncodedObject(
 *                     namespace, 'UTF-8', 'strict')
 */
      __pyx_t_1 = __Pyx_PySequence_GetSlice(__pyx_v_namespace_def, 1, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_v_namespace);
      __pyx_v_namespace = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":526
 *                 namespace = namespace_def[1:-1] # remove '{}'
 *                 namespace = python.PyUnicode_FromEncodedObject(
 *                     namespace, 'UTF-8', 'strict')             # <<<<<<<<<<<<<<
 *                 namespaces[
 *                     python.PyUnicode_FromEncodedObject(prefix, 'UTF-8', 'strict')
 */
      __pyx_t_1 = ((PyObject *)PyUnicode_FromEncodedObject(__pyx_v_namespace, __pyx_k_31, __pyx_k__strict)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_v_namespace);
      __pyx_v_namespace = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":528
 *                     namespace, 'UTF-8', 'strict')
 *                 namespaces[
 *                     python.PyUnicode_FromEncodedObject(prefix, 'UTF-8', 'strict')             # <<<<<<<<<<<<<<
 *                     ] = namespace
 *                 prefix_str = prefix + b':'
 */
      __pyx_t_1 = ((PyObject *)PyUnicode_FromEncodedObject(((PyObject *)__pyx_v_prefix), __pyx_k_31, __pyx_k__strict)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(((PyObject *)__pyx_v_namespaces), __pyx_t_1, __pyx_v_namespace) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":530
 *                     python.PyUnicode_FromEncodedObject(prefix, 'UTF-8', 'strict')
 *                     ] = namespace
 *                 prefix_str = prefix + b':'             # <<<<<<<<<<<<<<
 *                 # FIXME: this also replaces {namespaces} within strings!
 *                 path_utf = path_utf.replace(namespace_def, prefix_str)
 */
      __pyx_t_1 = PyNumber_Add(((PyObject *)__pyx_v_prefix), ((PyObject *)__pyx_kp_b_346)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      __Pyx_DECREF(((PyObject *)__pyx_v_prefix_str));
      __pyx_v_prefix_str = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":532
 *                 prefix_str = prefix + b':'
 *                 # FIXME: this also replaces {namespaces} within strings!
 *                 path_utf = path_utf.replace(namespace_def, prefix_str)             # <<<<<<<<<<<<<<
 *         path = python.PyUnicode_FromEncodedObject(path_utf, 'UTF-8', 'strict')
 *         return path, namespaces
 */
      __pyx_t_1 = PyObject_GetAttr(__pyx_v_path_utf, __pyx_n_s__replace); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
      __Pyx_INCREF(__pyx_v_namespace_def);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_namespace_def);
      __Pyx_GIVEREF(__pyx_v_namespace_def);
      __Pyx_INCREF(((PyObject *)__pyx_v_prefix_str));
      PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_v_prefix_str));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_prefix_str));
      __pyx_t_7 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_v_path_utf);
      __pyx_v_path_utf = __pyx_t_7;
      __pyx_t_7 = 0;
      goto __pyx_L5;
    }
    __pyx_L5:;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":533
 *                 # FIXME: this also replaces {namespaces} within strings!
 *                 path_utf = path_utf.replace(namespace_def, prefix_str)
 *         path = python.PyUnicode_FromEncodedObject(path_utf, 'UTF-8', 'strict')             # <<<<<<<<<<<<<<
 *         return path, namespaces
 */
  __pyx_t_2 = ((PyObject *)PyUnicode_FromEncodedObject(__pyx_v_path_utf, __pyx_k_31, __pyx_k__strict)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_v_path);
  __pyx_v_path = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":534
 *                 path_utf = path_utf.replace(namespace_def, prefix_str)
 *         path = python.PyUnicode_FromEncodedObject(path_utf, 'UTF-8', 'strict')
 *         return path, namespaces             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 534; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(__pyx_v_path);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_path);
  __Pyx_GIVEREF(__pyx_v_path);
  __Pyx_INCREF(((PyObject *)__pyx_v_namespaces));
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_namespaces));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_namespaces));
  __pyx_r = ((PyObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree.ETXPath._nsextract_path");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_namespaces);
  __Pyx_XDECREF(__pyx_v_namespace_defs);
  __Pyx_DECREF(__pyx_v_path_utf);
  __Pyx_DECREF(__pyx_v_stripped_path);
  __Pyx_DECREF(__pyx_v_namespace_def);
  __Pyx_DECREF(__pyx_v_prefix);
  __Pyx_DECREF(__pyx_v_namespace);
  __Pyx_DECREF(__pyx_v_prefix_str);
  __Pyx_DECREF(__pyx_v_path);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":54
 *     cdef _BaseParser _parser
 * 
 *     cdef _XSLTResolverContext _copy(self):             # <<<<<<<<<<<<<<
 *         cdef _XSLTResolverContext context
 *         context = _XSLTResolverContext()
 */

static  struct __pyx_obj_4lxml_5etree__XSLTResolverContext *__pyx_f_4lxml_5etree_20_XSLTResolverContext__copy(struct __pyx_obj_4lxml_5etree__XSLTResolverContext *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree__XSLTResolverContext *__pyx_v_context;
  struct __pyx_obj_4lxml_5etree__XSLTResolverContext *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_copy");
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__XSLTResolverContext *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":56
 *     cdef _XSLTResolverContext _copy(self):
 *         cdef _XSLTResolverContext context
 *         context = _XSLTResolverContext()             # <<<<<<<<<<<<<<
 *         _initXSLTResolverContext(context, self._parser)
 *         context._c_style_doc = self._c_style_doc
 */
  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__XSLTResolverContext)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_context));
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__XSLTResolverContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":57
 *         cdef _XSLTResolverContext context
 *         context = _XSLTResolverContext()
 *         _initXSLTResolverContext(context, self._parser)             # <<<<<<<<<<<<<<
 *         context._c_style_doc = self._c_style_doc
 *         return context
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_parser);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__initXSLTResolverContext(__pyx_v_context, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":58
 *         context = _XSLTResolverContext()
 *         _initXSLTResolverContext(context, self._parser)
 *         context._c_style_doc = self._c_style_doc             # <<<<<<<<<<<<<<
 *         return context
 * 
 */
  __pyx_v_context->_c_style_doc = __pyx_v_self->_c_style_doc;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":59
 *         _initXSLTResolverContext(context, self._parser)
 *         context._c_style_doc = self._c_style_doc
 *         return context             # <<<<<<<<<<<<<<
 * 
 * cdef _initXSLTResolverContext(_XSLTResolverContext context,
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_context));
  __pyx_r = __pyx_v_context;
  goto __pyx_L0;

  __pyx_r = ((struct __pyx_obj_4lxml_5etree__XSLTResolverContext *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._XSLTResolverContext._copy");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_context);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":61
 *         return context
 * 
 * cdef _initXSLTResolverContext(_XSLTResolverContext context,             # <<<<<<<<<<<<<<
 *                               _BaseParser parser):
 *     _initResolverContext(context, parser.resolvers)
 */

static  PyObject *__pyx_f_4lxml_5etree__initXSLTResolverContext(struct __pyx_obj_4lxml_5etree__XSLTResolverContext *__pyx_v_context, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_initXSLTResolverContext");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":63
 * cdef _initXSLTResolverContext(_XSLTResolverContext context,
 *                               _BaseParser parser):
 *     _initResolverContext(context, parser.resolvers)             # <<<<<<<<<<<<<<
 *     context._parser = parser
 *     context._c_style_doc = NULL
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_parser), __pyx_n_s__resolvers); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__ResolverRegistry))))) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = __pyx_f_4lxml_5etree__initResolverContext(((struct __pyx_obj_4lxml_5etree__ResolverContext *)__pyx_v_context), ((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":64
 *                               _BaseParser parser):
 *     _initResolverContext(context, parser.resolvers)
 *     context._parser = parser             # <<<<<<<<<<<<<<
 *     context._c_style_doc = NULL
 * 
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_parser));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_parser));
  __Pyx_GOTREF(__pyx_v_context->_parser);
  __Pyx_DECREF(((PyObject *)__pyx_v_context->_parser));
  __pyx_v_context->_parser = __pyx_v_parser;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":65
 *     _initResolverContext(context, parser.resolvers)
 *     context._parser = parser
 *     context._c_style_doc = NULL             # <<<<<<<<<<<<<<
 * 
 * cdef xmlDoc* _xslt_resolve_from_python(char* c_uri, void* c_context,
 */
  __pyx_v_context->_c_style_doc = NULL;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._initXSLTResolverContext");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":67
 *     context._c_style_doc = NULL
 * 
 * cdef xmlDoc* _xslt_resolve_from_python(char* c_uri, void* c_context,             # <<<<<<<<<<<<<<
 *                                        int parse_options, int* error) with gil:
 *     # call the Python document loaders
 */

static  xmlDoc *__pyx_f_4lxml_5etree__xslt_resolve_from_python(char *__pyx_v_c_uri, void *__pyx_v_c_context, int __pyx_v_parse_options, int *__pyx_v_error) {
  struct __pyx_obj_4lxml_5etree__XSLTResolverContext *__pyx_v_context;
  struct __pyx_obj_4lxml_5etree__ResolverRegistry *__pyx_v_resolvers;
  struct __pyx_obj_4lxml_5etree__InputDocument *__pyx_v_doc_ref;
  xmlDoc *__pyx_v_c_doc;
  PyObject *__pyx_v_uri;
  xmlDoc *__pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  xmlDoc *__pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  xmlDoc *__pyx_t_8;
  xmlDoc *__pyx_t_9;
  xmlDoc *__pyx_t_10;
  xmlDoc *__pyx_t_11;
  #ifdef WITH_THREAD
  PyGILState_STATE _save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_xslt_resolve_from_python");
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__XSLTResolverContext *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_resolvers = ((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_doc_ref = ((struct __pyx_obj_4lxml_5etree__InputDocument *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_uri = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":75
 *     cdef xmlDoc* c_doc
 * 
 *     error[0] = 0             # <<<<<<<<<<<<<<
 *     context = <_XSLTResolverContext>c_context
 * 
 */
  (__pyx_v_error[0]) = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":76
 * 
 *     error[0] = 0
 *     context = <_XSLTResolverContext>c_context             # <<<<<<<<<<<<<<
 * 
 *     # shortcut if we resolve the stylesheet itself
 */
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__XSLTResolverContext *)__pyx_v_c_context)));
  __Pyx_DECREF(((PyObject *)__pyx_v_context));
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__XSLTResolverContext *)__pyx_v_c_context);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":79
 * 
 *     # shortcut if we resolve the stylesheet itself
 *     c_doc = context._c_style_doc             # <<<<<<<<<<<<<<
 *     if c_doc is not NULL and c_doc.URL is not NULL:
 *         if cstd.strcmp(c_uri, c_doc.URL) == 0:
 */
  __pyx_v_c_doc = __pyx_v_context->_c_style_doc;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":80
 *     # shortcut if we resolve the stylesheet itself
 *     c_doc = context._c_style_doc
 *     if c_doc is not NULL and c_doc.URL is not NULL:             # <<<<<<<<<<<<<<
 *         if cstd.strcmp(c_uri, c_doc.URL) == 0:
 *             return _copyDoc(c_doc, 1)
 */
  __pyx_t_1 = (__pyx_v_c_doc != NULL);
  if (__pyx_t_1) {
    __pyx_t_2 = (__pyx_v_c_doc->URL != NULL);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":81
 *     c_doc = context._c_style_doc
 *     if c_doc is not NULL and c_doc.URL is not NULL:
 *         if cstd.strcmp(c_uri, c_doc.URL) == 0:             # <<<<<<<<<<<<<<
 *             return _copyDoc(c_doc, 1)
 * 
 */
    __pyx_t_3 = (strcmp(__pyx_v_c_uri, __pyx_v_c_doc->URL) == 0);
    if (__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":82
 *     if c_doc is not NULL and c_doc.URL is not NULL:
 *         if cstd.strcmp(c_uri, c_doc.URL) == 0:
 *             return _copyDoc(c_doc, 1)             # <<<<<<<<<<<<<<
 * 
 *     # delegate to the Python resolvers
 */
      __pyx_t_4 = __pyx_f_4lxml_5etree__copyDoc(__pyx_v_c_doc, 1); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = __pyx_t_4;
      goto __pyx_L0;
      goto __pyx_L4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":85
 * 
 *     # delegate to the Python resolvers
 *     try:             # <<<<<<<<<<<<<<
 *         resolvers = context._resolvers
 *         if cstd.strncmp('string://__STRING__XSLT__/', c_uri, 26) == 0:
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":86
 *     # delegate to the Python resolvers
 *     try:
 *         resolvers = context._resolvers             # <<<<<<<<<<<<<<
 *         if cstd.strncmp('string://__STRING__XSLT__/', c_uri, 26) == 0:
 *             c_uri += 26
 */
      __Pyx_INCREF(((PyObject *)__pyx_v_context->__pyx_base._resolvers));
      __Pyx_DECREF(((PyObject *)__pyx_v_resolvers));
      __pyx_v_resolvers = __pyx_v_context->__pyx_base._resolvers;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":87
 *     try:
 *         resolvers = context._resolvers
 *         if cstd.strncmp('string://__STRING__XSLT__/', c_uri, 26) == 0:             # <<<<<<<<<<<<<<
 *             c_uri += 26
 *         uri = _decodeFilename(c_uri)
 */
      __pyx_t_3 = (strncmp(__pyx_k_347, __pyx_v_c_uri, 26) == 0);
      if (__pyx_t_3) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":88
 *         resolvers = context._resolvers
 *         if cstd.strncmp('string://__STRING__XSLT__/', c_uri, 26) == 0:
 *             c_uri += 26             # <<<<<<<<<<<<<<
 *         uri = _decodeFilename(c_uri)
 *         doc_ref = resolvers.resolve(uri, None, context)
 */
        __pyx_v_c_uri = (__pyx_v_c_uri + 26);
        goto __pyx_L13;
      }
      __pyx_L13:;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":89
 *         if cstd.strncmp('string://__STRING__XSLT__/', c_uri, 26) == 0:
 *             c_uri += 26
 *         uri = _decodeFilename(c_uri)             # <<<<<<<<<<<<<<
 *         doc_ref = resolvers.resolve(uri, None, context)
 * 
 */
      __pyx_t_5 = __pyx_f_4lxml_5etree__decodeFilename(__pyx_v_c_uri); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_v_uri);
      __pyx_v_uri = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":90
 *             c_uri += 26
 *         uri = _decodeFilename(c_uri)
 *         doc_ref = resolvers.resolve(uri, None, context)             # <<<<<<<<<<<<<<
 * 
 *         c_doc = NULL
 */
      __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_resolvers), __pyx_n_s__resolve); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
      __Pyx_INCREF(__pyx_v_uri);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_uri);
      __Pyx_GIVEREF(__pyx_v_uri);
      __Pyx_INCREF(Py_None);
      PyTuple_SET_ITEM(__pyx_t_6, 1, Py_None);
      __Pyx_GIVEREF(Py_None);
      __Pyx_INCREF(((PyObject *)__pyx_v_context));
      PyTuple_SET_ITEM(__pyx_t_6, 2, ((PyObject *)__pyx_v_context));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_context));
      __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
      if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_4lxml_5etree__InputDocument))))) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_DECREF(((PyObject *)__pyx_v_doc_ref));
      __pyx_v_doc_ref = ((struct __pyx_obj_4lxml_5etree__InputDocument *)__pyx_t_7);
      __pyx_t_7 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":92
 *         doc_ref = resolvers.resolve(uri, None, context)
 * 
 *         c_doc = NULL             # <<<<<<<<<<<<<<
 *         if doc_ref is not None:
 *             if doc_ref._type == PARSER_DATA_STRING:
 */
      __pyx_v_c_doc = NULL;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":93
 * 
 *         c_doc = NULL
 *         if doc_ref is not None:             # <<<<<<<<<<<<<<
 *             if doc_ref._type == PARSER_DATA_STRING:
 *                 c_doc = _parseDoc(
 */
      __pyx_t_3 = (((PyObject *)__pyx_v_doc_ref) != Py_None);
      if (__pyx_t_3) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":94
 *         c_doc = NULL
 *         if doc_ref is not None:
 *             if doc_ref._type == PARSER_DATA_STRING:             # <<<<<<<<<<<<<<
 *                 c_doc = _parseDoc(
 *                     doc_ref._data_bytes, doc_ref._filename, context._parser)
 */
        __pyx_t_3 = (__pyx_v_doc_ref->_type == __pyx_e_4lxml_5etree_PARSER_DATA_STRING);
        if (__pyx_t_3) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":96
 *             if doc_ref._type == PARSER_DATA_STRING:
 *                 c_doc = _parseDoc(
 *                     doc_ref._data_bytes, doc_ref._filename, context._parser)             # <<<<<<<<<<<<<<
 *             elif doc_ref._type == PARSER_DATA_FILENAME:
 *                 c_doc = _parseDocFromFile(doc_ref._filename, context._parser)
 */
          __pyx_t_7 = __pyx_v_doc_ref->_data_bytes;
          __Pyx_INCREF(__pyx_t_7);
          __pyx_t_6 = __pyx_v_doc_ref->_filename;
          __Pyx_INCREF(__pyx_t_6);
          __pyx_t_5 = ((PyObject *)__pyx_v_context->_parser);
          __Pyx_INCREF(__pyx_t_5);
          __pyx_t_8 = __pyx_f_4lxml_5etree__parseDoc(__pyx_t_7, __pyx_t_6, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_5)); if (unlikely(__pyx_t_8 == NULL)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __pyx_v_c_doc = __pyx_t_8;
          goto __pyx_L15;
        }

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":97
 *                 c_doc = _parseDoc(
 *                     doc_ref._data_bytes, doc_ref._filename, context._parser)
 *             elif doc_ref._type == PARSER_DATA_FILENAME:             # <<<<<<<<<<<<<<
 *                 c_doc = _parseDocFromFile(doc_ref._filename, context._parser)
 *             elif doc_ref._type == PARSER_DATA_FILE:
 */
        __pyx_t_3 = (__pyx_v_doc_ref->_type == __pyx_e_4lxml_5etree_PARSER_DATA_FILENAME);
        if (__pyx_t_3) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":98
 *                     doc_ref._data_bytes, doc_ref._filename, context._parser)
 *             elif doc_ref._type == PARSER_DATA_FILENAME:
 *                 c_doc = _parseDocFromFile(doc_ref._filename, context._parser)             # <<<<<<<<<<<<<<
 *             elif doc_ref._type == PARSER_DATA_FILE:
 *                 c_doc = _parseDocFromFilelike(
 */
          __pyx_t_5 = __pyx_v_doc_ref->_filename;
          __Pyx_INCREF(__pyx_t_5);
          __pyx_t_6 = ((PyObject *)__pyx_v_context->_parser);
          __Pyx_INCREF(__pyx_t_6);
          __pyx_t_9 = __pyx_f_4lxml_5etree__parseDocFromFile(__pyx_t_5, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_6)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_v_c_doc = __pyx_t_9;
          goto __pyx_L15;
        }

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":99
 *             elif doc_ref._type == PARSER_DATA_FILENAME:
 *                 c_doc = _parseDocFromFile(doc_ref._filename, context._parser)
 *             elif doc_ref._type == PARSER_DATA_FILE:             # <<<<<<<<<<<<<<
 *                 c_doc = _parseDocFromFilelike(
 *                     doc_ref._file, doc_ref._filename, context._parser)
 */
        __pyx_t_3 = (__pyx_v_doc_ref->_type == __pyx_e_4lxml_5etree_PARSER_DATA_FILE);
        if (__pyx_t_3) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":101
 *             elif doc_ref._type == PARSER_DATA_FILE:
 *                 c_doc = _parseDocFromFilelike(
 *                     doc_ref._file, doc_ref._filename, context._parser)             # <<<<<<<<<<<<<<
 *             elif doc_ref._type == PARSER_DATA_EMPTY:
 *                 c_doc = _newXMLDoc()
 */
          __pyx_t_6 = __pyx_v_doc_ref->_file;
          __Pyx_INCREF(__pyx_t_6);
          __pyx_t_5 = __pyx_v_doc_ref->_filename;
          __Pyx_INCREF(__pyx_t_5);
          __pyx_t_7 = ((PyObject *)__pyx_v_context->_parser);
          __Pyx_INCREF(__pyx_t_7);
          __pyx_t_10 = __pyx_f_4lxml_5etree__parseDocFromFilelike(__pyx_t_6, __pyx_t_5, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_7)); if (unlikely(__pyx_t_10 == NULL)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_v_c_doc = __pyx_t_10;
          goto __pyx_L15;
        }

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":102
 *                 c_doc = _parseDocFromFilelike(
 *                     doc_ref._file, doc_ref._filename, context._parser)
 *             elif doc_ref._type == PARSER_DATA_EMPTY:             # <<<<<<<<<<<<<<
 *                 c_doc = _newXMLDoc()
 *             if c_doc is not NULL and c_doc.URL is NULL:
 */
        __pyx_t_3 = (__pyx_v_doc_ref->_type == __pyx_e_4lxml_5etree_PARSER_DATA_EMPTY);
        if (__pyx_t_3) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":103
 *                     doc_ref._file, doc_ref._filename, context._parser)
 *             elif doc_ref._type == PARSER_DATA_EMPTY:
 *                 c_doc = _newXMLDoc()             # <<<<<<<<<<<<<<
 *             if c_doc is not NULL and c_doc.URL is NULL:
 *                 c_doc.URL = tree.xmlStrdup(c_uri)
 */
          __pyx_t_11 = __pyx_f_4lxml_5etree__newXMLDoc(); if (unlikely(__pyx_t_11 == NULL)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
          __pyx_v_c_doc = __pyx_t_11;
          goto __pyx_L15;
        }
        __pyx_L15:;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":104
 *             elif doc_ref._type == PARSER_DATA_EMPTY:
 *                 c_doc = _newXMLDoc()
 *             if c_doc is not NULL and c_doc.URL is NULL:             # <<<<<<<<<<<<<<
 *                 c_doc.URL = tree.xmlStrdup(c_uri)
 *         return c_doc
 */
        __pyx_t_3 = (__pyx_v_c_doc != NULL);
        if (__pyx_t_3) {
          __pyx_t_1 = (__pyx_v_c_doc->URL == NULL);
          __pyx_t_2 = __pyx_t_1;
        } else {
          __pyx_t_2 = __pyx_t_3;
        }
        if (__pyx_t_2) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":105
 *                 c_doc = _newXMLDoc()
 *             if c_doc is not NULL and c_doc.URL is NULL:
 *                 c_doc.URL = tree.xmlStrdup(c_uri)             # <<<<<<<<<<<<<<
 *         return c_doc
 *     except:
 */
          __pyx_v_c_doc->URL = xmlStrdup(__pyx_v_c_uri);
          goto __pyx_L16;
        }
        __pyx_L16:;
        goto __pyx_L14;
      }
      __pyx_L14:;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":106
 *             if c_doc is not NULL and c_doc.URL is NULL:
 *                 c_doc.URL = tree.xmlStrdup(c_uri)
 *         return c_doc             # <<<<<<<<<<<<<<
 *     except:
 *         context._store_raised()
 */
      __pyx_r = __pyx_v_c_doc;
      goto __pyx_L9_try_return;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L12_try_end;
    __pyx_L9_try_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":107
 *                 c_doc.URL = tree.xmlStrdup(c_uri)
 *         return c_doc
 *     except:             # <<<<<<<<<<<<<<
 *         context._store_raised()
 *         error[0] = 1
 */
    /*except:*/ {
      __Pyx_AddTraceback("lxml.etree._xslt_resolve_from_python");
      if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_5, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_6);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":108
 *         return c_doc
 *     except:
 *         context._store_raised()             # <<<<<<<<<<<<<<
 *         error[0] = 1
 *         return NULL
 */
      ((struct __pyx_vtabstruct_4lxml_5etree__XSLTResolverContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._store_raised(((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_v_context));

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":109
 *     except:
 *         context._store_raised()
 *         error[0] = 1             # <<<<<<<<<<<<<<
 *         return NULL
 * 
 */
      (__pyx_v_error[0]) = 1;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":110
 *         context._store_raised()
 *         error[0] = 1
 *         return NULL             # <<<<<<<<<<<<<<
 * 
 * cdef void _xslt_store_resolver_exception(char* c_uri, void* context,
 */
      __pyx_r = NULL;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L8_except_return;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L6_exception_handled;
    }
    __pyx_L7_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L8_except_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;
    __pyx_L6_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L12_try_end:;
  }

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_WriteUnraisable("lxml.etree._xslt_resolve_from_python");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_context);
  __Pyx_DECREF((PyObject *)__pyx_v_resolvers);
  __Pyx_DECREF((PyObject *)__pyx_v_doc_ref);
  __Pyx_DECREF(__pyx_v_uri);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(_save);
  #endif
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":112
 *         return NULL
 * 
 * cdef void _xslt_store_resolver_exception(char* c_uri, void* context,             # <<<<<<<<<<<<<<
 *                                          xslt.xsltLoadType c_type) with gil:
 *     try:
 */

static  void __pyx_f_4lxml_5etree__xslt_store_resolver_exception(char *__pyx_v_c_uri, void *__pyx_v_context, xsltLoadType __pyx_v_c_type) {
  PyObject *__pyx_v_message;
  PyObject *__pyx_v_exception;
  PyObject *__pyx_v_e;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  #ifdef WITH_THREAD
  PyGILState_STATE _save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_xslt_store_resolver_exception");
  __pyx_v_message = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_exception = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_e = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":114
 * cdef void _xslt_store_resolver_exception(char* c_uri, void* context,
 *                                          xslt.xsltLoadType c_type) with gil:
 *     try:             # <<<<<<<<<<<<<<
 *         message = u"Cannot resolve URI %s" % _decodeFilename(c_uri)
 *         if c_type == xslt.XSLT_LOAD_DOCUMENT:
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":115
 *                                          xslt.xsltLoadType c_type) with gil:
 *     try:
 *         message = u"Cannot resolve URI %s" % _decodeFilename(c_uri)             # <<<<<<<<<<<<<<
 *         if c_type == xslt.XSLT_LOAD_DOCUMENT:
 *             exception = XSLTApplyError(message)
 */
      __pyx_t_1 = __pyx_f_4lxml_5etree__decodeFilename(__pyx_v_c_uri); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_348), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_v_message));
      __pyx_v_message = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":116
 *     try:
 *         message = u"Cannot resolve URI %s" % _decodeFilename(c_uri)
 *         if c_type == xslt.XSLT_LOAD_DOCUMENT:             # <<<<<<<<<<<<<<
 *             exception = XSLTApplyError(message)
 *         else:
 */
      __pyx_t_3 = (__pyx_v_c_type == XSLT_LOAD_DOCUMENT);
      if (__pyx_t_3) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":117
 *         message = u"Cannot resolve URI %s" % _decodeFilename(c_uri)
 *         if c_type == xslt.XSLT_LOAD_DOCUMENT:
 *             exception = XSLTApplyError(message)             # <<<<<<<<<<<<<<
 *         else:
 *             exception = XSLTParseError(message)
 */
        __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__XSLTApplyError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_1));
        __Pyx_INCREF(((PyObject *)__pyx_v_message));
        PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_message));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_message));
        __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_v_exception);
        __pyx_v_exception = __pyx_t_4;
        __pyx_t_4 = 0;
        goto __pyx_L11;
      }
      /*else*/ {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":119
 *             exception = XSLTApplyError(message)
 *         else:
 *             exception = XSLTParseError(message)             # <<<<<<<<<<<<<<
 *         (<_XSLTResolverContext>context)._store_exception(exception)
 *     except Exception, e:
 */
        __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__XSLTParseError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_1));
        __Pyx_INCREF(((PyObject *)__pyx_v_message));
        PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_message));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_message));
        __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_v_exception);
        __pyx_v_exception = __pyx_t_2;
        __pyx_t_2 = 0;
      }
      __pyx_L11:;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":120
 *         else:
 *             exception = XSLTParseError(message)
 *         (<_XSLTResolverContext>context)._store_exception(exception)             # <<<<<<<<<<<<<<
 *     except Exception, e:
 *         (<_XSLTResolverContext>context)._store_exception(e)
 */
      ((struct __pyx_vtabstruct_4lxml_5etree__XSLTResolverContext *)((struct __pyx_obj_4lxml_5etree__XSLTResolverContext *)__pyx_v_context)->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._store_exception(((struct __pyx_obj_4lxml_5etree__ExceptionContext *)((struct __pyx_obj_4lxml_5etree__XSLTResolverContext *)__pyx_v_context)), __pyx_v_exception);
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L10_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":121
 *             exception = XSLTParseError(message)
 *         (<_XSLTResolverContext>context)._store_exception(exception)
 *     except Exception, e:             # <<<<<<<<<<<<<<
 *         (<_XSLTResolverContext>context)._store_exception(e)
 * 
 */
    __pyx_t_5 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("lxml.etree._xslt_store_resolver_exception");
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_v_e);
      __pyx_v_e = __pyx_t_1;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":122
 *         (<_XSLTResolverContext>context)._store_exception(exception)
 *     except Exception, e:
 *         (<_XSLTResolverContext>context)._store_exception(e)             # <<<<<<<<<<<<<<
 * 
 * cdef xmlDoc* _xslt_doc_loader(char* c_uri, tree.xmlDict* c_dict,
 */
      ((struct __pyx_vtabstruct_4lxml_5etree__XSLTResolverContext *)((struct __pyx_obj_4lxml_5etree__XSLTResolverContext *)__pyx_v_context)->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._store_exception(((struct __pyx_obj_4lxml_5etree__ExceptionContext *)((struct __pyx_obj_4lxml_5etree__XSLTResolverContext *)__pyx_v_context)), __pyx_v_e);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L4_exception_handled;
    }
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L10_try_end:;
  }

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_WriteUnraisable("lxml.etree._xslt_store_resolver_exception");
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_message);
  __Pyx_DECREF(__pyx_v_exception);
  __Pyx_DECREF(__pyx_v_e);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(_save);
  #endif
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":124
 *         (<_XSLTResolverContext>context)._store_exception(e)
 * 
 * cdef xmlDoc* _xslt_doc_loader(char* c_uri, tree.xmlDict* c_dict,             # <<<<<<<<<<<<<<
 *                               int parse_options, void* c_ctxt,
 *                               xslt.xsltLoadType c_type) nogil:
 */

static  xmlDoc *__pyx_f_4lxml_5etree__xslt_doc_loader(char *__pyx_v_c_uri, xmlDict *__pyx_v_c_dict, int __pyx_v_parse_options, void *__pyx_v_c_ctxt, xsltLoadType __pyx_v_c_type) {
  xmlDoc *__pyx_v_c_doc;
  void *__pyx_v_c_pcontext;
  int __pyx_v_error;
  xmlDoc *__pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":133
 *     cdef int error
 *     # find resolver contexts of stylesheet and transformed doc
 *     if c_type == xslt.XSLT_LOAD_DOCUMENT:             # <<<<<<<<<<<<<<
 *         # transformation time
 *         c_pcontext = (<xslt.xsltTransformContext*>c_ctxt)._private
 */
  __pyx_t_1 = (__pyx_v_c_type == XSLT_LOAD_DOCUMENT);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":135
 *     if c_type == xslt.XSLT_LOAD_DOCUMENT:
 *         # transformation time
 *         c_pcontext = (<xslt.xsltTransformContext*>c_ctxt)._private             # <<<<<<<<<<<<<<
 *     elif c_type == xslt.XSLT_LOAD_STYLESHEET:
 *         # include/import resolution while parsing
 */
    __pyx_v_c_pcontext = ((xsltTransformContext *)__pyx_v_c_ctxt)->_private;
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":136
 *         # transformation time
 *         c_pcontext = (<xslt.xsltTransformContext*>c_ctxt)._private
 *     elif c_type == xslt.XSLT_LOAD_STYLESHEET:             # <<<<<<<<<<<<<<
 *         # include/import resolution while parsing
 *         c_pcontext = (<xslt.xsltStylesheet*>c_ctxt).doc._private
 */
  __pyx_t_1 = (__pyx_v_c_type == XSLT_LOAD_STYLESHEET);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":138
 *     elif c_type == xslt.XSLT_LOAD_STYLESHEET:
 *         # include/import resolution while parsing
 *         c_pcontext = (<xslt.xsltStylesheet*>c_ctxt).doc._private             # <<<<<<<<<<<<<<
 *     else:
 *         c_pcontext = NULL
 */
    __pyx_v_c_pcontext = ((xsltStylesheet *)__pyx_v_c_ctxt)->doc->_private;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":140
 *         c_pcontext = (<xslt.xsltStylesheet*>c_ctxt).doc._private
 *     else:
 *         c_pcontext = NULL             # <<<<<<<<<<<<<<
 * 
 *     if c_pcontext is NULL:
 */
    __pyx_v_c_pcontext = NULL;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":142
 *         c_pcontext = NULL
 * 
 *     if c_pcontext is NULL:             # <<<<<<<<<<<<<<
 *         # can't call Python without context, fall back to default loader
 *         return XSLT_DOC_DEFAULT_LOADER(
 */
  __pyx_t_1 = (__pyx_v_c_pcontext == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":145
 *         # can't call Python without context, fall back to default loader
 *         return XSLT_DOC_DEFAULT_LOADER(
 *             c_uri, c_dict, parse_options, c_ctxt, c_type)             # <<<<<<<<<<<<<<
 * 
 *     c_doc = _xslt_resolve_from_python(c_uri, c_pcontext, parse_options, &error)
 */
    __pyx_r = __pyx_v_4lxml_5etree_XSLT_DOC_DEFAULT_LOADER(__pyx_v_c_uri, __pyx_v_c_dict, __pyx_v_parse_options, __pyx_v_c_ctxt, __pyx_v_c_type);
    goto __pyx_L0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":147
 *             c_uri, c_dict, parse_options, c_ctxt, c_type)
 * 
 *     c_doc = _xslt_resolve_from_python(c_uri, c_pcontext, parse_options, &error)             # <<<<<<<<<<<<<<
 *     if c_doc is NULL and not error:
 *         c_doc = XSLT_DOC_DEFAULT_LOADER(
 */
  __pyx_v_c_doc = __pyx_f_4lxml_5etree__xslt_resolve_from_python(__pyx_v_c_uri, __pyx_v_c_pcontext, __pyx_v_parse_options, (&__pyx_v_error));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":148
 * 
 *     c_doc = _xslt_resolve_from_python(c_uri, c_pcontext, parse_options, &error)
 *     if c_doc is NULL and not error:             # <<<<<<<<<<<<<<
 *         c_doc = XSLT_DOC_DEFAULT_LOADER(
 *             c_uri, c_dict, parse_options, c_ctxt, c_type)
 */
  __pyx_t_1 = (__pyx_v_c_doc == NULL);
  if (__pyx_t_1) {
    __pyx_t_2 = (!__pyx_v_error);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":150
 *     if c_doc is NULL and not error:
 *         c_doc = XSLT_DOC_DEFAULT_LOADER(
 *             c_uri, c_dict, parse_options, c_ctxt, c_type)             # <<<<<<<<<<<<<<
 *         if c_doc is NULL:
 *             _xslt_store_resolver_exception(c_uri, c_pcontext, c_type)
 */
    __pyx_v_c_doc = __pyx_v_4lxml_5etree_XSLT_DOC_DEFAULT_LOADER(__pyx_v_c_uri, __pyx_v_c_dict, __pyx_v_parse_options, __pyx_v_c_ctxt, __pyx_v_c_type);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":151
 *         c_doc = XSLT_DOC_DEFAULT_LOADER(
 *             c_uri, c_dict, parse_options, c_ctxt, c_type)
 *         if c_doc is NULL:             # <<<<<<<<<<<<<<
 *             _xslt_store_resolver_exception(c_uri, c_pcontext, c_type)
 * 
 */
    __pyx_t_3 = (__pyx_v_c_doc == NULL);
    if (__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":152
 *             c_uri, c_dict, parse_options, c_ctxt, c_type)
 *         if c_doc is NULL:
 *             _xslt_store_resolver_exception(c_uri, c_pcontext, c_type)             # <<<<<<<<<<<<<<
 * 
 *     if c_doc is not NULL and c_type == xslt.XSLT_LOAD_STYLESHEET:
 */
      __pyx_f_4lxml_5etree__xslt_store_resolver_exception(__pyx_v_c_uri, __pyx_v_c_pcontext, __pyx_v_c_type);
      goto __pyx_L6;
    }
    __pyx_L6:;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":154
 *             _xslt_store_resolver_exception(c_uri, c_pcontext, c_type)
 * 
 *     if c_doc is not NULL and c_type == xslt.XSLT_LOAD_STYLESHEET:             # <<<<<<<<<<<<<<
 *         c_doc._private = c_pcontext
 *     return c_doc
 */
  __pyx_t_3 = (__pyx_v_c_doc != NULL);
  if (__pyx_t_3) {
    __pyx_t_1 = (__pyx_v_c_type == XSLT_LOAD_STYLESHEET);
    __pyx_t_2 = __pyx_t_1;
  } else {
    __pyx_t_2 = __pyx_t_3;
  }
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":155
 * 
 *     if c_doc is not NULL and c_type == xslt.XSLT_LOAD_STYLESHEET:
 *         c_doc._private = c_pcontext             # <<<<<<<<<<<<<<
 *     return c_doc
 * 
 */
    __pyx_v_c_doc->_private = __pyx_v_c_pcontext;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":156
 *     if c_doc is not NULL and c_type == xslt.XSLT_LOAD_STYLESHEET:
 *         c_doc._private = c_pcontext
 *     return c_doc             # <<<<<<<<<<<<<<
 * 
 * cdef xslt.xsltDocLoaderFunc XSLT_DOC_DEFAULT_LOADER
 */
  __pyx_r = __pyx_v_c_doc;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":188
 *     """
 *     cdef xslt.xsltSecurityPrefs* _prefs
 *     def __cinit__(self, *, read_file=True, write_file=True, create_dir=True,             # <<<<<<<<<<<<<<
 *                  read_network=True, write_network=True):
 *         self._prefs = xslt.xsltNewSecurityPrefs()
 */

static int __pyx_pf_4lxml_5etree_17XSLTAccessControl___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_17XSLTAccessControl___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_read_file = 0;
  PyObject *__pyx_v_write_file = 0;
  PyObject *__pyx_v_create_dir = 0;
  PyObject *__pyx_v_read_network = 0;
  PyObject *__pyx_v_write_network = 0;
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__read_file,&__pyx_n_s__write_file,&__pyx_n_s__create_dir,&__pyx_n_s__read_network,&__pyx_n_s__write_network,0};
  __Pyx_RefNannySetupContext("__cinit__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[5] = {0,0,0,0,0};
    values[0] = __pyx_k_349;
    values[1] = __pyx_k_350;
    values[2] = __pyx_k_351;
    values[3] = __pyx_k_352;
    values[4] = __pyx_k_353;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    while (kw_args > 0) {
      PyObject* value;
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__read_file);
      if (value) { values[0] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__write_file);
      if (value) { values[1] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__create_dir);
      if (value) { values[2] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__read_network);
      if (value) { values[3] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__write_network);
      if (value) { values[4] = value; if (!(--kw_args)) break; }
      break;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, 0, "__cinit__") < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_read_file = values[0];
    __pyx_v_write_file = values[1];
    __pyx_v_create_dir = values[2];
    __pyx_v_read_network = values[3];
    __pyx_v_write_network = values[4];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 0) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_read_file = __pyx_k_349;
    __pyx_v_write_file = __pyx_k_350;
    __pyx_v_create_dir = __pyx_k_351;
    __pyx_v_read_network = __pyx_k_352;
    __pyx_v_write_network = __pyx_k_353;
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[18]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.XSLTAccessControl.__cinit__");
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":190
 *     def __cinit__(self, *, read_file=True, write_file=True, create_dir=True,
 *                  read_network=True, write_network=True):
 *         self._prefs = xslt.xsltNewSecurityPrefs()             # <<<<<<<<<<<<<<
 *         if self._prefs is NULL:
 *             python.PyErr_NoMemory()
 */
  ((struct __pyx_obj_4lxml_5etree_XSLTAccessControl *)__pyx_v_self)->_prefs = xsltNewSecurityPrefs();

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":191
 *                  read_network=True, write_network=True):
 *         self._prefs = xslt.xsltNewSecurityPrefs()
 *         if self._prefs is NULL:             # <<<<<<<<<<<<<<
 *             python.PyErr_NoMemory()
 *         self._setAccess(xslt.XSLT_SECPREF_READ_FILE, read_file)
 */
  __pyx_t_1 = (((struct __pyx_obj_4lxml_5etree_XSLTAccessControl *)__pyx_v_self)->_prefs == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":192
 *         self._prefs = xslt.xsltNewSecurityPrefs()
 *         if self._prefs is NULL:
 *             python.PyErr_NoMemory()             # <<<<<<<<<<<<<<
 *         self._setAccess(xslt.XSLT_SECPREF_READ_FILE, read_file)
 *         self._setAccess(xslt.XSLT_SECPREF_WRITE_FILE, write_file)
 */
    __pyx_t_2 = PyErr_NoMemory(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":193
 *         if self._prefs is NULL:
 *             python.PyErr_NoMemory()
 *         self._setAccess(xslt.XSLT_SECPREF_READ_FILE, read_file)             # <<<<<<<<<<<<<<
 *         self._setAccess(xslt.XSLT_SECPREF_WRITE_FILE, write_file)
 *         self._setAccess(xslt.XSLT_SECPREF_CREATE_DIRECTORY, create_dir)
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree_XSLTAccessControl *)((struct __pyx_obj_4lxml_5etree_XSLTAccessControl *)__pyx_v_self)->__pyx_vtab)->_setAccess(((struct __pyx_obj_4lxml_5etree_XSLTAccessControl *)__pyx_v_self), XSLT_SECPREF_READ_FILE, __pyx_v_read_file); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":194
 *             python.PyErr_NoMemory()
 *         self._setAccess(xslt.XSLT_SECPREF_READ_FILE, read_file)
 *         self._setAccess(xslt.XSLT_SECPREF_WRITE_FILE, write_file)             # <<<<<<<<<<<<<<
 *         self._setAccess(xslt.XSLT_SECPREF_CREATE_DIRECTORY, create_dir)
 *         self._setAccess(xslt.XSLT_SECPREF_READ_NETWORK, read_network)
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree_XSLTAccessControl *)((struct __pyx_obj_4lxml_5etree_XSLTAccessControl *)__pyx_v_self)->__pyx_vtab)->_setAccess(((struct __pyx_obj_4lxml_5etree_XSLTAccessControl *)__pyx_v_self), XSLT_SECPREF_WRITE_FILE, __pyx_v_write_file); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":195
 *         self._setAccess(xslt.XSLT_SECPREF_READ_FILE, read_file)
 *         self._setAccess(xslt.XSLT_SECPREF_WRITE_FILE, write_file)
 *         self._setAccess(xslt.XSLT_SECPREF_CREATE_DIRECTORY, create_dir)             # <<<<<<<<<<<<<<
 *         self._setAccess(xslt.XSLT_SECPREF_READ_NETWORK, read_network)
 *         self._setAccess(xslt.XSLT_SECPREF_WRITE_NETWORK, write_network)
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree_XSLTAccessControl *)((struct __pyx_obj_4lxml_5etree_XSLTAccessControl *)__pyx_v_self)->__pyx_vtab)->_setAccess(((struct __pyx_obj_4lxml_5etree_XSLTAccessControl *)__pyx_v_self), XSLT_SECPREF_CREATE_DIRECTORY, __pyx_v_create_dir); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":196
 *         self._setAccess(xslt.XSLT_SECPREF_WRITE_FILE, write_file)
 *         self._setAccess(xslt.XSLT_SECPREF_CREATE_DIRECTORY, create_dir)
 *         self._setAccess(xslt.XSLT_SECPREF_READ_NETWORK, read_network)             # <<<<<<<<<<<<<<
 *         self._setAccess(xslt.XSLT_SECPREF_WRITE_NETWORK, write_network)
 * 
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree_XSLTAccessControl *)((struct __pyx_obj_4lxml_5etree_XSLTAccessControl *)__pyx_v_self)->__pyx_vtab)->_setAccess(((struct __pyx_obj_4lxml_5etree_XSLTAccessControl *)__pyx_v_self), XSLT_SECPREF_READ_NETWORK, __pyx_v_read_network); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":197
 *         self._setAccess(xslt.XSLT_SECPREF_CREATE_DIRECTORY, create_dir)
 *         self._setAccess(xslt.XSLT_SECPREF_READ_NETWORK, read_network)
 *         self._setAccess(xslt.XSLT_SECPREF_WRITE_NETWORK, write_network)             # <<<<<<<<<<<<<<
 * 
 *     DENY_ALL = XSLTAccessControl(
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree_XSLTAccessControl *)((struct __pyx_obj_4lxml_5etree_XSLTAccessControl *)__pyx_v_self)->__pyx_vtab)->_setAccess(((struct __pyx_obj_4lxml_5etree_XSLTAccessControl *)__pyx_v_self), XSLT_SECPREF_WRITE_NETWORK, __pyx_v_write_network); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.XSLTAccessControl.__cinit__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":207
 *         read_network=True, write_network=False)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._prefs is not NULL:
 *             xslt.xsltFreeSecurityPrefs(self._prefs)
 */

static void __pyx_pf_4lxml_5etree_17XSLTAccessControl_1__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pf_4lxml_5etree_17XSLTAccessControl_1__dealloc__(PyObject *__pyx_v_self) {
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__dealloc__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":208
 * 
 *     def __dealloc__(self):
 *         if self._prefs is not NULL:             # <<<<<<<<<<<<<<
 *             xslt.xsltFreeSecurityPrefs(self._prefs)
 * 
 */
  __pyx_t_1 = (((struct __pyx_obj_4lxml_5etree_XSLTAccessControl *)__pyx_v_self)->_prefs != NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":209
 *     def __dealloc__(self):
 *         if self._prefs is not NULL:
 *             xslt.xsltFreeSecurityPrefs(self._prefs)             # <<<<<<<<<<<<<<
 * 
 *     cdef _setAccess(self, xslt.xsltSecurityOption option, allow):
 */
    xsltFreeSecurityPrefs(((struct __pyx_obj_4lxml_5etree_XSLTAccessControl *)__pyx_v_self)->_prefs);
    goto __pyx_L5;
  }
  __pyx_L5:;

  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":211
 *             xslt.xsltFreeSecurityPrefs(self._prefs)
 * 
 *     cdef _setAccess(self, xslt.xsltSecurityOption option, allow):             # <<<<<<<<<<<<<<
 *         cdef xslt.xsltSecurityCheck function
 *         if allow:
 */

static  PyObject *__pyx_f_4lxml_5etree_17XSLTAccessControl__setAccess(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *__pyx_v_self, xsltSecurityOption __pyx_v_option, PyObject *__pyx_v_allow) {
  xsltSecurityCheck __pyx_v_function;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_setAccess");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":213
 *     cdef _setAccess(self, xslt.xsltSecurityOption option, allow):
 *         cdef xslt.xsltSecurityCheck function
 *         if allow:             # <<<<<<<<<<<<<<
 *             function = xslt.xsltSecurityAllow
 *         else:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_allow); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":214
 *         cdef xslt.xsltSecurityCheck function
 *         if allow:
 *             function = xslt.xsltSecurityAllow             # <<<<<<<<<<<<<<
 *         else:
 *             function = xslt.xsltSecurityForbid
 */
    __pyx_v_function = xsltSecurityAllow;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":216
 *             function = xslt.xsltSecurityAllow
 *         else:
 *             function = xslt.xsltSecurityForbid             # <<<<<<<<<<<<<<
 *         xslt.xsltSetSecurityPrefs(self._prefs, option, function)
 * 
 */
    __pyx_v_function = xsltSecurityForbid;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":217
 *         else:
 *             function = xslt.xsltSecurityForbid
 *         xslt.xsltSetSecurityPrefs(self._prefs, option, function)             # <<<<<<<<<<<<<<
 * 
 *     cdef void _register_in_context(self, xslt.xsltTransformContext* ctxt):
 */
  xsltSetSecurityPrefs(__pyx_v_self->_prefs, __pyx_v_option, __pyx_v_function);

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.XSLTAccessControl._setAccess");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":219
 *         xslt.xsltSetSecurityPrefs(self._prefs, option, function)
 * 
 *     cdef void _register_in_context(self, xslt.xsltTransformContext* ctxt):             # <<<<<<<<<<<<<<
 *         xslt.xsltSetCtxtSecurityPrefs(self._prefs, ctxt)
 * 
 */

static  void __pyx_f_4lxml_5etree_17XSLTAccessControl__register_in_context(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *__pyx_v_self, xsltTransformContext *__pyx_v_ctxt) {
  __Pyx_RefNannySetupContext("_register_in_context");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":220
 * 
 *     cdef void _register_in_context(self, xslt.xsltTransformContext* ctxt):
 *         xslt.xsltSetCtxtSecurityPrefs(self._prefs, ctxt)             # <<<<<<<<<<<<<<
 * 
 *     property options:
 */
  xsltSetCtxtSecurityPrefs(__pyx_v_self->_prefs, __pyx_v_ctxt);

  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":224
 *     property options:
 *         u"The access control configuration as a map of options."
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return {
 *                 u'read_file': self._optval(xslt.XSLT_SECPREF_READ_FILE),
 */

static PyObject *__pyx_pf_4lxml_5etree_17XSLTAccessControl_7options___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_17XSLTAccessControl_7options___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__get__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":225
 *         u"The access control configuration as a map of options."
 *         def __get__(self):
 *             return {             # <<<<<<<<<<<<<<
 *                 u'read_file': self._optval(xslt.XSLT_SECPREF_READ_FILE),
 *                 u'write_file': self._optval(xslt.XSLT_SECPREF_WRITE_FILE),
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":226
 *         def __get__(self):
 *             return {
 *                 u'read_file': self._optval(xslt.XSLT_SECPREF_READ_FILE),             # <<<<<<<<<<<<<<
 *                 u'write_file': self._optval(xslt.XSLT_SECPREF_WRITE_FILE),
 *                 u'create_dir': self._optval(xslt.XSLT_SECPREF_CREATE_DIRECTORY),
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree_XSLTAccessControl *)((struct __pyx_obj_4lxml_5etree_XSLTAccessControl *)__pyx_v_self)->__pyx_vtab)->_optval(((struct __pyx_obj_4lxml_5etree_XSLTAccessControl *)__pyx_v_self), XSLT_SECPREF_READ_FILE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_u__read_file), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":227
 *             return {
 *                 u'read_file': self._optval(xslt.XSLT_SECPREF_READ_FILE),
 *                 u'write_file': self._optval(xslt.XSLT_SECPREF_WRITE_FILE),             # <<<<<<<<<<<<<<
 *                 u'create_dir': self._optval(xslt.XSLT_SECPREF_CREATE_DIRECTORY),
 *                 u'read_network': self._optval(xslt.XSLT_SECPREF_READ_NETWORK),
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree_XSLTAccessControl *)((struct __pyx_obj_4lxml_5etree_XSLTAccessControl *)__pyx_v_self)->__pyx_vtab)->_optval(((struct __pyx_obj_4lxml_5etree_XSLTAccessControl *)__pyx_v_self), XSLT_SECPREF_WRITE_FILE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_u__write_file), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":228
 *                 u'read_file': self._optval(xslt.XSLT_SECPREF_READ_FILE),
 *                 u'write_file': self._optval(xslt.XSLT_SECPREF_WRITE_FILE),
 *                 u'create_dir': self._optval(xslt.XSLT_SECPREF_CREATE_DIRECTORY),             # <<<<<<<<<<<<<<
 *                 u'read_network': self._optval(xslt.XSLT_SECPREF_READ_NETWORK),
 *                 u'write_network': self._optval(xslt.XSLT_SECPREF_WRITE_NETWORK),
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree_XSLTAccessControl *)((struct __pyx_obj_4lxml_5etree_XSLTAccessControl *)__pyx_v_self)->__pyx_vtab)->_optval(((struct __pyx_obj_4lxml_5etree_XSLTAccessControl *)__pyx_v_self), XSLT_SECPREF_CREATE_DIRECTORY); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_u__create_dir), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":229
 *                 u'write_file': self._optval(xslt.XSLT_SECPREF_WRITE_FILE),
 *                 u'create_dir': self._optval(xslt.XSLT_SECPREF_CREATE_DIRECTORY),
 *                 u'read_network': self._optval(xslt.XSLT_SECPREF_READ_NETWORK),             # <<<<<<<<<<<<<<
 *                 u'write_network': self._optval(xslt.XSLT_SECPREF_WRITE_NETWORK),
 *                 }
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree_XSLTAccessControl *)((struct __pyx_obj_4lxml_5etree_XSLTAccessControl *)__pyx_v_self)->__pyx_vtab)->_optval(((struct __pyx_obj_4lxml_5etree_XSLTAccessControl *)__pyx_v_self), XSLT_SECPREF_READ_NETWORK); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_u__read_network), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":230
 *                 u'create_dir': self._optval(xslt.XSLT_SECPREF_CREATE_DIRECTORY),
 *                 u'read_network': self._optval(xslt.XSLT_SECPREF_READ_NETWORK),
 *                 u'write_network': self._optval(xslt.XSLT_SECPREF_WRITE_NETWORK),             # <<<<<<<<<<<<<<
 *                 }
 * 
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree_XSLTAccessControl *)((struct __pyx_obj_4lxml_5etree_XSLTAccessControl *)__pyx_v_self)->__pyx_vtab)->_optval(((struct __pyx_obj_4lxml_5etree_XSLTAccessControl *)__pyx_v_self), XSLT_SECPREF_WRITE_NETWORK); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_u__write_network), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.XSLTAccessControl.options.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":233
 *                 }
 * 
 *     cdef _optval(self, xslt.xsltSecurityOption option):             # <<<<<<<<<<<<<<
 *         cdef xslt.xsltSecurityCheck function
 *         function = xslt.xsltGetSecurityPrefs(self._prefs, option)
 */

static  PyObject *__pyx_f_4lxml_5etree_17XSLTAccessControl__optval(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *__pyx_v_self, xsltSecurityOption __pyx_v_option) {
  xsltSecurityCheck __pyx_v_function;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_optval");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":235
 *     cdef _optval(self, xslt.xsltSecurityOption option):
 *         cdef xslt.xsltSecurityCheck function
 *         function = xslt.xsltGetSecurityPrefs(self._prefs, option)             # <<<<<<<<<<<<<<
 *         if function is <xslt.xsltSecurityCheck>xslt.xsltSecurityAllow:
 *             return True
 */
  __pyx_v_function = xsltGetSecurityPrefs(__pyx_v_self->_prefs, __pyx_v_option);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":236
 *         cdef xslt.xsltSecurityCheck function
 *         function = xslt.xsltGetSecurityPrefs(self._prefs, option)
 *         if function is <xslt.xsltSecurityCheck>xslt.xsltSecurityAllow:             # <<<<<<<<<<<<<<
 *             return True
 *         elif function is <xslt.xsltSecurityCheck>xslt.xsltSecurityForbid:
 */
  __pyx_t_1 = (__pyx_v_function == ((xsltSecurityCheck)xsltSecurityAllow));
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":237
 *         function = xslt.xsltGetSecurityPrefs(self._prefs, option)
 *         if function is <xslt.xsltSecurityCheck>xslt.xsltSecurityAllow:
 *             return True             # <<<<<<<<<<<<<<
 *         elif function is <xslt.xsltSecurityCheck>xslt.xsltSecurityForbid:
 *             return False
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":238
 *         if function is <xslt.xsltSecurityCheck>xslt.xsltSecurityAllow:
 *             return True
 *         elif function is <xslt.xsltSecurityCheck>xslt.xsltSecurityForbid:             # <<<<<<<<<<<<<<
 *             return False
 *         else:
 */
  __pyx_t_1 = (__pyx_v_function == ((xsltSecurityCheck)xsltSecurityForbid));
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":239
 *             return True
 *         elif function is <xslt.xsltSecurityCheck>xslt.xsltSecurityForbid:
 *             return False             # <<<<<<<<<<<<<<
 *         else:
 *             return None
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":241
 *             return False
 *         else:
 *             return None             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.XSLTAccessControl._optval");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":243
 *             return None
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         items = self.options.items()
 *         items.sort()
 */

static PyObject *__pyx_pf_4lxml_5etree_17XSLTAccessControl_2__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_17XSLTAccessControl_2__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_v_items;
  PyObject *__pyx_v_item;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__repr__");
  __pyx_v_items = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_item = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":244
 * 
 *     def __repr__(self):
 *         items = self.options.items()             # <<<<<<<<<<<<<<
 *         items.sort()
 *         return u"%s(%s)" % (
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__options); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__items); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_v_items);
  __pyx_v_items = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":245
 *     def __repr__(self):
 *         items = self.options.items()
 *         items.sort()             # <<<<<<<<<<<<<<
 *         return u"%s(%s)" % (
 *             funicode(python._fqtypename(self)).split(u'.')[-1],
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_items, __pyx_n_s__sort); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":246
 *         items = self.options.items()
 *         items.sort()
 *         return u"%s(%s)" % (             # <<<<<<<<<<<<<<
 *             funicode(python._fqtypename(self)).split(u'.')[-1],
 *             u', '.join([u"%s=%r" % item for item in items]))
 */
  __Pyx_XDECREF(__pyx_r);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":247
 *         items.sort()
 *         return u"%s(%s)" % (
 *             funicode(python._fqtypename(self)).split(u'.')[-1],             # <<<<<<<<<<<<<<
 *             u', '.join([u"%s=%r" % item for item in items]))
 * 
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(_fqtypename(__pyx_v_self)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_355), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":248
 *         return u"%s(%s)" % (
 *             funicode(python._fqtypename(self)).split(u'.')[-1],
 *             u', '.join([u"%s=%r" % item for item in items]))             # <<<<<<<<<<<<<<
 * 
 * ################################################################################
 */
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  if (PyList_CheckExact(__pyx_v_items) || PyTuple_CheckExact(__pyx_v_items)) {
    __pyx_t_3 = 0; __pyx_t_4 = __pyx_v_items; __Pyx_INCREF(__pyx_t_4);
  } else {
    __pyx_t_3 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_items); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
  }
  for (;;) {
    if (likely(PyList_CheckExact(__pyx_t_4))) {
      if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_4)) break;
      __pyx_t_5 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++;
    } else if (likely(PyTuple_CheckExact(__pyx_t_4))) {
      if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
      __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++;
    } else {
      __pyx_t_5 = PyIter_Next(__pyx_t_4);
      if (!__pyx_t_5) {
        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        break;
      }
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_DECREF(__pyx_v_item);
    __pyx_v_item = __pyx_t_5;
    __pyx_t_5 = 0;
    __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_357), __pyx_v_item); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
    if (unlikely(PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = ((PyObject *)PyUnicode_Join(__pyx_kp_u_356, ((PyObject *)__pyx_t_2))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_1 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_354), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_r = ((PyObject *)__pyx_t_4);
  __pyx_t_4 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.XSLTAccessControl.__repr__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_items);
  __Pyx_DECREF(__pyx_v_item);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":253
 * # XSLT
 * 
 * cdef int _register_xslt_function(void* ctxt, name_utf, ns_utf):             # <<<<<<<<<<<<<<
 *     if ns_utf is None:
 *         return 0
 */

static  int __pyx_f_4lxml_5etree__register_xslt_function(void *__pyx_v_ctxt, PyObject *__pyx_v_name_utf, PyObject *__pyx_v_ns_utf) {
  int __pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_register_xslt_function");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":254
 * 
 * cdef int _register_xslt_function(void* ctxt, name_utf, ns_utf):
 *     if ns_utf is None:             # <<<<<<<<<<<<<<
 *         return 0
 *     return xslt.xsltRegisterExtFunction(
 */
  __pyx_t_1 = (__pyx_v_ns_utf == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":255
 * cdef int _register_xslt_function(void* ctxt, name_utf, ns_utf):
 *     if ns_utf is None:
 *         return 0             # <<<<<<<<<<<<<<
 *     return xslt.xsltRegisterExtFunction(
 *         <xslt.xsltTransformContext*>ctxt, _cstr(name_utf), _cstr(ns_utf),
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":258
 *     return xslt.xsltRegisterExtFunction(
 *         <xslt.xsltTransformContext*>ctxt, _cstr(name_utf), _cstr(ns_utf),
 *         _xpath_function_call)             # <<<<<<<<<<<<<<
 * 
 * cdef int _unregister_xslt_function(void* ctxt, name_utf, ns_utf):
 */
  __pyx_r = xsltRegisterExtFunction(((xsltTransformContext *)__pyx_v_ctxt), PyBytes_AS_STRING(__pyx_v_name_utf), PyBytes_AS_STRING(__pyx_v_ns_utf), __pyx_f_4lxml_5etree__xpath_function_call);
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":260
 *         _xpath_function_call)
 * 
 * cdef int _unregister_xslt_function(void* ctxt, name_utf, ns_utf):             # <<<<<<<<<<<<<<
 *     if ns_utf is None:
 *         return 0
 */

static  int __pyx_f_4lxml_5etree__unregister_xslt_function(void *__pyx_v_ctxt, PyObject *__pyx_v_name_utf, PyObject *__pyx_v_ns_utf) {
  int __pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_unregister_xslt_function");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":261
 * 
 * cdef int _unregister_xslt_function(void* ctxt, name_utf, ns_utf):
 *     if ns_utf is None:             # <<<<<<<<<<<<<<
 *         return 0
 *     return xslt.xsltRegisterExtFunction(
 */
  __pyx_t_1 = (__pyx_v_ns_utf == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":262
 * cdef int _unregister_xslt_function(void* ctxt, name_utf, ns_utf):
 *     if ns_utf is None:
 *         return 0             # <<<<<<<<<<<<<<
 *     return xslt.xsltRegisterExtFunction(
 *         <xslt.xsltTransformContext*>ctxt, _cstr(name_utf), _cstr(ns_utf),
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":265
 *     return xslt.xsltRegisterExtFunction(
 *         <xslt.xsltTransformContext*>ctxt, _cstr(name_utf), _cstr(ns_utf),
 *         NULL)             # <<<<<<<<<<<<<<
 * 
 * cdef dict EMPTY_DICT = {}
 */
  __pyx_r = xsltRegisterExtFunction(((xsltTransformContext *)__pyx_v_ctxt), PyBytes_AS_STRING(__pyx_v_name_utf), PyBytes_AS_STRING(__pyx_v_ns_utf), NULL);
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":273
 *     cdef _ReadOnlyElementProxy _extension_element_proxy
 *     cdef dict _extension_elements
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._xsltCtxt = NULL
 *         self._extension_elements = EMPTY_DICT
 */

static int __pyx_pf_4lxml_5etree_12_XSLTContext___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_12_XSLTContext___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("__cinit__");
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":274
 *     cdef dict _extension_elements
 *     def __cinit__(self):
 *         self._xsltCtxt = NULL             # <<<<<<<<<<<<<<
 *         self._extension_elements = EMPTY_DICT
 * 
 */
  ((struct __pyx_obj_4lxml_5etree__XSLTContext *)__pyx_v_self)->_xsltCtxt = NULL;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":275
 *     def __cinit__(self):
 *         self._xsltCtxt = NULL
 *         self._extension_elements = EMPTY_DICT             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, namespaces, extensions, enable_regexp,
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_4lxml_5etree_EMPTY_DICT));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_4lxml_5etree_EMPTY_DICT));
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__XSLTContext *)__pyx_v_self)->_extension_elements);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__XSLTContext *)__pyx_v_self)->_extension_elements));
  ((struct __pyx_obj_4lxml_5etree__XSLTContext *)__pyx_v_self)->_extension_elements = __pyx_v_4lxml_5etree_EMPTY_DICT;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":277
 *         self._extension_elements = EMPTY_DICT
 * 
 *     def __init__(self, namespaces, extensions, enable_regexp,             # <<<<<<<<<<<<<<
 *                  build_smart_strings):
 *         if extensions is not None and extensions:
 */

static int __pyx_pf_4lxml_5etree_12_XSLTContext_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_12_XSLTContext_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_namespaces = 0;
  PyObject *__pyx_v_extensions = 0;
  PyObject *__pyx_v_enable_regexp = 0;
  PyObject *__pyx_v_build_smart_strings = 0;
  PyObject *__pyx_v_ns_name_tuple;
  PyObject *__pyx_v_extension;
  PyObject *__pyx_v_ns_utf;
  PyObject *__pyx_v_name_utf;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__namespaces,&__pyx_n_s__extensions,&__pyx_n_s__enable_regexp,&__pyx_n_s__build_smart_strings,0};
  __Pyx_RefNannySetupContext("__init__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[4] = {0,0,0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__namespaces);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__extensions);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 1); {__pyx_filename = __pyx_f[18]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__enable_regexp);
      if (likely(values[2])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 2); {__pyx_filename = __pyx_f[18]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  3:
      values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__build_smart_strings);
      if (likely(values[3])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 3); {__pyx_filename = __pyx_f[18]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_namespaces = values[0];
    __pyx_v_extensions = values[1];
    __pyx_v_enable_regexp = values[2];
    __pyx_v_build_smart_strings = values[3];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_namespaces = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_extensions = PyTuple_GET_ITEM(__pyx_args, 1);
    __pyx_v_enable_regexp = PyTuple_GET_ITEM(__pyx_args, 2);
    __pyx_v_build_smart_strings = PyTuple_GET_ITEM(__pyx_args, 3);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[18]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._XSLTContext.__init__");
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF(__pyx_v_extensions);
  __pyx_v_ns_name_tuple = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_extension = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_ns_utf = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_name_utf = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":279
 *     def __init__(self, namespaces, extensions, enable_regexp,
 *                  build_smart_strings):
 *         if extensions is not None and extensions:             # <<<<<<<<<<<<<<
 *             for ns_name_tuple, extension in extensions.items():
 *                 if ns_name_tuple[0] is None:
 */
  __pyx_t_1 = (__pyx_v_extensions != Py_None);
  if (__pyx_t_1) {
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_extensions); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":280
 *                  build_smart_strings):
 *         if extensions is not None and extensions:
 *             for ns_name_tuple, extension in extensions.items():             # <<<<<<<<<<<<<<
 *                 if ns_name_tuple[0] is None:
 *                     raise XSLTExtensionError, \
 */
    __pyx_t_5 = PyObject_GetAttr(__pyx_v_extensions, __pyx_n_s__items); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (PyList_CheckExact(__pyx_t_6) || PyTuple_CheckExact(__pyx_t_6)) {
      __pyx_t_4 = 0; __pyx_t_5 = __pyx_t_6; __Pyx_INCREF(__pyx_t_5);
    } else {
      __pyx_t_4 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    for (;;) {
      if (likely(PyList_CheckExact(__pyx_t_5))) {
        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_5)) break;
        __pyx_t_6 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++;
      } else if (likely(PyTuple_CheckExact(__pyx_t_5))) {
        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
        __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++;
      } else {
        __pyx_t_6 = PyIter_Next(__pyx_t_5);
        if (!__pyx_t_6) {
          if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          break;
        }
        __Pyx_GOTREF(__pyx_t_6);
      }
      if (PyTuple_CheckExact(__pyx_t_6) && likely(PyTuple_GET_SIZE(__pyx_t_6) == 2)) {
        PyObject* tuple = __pyx_t_6;
        __pyx_t_7 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_7);
        __pyx_t_8 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_v_ns_name_tuple);
        __pyx_v_ns_name_tuple = __pyx_t_7;
        __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_v_extension);
        __pyx_v_extension = __pyx_t_8;
        __pyx_t_8 = 0;
      } else {
        __pyx_t_9 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_7 = __Pyx_UnpackItem(__pyx_t_9, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_8 = __Pyx_UnpackItem(__pyx_t_9, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        if (__Pyx_EndUnpack(__pyx_t_9, 2) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_v_ns_name_tuple);
        __pyx_v_ns_name_tuple = __pyx_t_7;
        __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_v_extension);
        __pyx_v_extension = __pyx_t_8;
        __pyx_t_8 = 0;
      }

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":281
 *         if extensions is not None and extensions:
 *             for ns_name_tuple, extension in extensions.items():
 *                 if ns_name_tuple[0] is None:             # <<<<<<<<<<<<<<
 *                     raise XSLTExtensionError, \
 *                         u"extensions must not have empty namespaces"
 */
      __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_ns_name_tuple, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_3 = (__pyx_t_6 == Py_None);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (__pyx_t_3) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":282
 *             for ns_name_tuple, extension in extensions.items():
 *                 if ns_name_tuple[0] is None:
 *                     raise XSLTExtensionError, \             # <<<<<<<<<<<<<<
 *                         u"extensions must not have empty namespaces"
 *                 if isinstance(extension, XSLTExtension):
 */
        __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__XSLTExtensionError); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_Raise(__pyx_t_6, ((PyObject *)__pyx_kp_u_358), 0);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        {__pyx_filename = __pyx_f[18]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L9;
      }
      __pyx_L9:;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":284
 *                     raise XSLTExtensionError, \
 *                         u"extensions must not have empty namespaces"
 *                 if isinstance(extension, XSLTExtension):             # <<<<<<<<<<<<<<
 *                     if self._extension_elements is EMPTY_DICT:
 *                         self._extension_elements = {}
 */
      __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_extension, ((PyObject*)__pyx_ptype_4lxml_5etree_XSLTExtension)); 
      if (__pyx_t_3) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":285
 *                         u"extensions must not have empty namespaces"
 *                 if isinstance(extension, XSLTExtension):
 *                     if self._extension_elements is EMPTY_DICT:             # <<<<<<<<<<<<<<
 *                         self._extension_elements = {}
 *                         extensions = extensions.copy()
 */
        __pyx_t_3 = (((struct __pyx_obj_4lxml_5etree__XSLTContext *)__pyx_v_self)->_extension_elements == __pyx_v_4lxml_5etree_EMPTY_DICT);
        if (__pyx_t_3) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":286
 *                 if isinstance(extension, XSLTExtension):
 *                     if self._extension_elements is EMPTY_DICT:
 *                         self._extension_elements = {}             # <<<<<<<<<<<<<<
 *                         extensions = extensions.copy()
 *                     ns_utf   = _utf8(ns_name_tuple[0])
 */
          __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(((PyObject *)__pyx_t_6));
          __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
          __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__XSLTContext *)__pyx_v_self)->_extension_elements);
          __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__XSLTContext *)__pyx_v_self)->_extension_elements));
          ((struct __pyx_obj_4lxml_5etree__XSLTContext *)__pyx_v_self)->_extension_elements = __pyx_t_6;
          __pyx_t_6 = 0;

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":287
 *                     if self._extension_elements is EMPTY_DICT:
 *                         self._extension_elements = {}
 *                         extensions = extensions.copy()             # <<<<<<<<<<<<<<
 *                     ns_utf   = _utf8(ns_name_tuple[0])
 *                     name_utf = _utf8(ns_name_tuple[1])
 */
          __pyx_t_6 = PyObject_GetAttr(__pyx_v_extensions, __pyx_n_s__copy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_8 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_v_extensions);
          __pyx_v_extensions = __pyx_t_8;
          __pyx_t_8 = 0;
          goto __pyx_L11;
        }
        __pyx_L11:;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":288
 *                         self._extension_elements = {}
 *                         extensions = extensions.copy()
 *                     ns_utf   = _utf8(ns_name_tuple[0])             # <<<<<<<<<<<<<<
 *                     name_utf = _utf8(ns_name_tuple[1])
 *                     self._extension_elements[(ns_utf, name_utf)] = extension
 */
        __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_ns_name_tuple, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_6 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_t_8)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_v_ns_utf));
        __pyx_v_ns_utf = ((PyObject*)__pyx_t_6);
        __pyx_t_6 = 0;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":289
 *                         extensions = extensions.copy()
 *                     ns_utf   = _utf8(ns_name_tuple[0])
 *                     name_utf = _utf8(ns_name_tuple[1])             # <<<<<<<<<<<<<<
 *                     self._extension_elements[(ns_utf, name_utf)] = extension
 *                     del extensions[ns_name_tuple]
 */
        __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_ns_name_tuple, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_8 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_t_6)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_v_name_utf));
        __pyx_v_name_utf = ((PyObject*)__pyx_t_8);
        __pyx_t_8 = 0;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":290
 *                     ns_utf   = _utf8(ns_name_tuple[0])
 *                     name_utf = _utf8(ns_name_tuple[1])
 *                     self._extension_elements[(ns_utf, name_utf)] = extension             # <<<<<<<<<<<<<<
 *                     del extensions[ns_name_tuple]
 *         _BaseContext.__init__(self, namespaces, extensions, enable_regexp,
 */
        __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_8));
        __Pyx_INCREF(((PyObject *)__pyx_v_ns_utf));
        PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_v_ns_utf));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_ns_utf));
        __Pyx_INCREF(((PyObject *)__pyx_v_name_utf));
        PyTuple_SET_ITEM(__pyx_t_8, 1, ((PyObject *)__pyx_v_name_utf));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_name_utf));
        if (PyDict_SetItem(((PyObject *)((struct __pyx_obj_4lxml_5etree__XSLTContext *)__pyx_v_self)->_extension_elements), ((PyObject *)__pyx_t_8), __pyx_v_extension) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":291
 *                     name_utf = _utf8(ns_name_tuple[1])
 *                     self._extension_elements[(ns_utf, name_utf)] = extension
 *                     del extensions[ns_name_tuple]             # <<<<<<<<<<<<<<
 *         _BaseContext.__init__(self, namespaces, extensions, enable_regexp,
 *                               build_smart_strings)
 */
        if (PyObject_DelItem(__pyx_v_extensions, __pyx_v_ns_name_tuple) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L10;
      }
      __pyx_L10:;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":292
 *                     self._extension_elements[(ns_utf, name_utf)] = extension
 *                     del extensions[ns_name_tuple]
 *         _BaseContext.__init__(self, namespaces, extensions, enable_regexp,             # <<<<<<<<<<<<<<
 *                               build_smart_strings)
 * 
 */
  __pyx_t_5 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__BaseContext)), __pyx_n_s____init__); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":293
 *                     del extensions[ns_name_tuple]
 *         _BaseContext.__init__(self, namespaces, extensions, enable_regexp,
 *                               build_smart_strings)             # <<<<<<<<<<<<<<
 * 
 *     cdef _BaseContext _copy(self):
 */
  __pyx_t_8 = PyTuple_New(5); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_8));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __Pyx_INCREF(__pyx_v_namespaces);
  PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_namespaces);
  __Pyx_GIVEREF(__pyx_v_namespaces);
  __Pyx_INCREF(__pyx_v_extensions);
  PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_extensions);
  __Pyx_GIVEREF(__pyx_v_extensions);
  __Pyx_INCREF(__pyx_v_enable_regexp);
  PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_v_enable_regexp);
  __Pyx_GIVEREF(__pyx_v_enable_regexp);
  __Pyx_INCREF(__pyx_v_build_smart_strings);
  PyTuple_SET_ITEM(__pyx_t_8, 4, __pyx_v_build_smart_strings);
  __Pyx_GIVEREF(__pyx_v_build_smart_strings);
  __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("lxml.etree._XSLTContext.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_ns_name_tuple);
  __Pyx_DECREF(__pyx_v_extension);
  __Pyx_DECREF(__pyx_v_ns_utf);
  __Pyx_DECREF(__pyx_v_name_utf);
  __Pyx_DECREF(__pyx_v_extensions);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":295
 *                               build_smart_strings)
 * 
 *     cdef _BaseContext _copy(self):             # <<<<<<<<<<<<<<
 *         cdef _XSLTContext context
 *         context = <_XSLTContext>_BaseContext._copy(self)
 */

static  struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_f_4lxml_5etree_12_XSLTContext__copy(struct __pyx_obj_4lxml_5etree__XSLTContext *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree__XSLTContext *__pyx_v_context;
  struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("_copy");
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__XSLTContext *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":297
 *     cdef _BaseContext _copy(self):
 *         cdef _XSLTContext context
 *         context = <_XSLTContext>_BaseContext._copy(self)             # <<<<<<<<<<<<<<
 *         context._extension_elements = self._extension_elements
 *         return context
 */
  __pyx_t_1 = ((PyObject *)__pyx_vtabptr_4lxml_5etree__BaseContext->_copy(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__XSLTContext *)__pyx_t_1)));
  __Pyx_DECREF(((PyObject *)__pyx_v_context));
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__XSLTContext *)__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":298
 *         cdef _XSLTContext context
 *         context = <_XSLTContext>_BaseContext._copy(self)
 *         context._extension_elements = self._extension_elements             # <<<<<<<<<<<<<<
 *         return context
 * 
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_extension_elements));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->_extension_elements));
  __Pyx_GOTREF(__pyx_v_context->_extension_elements);
  __Pyx_DECREF(((PyObject *)__pyx_v_context->_extension_elements));
  __pyx_v_context->_extension_elements = __pyx_v_self->_extension_elements;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":299
 *         context = <_XSLTContext>_BaseContext._copy(self)
 *         context._extension_elements = self._extension_elements
 *         return context             # <<<<<<<<<<<<<<
 * 
 *     cdef register_context(self, xslt.xsltTransformContext* xsltCtxt,
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_context));
  __pyx_r = ((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_context);
  goto __pyx_L0;

  __pyx_r = ((struct __pyx_obj_4lxml_5etree__BaseContext *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._XSLTContext._copy");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_context);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":301
 *         return context
 * 
 *     cdef register_context(self, xslt.xsltTransformContext* xsltCtxt,             # <<<<<<<<<<<<<<
 *                                _Document doc):
 *         self._xsltCtxt = xsltCtxt
 */

static  PyObject *__pyx_f_4lxml_5etree_12_XSLTContext_register_context(struct __pyx_obj_4lxml_5etree__XSLTContext *__pyx_v_self, xsltTransformContext *__pyx_v_xsltCtxt, struct LxmlDocument *__pyx_v_doc) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("register_context");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":303
 *     cdef register_context(self, xslt.xsltTransformContext* xsltCtxt,
 *                                _Document doc):
 *         self._xsltCtxt = xsltCtxt             # <<<<<<<<<<<<<<
 *         self._set_xpath_context(xsltCtxt.xpathCtxt)
 *         self._register_context(doc)
 */
  __pyx_v_self->_xsltCtxt = __pyx_v_xsltCtxt;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":304
 *                                _Document doc):
 *         self._xsltCtxt = xsltCtxt
 *         self._set_xpath_context(xsltCtxt.xpathCtxt)             # <<<<<<<<<<<<<<
 *         self._register_context(doc)
 *         self.registerLocalFunctions(xsltCtxt, _register_xslt_function)
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__XSLTContext *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._set_xpath_context(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self), __pyx_v_xsltCtxt->xpathCtxt);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":305
 *         self._xsltCtxt = xsltCtxt
 *         self._set_xpath_context(xsltCtxt.xpathCtxt)
 *         self._register_context(doc)             # <<<<<<<<<<<<<<
 *         self.registerLocalFunctions(xsltCtxt, _register_xslt_function)
 *         self.registerGlobalFunctions(xsltCtxt, _register_xslt_function)
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__XSLTContext *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._register_context(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self), __pyx_v_doc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":306
 *         self._set_xpath_context(xsltCtxt.xpathCtxt)
 *         self._register_context(doc)
 *         self.registerLocalFunctions(xsltCtxt, _register_xslt_function)             # <<<<<<<<<<<<<<
 *         self.registerGlobalFunctions(xsltCtxt, _register_xslt_function)
 *         _registerXSLTExtensions(xsltCtxt, self._extension_elements)
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__XSLTContext *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.registerLocalFunctions(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self), __pyx_v_xsltCtxt, __pyx_f_4lxml_5etree__register_xslt_function);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":307
 *         self._register_context(doc)
 *         self.registerLocalFunctions(xsltCtxt, _register_xslt_function)
 *         self.registerGlobalFunctions(xsltCtxt, _register_xslt_function)             # <<<<<<<<<<<<<<
 *         _registerXSLTExtensions(xsltCtxt, self._extension_elements)
 * 
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__XSLTContext *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.registerGlobalFunctions(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self), __pyx_v_xsltCtxt, __pyx_f_4lxml_5etree__register_xslt_function);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":308
 *         self.registerLocalFunctions(xsltCtxt, _register_xslt_function)
 *         self.registerGlobalFunctions(xsltCtxt, _register_xslt_function)
 *         _registerXSLTExtensions(xsltCtxt, self._extension_elements)             # <<<<<<<<<<<<<<
 * 
 *     cdef free_context(self):
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_extension_elements);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__registerXSLTExtensions(__pyx_v_xsltCtxt, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._XSLTContext.register_context");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":310
 *         _registerXSLTExtensions(xsltCtxt, self._extension_elements)
 * 
 *     cdef free_context(self):             # <<<<<<<<<<<<<<
 *         self._cleanup_context()
 *         self._release_context()
 */

static  PyObject *__pyx_f_4lxml_5etree_12_XSLTContext_free_context(struct __pyx_obj_4lxml_5etree__XSLTContext *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("free_context");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":311
 * 
 *     cdef free_context(self):
 *         self._cleanup_context()             # <<<<<<<<<<<<<<
 *         self._release_context()
 *         if self._xsltCtxt is not NULL:
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__XSLTContext *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._cleanup_context(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":312
 *     cdef free_context(self):
 *         self._cleanup_context()
 *         self._release_context()             # <<<<<<<<<<<<<<
 *         if self._xsltCtxt is not NULL:
 *             xslt.xsltFreeTransformContext(self._xsltCtxt)
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__XSLTContext *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._release_context(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":313
 *         self._cleanup_context()
 *         self._release_context()
 *         if self._xsltCtxt is not NULL:             # <<<<<<<<<<<<<<
 *             xslt.xsltFreeTransformContext(self._xsltCtxt)
 *             self._xsltCtxt = NULL
 */
  __pyx_t_2 = (__pyx_v_self->_xsltCtxt != NULL);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":314
 *         self._release_context()
 *         if self._xsltCtxt is not NULL:
 *             xslt.xsltFreeTransformContext(self._xsltCtxt)             # <<<<<<<<<<<<<<
 *             self._xsltCtxt = NULL
 *         self._release_temp_refs()
 */
    xsltFreeTransformContext(__pyx_v_self->_xsltCtxt);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":315
 *         if self._xsltCtxt is not NULL:
 *             xslt.xsltFreeTransformContext(self._xsltCtxt)
 *             self._xsltCtxt = NULL             # <<<<<<<<<<<<<<
 *         self._release_temp_refs()
 * 
 */
    __pyx_v_self->_xsltCtxt = NULL;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":316
 *             xslt.xsltFreeTransformContext(self._xsltCtxt)
 *             self._xsltCtxt = NULL
 *         self._release_temp_refs()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__XSLTContext *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._release_temp_refs(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._XSLTContext.free_context");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":324
 *     """
 *     cdef bytes strval
 *     def __cinit__(self, strval):             # <<<<<<<<<<<<<<
 *         self.strval = _utf8(strval)
 * 
 */

static int __pyx_pf_4lxml_5etree_22_XSLTQuotedStringParam___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_22_XSLTQuotedStringParam___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_strval = 0;
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__strval,0};
  __Pyx_RefNannySetupContext("__cinit__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[1] = {0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__strval);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_strval = values[0];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_strval = PyTuple_GET_ITEM(__pyx_args, 0);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[18]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._XSLTQuotedStringParam.__cinit__");
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":325
 *     cdef bytes strval
 *     def __cinit__(self, strval):
 *         self.strval = _utf8(strval)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_v_strval)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__XSLTQuotedStringParam *)__pyx_v_self)->strval);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__XSLTQuotedStringParam *)__pyx_v_self)->strval));
  ((struct __pyx_obj_4lxml_5etree__XSLTQuotedStringParam *)__pyx_v_self)->strval = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._XSLTQuotedStringParam.__cinit__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":360
 *     cdef _ErrorLog _error_log
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._c_style = NULL
 * 
 */

static int __pyx_pf_4lxml_5etree_4XSLT___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_4XSLT___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("__cinit__");
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":361
 * 
 *     def __cinit__(self):
 *         self._c_style = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, xslt_input, *, extensions=None, regexp=True,
 */
  ((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_c_style = NULL;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":363
 *         self._c_style = NULL
 * 
 *     def __init__(self, xslt_input, *, extensions=None, regexp=True,             # <<<<<<<<<<<<<<
 *                  access_control=None):
 *         cdef xslt.xsltStylesheet* c_style
 */

static int __pyx_pf_4lxml_5etree_4XSLT_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_4XSLT_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_xslt_input = 0;
  PyObject *__pyx_v_extensions = 0;
  PyObject *__pyx_v_regexp = 0;
  PyObject *__pyx_v_access_control = 0;
  xsltStylesheet *__pyx_v_c_style;
  xmlDoc *__pyx_v_c_doc;
  struct LxmlDocument *__pyx_v_doc;
  struct LxmlElement *__pyx_v_root_node;
  PyObject *__pyx_v_doc_url_utf;
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  xmlDoc *__pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  xmlDoc *__pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__xslt_input,&__pyx_n_s__extensions,&__pyx_n_s__regexp,&__pyx_n_s__access_control,0};
  __Pyx_RefNannySetupContext("__init__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[4] = {0,0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = __pyx_k_359;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":364
 * 
 *     def __init__(self, xslt_input, *, extensions=None, regexp=True,
 *                  access_control=None):             # <<<<<<<<<<<<<<
 *         cdef xslt.xsltStylesheet* c_style
 *         cdef xmlDoc* c_doc
 */
    values[3] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xslt_input);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
    }
    while (kw_args > 0) {
      PyObject* value;
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__extensions);
      if (value) { values[1] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__regexp);
      if (value) { values[2] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__access_control);
      if (value) { values[3] = value; if (!(--kw_args)) break; }
      break;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_xslt_input = values[0];
    __pyx_v_extensions = values[1];
    __pyx_v_regexp = values[2];
    __pyx_v_access_control = values[3];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_xslt_input = PyTuple_GET_ITEM(__pyx_args, 0);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":363
 *         self._c_style = NULL
 * 
 *     def __init__(self, xslt_input, *, extensions=None, regexp=True,             # <<<<<<<<<<<<<<
 *                  access_control=None):
 *         cdef xslt.xsltStylesheet* c_style
 */
    __pyx_v_extensions = ((PyObject *)Py_None);
    __pyx_v_regexp = __pyx_k_359;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":364
 * 
 *     def __init__(self, xslt_input, *, extensions=None, regexp=True,
 *                  access_control=None):             # <<<<<<<<<<<<<<
 *         cdef xslt.xsltStylesheet* c_style
 *         cdef xmlDoc* c_doc
 */
    __pyx_v_access_control = ((PyObject *)Py_None);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[18]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.XSLT.__init__");
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_doc = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_root_node = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_doc_url_utf = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":370
 *         cdef _Element root_node
 * 
 *         doc = _documentOrRaise(xslt_input)             # <<<<<<<<<<<<<<
 *         root_node = _rootNodeOrRaise(xslt_input)
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v_xslt_input)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_doc));
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":371
 * 
 *         doc = _documentOrRaise(xslt_input)
 *         root_node = _rootNodeOrRaise(xslt_input)             # <<<<<<<<<<<<<<
 * 
 *         # set access control or raise TypeError
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v_xslt_input)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_root_node));
  __pyx_v_root_node = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":374
 * 
 *         # set access control or raise TypeError
 *         self._access_control = access_control             # <<<<<<<<<<<<<<
 * 
 *         # make a copy of the document as stylesheet parsing modifies it
 */
  if (!(likely(((__pyx_v_access_control) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_access_control, __pyx_ptype_4lxml_5etree_XSLTAccessControl))))) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_access_control);
  __Pyx_GIVEREF(__pyx_v_access_control);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_access_control);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_access_control));
  ((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_access_control = ((struct __pyx_obj_4lxml_5etree_XSLTAccessControl *)__pyx_v_access_control);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":377
 * 
 *         # make a copy of the document as stylesheet parsing modifies it
 *         c_doc = _copyDocRoot(doc._c_doc, root_node._c_node)             # <<<<<<<<<<<<<<
 * 
 *         # make sure we always have a stylesheet URL
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__copyDocRoot(__pyx_v_doc->_c_doc, __pyx_v_root_node->_c_node); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_doc = __pyx_t_2;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":380
 * 
 *         # make sure we always have a stylesheet URL
 *         if c_doc.URL is NULL:             # <<<<<<<<<<<<<<
 *             doc_url_utf = python.PyUnicode_AsASCIIString(
 *                 u"string://__STRING__XSLT__/%d.xslt" % id(self))
 */
  __pyx_t_3 = (__pyx_v_c_doc->URL == NULL);
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":382
 *         if c_doc.URL is NULL:
 *             doc_url_utf = python.PyUnicode_AsASCIIString(
 *                 u"string://__STRING__XSLT__/%d.xslt" % id(self))             # <<<<<<<<<<<<<<
 *             c_doc.URL = tree.xmlStrdup(_cstr(doc_url_utf))
 * 
 */
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __Pyx_INCREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    __pyx_t_4 = PyObject_Call(__pyx_builtin_id, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_360), __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = ((PyObject *)PyUnicode_AsASCIIString(((PyObject *)__pyx_t_1))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_v_doc_url_utf));
    __pyx_v_doc_url_utf = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":383
 *             doc_url_utf = python.PyUnicode_AsASCIIString(
 *                 u"string://__STRING__XSLT__/%d.xslt" % id(self))
 *             c_doc.URL = tree.xmlStrdup(_cstr(doc_url_utf))             # <<<<<<<<<<<<<<
 * 
 *         self._error_log = _ErrorLog()
 */
    __pyx_v_c_doc->URL = xmlStrdup(PyBytes_AS_STRING(((PyObject *)__pyx_v_doc_url_utf)));
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":385
 *             c_doc.URL = tree.xmlStrdup(_cstr(doc_url_utf))
 * 
 *         self._error_log = _ErrorLog()             # <<<<<<<<<<<<<<
 *         self._xslt_resolver_context = _XSLTResolverContext()
 *         _initXSLTResolverContext(self._xslt_resolver_context, doc._parser)
 */
  __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ErrorLog)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_error_log);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_error_log));
  ((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_error_log = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":386
 * 
 *         self._error_log = _ErrorLog()
 *         self._xslt_resolver_context = _XSLTResolverContext()             # <<<<<<<<<<<<<<
 *         _initXSLTResolverContext(self._xslt_resolver_context, doc._parser)
 *         # keep a copy in case we need to access the stylesheet via 'document()'
 */
  __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__XSLTResolverContext)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_xslt_resolver_context);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_xslt_resolver_context));
  ((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_xslt_resolver_context = ((struct __pyx_obj_4lxml_5etree__XSLTResolverContext *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":387
 *         self._error_log = _ErrorLog()
 *         self._xslt_resolver_context = _XSLTResolverContext()
 *         _initXSLTResolverContext(self._xslt_resolver_context, doc._parser)             # <<<<<<<<<<<<<<
 *         # keep a copy in case we need to access the stylesheet via 'document()'
 *         self._xslt_resolver_context._c_style_doc = _copyDoc(c_doc, 1)
 */
  __pyx_t_4 = ((PyObject *)((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_xslt_resolver_context);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_1 = ((PyObject *)__pyx_v_doc->_parser);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_5 = __pyx_f_4lxml_5etree__initXSLTResolverContext(((struct __pyx_obj_4lxml_5etree__XSLTResolverContext *)__pyx_t_4), ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":389
 *         _initXSLTResolverContext(self._xslt_resolver_context, doc._parser)
 *         # keep a copy in case we need to access the stylesheet via 'document()'
 *         self._xslt_resolver_context._c_style_doc = _copyDoc(c_doc, 1)             # <<<<<<<<<<<<<<
 *         c_doc._private = <python.PyObject*>self._xslt_resolver_context
 * 
 */
  __pyx_t_6 = __pyx_f_4lxml_5etree__copyDoc(__pyx_v_c_doc, 1); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_xslt_resolver_context->_c_style_doc = __pyx_t_6;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":390
 *         # keep a copy in case we need to access the stylesheet via 'document()'
 *         self._xslt_resolver_context._c_style_doc = _copyDoc(c_doc, 1)
 *         c_doc._private = <python.PyObject*>self._xslt_resolver_context             # <<<<<<<<<<<<<<
 * 
 *         self._error_log.connect()
 */
  __pyx_v_c_doc->_private = ((PyObject *)((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_xslt_resolver_context);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":392
 *         c_doc._private = <python.PyObject*>self._xslt_resolver_context
 * 
 *         self._error_log.connect()             # <<<<<<<<<<<<<<
 *         with nogil:
 *             c_style = xslt.xsltParseStylesheetDoc(c_doc)
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_error_log->__pyx_base.__pyx_base.__pyx_vtab)->connect(((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_error_log);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":393
 * 
 *         self._error_log.connect()
 *         with nogil:             # <<<<<<<<<<<<<<
 *             c_style = xslt.xsltParseStylesheetDoc(c_doc)
 *         self._error_log.disconnect()
 */
  {
    #ifdef WITH_THREAD
    PyThreadState *_save;
    #endif
    Py_UNBLOCK_THREADS
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":394
 *         self._error_log.connect()
 *         with nogil:
 *             c_style = xslt.xsltParseStylesheetDoc(c_doc)             # <<<<<<<<<<<<<<
 *         self._error_log.disconnect()
 * 
 */
      __pyx_v_c_style = xsltParseStylesheetDoc(__pyx_v_c_doc);
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":393
 * 
 *         self._error_log.connect()
 *         with nogil:             # <<<<<<<<<<<<<<
 *             c_style = xslt.xsltParseStylesheetDoc(c_doc)
 *         self._error_log.disconnect()
 */
    /*finally:*/ {
      Py_BLOCK_THREADS
    }
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":395
 *         with nogil:
 *             c_style = xslt.xsltParseStylesheetDoc(c_doc)
 *         self._error_log.disconnect()             # <<<<<<<<<<<<<<
 * 
 *         if c_style is NULL:
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_error_log->__pyx_base.__pyx_base.__pyx_vtab)->disconnect(((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_error_log);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":397
 *         self._error_log.disconnect()
 * 
 *         if c_style is NULL:             # <<<<<<<<<<<<<<
 *             tree.xmlFreeDoc(c_doc)
 *             self._xslt_resolver_context._raise_if_stored()
 */
  __pyx_t_3 = (__pyx_v_c_style == NULL);
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":398
 * 
 *         if c_style is NULL:
 *             tree.xmlFreeDoc(c_doc)             # <<<<<<<<<<<<<<
 *             self._xslt_resolver_context._raise_if_stored()
 *             # last error seems to be the most accurate here
 */
    xmlFreeDoc(__pyx_v_c_doc);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":399
 *         if c_style is NULL:
 *             tree.xmlFreeDoc(c_doc)
 *             self._xslt_resolver_context._raise_if_stored()             # <<<<<<<<<<<<<<
 *             # last error seems to be the most accurate here
 *             if self._error_log.last_error is not None and \
 */
    __pyx_t_7 = ((struct __pyx_vtabstruct_4lxml_5etree__XSLTResolverContext *)((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_xslt_resolver_context->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._raise_if_stored(((struct __pyx_obj_4lxml_5etree__ExceptionContext *)((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_xslt_resolver_context)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":401
 *             self._xslt_resolver_context._raise_if_stored()
 *             # last error seems to be the most accurate here
 *             if self._error_log.last_error is not None and \             # <<<<<<<<<<<<<<
 *                     self._error_log.last_error.message:
 *                 raise XSLTParseError(self._error_log.last_error.message,
 */
    __pyx_t_3 = (((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_error_log->__pyx_base.__pyx_base.last_error != Py_None);
    if (__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":402
 *             # last error seems to be the most accurate here
 *             if self._error_log.last_error is not None and \
 *                     self._error_log.last_error.message:             # <<<<<<<<<<<<<<
 *                 raise XSLTParseError(self._error_log.last_error.message,
 *                                      self._error_log)
 */
      __pyx_t_5 = PyObject_GetAttr(((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_error_log->__pyx_base.__pyx_base.last_error, __pyx_n_s__message); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_9 = __pyx_t_8;
    } else {
      __pyx_t_9 = __pyx_t_3;
    }
    if (__pyx_t_9) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":403
 *             if self._error_log.last_error is not None and \
 *                     self._error_log.last_error.message:
 *                 raise XSLTParseError(self._error_log.last_error.message,             # <<<<<<<<<<<<<<
 *                                      self._error_log)
 *             else:
 */
      __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__XSLTParseError); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_1 = PyObject_GetAttr(((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_error_log->__pyx_base.__pyx_base.last_error, __pyx_n_s__message); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":404
 *                     self._error_log.last_error.message:
 *                 raise XSLTParseError(self._error_log.last_error.message,
 *                                      self._error_log)             # <<<<<<<<<<<<<<
 *             else:
 *                 raise XSLTParseError(
 */
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_error_log));
      PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_error_log));
      __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_error_log));
      __pyx_t_1 = 0;
      __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __Pyx_Raise(__pyx_t_1, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      {__pyx_filename = __pyx_f[18]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L11;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":406
 *                                      self._error_log)
 *             else:
 *                 raise XSLTParseError(             # <<<<<<<<<<<<<<
 *                     self._error_log._buildExceptionMessage(
 *                         u"Cannot parse stylesheet"),
 */
      __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__XSLTParseError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":407
 *             else:
 *                 raise XSLTParseError(
 *                     self._error_log._buildExceptionMessage(             # <<<<<<<<<<<<<<
 *                         u"Cannot parse stylesheet"),
 *                     self._error_log)
 */
      __pyx_t_4 = ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_error_log->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._buildExceptionMessage(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_error_log), ((PyObject *)__pyx_kp_u_362)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":409
 *                     self._error_log._buildExceptionMessage(
 *                         u"Cannot parse stylesheet"),
 *                     self._error_log)             # <<<<<<<<<<<<<<
 * 
 *         c_doc._private = NULL # no longer used!
 */
      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_error_log));
      PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_error_log));
      __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_error_log));
      __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
      __Pyx_Raise(__pyx_t_4, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      {__pyx_filename = __pyx_f[18]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_L11:;
    goto __pyx_L10;
  }
  __pyx_L10:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":411
 *                     self._error_log)
 * 
 *         c_doc._private = NULL # no longer used!             # <<<<<<<<<<<<<<
 *         self._c_style = c_style
 *         self._context = _XSLTContext(None, extensions, regexp, True)
 */
  __pyx_v_c_doc->_private = NULL;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":412
 * 
 *         c_doc._private = NULL # no longer used!
 *         self._c_style = c_style             # <<<<<<<<<<<<<<
 *         self._context = _XSLTContext(None, extensions, regexp, True)
 * 
 */
  ((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_c_style = __pyx_v_c_style;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":413
 *         c_doc._private = NULL # no longer used!
 *         self._c_style = c_style
 *         self._context = _XSLTContext(None, extensions, regexp, True)             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_5, 0, Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_INCREF(__pyx_v_extensions);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_extensions);
  __Pyx_GIVEREF(__pyx_v_extensions);
  __Pyx_INCREF(__pyx_v_regexp);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_regexp);
  __Pyx_GIVEREF(__pyx_v_regexp);
  PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__XSLTContext)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_context);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_context));
  ((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_context = ((struct __pyx_obj_4lxml_5etree__XSLTContext *)__pyx_t_4);
  __pyx_t_4 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.XSLT.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_doc);
  __Pyx_DECREF((PyObject *)__pyx_v_root_node);
  __Pyx_DECREF(__pyx_v_doc_url_utf);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":415
 *         self._context = _XSLTContext(None, extensions, regexp, True)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._xslt_resolver_context is not None and \
 *                self._xslt_resolver_context._c_style_doc is not NULL:
 */

static void __pyx_pf_4lxml_5etree_4XSLT_2__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pf_4lxml_5etree_4XSLT_2__dealloc__(PyObject *__pyx_v_self) {
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("__dealloc__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":416
 * 
 *     def __dealloc__(self):
 *         if self._xslt_resolver_context is not None and \             # <<<<<<<<<<<<<<
 *                self._xslt_resolver_context._c_style_doc is not NULL:
 *             tree.xmlFreeDoc(self._xslt_resolver_context._c_style_doc)
 */
  __pyx_t_1 = (((PyObject *)((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_xslt_resolver_context) != Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":417
 *     def __dealloc__(self):
 *         if self._xslt_resolver_context is not None and \
 *                self._xslt_resolver_context._c_style_doc is not NULL:             # <<<<<<<<<<<<<<
 *             tree.xmlFreeDoc(self._xslt_resolver_context._c_style_doc)
 *         # this cleans up the doc copy as well
 */
    __pyx_t_2 = (((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_xslt_resolver_context->_c_style_doc != NULL);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":418
 *         if self._xslt_resolver_context is not None and \
 *                self._xslt_resolver_context._c_style_doc is not NULL:
 *             tree.xmlFreeDoc(self._xslt_resolver_context._c_style_doc)             # <<<<<<<<<<<<<<
 *         # this cleans up the doc copy as well
 *         if self._c_style is not NULL:
 */
    xmlFreeDoc(((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_xslt_resolver_context->_c_style_doc);
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":420
 *             tree.xmlFreeDoc(self._xslt_resolver_context._c_style_doc)
 *         # this cleans up the doc copy as well
 *         if self._c_style is not NULL:             # <<<<<<<<<<<<<<
 *             xslt.xsltFreeStylesheet(self._c_style)
 * 
 */
  __pyx_t_3 = (((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_c_style != NULL);
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":421
 *         # this cleans up the doc copy as well
 *         if self._c_style is not NULL:
 *             xslt.xsltFreeStylesheet(self._c_style)             # <<<<<<<<<<<<<<
 * 
 *     property error_log:
 */
    xsltFreeStylesheet(((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_c_style);
    goto __pyx_L6;
  }
  __pyx_L6:;

  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":425
 *     property error_log:
 *         u"The log of errors and warnings of an XSLT execution."
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._error_log.copy()
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_4XSLT_9error_log___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_4XSLT_9error_log___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__get__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":426
 *         u"The log of errors and warnings of an XSLT execution."
 *         def __get__(self):
 *             return self._error_log.copy()             # <<<<<<<<<<<<<<
 * 
 *     @classmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_error_log), __pyx_n_s__copy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.XSLT.error_log.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":429
 * 
 *     @classmethod
 *     def strparam(_, strval):             # <<<<<<<<<<<<<<
 *         u"""strparam(strval)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_4XSLT_3strparam(PyObject *__pyx_v__, PyObject *__pyx_v_strval); /*proto*/
static char __pyx_doc_4lxml_5etree_4XSLT_3strparam[] = "strparam(strval)\n\n        Mark an XSLT string parameter that requires quote escaping\n        before passing it into the transformation.  Use it like this::\n\n            result = transform(doc, some_strval = XSLT.strparam(\n                '''it's \"Monty Python's\" ...'''))\n\n        Escaped string parameters can be reused without restriction.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_4XSLT_3strparam(PyObject *__pyx_v__, PyObject *__pyx_v_strval) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("strparam");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":440
 *         Escaped string parameters can be reused without restriction.
 *         """
 *         return _XSLTQuotedStringParam(strval)             # <<<<<<<<<<<<<<
 * 
 *     def apply(self, _input, *, profile_run=False, **kw):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_strval);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_strval);
  __Pyx_GIVEREF(__pyx_v_strval);
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__XSLTQuotedStringParam)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.XSLT.strparam");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":442
 *         return _XSLTQuotedStringParam(strval)
 * 
 *     def apply(self, _input, *, profile_run=False, **kw):             # <<<<<<<<<<<<<<
 *         u"""apply(self, _input,  profile_run=False, **kw)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_4XSLT_4apply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_4XSLT_4apply[] = "apply(self, _input,  profile_run=False, **kw)\n        \n        :deprecated: call the object, not this method.";
static PyObject *__pyx_pf_4lxml_5etree_4XSLT_4apply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v__input = 0;
  PyObject *__pyx_v_profile_run = 0;
  PyObject *__pyx_v_kw = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s___input,&__pyx_n_s__profile_run,0};
  __Pyx_RefNannySetupContext("apply");
  __pyx_v_kw = PyDict_New(); if (unlikely(!__pyx_v_kw)) return NULL;
  __Pyx_GOTREF(__pyx_v_kw);
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    values[1] = __pyx_k_363;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s___input);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kw, values, PyTuple_GET_SIZE(__pyx_args), "apply") < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v__input = values[0];
    __pyx_v_profile_run = values[1];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v__input = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_profile_run = __pyx_k_363;
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("apply", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[18]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_kw);
  __Pyx_AddTraceback("lxml.etree.XSLT.apply");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":446
 * 
 *         :deprecated: call the object, not this method."""
 *         return self(_input, profile_run=profile_run, **kw)             # <<<<<<<<<<<<<<
 * 
 *     def tostring(self, _ElementTree result_tree):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v__input);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__input);
  __Pyx_GIVEREF(__pyx_v__input);
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__profile_run), __pyx_v_profile_run) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_Update(((PyObject *)__pyx_t_2), ((PyObject *)__pyx_v_kw)) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_v_self, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.XSLT.apply");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_kw);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":448
 *         return self(_input, profile_run=profile_run, **kw)
 * 
 *     def tostring(self, _ElementTree result_tree):             # <<<<<<<<<<<<<<
 *         u"""tostring(self, result_tree)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_4XSLT_5tostring(PyObject *__pyx_v_self, PyObject *__pyx_v_result_tree); /*proto*/
static char __pyx_doc_4lxml_5etree_4XSLT_5tostring[] = "tostring(self, result_tree)\n\n        Save result doc to string based on stylesheet output method.\n\n        :deprecated: use str(result_tree) instead.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_4XSLT_5tostring(PyObject *__pyx_v_self, PyObject *__pyx_v_result_tree) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("tostring");
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_result_tree), __pyx_ptype_4lxml_5etree__ElementTree, 1, "result_tree", 0))) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":455
 *         :deprecated: use str(result_tree) instead.
 *         """
 *         return str(result_tree)             # <<<<<<<<<<<<<<
 * 
 *     def __deepcopy__(self, memo):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_result_tree);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_result_tree);
  __Pyx_GIVEREF(__pyx_v_result_tree);
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.XSLT.tostring");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":457
 *         return str(result_tree)
 * 
 *     def __deepcopy__(self, memo):             # <<<<<<<<<<<<<<
 *         return self.__copy__()
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_4XSLT_6__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_4XSLT_6__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__deepcopy__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":458
 * 
 *     def __deepcopy__(self, memo):
 *         return self.__copy__()             # <<<<<<<<<<<<<<
 * 
 *     def __copy__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____copy__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.XSLT.__deepcopy__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":460
 *         return self.__copy__()
 * 
 *     def __copy__(self):             # <<<<<<<<<<<<<<
 *         return _copyXSLT(self)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_4XSLT_7__copy__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_4XSLT_7__copy__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__copy__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":461
 * 
 *     def __copy__(self):
 *         return _copyXSLT(self)             # <<<<<<<<<<<<<<
 * 
 *     def __call__(self, _input, *, profile_run=False, **kw):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__copyXSLT(((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.XSLT.__copy__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":463
 *         return _copyXSLT(self)
 * 
 *     def __call__(self, _input, *, profile_run=False, **kw):             # <<<<<<<<<<<<<<
 *         u"""__call__(self, _input, profile_run=False, **kw)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_4XSLT_8__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_4XSLT_8__call__[] = "__call__(self, _input, profile_run=False, **kw)\n\n        Execute the XSL transformation on a tree or Element.\n\n        Pass the ``profile_run`` option to get profile information\n        about the XSLT.  The result of the XSLT will have a property\n        xslt_profile that holds an XML tree with profiling data.\n        ";
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_4XSLT_8__call__;
static PyObject *__pyx_pf_4lxml_5etree_4XSLT_8__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v__input = 0;
  PyObject *__pyx_v_profile_run = 0;
  PyObject *__pyx_v_kw = 0;
  struct __pyx_obj_4lxml_5etree__XSLTContext *__pyx_v_context;
  struct __pyx_obj_4lxml_5etree__XSLTResolverContext *__pyx_v_resolver_context;
  struct LxmlDocument *__pyx_v_input_doc;
  struct LxmlElement *__pyx_v_root_node;
  struct LxmlDocument *__pyx_v_result_doc;
  struct LxmlDocument *__pyx_v_profile_doc;
  xmlDoc *__pyx_v_c_profile_doc;
  xsltTransformContext *__pyx_v_transform_ctxt;
  xmlDoc *__pyx_v_c_result;
  xmlDoc *__pyx_v_c_doc;
  xmlDict *__pyx_v_c_dict;
  char **__pyx_v_params;
  PyObject *__pyx_v_live_refs;
  PyObject *__pyx_v_error;
  PyObject *__pyx_v_message;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  xmlDoc *__pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s___input,&__pyx_n_s__profile_run,0};
  __Pyx_RefNannySetupContext("__call__");
  __pyx_v_kw = PyDict_New(); if (unlikely(!__pyx_v_kw)) return NULL;
  __Pyx_GOTREF(__pyx_v_kw);
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    values[1] = __pyx_k_364;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s___input);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kw, values, PyTuple_GET_SIZE(__pyx_args), "__call__") < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v__input = values[0];
    __pyx_v_profile_run = values[1];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v__input = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_profile_run = __pyx_k_364;
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[18]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_kw);
  __Pyx_AddTraceback("lxml.etree.XSLT.__call__");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__XSLTContext *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_resolver_context = ((struct __pyx_obj_4lxml_5etree__XSLTResolverContext *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_input_doc = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_root_node = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_result_doc = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_profile_doc = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_live_refs = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_error = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_message = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":480
 *         cdef xmlDoc* c_profile_doc
 *         cdef xslt.xsltTransformContext* transform_ctxt
 *         cdef xmlDoc* c_result = NULL             # <<<<<<<<<<<<<<
 *         cdef xmlDoc* c_doc
 *         cdef tree.xmlDict* c_dict
 */
  __pyx_v_c_result = NULL;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":485
 *         cdef char** params
 * 
 *         assert self._c_style is not NULL, "XSLT stylesheet not initialised"             # <<<<<<<<<<<<<<
 *         input_doc = _documentOrRaise(_input)
 *         root_node = _rootNodeOrRaise(_input)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!(((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_c_style != NULL))) {
    PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_365));
    {__pyx_filename = __pyx_f[18]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":486
 * 
 *         assert self._c_style is not NULL, "XSLT stylesheet not initialised"
 *         input_doc = _documentOrRaise(_input)             # <<<<<<<<<<<<<<
 *         root_node = _rootNodeOrRaise(_input)
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v__input)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_input_doc));
  __pyx_v_input_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":487
 *         assert self._c_style is not NULL, "XSLT stylesheet not initialised"
 *         input_doc = _documentOrRaise(_input)
 *         root_node = _rootNodeOrRaise(_input)             # <<<<<<<<<<<<<<
 * 
 *         c_doc = _fakeRootDoc(input_doc._c_doc, root_node._c_node)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v__input)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_root_node));
  __pyx_v_root_node = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":489
 *         root_node = _rootNodeOrRaise(_input)
 * 
 *         c_doc = _fakeRootDoc(input_doc._c_doc, root_node._c_node)             # <<<<<<<<<<<<<<
 * 
 *         transform_ctxt = xslt.xsltNewTransformContext(self._c_style, c_doc)
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__fakeRootDoc(__pyx_v_input_doc->_c_doc, __pyx_v_root_node->_c_node); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_doc = __pyx_t_2;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":491
 *         c_doc = _fakeRootDoc(input_doc._c_doc, root_node._c_node)
 * 
 *         transform_ctxt = xslt.xsltNewTransformContext(self._c_style, c_doc)             # <<<<<<<<<<<<<<
 *         if transform_ctxt is NULL:
 *             _destroyFakeDoc(input_doc._c_doc, c_doc)
 */
  __pyx_v_transform_ctxt = xsltNewTransformContext(((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_c_style, __pyx_v_c_doc);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":492
 * 
 *         transform_ctxt = xslt.xsltNewTransformContext(self._c_style, c_doc)
 *         if transform_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             _destroyFakeDoc(input_doc._c_doc, c_doc)
 *             python.PyErr_NoMemory()
 */
  __pyx_t_3 = (__pyx_v_transform_ctxt == NULL);
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":493
 *         transform_ctxt = xslt.xsltNewTransformContext(self._c_style, c_doc)
 *         if transform_ctxt is NULL:
 *             _destroyFakeDoc(input_doc._c_doc, c_doc)             # <<<<<<<<<<<<<<
 *             python.PyErr_NoMemory()
 * 
 */
    __pyx_f_4lxml_5etree__destroyFakeDoc(__pyx_v_input_doc->_c_doc, __pyx_v_c_doc);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":494
 *         if transform_ctxt is NULL:
 *             _destroyFakeDoc(input_doc._c_doc, c_doc)
 *             python.PyErr_NoMemory()             # <<<<<<<<<<<<<<
 * 
 *         # using the stylesheet dict is safer than using a possibly
 */
    __pyx_t_1 = PyErr_NoMemory(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":500
 *         # non-input tag/attr names will come from the stylesheet
 *         # anyway.
 *         if transform_ctxt.dict is not NULL:             # <<<<<<<<<<<<<<
 *             xmlparser.xmlDictFree(transform_ctxt.dict)
 *         transform_ctxt.dict = self._c_style.doc.dict
 */
  __pyx_t_3 = (__pyx_v_transform_ctxt->dict != NULL);
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":501
 *         # anyway.
 *         if transform_ctxt.dict is not NULL:
 *             xmlparser.xmlDictFree(transform_ctxt.dict)             # <<<<<<<<<<<<<<
 *         transform_ctxt.dict = self._c_style.doc.dict
 *         xmlparser.xmlDictReference(transform_ctxt.dict)
 */
    xmlDictFree(__pyx_v_transform_ctxt->dict);
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":502
 *         if transform_ctxt.dict is not NULL:
 *             xmlparser.xmlDictFree(transform_ctxt.dict)
 *         transform_ctxt.dict = self._c_style.doc.dict             # <<<<<<<<<<<<<<
 *         xmlparser.xmlDictReference(transform_ctxt.dict)
 * 
 */
  __pyx_v_transform_ctxt->dict = ((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_c_style->doc->dict;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":503
 *             xmlparser.xmlDictFree(transform_ctxt.dict)
 *         transform_ctxt.dict = self._c_style.doc.dict
 *         xmlparser.xmlDictReference(transform_ctxt.dict)             # <<<<<<<<<<<<<<
 * 
 *         xslt.xsltSetCtxtParseOptions(
 */
  xmlDictReference(__pyx_v_transform_ctxt->dict);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":506
 * 
 *         xslt.xsltSetCtxtParseOptions(
 *             transform_ctxt, input_doc._parser._parse_options)             # <<<<<<<<<<<<<<
 * 
 *         if profile_run:
 */
  xsltSetCtxtParseOptions(__pyx_v_transform_ctxt, __pyx_v_input_doc->_parser->_parse_options);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":508
 *             transform_ctxt, input_doc._parser._parse_options)
 * 
 *         if profile_run:             # <<<<<<<<<<<<<<
 *             transform_ctxt.profile = 1
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_profile_run); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":509
 * 
 *         if profile_run:
 *             transform_ctxt.profile = 1             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
    __pyx_v_transform_ctxt->profile = 1;
    goto __pyx_L8;
  }
  __pyx_L8:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":511
 *             transform_ctxt.profile = 1
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             self._error_log.connect()
 *             context = self._context._copy()
 */
  /*try:*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":512
 * 
 *         try:
 *             self._error_log.connect()             # <<<<<<<<<<<<<<
 *             context = self._context._copy()
 *             context.register_context(transform_ctxt, input_doc)
 */
    ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_error_log->__pyx_base.__pyx_base.__pyx_vtab)->connect(((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_error_log);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":513
 *         try:
 *             self._error_log.connect()
 *             context = self._context._copy()             # <<<<<<<<<<<<<<
 *             context.register_context(transform_ctxt, input_doc)
 * 
 */
    __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__XSLTContext *)((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_context->__pyx_base.__pyx_vtab)->__pyx_base._copy(((struct __pyx_obj_4lxml_5etree__BaseContext *)((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_context))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L10;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__XSLTContext))))) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L10;}
    __Pyx_DECREF(((PyObject *)__pyx_v_context));
    __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__XSLTContext *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":514
 *             self._error_log.connect()
 *             context = self._context._copy()
 *             context.register_context(transform_ctxt, input_doc)             # <<<<<<<<<<<<<<
 * 
 *             resolver_context = self._xslt_resolver_context._copy()
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__XSLTContext *)__pyx_v_context->__pyx_base.__pyx_vtab)->register_context(__pyx_v_context, __pyx_v_transform_ctxt, __pyx_v_input_doc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L10;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":516
 *             context.register_context(transform_ctxt, input_doc)
 * 
 *             resolver_context = self._xslt_resolver_context._copy()             # <<<<<<<<<<<<<<
 *             transform_ctxt._private = <python.PyObject*>resolver_context
 * 
 */
    __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__XSLTResolverContext *)((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_xslt_resolver_context->__pyx_base.__pyx_base.__pyx_vtab)->_copy(((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_xslt_resolver_context)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L10;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(((PyObject *)__pyx_v_resolver_context));
    __pyx_v_resolver_context = ((struct __pyx_obj_4lxml_5etree__XSLTResolverContext *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":517
 * 
 *             resolver_context = self._xslt_resolver_context._copy()
 *             transform_ctxt._private = <python.PyObject*>resolver_context             # <<<<<<<<<<<<<<
 * 
 *             live_refs = _convert_xslt_parameters(transform_ctxt, kw, &params)
 */
    __pyx_v_transform_ctxt->_private = ((PyObject *)__pyx_v_resolver_context);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":519
 *             transform_ctxt._private = <python.PyObject*>resolver_context
 * 
 *             live_refs = _convert_xslt_parameters(transform_ctxt, kw, &params)             # <<<<<<<<<<<<<<
 *             c_result = self._run_transform(
 *                 c_doc, params, context, transform_ctxt)
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree__convert_xslt_parameters(__pyx_v_transform_ctxt, __pyx_v_kw, (&__pyx_v_params)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L10;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_v_live_refs);
    __pyx_v_live_refs = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":521
 *             live_refs = _convert_xslt_parameters(transform_ctxt, kw, &params)
 *             c_result = self._run_transform(
 *                 c_doc, params, context, transform_ctxt)             # <<<<<<<<<<<<<<
 *             if params is not NULL:
 *                 # deallocate space for parameters
 */
    __pyx_v_c_result = ((struct __pyx_vtabstruct_4lxml_5etree_XSLT *)((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->__pyx_vtab)->_run_transform(((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self), __pyx_v_c_doc, __pyx_v_params, __pyx_v_context, __pyx_v_transform_ctxt);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":522
 *             c_result = self._run_transform(
 *                 c_doc, params, context, transform_ctxt)
 *             if params is not NULL:             # <<<<<<<<<<<<<<
 *                 # deallocate space for parameters
 *                 python.PyMem_Free(params)
 */
    __pyx_t_3 = (__pyx_v_params != NULL);
    if (__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":524
 *             if params is not NULL:
 *                 # deallocate space for parameters
 *                 python.PyMem_Free(params)             # <<<<<<<<<<<<<<
 *             live_refs = None
 * 
 */
      PyMem_Free(__pyx_v_params);
      goto __pyx_L12;
    }
    __pyx_L12:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":525
 *                 # deallocate space for parameters
 *                 python.PyMem_Free(params)
 *             live_refs = None             # <<<<<<<<<<<<<<
 * 
 *             if transform_ctxt.state != xslt.XSLT_STATE_OK:
 */
    __Pyx_INCREF(Py_None);
    __Pyx_DECREF(__pyx_v_live_refs);
    __pyx_v_live_refs = Py_None;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":527
 *             live_refs = None
 * 
 *             if transform_ctxt.state != xslt.XSLT_STATE_OK:             # <<<<<<<<<<<<<<
 *                 if c_result is not NULL:
 *                     tree.xmlFreeDoc(c_result)
 */
    __pyx_t_3 = (__pyx_v_transform_ctxt->state != XSLT_STATE_OK);
    if (__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":528
 * 
 *             if transform_ctxt.state != xslt.XSLT_STATE_OK:
 *                 if c_result is not NULL:             # <<<<<<<<<<<<<<
 *                     tree.xmlFreeDoc(c_result)
 *                     c_result = NULL
 */
      __pyx_t_3 = (__pyx_v_c_result != NULL);
      if (__pyx_t_3) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":529
 *             if transform_ctxt.state != xslt.XSLT_STATE_OK:
 *                 if c_result is not NULL:
 *                     tree.xmlFreeDoc(c_result)             # <<<<<<<<<<<<<<
 *                     c_result = NULL
 * 
 */
        xmlFreeDoc(__pyx_v_c_result);

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":530
 *                 if c_result is not NULL:
 *                     tree.xmlFreeDoc(c_result)
 *                     c_result = NULL             # <<<<<<<<<<<<<<
 * 
 *             if transform_ctxt.profile:
 */
        __pyx_v_c_result = NULL;
        goto __pyx_L14;
      }
      __pyx_L14:;
      goto __pyx_L13;
    }
    __pyx_L13:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":532
 *                     c_result = NULL
 * 
 *             if transform_ctxt.profile:             # <<<<<<<<<<<<<<
 *                 c_profile_doc = xslt.xsltGetProfileInformation(transform_ctxt)
 *                 if c_profile_doc is not NULL:
 */
    if (__pyx_v_transform_ctxt->profile) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":533
 * 
 *             if transform_ctxt.profile:
 *                 c_profile_doc = xslt.xsltGetProfileInformation(transform_ctxt)             # <<<<<<<<<<<<<<
 *                 if c_profile_doc is not NULL:
 *                     profile_doc = _documentFactory(
 */
      __pyx_v_c_profile_doc = xsltGetProfileInformation(__pyx_v_transform_ctxt);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":534
 *             if transform_ctxt.profile:
 *                 c_profile_doc = xslt.xsltGetProfileInformation(transform_ctxt)
 *                 if c_profile_doc is not NULL:             # <<<<<<<<<<<<<<
 *                     profile_doc = _documentFactory(
 *                         c_profile_doc, input_doc._parser)
 */
      __pyx_t_3 = (__pyx_v_c_profile_doc != NULL);
      if (__pyx_t_3) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":536
 *                 if c_profile_doc is not NULL:
 *                     profile_doc = _documentFactory(
 *                         c_profile_doc, input_doc._parser)             # <<<<<<<<<<<<<<
 *         finally:
 *             if context is not None:
 */
        __pyx_t_1 = ((PyObject *)__pyx_v_input_doc->_parser);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_profile_doc, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_1))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L10;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_v_profile_doc));
        __pyx_v_profile_doc = ((struct LxmlDocument *)__pyx_t_4);
        __pyx_t_4 = 0;
        goto __pyx_L16;
      }
      __pyx_L16:;
      goto __pyx_L15;
    }
    __pyx_L15:;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":538
 *                         c_profile_doc, input_doc._parser)
 *         finally:
 *             if context is not None:             # <<<<<<<<<<<<<<
 *                 context.free_context()
 *             _destroyFakeDoc(input_doc._c_doc, c_doc)
 */
  /*finally:*/ {
    int __pyx_why;
    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
    int __pyx_exc_lineno;
    __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 0; goto __pyx_L11;
    __pyx_L10: {
      __pyx_why = 4;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
      __pyx_exc_lineno = __pyx_lineno;
      goto __pyx_L11;
    }
    __pyx_L11:;
    __pyx_t_3 = (((PyObject *)__pyx_v_context) != Py_None);
    if (__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":539
 *         finally:
 *             if context is not None:
 *                 context.free_context()             # <<<<<<<<<<<<<<
 *             _destroyFakeDoc(input_doc._c_doc, c_doc)
 *             self._error_log.disconnect()
 */
      __pyx_t_4 = ((struct __pyx_vtabstruct_4lxml_5etree__XSLTContext *)__pyx_v_context->__pyx_base.__pyx_vtab)->free_context(__pyx_v_context); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L17_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L18;
    }
    __pyx_L18:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":540
 *             if context is not None:
 *                 context.free_context()
 *             _destroyFakeDoc(input_doc._c_doc, c_doc)             # <<<<<<<<<<<<<<
 *             self._error_log.disconnect()
 * 
 */
    __pyx_f_4lxml_5etree__destroyFakeDoc(__pyx_v_input_doc->_c_doc, __pyx_v_c_doc);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":541
 *                 context.free_context()
 *             _destroyFakeDoc(input_doc._c_doc, c_doc)
 *             self._error_log.disconnect()             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
    ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_error_log->__pyx_base.__pyx_base.__pyx_vtab)->disconnect(((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_error_log);
    goto __pyx_L19;
    __pyx_L17_error:;
    if (__pyx_why == 4) {
      Py_XDECREF(__pyx_exc_type);
      Py_XDECREF(__pyx_exc_value);
      Py_XDECREF(__pyx_exc_tb);
    }
    goto __pyx_L1_error;
    __pyx_L19:;
    switch (__pyx_why) {
      case 4: {
        __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
        __pyx_lineno = __pyx_exc_lineno;
        __pyx_exc_type = 0;
        __pyx_exc_value = 0;
        __pyx_exc_tb = 0;
        goto __pyx_L1_error;
      }
    }
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":543
 *             self._error_log.disconnect()
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             if resolver_context is not None and resolver_context._has_raised():
 *                 if c_result is not NULL:
 */
  /*try:*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":544
 * 
 *         try:
 *             if resolver_context is not None and resolver_context._has_raised():             # <<<<<<<<<<<<<<
 *                 if c_result is not NULL:
 *                     tree.xmlFreeDoc(c_result)
 */
    __pyx_t_3 = (((PyObject *)__pyx_v_resolver_context) != Py_None);
    if (__pyx_t_3) {
      __pyx_t_5 = ((struct __pyx_vtabstruct_4lxml_5etree__XSLTResolverContext *)__pyx_v_resolver_context->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._has_raised(((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_v_resolver_context));
      __pyx_t_6 = __pyx_t_5;
    } else {
      __pyx_t_6 = __pyx_t_3;
    }
    if (__pyx_t_6) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":545
 *         try:
 *             if resolver_context is not None and resolver_context._has_raised():
 *                 if c_result is not NULL:             # <<<<<<<<<<<<<<
 *                     tree.xmlFreeDoc(c_result)
 *                     c_result = NULL
 */
      __pyx_t_6 = (__pyx_v_c_result != NULL);
      if (__pyx_t_6) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":546
 *             if resolver_context is not None and resolver_context._has_raised():
 *                 if c_result is not NULL:
 *                     tree.xmlFreeDoc(c_result)             # <<<<<<<<<<<<<<
 *                     c_result = NULL
 *                 resolver_context._raise_if_stored()
 */
        xmlFreeDoc(__pyx_v_c_result);

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":547
 *                 if c_result is not NULL:
 *                     tree.xmlFreeDoc(c_result)
 *                     c_result = NULL             # <<<<<<<<<<<<<<
 *                 resolver_context._raise_if_stored()
 * 
 */
        __pyx_v_c_result = NULL;
        goto __pyx_L24;
      }
      __pyx_L24:;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":548
 *                     tree.xmlFreeDoc(c_result)
 *                     c_result = NULL
 *                 resolver_context._raise_if_stored()             # <<<<<<<<<<<<<<
 * 
 *             if context._exc._has_raised():
 */
      __pyx_t_7 = ((struct __pyx_vtabstruct_4lxml_5etree__XSLTResolverContext *)__pyx_v_resolver_context->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._raise_if_stored(((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_v_resolver_context)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L21;}
      goto __pyx_L23;
    }
    __pyx_L23:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":550
 *                 resolver_context._raise_if_stored()
 * 
 *             if context._exc._has_raised():             # <<<<<<<<<<<<<<
 *                 if c_result is not NULL:
 *                     tree.xmlFreeDoc(c_result)
 */
    __pyx_t_6 = ((struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext *)__pyx_v_context->__pyx_base._exc->__pyx_vtab)->_has_raised(__pyx_v_context->__pyx_base._exc);
    if (__pyx_t_6) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":551
 * 
 *             if context._exc._has_raised():
 *                 if c_result is not NULL:             # <<<<<<<<<<<<<<
 *                     tree.xmlFreeDoc(c_result)
 *                     c_result = NULL
 */
      __pyx_t_6 = (__pyx_v_c_result != NULL);
      if (__pyx_t_6) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":552
 *             if context._exc._has_raised():
 *                 if c_result is not NULL:
 *                     tree.xmlFreeDoc(c_result)             # <<<<<<<<<<<<<<
 *                     c_result = NULL
 *                 context._exc._raise_if_stored()
 */
        xmlFreeDoc(__pyx_v_c_result);

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":553
 *                 if c_result is not NULL:
 *                     tree.xmlFreeDoc(c_result)
 *                     c_result = NULL             # <<<<<<<<<<<<<<
 *                 context._exc._raise_if_stored()
 * 
 */
        __pyx_v_c_result = NULL;
        goto __pyx_L26;
      }
      __pyx_L26:;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":554
 *                     tree.xmlFreeDoc(c_result)
 *                     c_result = NULL
 *                 context._exc._raise_if_stored()             # <<<<<<<<<<<<<<
 * 
 *             if c_result is NULL:
 */
      __pyx_t_7 = ((struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext *)__pyx_v_context->__pyx_base._exc->__pyx_vtab)->_raise_if_stored(__pyx_v_context->__pyx_base._exc); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L21;}
      goto __pyx_L25;
    }
    __pyx_L25:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":556
 *                 context._exc._raise_if_stored()
 * 
 *             if c_result is NULL:             # <<<<<<<<<<<<<<
 *                 # last error seems to be the most accurate here
 *                 error = self._error_log.last_error
 */
    __pyx_t_6 = (__pyx_v_c_result == NULL);
    if (__pyx_t_6) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":558
 *             if c_result is NULL:
 *                 # last error seems to be the most accurate here
 *                 error = self._error_log.last_error             # <<<<<<<<<<<<<<
 *                 if error is not None and error.message:
 *                     if error.line > 0:
 */
      __Pyx_INCREF(((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_error_log->__pyx_base.__pyx_base.last_error);
      __Pyx_DECREF(__pyx_v_error);
      __pyx_v_error = ((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_error_log->__pyx_base.__pyx_base.last_error;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":559
 *                 # last error seems to be the most accurate here
 *                 error = self._error_log.last_error
 *                 if error is not None and error.message:             # <<<<<<<<<<<<<<
 *                     if error.line > 0:
 *                         message = u"%s, line %d" % (error.message, error.line)
 */
      __pyx_t_6 = (__pyx_v_error != Py_None);
      if (__pyx_t_6) {
        __pyx_t_4 = PyObject_GetAttr(__pyx_v_error, __pyx_n_s__message); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L21;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L21;}
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_5 = __pyx_t_3;
      } else {
        __pyx_t_5 = __pyx_t_6;
      }
      if (__pyx_t_5) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":560
 *                 error = self._error_log.last_error
 *                 if error is not None and error.message:
 *                     if error.line > 0:             # <<<<<<<<<<<<<<
 *                         message = u"%s, line %d" % (error.message, error.line)
 *                     else:
 */
        __pyx_t_4 = PyObject_GetAttr(__pyx_v_error, __pyx_n_s__line); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L21;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_int_0, Py_GT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L21;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L21;}
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (__pyx_t_5) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":561
 *                 if error is not None and error.message:
 *                     if error.line > 0:
 *                         message = u"%s, line %d" % (error.message, error.line)             # <<<<<<<<<<<<<<
 *                     else:
 *                         message = error.message
 */
          __pyx_t_1 = PyObject_GetAttr(__pyx_v_error, __pyx_n_s__message); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L21;}
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_4 = PyObject_GetAttr(__pyx_v_error, __pyx_n_s__line); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L21;}
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L21;}
          __Pyx_GOTREF(((PyObject *)__pyx_t_8));
          PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_1);
          __Pyx_GIVEREF(__pyx_t_1);
          PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_4);
          __Pyx_GIVEREF(__pyx_t_4);
          __pyx_t_1 = 0;
          __pyx_t_4 = 0;
          __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_46), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L21;}
          __Pyx_GOTREF(((PyObject *)__pyx_t_4));
          __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
          __Pyx_DECREF(__pyx_v_message);
          __pyx_v_message = ((PyObject *)__pyx_t_4);
          __pyx_t_4 = 0;
          goto __pyx_L29;
        }
        /*else*/ {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":563
 *                         message = u"%s, line %d" % (error.message, error.line)
 *                     else:
 *                         message = error.message             # <<<<<<<<<<<<<<
 *                 elif error is not None and error.line > 0:
 *                     message = u"Error applying stylesheet, line %d" % error.line
 */
          __pyx_t_4 = PyObject_GetAttr(__pyx_v_error, __pyx_n_s__message); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L21;}
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_v_message);
          __pyx_v_message = __pyx_t_4;
          __pyx_t_4 = 0;
        }
        __pyx_L29:;
        goto __pyx_L28;
      }

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":564
 *                     else:
 *                         message = error.message
 *                 elif error is not None and error.line > 0:             # <<<<<<<<<<<<<<
 *                     message = u"Error applying stylesheet, line %d" % error.line
 *                 else:
 */
      __pyx_t_5 = (__pyx_v_error != Py_None);
      if (__pyx_t_5) {
        __pyx_t_4 = PyObject_GetAttr(__pyx_v_error, __pyx_n_s__line); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L21;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_8 = PyObject_RichCompare(__pyx_t_4, __pyx_int_0, Py_GT); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L21;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L21;}
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_3 = __pyx_t_6;
      } else {
        __pyx_t_3 = __pyx_t_5;
      }
      if (__pyx_t_3) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":565
 *                         message = error.message
 *                 elif error is not None and error.line > 0:
 *                     message = u"Error applying stylesheet, line %d" % error.line             # <<<<<<<<<<<<<<
 *                 else:
 *                     message = u"Error applying stylesheet"
 */
        __pyx_t_8 = PyObject_GetAttr(__pyx_v_error, __pyx_n_s__line); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L21;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_366), __pyx_t_8); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L21;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_4));
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_v_message);
        __pyx_v_message = ((PyObject *)__pyx_t_4);
        __pyx_t_4 = 0;
        goto __pyx_L28;
      }
      /*else*/ {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":567
 *                     message = u"Error applying stylesheet, line %d" % error.line
 *                 else:
 *                     message = u"Error applying stylesheet"             # <<<<<<<<<<<<<<
 *                 raise XSLTApplyError(message, self._error_log)
 *         finally:
 */
        __Pyx_INCREF(((PyObject *)__pyx_kp_u_367));
        __Pyx_DECREF(__pyx_v_message);
        __pyx_v_message = ((PyObject *)__pyx_kp_u_367);
      }
      __pyx_L28:;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":568
 *                 else:
 *                     message = u"Error applying stylesheet"
 *                 raise XSLTApplyError(message, self._error_log)             # <<<<<<<<<<<<<<
 *         finally:
 *             if resolver_context is not None:
 */
      __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__XSLTApplyError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L21;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L21;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_8));
      __Pyx_INCREF(__pyx_v_message);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_message);
      __Pyx_GIVEREF(__pyx_v_message);
      __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_error_log));
      PyTuple_SET_ITEM(__pyx_t_8, 1, ((PyObject *)((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_error_log));
      __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_error_log));
      __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L21;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
      __Pyx_Raise(__pyx_t_1, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      {__pyx_filename = __pyx_f[18]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L21;}
      goto __pyx_L27;
    }
    __pyx_L27:;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":570
 *                 raise XSLTApplyError(message, self._error_log)
 *         finally:
 *             if resolver_context is not None:             # <<<<<<<<<<<<<<
 *                 resolver_context.clear()
 * 
 */
  /*finally:*/ {
    int __pyx_why;
    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
    int __pyx_exc_lineno;
    __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 0; goto __pyx_L22;
    __pyx_L21: {
      __pyx_why = 4;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
      __pyx_exc_lineno = __pyx_lineno;
      goto __pyx_L22;
    }
    __pyx_L22:;
    __pyx_t_3 = (((PyObject *)__pyx_v_resolver_context) != Py_None);
    if (__pyx_t_3) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":571
 *         finally:
 *             if resolver_context is not None:
 *                 resolver_context.clear()             # <<<<<<<<<<<<<<
 * 
 *         result_doc = _documentFactory(c_result, input_doc._parser)
 */
      ((struct __pyx_vtabstruct_4lxml_5etree__XSLTResolverContext *)__pyx_v_resolver_context->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.clear(((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_v_resolver_context));
      goto __pyx_L31;
    }
    __pyx_L31:;
    switch (__pyx_why) {
      case 4: {
        __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
        __pyx_lineno = __pyx_exc_lineno;
        __pyx_exc_type = 0;
        __pyx_exc_value = 0;
        __pyx_exc_tb = 0;
        goto __pyx_L1_error;
      }
    }
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":573
 *                 resolver_context.clear()
 * 
 *         result_doc = _documentFactory(c_result, input_doc._parser)             # <<<<<<<<<<<<<<
 * 
 *         c_dict = c_result.dict
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_input_doc->_parser);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_8 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_result, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_1))); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_v_result_doc));
  __pyx_v_result_doc = ((struct LxmlDocument *)__pyx_t_8);
  __pyx_t_8 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":575
 *         result_doc = _documentFactory(c_result, input_doc._parser)
 * 
 *         c_dict = c_result.dict             # <<<<<<<<<<<<<<
 *         __GLOBAL_PARSER_CONTEXT.initThreadDictRef(&c_result.dict)
 *         if c_dict is not c_result.dict or \
 */
  __pyx_v_c_dict = __pyx_v_c_result->dict;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":576
 * 
 *         c_dict = c_result.dict
 *         __GLOBAL_PARSER_CONTEXT.initThreadDictRef(&c_result.dict)             # <<<<<<<<<<<<<<
 *         if c_dict is not c_result.dict or \
 *                 self._c_style.doc.dict is not c_result.dict or \
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext *)__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT->__pyx_vtab)->initThreadDictRef(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, (&__pyx_v_c_result->dict));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":577
 *         c_dict = c_result.dict
 *         __GLOBAL_PARSER_CONTEXT.initThreadDictRef(&c_result.dict)
 *         if c_dict is not c_result.dict or \             # <<<<<<<<<<<<<<
 *                 self._c_style.doc.dict is not c_result.dict or \
 *                 input_doc._c_doc.dict is not c_result.dict:
 */
  __pyx_t_3 = (__pyx_v_c_dict != __pyx_v_c_result->dict);
  if (!__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":578
 *         __GLOBAL_PARSER_CONTEXT.initThreadDictRef(&c_result.dict)
 *         if c_dict is not c_result.dict or \
 *                 self._c_style.doc.dict is not c_result.dict or \             # <<<<<<<<<<<<<<
 *                 input_doc._c_doc.dict is not c_result.dict:
 *             with nogil:
 */
    __pyx_t_5 = (((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_c_style->doc->dict != __pyx_v_c_result->dict);
    if (!__pyx_t_5) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":579
 *         if c_dict is not c_result.dict or \
 *                 self._c_style.doc.dict is not c_result.dict or \
 *                 input_doc._c_doc.dict is not c_result.dict:             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 if c_dict is not c_result.dict:
 */
      __pyx_t_6 = (__pyx_v_input_doc->_c_doc->dict != __pyx_v_c_result->dict);
      __pyx_t_9 = __pyx_t_6;
    } else {
      __pyx_t_9 = __pyx_t_5;
    }
    __pyx_t_5 = __pyx_t_9;
  } else {
    __pyx_t_5 = __pyx_t_3;
  }
  if (__pyx_t_5) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":580
 *                 self._c_style.doc.dict is not c_result.dict or \
 *                 input_doc._c_doc.dict is not c_result.dict:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 if c_dict is not c_result.dict:
 *                     fixThreadDictNames(<xmlNode*>c_result,
 */
    {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      #endif
      Py_UNBLOCK_THREADS
      /*try:*/ {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":581
 *                 input_doc._c_doc.dict is not c_result.dict:
 *             with nogil:
 *                 if c_dict is not c_result.dict:             # <<<<<<<<<<<<<<
 *                     fixThreadDictNames(<xmlNode*>c_result,
 *                                        c_dict, c_result.dict)
 */
        __pyx_t_5 = (__pyx_v_c_dict != __pyx_v_c_result->dict);
        if (__pyx_t_5) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":583
 *                 if c_dict is not c_result.dict:
 *                     fixThreadDictNames(<xmlNode*>c_result,
 *                                        c_dict, c_result.dict)             # <<<<<<<<<<<<<<
 *                 if self._c_style.doc.dict is not c_result.dict:
 *                     fixThreadDictNames(<xmlNode*>c_result,
 */
          __pyx_f_4lxml_5etree_fixThreadDictNames(((xmlNode *)__pyx_v_c_result), __pyx_v_c_dict, __pyx_v_c_result->dict);
          goto __pyx_L36;
        }
        __pyx_L36:;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":584
 *                     fixThreadDictNames(<xmlNode*>c_result,
 *                                        c_dict, c_result.dict)
 *                 if self._c_style.doc.dict is not c_result.dict:             # <<<<<<<<<<<<<<
 *                     fixThreadDictNames(<xmlNode*>c_result,
 *                                        self._c_style.doc.dict, c_result.dict)
 */
        __pyx_t_5 = (((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_c_style->doc->dict != __pyx_v_c_result->dict);
        if (__pyx_t_5) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":586
 *                 if self._c_style.doc.dict is not c_result.dict:
 *                     fixThreadDictNames(<xmlNode*>c_result,
 *                                        self._c_style.doc.dict, c_result.dict)             # <<<<<<<<<<<<<<
 *                 if input_doc._c_doc.dict is not c_result.dict:
 *                     fixThreadDictNames(<xmlNode*>c_result,
 */
          __pyx_f_4lxml_5etree_fixThreadDictNames(((xmlNode *)__pyx_v_c_result), ((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_c_style->doc->dict, __pyx_v_c_result->dict);
          goto __pyx_L37;
        }
        __pyx_L37:;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":587
 *                     fixThreadDictNames(<xmlNode*>c_result,
 *                                        self._c_style.doc.dict, c_result.dict)
 *                 if input_doc._c_doc.dict is not c_result.dict:             # <<<<<<<<<<<<<<
 *                     fixThreadDictNames(<xmlNode*>c_result,
 *                                        input_doc._c_doc.dict, c_result.dict)
 */
        __pyx_t_5 = (__pyx_v_input_doc->_c_doc->dict != __pyx_v_c_result->dict);
        if (__pyx_t_5) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":589
 *                 if input_doc._c_doc.dict is not c_result.dict:
 *                     fixThreadDictNames(<xmlNode*>c_result,
 *                                        input_doc._c_doc.dict, c_result.dict)             # <<<<<<<<<<<<<<
 * 
 *         return _xsltResultTreeFactory(result_doc, self, profile_doc)
 */
          __pyx_f_4lxml_5etree_fixThreadDictNames(((xmlNode *)__pyx_v_c_result), __pyx_v_input_doc->_c_doc->dict, __pyx_v_c_result->dict);
          goto __pyx_L38;
        }
        __pyx_L38:;
      }

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":580
 *                 self._c_style.doc.dict is not c_result.dict or \
 *                 input_doc._c_doc.dict is not c_result.dict:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 if c_dict is not c_result.dict:
 *                     fixThreadDictNames(<xmlNode*>c_result,
 */
      /*finally:*/ {
        Py_BLOCK_THREADS
      }
    }
    goto __pyx_L32;
  }
  __pyx_L32:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":591
 *                                        input_doc._c_doc.dict, c_result.dict)
 * 
 *         return _xsltResultTreeFactory(result_doc, self, profile_doc)             # <<<<<<<<<<<<<<
 * 
 *     cdef xmlDoc* _run_transform(self, xmlDoc* c_input_doc,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_8 = __pyx_f_4lxml_5etree__xsltResultTreeFactory(__pyx_v_result_doc, ((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self), __pyx_v_profile_doc); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_r = __pyx_t_8;
  __pyx_t_8 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("lxml.etree.XSLT.__call__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_kw);
  __Pyx_DECREF((PyObject *)__pyx_v_context);
  __Pyx_DECREF((PyObject *)__pyx_v_resolver_context);
  __Pyx_DECREF((PyObject *)__pyx_v_input_doc);
  __Pyx_DECREF((PyObject *)__pyx_v_root_node);
  __Pyx_DECREF((PyObject *)__pyx_v_result_doc);
  __Pyx_DECREF((PyObject *)__pyx_v_profile_doc);
  __Pyx_DECREF(__pyx_v_live_refs);
  __Pyx_DECREF(__pyx_v_error);
  __Pyx_DECREF(__pyx_v_message);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":593
 *         return _xsltResultTreeFactory(result_doc, self, profile_doc)
 * 
 *     cdef xmlDoc* _run_transform(self, xmlDoc* c_input_doc,             # <<<<<<<<<<<<<<
 *                                 char** params, _XSLTContext context,
 *                                 xslt.xsltTransformContext* transform_ctxt):
 */

static  xmlDoc *__pyx_f_4lxml_5etree_4XSLT__run_transform(struct __pyx_obj_4lxml_5etree_XSLT *__pyx_v_self, xmlDoc *__pyx_v_c_input_doc, char **__pyx_v_params, struct __pyx_obj_4lxml_5etree__XSLTContext *__pyx_v_context, xsltTransformContext *__pyx_v_transform_ctxt) {
  xmlDoc *__pyx_v_c_result;
  xmlDoc *__pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_run_transform");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":598
 *         cdef xmlDoc* c_result
 *         xslt.xsltSetTransformErrorFunc(transform_ctxt, <void*>self._error_log,
 *                                        _receiveXSLTError)             # <<<<<<<<<<<<<<
 *         if self._access_control is not None:
 *             self._access_control._register_in_context(transform_ctxt)
 */
  xsltSetTransformErrorFunc(__pyx_v_transform_ctxt, ((void *)__pyx_v_self->_error_log), __pyx_f_4lxml_5etree__receiveXSLTError);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":599
 *         xslt.xsltSetTransformErrorFunc(transform_ctxt, <void*>self._error_log,
 *                                        _receiveXSLTError)
 *         if self._access_control is not None:             # <<<<<<<<<<<<<<
 *             self._access_control._register_in_context(transform_ctxt)
 *         with nogil:
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_self->_access_control) != Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":600
 *                                        _receiveXSLTError)
 *         if self._access_control is not None:
 *             self._access_control._register_in_context(transform_ctxt)             # <<<<<<<<<<<<<<
 *         with nogil:
 *             c_result = xslt.xsltApplyStylesheetUser(
 */
    ((struct __pyx_vtabstruct_4lxml_5etree_XSLTAccessControl *)__pyx_v_self->_access_control->__pyx_vtab)->_register_in_context(__pyx_v_self->_access_control, __pyx_v_transform_ctxt);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":601
 *         if self._access_control is not None:
 *             self._access_control._register_in_context(transform_ctxt)
 *         with nogil:             # <<<<<<<<<<<<<<
 *             c_result = xslt.xsltApplyStylesheetUser(
 *                 self._c_style, c_input_doc, params, NULL, NULL, transform_ctxt)
 */
  {
    #ifdef WITH_THREAD
    PyThreadState *_save;
    #endif
    Py_UNBLOCK_THREADS
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":603
 *         with nogil:
 *             c_result = xslt.xsltApplyStylesheetUser(
 *                 self._c_style, c_input_doc, params, NULL, NULL, transform_ctxt)             # <<<<<<<<<<<<<<
 *         return c_result
 * 
 */
      __pyx_v_c_result = xsltApplyStylesheetUser(__pyx_v_self->_c_style, __pyx_v_c_input_doc, __pyx_v_params, NULL, NULL, __pyx_v_transform_ctxt);
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":601
 *         if self._access_control is not None:
 *             self._access_control._register_in_context(transform_ctxt)
 *         with nogil:             # <<<<<<<<<<<<<<
 *             c_result = xslt.xsltApplyStylesheetUser(
 *                 self._c_style, c_input_doc, params, NULL, NULL, transform_ctxt)
 */
    /*finally:*/ {
      Py_BLOCK_THREADS
    }
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":604
 *             c_result = xslt.xsltApplyStylesheetUser(
 *                 self._c_style, c_input_doc, params, NULL, NULL, transform_ctxt)
 *         return c_result             # <<<<<<<<<<<<<<
 * 
 * cdef _convert_xslt_parameters(xslt.xsltTransformContext* transform_ctxt,
 */
  __pyx_r = __pyx_v_c_result;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":606
 *         return c_result
 * 
 * cdef _convert_xslt_parameters(xslt.xsltTransformContext* transform_ctxt,             # <<<<<<<<<<<<<<
 *                               dict parameters, char*** params_ptr):
 *     cdef Py_ssize_t i, parameter_count
 */

static  PyObject *__pyx_f_4lxml_5etree__convert_xslt_parameters(xsltTransformContext *__pyx_v_transform_ctxt, PyObject *__pyx_v_parameters, char ***__pyx_v_params_ptr) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_parameter_count;
  char **__pyx_v_params;
  PyObject *__pyx_v_keep_ref;
  PyObject *__pyx_v_key;
  PyObject *__pyx_v_value;
  PyObject *__pyx_v_k;
  PyObject *__pyx_v_v;
  PyObject *__pyx_r = NULL;
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  void *__pyx_t_4;
  void *__pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("_convert_xslt_parameters");
  __pyx_v_keep_ref = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_key = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_value = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_k = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_v = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":611
 *     cdef char** params
 *     cdef list keep_ref
 *     params_ptr[0] = NULL             # <<<<<<<<<<<<<<
 *     parameter_count = len(parameters)
 *     if parameter_count == 0:
 */
  (__pyx_v_params_ptr[0]) = NULL;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":612
 *     cdef list keep_ref
 *     params_ptr[0] = NULL
 *     parameter_count = len(parameters)             # <<<<<<<<<<<<<<
 *     if parameter_count == 0:
 *         return None
 */
  if (unlikely(__pyx_v_parameters == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[18]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_1 = PyDict_Size(((PyObject *)__pyx_v_parameters)); 
  __pyx_v_parameter_count = __pyx_t_1;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":613
 *     params_ptr[0] = NULL
 *     parameter_count = len(parameters)
 *     if parameter_count == 0:             # <<<<<<<<<<<<<<
 *         return None
 *     # allocate space for parameters
 */
  __pyx_t_2 = (__pyx_v_parameter_count == 0);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":614
 *     parameter_count = len(parameters)
 *     if parameter_count == 0:
 *         return None             # <<<<<<<<<<<<<<
 *     # allocate space for parameters
 *     # * 2 as we want an entry for both key and value,
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":619
 *     # and + 1 as array is NULL terminated
 *     params = <char**>python.PyMem_Malloc(
 *         sizeof(char*) * (parameter_count * 2 + 1))             # <<<<<<<<<<<<<<
 *     try:
 *         i = 0
 */
  __pyx_v_params = ((char **)PyMem_Malloc(((sizeof(char *)) * ((__pyx_v_parameter_count * 2) + 1))));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":620
 *     params = <char**>python.PyMem_Malloc(
 *         sizeof(char*) * (parameter_count * 2 + 1))
 *     try:             # <<<<<<<<<<<<<<
 *         i = 0
 *         keep_ref = []
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":621
 *         sizeof(char*) * (parameter_count * 2 + 1))
 *     try:
 *         i = 0             # <<<<<<<<<<<<<<
 *         keep_ref = []
 *         for key, value in parameters.iteritems():
 */
      __pyx_v_i = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":622
 *     try:
 *         i = 0
 *         keep_ref = []             # <<<<<<<<<<<<<<
 *         for key, value in parameters.iteritems():
 *             k = _utf8(key)
 */
      __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
      __Pyx_DECREF(((PyObject *)__pyx_v_keep_ref));
      __pyx_v_keep_ref = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":623
 *         i = 0
 *         keep_ref = []
 *         for key, value in parameters.iteritems():             # <<<<<<<<<<<<<<
 *             k = _utf8(key)
 *             keep_ref.append(k)
 */
      __Pyx_INCREF(((PyObject *)__pyx_v_parameters));
      __Pyx_XDECREF(__pyx_t_3);
      __pyx_t_3 = ((PyObject *)__pyx_v_parameters);
      __pyx_t_1 = 0;
      while (1) {
        if (!PyDict_Next(__pyx_t_3, (&__pyx_t_1), ((PyObject **)(&__pyx_t_4)), ((PyObject **)(&__pyx_t_5)))) break;
        __Pyx_INCREF(((PyObject *)__pyx_t_4));
        __Pyx_DECREF(__pyx_v_key);
        __pyx_v_key = ((PyObject *)__pyx_t_4);
        __Pyx_INCREF(((PyObject *)__pyx_t_5));
        __Pyx_DECREF(__pyx_v_value);
        __pyx_v_value = ((PyObject *)__pyx_t_5);

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":624
 *         keep_ref = []
 *         for key, value in parameters.iteritems():
 *             k = _utf8(key)             # <<<<<<<<<<<<<<
 *             keep_ref.append(k)
 *             if isinstance(value, _XSLTQuotedStringParam):
 */
        __pyx_t_6 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_v_key)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(((PyObject *)__pyx_v_k));
        __pyx_v_k = ((PyObject*)__pyx_t_6);
        __pyx_t_6 = 0;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":625
 *         for key, value in parameters.iteritems():
 *             k = _utf8(key)
 *             keep_ref.append(k)             # <<<<<<<<<<<<<<
 *             if isinstance(value, _XSLTQuotedStringParam):
 *                 v = (<_XSLTQuotedStringParam>value).strval
 */
        if (unlikely(__pyx_v_keep_ref == Py_None)) {
          PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[18]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L4_error;} 
        }
        __pyx_t_7 = PyList_Append(__pyx_v_keep_ref, ((PyObject *)__pyx_v_k)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L4_error;}

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":626
 *             k = _utf8(key)
 *             keep_ref.append(k)
 *             if isinstance(value, _XSLTQuotedStringParam):             # <<<<<<<<<<<<<<
 *                 v = (<_XSLTQuotedStringParam>value).strval
 *                 xslt.xsltQuoteOneUserParam(
 */
        __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_value, ((PyObject*)__pyx_ptype_4lxml_5etree__XSLTQuotedStringParam)); 
        if (__pyx_t_2) {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":627
 *             keep_ref.append(k)
 *             if isinstance(value, _XSLTQuotedStringParam):
 *                 v = (<_XSLTQuotedStringParam>value).strval             # <<<<<<<<<<<<<<
 *                 xslt.xsltQuoteOneUserParam(
 *                     transform_ctxt, _cstr(k), _cstr(v))
 */
          __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__XSLTQuotedStringParam *)__pyx_v_value)->strval));
          __Pyx_DECREF(((PyObject *)__pyx_v_v));
          __pyx_v_v = ((struct __pyx_obj_4lxml_5etree__XSLTQuotedStringParam *)__pyx_v_value)->strval;

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":629
 *                 v = (<_XSLTQuotedStringParam>value).strval
 *                 xslt.xsltQuoteOneUserParam(
 *                     transform_ctxt, _cstr(k), _cstr(v))             # <<<<<<<<<<<<<<
 *             else:
 *                 if isinstance(value, XPath):
 */
          xsltQuoteOneUserParam(__pyx_v_transform_ctxt, PyBytes_AS_STRING(((PyObject *)__pyx_v_k)), PyBytes_AS_STRING(((PyObject *)__pyx_v_v)));
          goto __pyx_L14;
        }
        /*else*/ {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":631
 *                     transform_ctxt, _cstr(k), _cstr(v))
 *             else:
 *                 if isinstance(value, XPath):             # <<<<<<<<<<<<<<
 *                     v = (<XPath>value)._path
 *                 else:
 */
          __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_value, ((PyObject*)__pyx_ptype_4lxml_5etree_XPath)); 
          if (__pyx_t_2) {

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":632
 *             else:
 *                 if isinstance(value, XPath):
 *                     v = (<XPath>value)._path             # <<<<<<<<<<<<<<
 *                 else:
 *                     v = _utf8(value)
 */
            __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_v_value)->_path));
            __Pyx_DECREF(((PyObject *)__pyx_v_v));
            __pyx_v_v = ((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_v_value)->_path;
            goto __pyx_L15;
          }
          /*else*/ {

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":634
 *                     v = (<XPath>value)._path
 *                 else:
 *                     v = _utf8(value)             # <<<<<<<<<<<<<<
 *                     keep_ref.append(v)
 *                 params[i] = _cstr(k)
 */
            __pyx_t_6 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_v_value)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
            __Pyx_GOTREF(__pyx_t_6);
            __Pyx_DECREF(((PyObject *)__pyx_v_v));
            __pyx_v_v = ((PyObject*)__pyx_t_6);
            __pyx_t_6 = 0;

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":635
 *                 else:
 *                     v = _utf8(value)
 *                     keep_ref.append(v)             # <<<<<<<<<<<<<<
 *                 params[i] = _cstr(k)
 *                 i += 1
 */
            if (unlikely(__pyx_v_keep_ref == Py_None)) {
              PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[18]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L4_error;} 
            }
            __pyx_t_7 = PyList_Append(__pyx_v_keep_ref, ((PyObject *)__pyx_v_v)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
          }
          __pyx_L15:;

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":636
 *                     v = _utf8(value)
 *                     keep_ref.append(v)
 *                 params[i] = _cstr(k)             # <<<<<<<<<<<<<<
 *                 i += 1
 *                 params[i] = _cstr(v)
 */
          (__pyx_v_params[__pyx_v_i]) = PyBytes_AS_STRING(((PyObject *)__pyx_v_k));

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":637
 *                     keep_ref.append(v)
 *                 params[i] = _cstr(k)
 *                 i += 1             # <<<<<<<<<<<<<<
 *                 params[i] = _cstr(v)
 *                 i += 1
 */
          __pyx_v_i = (__pyx_v_i + 1);

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":638
 *                 params[i] = _cstr(k)
 *                 i += 1
 *                 params[i] = _cstr(v)             # <<<<<<<<<<<<<<
 *                 i += 1
 *     except:
 */
          (__pyx_v_params[__pyx_v_i]) = PyBytes_AS_STRING(((PyObject *)__pyx_v_v));

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":639
 *                 i += 1
 *                 params[i] = _cstr(v)
 *                 i += 1             # <<<<<<<<<<<<<<
 *     except:
 *         python.PyMem_Free(params)
 */
          __pyx_v_i = (__pyx_v_i + 1);
        }
        __pyx_L14:;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L11_try_end;
    __pyx_L4_error:;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":640
 *                 params[i] = _cstr(v)
 *                 i += 1
 *     except:             # <<<<<<<<<<<<<<
 *         python.PyMem_Free(params)
 *         raise
 */
    /*except:*/ {
      __Pyx_AddTraceback("lxml.etree._convert_xslt_parameters");
      if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_6, &__pyx_t_8) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_8);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":641
 *                 i += 1
 *     except:
 *         python.PyMem_Free(params)             # <<<<<<<<<<<<<<
 *         raise
 *     params[i] = NULL
 */
      PyMem_Free(__pyx_v_params);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":642
 *     except:
 *         python.PyMem_Free(params)
 *         raise             # <<<<<<<<<<<<<<
 *     params[i] = NULL
 *     params_ptr[0] = params
 */
      __Pyx_GIVEREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_8);
      __Pyx_ErrRestore(__pyx_t_3, __pyx_t_6, __pyx_t_8);
      __pyx_t_3 = 0; __pyx_t_6 = 0; __pyx_t_8 = 0; 
      {__pyx_filename = __pyx_f[18]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L5_exception_handled;
    }
    __pyx_L6_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L5_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L11_try_end:;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":643
 *         python.PyMem_Free(params)
 *         raise
 *     params[i] = NULL             # <<<<<<<<<<<<<<
 *     params_ptr[0] = params
 *     return keep_ref
 */
  (__pyx_v_params[__pyx_v_i]) = NULL;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":644
 *         raise
 *     params[i] = NULL
 *     params_ptr[0] = params             # <<<<<<<<<<<<<<
 *     return keep_ref
 * 
 */
  (__pyx_v_params_ptr[0]) = __pyx_v_params;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":645
 *     params[i] = NULL
 *     params_ptr[0] = params
 *     return keep_ref             # <<<<<<<<<<<<<<
 * 
 * cdef extern from "etree_defs.h":
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_keep_ref));
  __pyx_r = ((PyObject *)__pyx_v_keep_ref);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("lxml.etree._convert_xslt_parameters");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_keep_ref);
  __Pyx_DECREF(__pyx_v_key);
  __Pyx_DECREF(__pyx_v_value);
  __Pyx_DECREF(__pyx_v_k);
  __Pyx_DECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":651
 *     cdef XSLT NEW_XSLT "PY_NEW" (object t)
 * 
 * cdef XSLT _copyXSLT(XSLT stylesheet):             # <<<<<<<<<<<<<<
 *     cdef XSLT new_xslt
 *     cdef xmlDoc* c_doc
 */

static  struct __pyx_obj_4lxml_5etree_XSLT *__pyx_f_4lxml_5etree__copyXSLT(struct __pyx_obj_4lxml_5etree_XSLT *__pyx_v_stylesheet) {
  struct __pyx_obj_4lxml_5etree_XSLT *__pyx_v_new_xslt;
  xmlDoc *__pyx_v_c_doc;
  struct __pyx_obj_4lxml_5etree_XSLT *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  xmlDoc *__pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("_copyXSLT");
  __pyx_v_new_xslt = ((struct __pyx_obj_4lxml_5etree_XSLT *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":654
 *     cdef XSLT new_xslt
 *     cdef xmlDoc* c_doc
 *     assert stylesheet._c_style is not NULL, "XSLT stylesheet not initialised"             # <<<<<<<<<<<<<<
 *     new_xslt = NEW_XSLT(XSLT) # without calling __init__()
 *     new_xslt._access_control = stylesheet._access_control
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!(__pyx_v_stylesheet->_c_style != NULL))) {
    PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_365));
    {__pyx_filename = __pyx_f[18]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":655
 *     cdef xmlDoc* c_doc
 *     assert stylesheet._c_style is not NULL, "XSLT stylesheet not initialised"
 *     new_xslt = NEW_XSLT(XSLT) # without calling __init__()             # <<<<<<<<<<<<<<
 *     new_xslt._access_control = stylesheet._access_control
 *     new_xslt._error_log = _ErrorLog()
 */
  __pyx_t_1 = ((PyObject *)PY_NEW(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_XSLT)))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_new_xslt));
  __pyx_v_new_xslt = ((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":656
 *     assert stylesheet._c_style is not NULL, "XSLT stylesheet not initialised"
 *     new_xslt = NEW_XSLT(XSLT) # without calling __init__()
 *     new_xslt._access_control = stylesheet._access_control             # <<<<<<<<<<<<<<
 *     new_xslt._error_log = _ErrorLog()
 *     new_xslt._context = stylesheet._context._copy()
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_stylesheet->_access_control));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_stylesheet->_access_control));
  __Pyx_GOTREF(__pyx_v_new_xslt->_access_control);
  __Pyx_DECREF(((PyObject *)__pyx_v_new_xslt->_access_control));
  __pyx_v_new_xslt->_access_control = __pyx_v_stylesheet->_access_control;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":657
 *     new_xslt = NEW_XSLT(XSLT) # without calling __init__()
 *     new_xslt._access_control = stylesheet._access_control
 *     new_xslt._error_log = _ErrorLog()             # <<<<<<<<<<<<<<
 *     new_xslt._context = stylesheet._context._copy()
 * 
 */
  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ErrorLog)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_new_xslt->_error_log);
  __Pyx_DECREF(((PyObject *)__pyx_v_new_xslt->_error_log));
  __pyx_v_new_xslt->_error_log = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":658
 *     new_xslt._access_control = stylesheet._access_control
 *     new_xslt._error_log = _ErrorLog()
 *     new_xslt._context = stylesheet._context._copy()             # <<<<<<<<<<<<<<
 * 
 *     new_xslt._xslt_resolver_context = stylesheet._xslt_resolver_context._copy()
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__XSLTContext *)__pyx_v_stylesheet->_context->__pyx_base.__pyx_vtab)->__pyx_base._copy(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_stylesheet->_context))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 658; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__XSLTContext))))) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 658; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_new_xslt->_context);
  __Pyx_DECREF(((PyObject *)__pyx_v_new_xslt->_context));
  __pyx_v_new_xslt->_context = ((struct __pyx_obj_4lxml_5etree__XSLTContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":660
 *     new_xslt._context = stylesheet._context._copy()
 * 
 *     new_xslt._xslt_resolver_context = stylesheet._xslt_resolver_context._copy()             # <<<<<<<<<<<<<<
 *     new_xslt._xslt_resolver_context._c_style_doc = _copyDoc(
 *         stylesheet._xslt_resolver_context._c_style_doc, 1)
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__XSLTResolverContext *)__pyx_v_stylesheet->_xslt_resolver_context->__pyx_base.__pyx_base.__pyx_vtab)->_copy(__pyx_v_stylesheet->_xslt_resolver_context)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_new_xslt->_xslt_resolver_context);
  __Pyx_DECREF(((PyObject *)__pyx_v_new_xslt->_xslt_resolver_context));
  __pyx_v_new_xslt->_xslt_resolver_context = ((struct __pyx_obj_4lxml_5etree__XSLTResolverContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":662
 *     new_xslt._xslt_resolver_context = stylesheet._xslt_resolver_context._copy()
 *     new_xslt._xslt_resolver_context._c_style_doc = _copyDoc(
 *         stylesheet._xslt_resolver_context._c_style_doc, 1)             # <<<<<<<<<<<<<<
 * 
 *     c_doc = _copyDoc(stylesheet._c_style.doc, 1)
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__copyDoc(__pyx_v_stylesheet->_xslt_resolver_context->_c_style_doc, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":661
 * 
 *     new_xslt._xslt_resolver_context = stylesheet._xslt_resolver_context._copy()
 *     new_xslt._xslt_resolver_context._c_style_doc = _copyDoc(             # <<<<<<<<<<<<<<
 *         stylesheet._xslt_resolver_context._c_style_doc, 1)
 * 
 */
  __pyx_v_new_xslt->_xslt_resolver_context->_c_style_doc = __pyx_t_2;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":664
 *         stylesheet._xslt_resolver_context._c_style_doc, 1)
 * 
 *     c_doc = _copyDoc(stylesheet._c_style.doc, 1)             # <<<<<<<<<<<<<<
 *     new_xslt._c_style = xslt.xsltParseStylesheetDoc(c_doc)
 *     if new_xslt._c_style is NULL:
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__copyDoc(__pyx_v_stylesheet->_c_style->doc, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 664; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_doc = __pyx_t_2;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":665
 * 
 *     c_doc = _copyDoc(stylesheet._c_style.doc, 1)
 *     new_xslt._c_style = xslt.xsltParseStylesheetDoc(c_doc)             # <<<<<<<<<<<<<<
 *     if new_xslt._c_style is NULL:
 *         tree.xmlFreeDoc(c_doc)
 */
  __pyx_v_new_xslt->_c_style = xsltParseStylesheetDoc(__pyx_v_c_doc);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":666
 *     c_doc = _copyDoc(stylesheet._c_style.doc, 1)
 *     new_xslt._c_style = xslt.xsltParseStylesheetDoc(c_doc)
 *     if new_xslt._c_style is NULL:             # <<<<<<<<<<<<<<
 *         tree.xmlFreeDoc(c_doc)
 *         python.PyErr_NoMemory()
 */
  __pyx_t_3 = (__pyx_v_new_xslt->_c_style == NULL);
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":667
 *     new_xslt._c_style = xslt.xsltParseStylesheetDoc(c_doc)
 *     if new_xslt._c_style is NULL:
 *         tree.xmlFreeDoc(c_doc)             # <<<<<<<<<<<<<<
 *         python.PyErr_NoMemory()
 * 
 */
    xmlFreeDoc(__pyx_v_c_doc);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":668
 *     if new_xslt._c_style is NULL:
 *         tree.xmlFreeDoc(c_doc)
 *         python.PyErr_NoMemory()             # <<<<<<<<<<<<<<
 * 
 *     return new_xslt
 */
    __pyx_t_1 = PyErr_NoMemory(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":670
 *         python.PyErr_NoMemory()
 * 
 *     return new_xslt             # <<<<<<<<<<<<<<
 * 
 * cdef class _XSLTResultTree(_ElementTree):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_new_xslt));
  __pyx_r = __pyx_v_new_xslt;
  goto __pyx_L0;

  __pyx_r = ((struct __pyx_obj_4lxml_5etree_XSLT *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._copyXSLT");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_new_xslt);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":678
 *     cdef Py_ssize_t _buffer_len
 *     cdef Py_ssize_t _buffer_refcnt
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._buffer = NULL
 *         self._buffer_len = 0
 */

static int __pyx_pf_4lxml_5etree_15_XSLTResultTree___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_15_XSLTResultTree___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("__cinit__");
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":679
 *     cdef Py_ssize_t _buffer_refcnt
 *     def __cinit__(self):
 *         self._buffer = NULL             # <<<<<<<<<<<<<<
 *         self._buffer_len = 0
 *         self._buffer_refcnt = 0
 */
  ((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)__pyx_v_self)->_buffer = NULL;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":680
 *     def __cinit__(self):
 *         self._buffer = NULL
 *         self._buffer_len = 0             # <<<<<<<<<<<<<<
 *         self._buffer_refcnt = 0
 * 
 */
  ((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)__pyx_v_self)->_buffer_len = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":681
 *         self._buffer = NULL
 *         self._buffer_len = 0
 *         self._buffer_refcnt = 0             # <<<<<<<<<<<<<<
 * 
 *     cdef _saveToStringAndSize(self, char** s, int* l):
 */
  ((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)__pyx_v_self)->_buffer_refcnt = 0;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":683
 *         self._buffer_refcnt = 0
 * 
 *     cdef _saveToStringAndSize(self, char** s, int* l):             # <<<<<<<<<<<<<<
 *         cdef _Document doc
 *         cdef int r
 */

static  PyObject *__pyx_f_4lxml_5etree_15_XSLTResultTree__saveToStringAndSize(struct __pyx_obj_4lxml_5etree__XSLTResultTree *__pyx_v_self, char **__pyx_v_s, int *__pyx_v_l) {
  struct LxmlDocument *__pyx_v_doc;
  int __pyx_v_r;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_saveToStringAndSize");
  __pyx_v_doc = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":686
 *         cdef _Document doc
 *         cdef int r
 *         if self._context_node is not None:             # <<<<<<<<<<<<<<
 *             doc = self._context_node._doc
 *         if doc is None:
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_self->__pyx_base._context_node) != Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":687
 *         cdef int r
 *         if self._context_node is not None:
 *             doc = self._context_node._doc             # <<<<<<<<<<<<<<
 *         if doc is None:
 *             doc = self._doc
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base._context_node->_doc));
    __Pyx_DECREF(((PyObject *)__pyx_v_doc));
    __pyx_v_doc = __pyx_v_self->__pyx_base._context_node->_doc;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":688
 *         if self._context_node is not None:
 *             doc = self._context_node._doc
 *         if doc is None:             # <<<<<<<<<<<<<<
 *             doc = self._doc
 *             if doc is None:
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_doc) == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":689
 *             doc = self._context_node._doc
 *         if doc is None:
 *             doc = self._doc             # <<<<<<<<<<<<<<
 *             if doc is None:
 *                 s[0] = NULL
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base._doc));
    __Pyx_DECREF(((PyObject *)__pyx_v_doc));
    __pyx_v_doc = __pyx_v_self->__pyx_base._doc;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":690
 *         if doc is None:
 *             doc = self._doc
 *             if doc is None:             # <<<<<<<<<<<<<<
 *                 s[0] = NULL
 *                 return
 */
    __pyx_t_1 = (((PyObject *)__pyx_v_doc) == Py_None);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":691
 *             doc = self._doc
 *             if doc is None:
 *                 s[0] = NULL             # <<<<<<<<<<<<<<
 *                 return
 *         with nogil:
 */
      (__pyx_v_s[0]) = NULL;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":692
 *             if doc is None:
 *                 s[0] = NULL
 *                 return             # <<<<<<<<<<<<<<
 *         with nogil:
 *             r = xslt.xsltSaveResultToString(s, l, doc._c_doc,
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      goto __pyx_L5;
    }
    __pyx_L5:;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":693
 *                 s[0] = NULL
 *                 return
 *         with nogil:             # <<<<<<<<<<<<<<
 *             r = xslt.xsltSaveResultToString(s, l, doc._c_doc,
 *                                             self._xslt._c_style)
 */
  {
    #ifdef WITH_THREAD
    PyThreadState *_save;
    #endif
    Py_UNBLOCK_THREADS
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":695
 *         with nogil:
 *             r = xslt.xsltSaveResultToString(s, l, doc._c_doc,
 *                                             self._xslt._c_style)             # <<<<<<<<<<<<<<
 *         if r == -1:
 *             python.PyErr_NoMemory()
 */
      __pyx_v_r = xsltSaveResultToString(__pyx_v_s, __pyx_v_l, __pyx_v_doc->_c_doc, __pyx_v_self->_xslt->_c_style);
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":693
 *                 s[0] = NULL
 *                 return
 *         with nogil:             # <<<<<<<<<<<<<<
 *             r = xslt.xsltSaveResultToString(s, l, doc._c_doc,
 *                                             self._xslt._c_style)
 */
    /*finally:*/ {
      Py_BLOCK_THREADS
    }
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":696
 *             r = xslt.xsltSaveResultToString(s, l, doc._c_doc,
 *                                             self._xslt._c_style)
 *         if r == -1:             # <<<<<<<<<<<<<<
 *             python.PyErr_NoMemory()
 * 
 */
  __pyx_t_1 = (__pyx_v_r == -1);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":697
 *                                             self._xslt._c_style)
 *         if r == -1:
 *             python.PyErr_NoMemory()             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
 */
    __pyx_t_2 = PyErr_NoMemory(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L9;
  }
  __pyx_L9:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._XSLTResultTree._saveToStringAndSize");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_doc);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":699
 *             python.PyErr_NoMemory()
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         cdef char* s
 *         cdef int l
 */

static PyObject *__pyx_pf_4lxml_5etree_15_XSLTResultTree_1__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_15_XSLTResultTree_1__str__(PyObject *__pyx_v_self) {
  char *__pyx_v_s;
  int __pyx_v_l;
  PyObject *__pyx_v_result;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("__str__");
  __pyx_v_result = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":702
 *         cdef char* s
 *         cdef int l
 *         if python.IS_PYTHON3:             # <<<<<<<<<<<<<<
 *             return self.__unicode__()
 *         self._saveToStringAndSize(&s, &l)
 */
  if (IS_PYTHON3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":703
 *         cdef int l
 *         if python.IS_PYTHON3:
 *             return self.__unicode__()             # <<<<<<<<<<<<<<
 *         self._saveToStringAndSize(&s, &l)
 *         if s is NULL:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____unicode__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":704
 *         if python.IS_PYTHON3:
 *             return self.__unicode__()
 *         self._saveToStringAndSize(&s, &l)             # <<<<<<<<<<<<<<
 *         if s is NULL:
 *             return ''
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__XSLTResultTree *)((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)__pyx_v_self)->__pyx_base.__pyx_vtab)->_saveToStringAndSize(((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)__pyx_v_self), (&__pyx_v_s), (&__pyx_v_l)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":705
 *             return self.__unicode__()
 *         self._saveToStringAndSize(&s, &l)
 *         if s is NULL:             # <<<<<<<<<<<<<<
 *             return ''
 *         # we must not use 'funicode' here as this is not always UTF-8
 */
  __pyx_t_3 = (__pyx_v_s == NULL);
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":706
 *         self._saveToStringAndSize(&s, &l)
 *         if s is NULL:
 *             return ''             # <<<<<<<<<<<<<<
 *         # we must not use 'funicode' here as this is not always UTF-8
 *         try:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_25));
    __pyx_r = ((PyObject *)__pyx_kp_s_25);
    goto __pyx_L0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":708
 *             return ''
 *         # we must not use 'funicode' here as this is not always UTF-8
 *         try:             # <<<<<<<<<<<<<<
 *             result = <bytes>s[:l]
 *         finally:
 */
  /*try:*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":709
 *         # we must not use 'funicode' here as this is not always UTF-8
 *         try:
 *             result = <bytes>s[:l]             # <<<<<<<<<<<<<<
 *         finally:
 *             tree.xmlFree(s)
 */
    __pyx_t_2 = PyBytes_FromStringAndSize(__pyx_v_s + 0, __pyx_v_l - 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 709; __pyx_clineno = __LINE__; goto __pyx_L8;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __Pyx_DECREF(((PyObject *)__pyx_v_result));
    __pyx_v_result = __pyx_t_2;
    __pyx_t_2 = 0;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":711
 *             result = <bytes>s[:l]
 *         finally:
 *             tree.xmlFree(s)             # <<<<<<<<<<<<<<
 *         return result
 * 
 */
  /*finally:*/ {
    int __pyx_why;
    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
    int __pyx_exc_lineno;
    __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 0; goto __pyx_L9;
    __pyx_L8: {
      __pyx_why = 4;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
      __pyx_exc_lineno = __pyx_lineno;
      goto __pyx_L9;
    }
    __pyx_L9:;
    xmlFree(__pyx_v_s);
    switch (__pyx_why) {
      case 4: {
        __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
        __pyx_lineno = __pyx_exc_lineno;
        __pyx_exc_type = 0;
        __pyx_exc_value = 0;
        __pyx_exc_tb = 0;
        goto __pyx_L1_error;
      }
    }
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":712
 *         finally:
 *             tree.xmlFree(s)
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     def __unicode__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._XSLTResultTree.__str__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":714
 *         return result
 * 
 *     def __unicode__(self):             # <<<<<<<<<<<<<<
 *         cdef char* encoding
 *         cdef char* s
 */

static PyObject *__pyx_pf_4lxml_5etree_15_XSLTResultTree_2__unicode__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_15_XSLTResultTree_2__unicode__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  char *__pyx_v_encoding;
  char *__pyx_v_s;
  int __pyx_v_l;
  PyObject *__pyx_v_result;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("__unicode__");
  __pyx_v_result = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":718
 *         cdef char* s
 *         cdef int l
 *         self._saveToStringAndSize(&s, &l)             # <<<<<<<<<<<<<<
 *         if s is NULL:
 *             return u''
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__XSLTResultTree *)((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)__pyx_v_self)->__pyx_base.__pyx_vtab)->_saveToStringAndSize(((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)__pyx_v_self), (&__pyx_v_s), (&__pyx_v_l)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":719
 *         cdef int l
 *         self._saveToStringAndSize(&s, &l)
 *         if s is NULL:             # <<<<<<<<<<<<<<
 *             return u''
 *         encoding = self._xslt._c_style.encoding
 */
  __pyx_t_2 = (__pyx_v_s == NULL);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":720
 *         self._saveToStringAndSize(&s, &l)
 *         if s is NULL:
 *             return u''             # <<<<<<<<<<<<<<
 *         encoding = self._xslt._c_style.encoding
 *         try:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_kp_u_25));
    __pyx_r = ((PyObject *)__pyx_kp_u_25);
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":721
 *         if s is NULL:
 *             return u''
 *         encoding = self._xslt._c_style.encoding             # <<<<<<<<<<<<<<
 *         try:
 *             if encoding is NULL:
 */
  __pyx_v_encoding = ((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)__pyx_v_self)->_xslt->_c_style->encoding;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":722
 *             return u''
 *         encoding = self._xslt._c_style.encoding
 *         try:             # <<<<<<<<<<<<<<
 *             if encoding is NULL:
 *                 result = s[:l].decode('UTF-8')
 */
  /*try:*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":723
 *         encoding = self._xslt._c_style.encoding
 *         try:
 *             if encoding is NULL:             # <<<<<<<<<<<<<<
 *                 result = s[:l].decode('UTF-8')
 *             else:
 */
    __pyx_t_2 = (__pyx_v_encoding == NULL);
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":724
 *         try:
 *             if encoding is NULL:
 *                 result = s[:l].decode('UTF-8')             # <<<<<<<<<<<<<<
 *             else:
 *                 result = python.PyUnicode_Decode(s, l, encoding, 'strict')
 */
      __pyx_t_1 = ((PyObject *)PyUnicode_DecodeUTF8(__pyx_v_s, __pyx_v_l, NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L7;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      __Pyx_DECREF(__pyx_v_result);
      __pyx_v_result = ((PyObject *)__pyx_t_1);
      __pyx_t_1 = 0;
      goto __pyx_L9;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":726
 *                 result = s[:l].decode('UTF-8')
 *             else:
 *                 result = python.PyUnicode_Decode(s, l, encoding, 'strict')             # <<<<<<<<<<<<<<
 *         finally:
 *             tree.xmlFree(s)
 */
      __pyx_t_1 = ((PyObject *)PyUnicode_Decode(__pyx_v_s, __pyx_v_l, __pyx_v_encoding, __pyx_k__strict)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L7;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_v_result);
      __pyx_v_result = __pyx_t_1;
      __pyx_t_1 = 0;
    }
    __pyx_L9:;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":728
 *                 result = python.PyUnicode_Decode(s, l, encoding, 'strict')
 *         finally:
 *             tree.xmlFree(s)             # <<<<<<<<<<<<<<
 *         return _stripEncodingDeclaration(result)
 * 
 */
  /*finally:*/ {
    int __pyx_why;
    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
    int __pyx_exc_lineno;
    __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 0; goto __pyx_L8;
    __pyx_L7: {
      __pyx_why = 4;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
      __pyx_exc_lineno = __pyx_lineno;
      goto __pyx_L8;
    }
    __pyx_L8:;
    xmlFree(__pyx_v_s);
    switch (__pyx_why) {
      case 4: {
        __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
        __pyx_lineno = __pyx_exc_lineno;
        __pyx_exc_type = 0;
        __pyx_exc_value = 0;
        __pyx_exc_tb = 0;
        goto __pyx_L1_error;
      }
    }
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":729
 *         finally:
 *             tree.xmlFree(s)
 *         return _stripEncodingDeclaration(result)             # <<<<<<<<<<<<<<
 * 
 *     def __getbuffer__(self, Py_buffer* buffer, int flags):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__stripEncodingDeclaration(__pyx_v_result); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._XSLTResultTree.__unicode__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":731
 *         return _stripEncodingDeclaration(result)
 * 
 *     def __getbuffer__(self, Py_buffer* buffer, int flags):             # <<<<<<<<<<<<<<
 *         cdef int l
 *         if buffer is NULL:
 */

static CYTHON_UNUSED int __pyx_pf_4lxml_5etree_15_XSLTResultTree_3__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_buffer, int __pyx_v_flags); /*proto*/
static CYTHON_UNUSED int __pyx_pf_4lxml_5etree_15_XSLTResultTree_3__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_buffer, int __pyx_v_flags) {
  int __pyx_v_l;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("__getbuffer__");
  if (__pyx_v_buffer == NULL) return 0;
  __pyx_v_buffer->obj = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(__pyx_v_buffer->obj);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":733
 *     def __getbuffer__(self, Py_buffer* buffer, int flags):
 *         cdef int l
 *         if buffer is NULL:             # <<<<<<<<<<<<<<
 *             return
 *         if self._buffer is NULL or flags & python.PyBUF_WRITABLE:
 */
  __pyx_t_1 = (__pyx_v_buffer == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":734
 *         cdef int l
 *         if buffer is NULL:
 *             return             # <<<<<<<<<<<<<<
 *         if self._buffer is NULL or flags & python.PyBUF_WRITABLE:
 *             self._saveToStringAndSize(<char**>&buffer.buf, &l)
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":735
 *         if buffer is NULL:
 *             return
 *         if self._buffer is NULL or flags & python.PyBUF_WRITABLE:             # <<<<<<<<<<<<<<
 *             self._saveToStringAndSize(<char**>&buffer.buf, &l)
 *             buffer.len = l
 */
  __pyx_t_1 = (((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)__pyx_v_self)->_buffer == NULL);
  if (!__pyx_t_1) {
    __pyx_t_2 = (__pyx_v_flags & PyBUF_WRITABLE);
  } else {
    __pyx_t_2 = __pyx_t_1;
  }
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":736
 *             return
 *         if self._buffer is NULL or flags & python.PyBUF_WRITABLE:
 *             self._saveToStringAndSize(<char**>&buffer.buf, &l)             # <<<<<<<<<<<<<<
 *             buffer.len = l
 *             if self._buffer is NULL and not flags & python.PyBUF_WRITABLE:
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree__XSLTResultTree *)((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)__pyx_v_self)->__pyx_base.__pyx_vtab)->_saveToStringAndSize(((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)__pyx_v_self), ((char **)(&__pyx_v_buffer->buf)), (&__pyx_v_l)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":737
 *         if self._buffer is NULL or flags & python.PyBUF_WRITABLE:
 *             self._saveToStringAndSize(<char**>&buffer.buf, &l)
 *             buffer.len = l             # <<<<<<<<<<<<<<
 *             if self._buffer is NULL and not flags & python.PyBUF_WRITABLE:
 *                 self._buffer = <char*>buffer.buf
 */
    __pyx_v_buffer->len = __pyx_v_l;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":738
 *             self._saveToStringAndSize(<char**>&buffer.buf, &l)
 *             buffer.len = l
 *             if self._buffer is NULL and not flags & python.PyBUF_WRITABLE:             # <<<<<<<<<<<<<<
 *                 self._buffer = <char*>buffer.buf
 *                 self._buffer_len = l
 */
    __pyx_t_2 = (((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)__pyx_v_self)->_buffer == NULL);
    if (__pyx_t_2) {
      __pyx_t_1 = (!(__pyx_v_flags & PyBUF_WRITABLE));
      __pyx_t_4 = __pyx_t_1;
    } else {
      __pyx_t_4 = __pyx_t_2;
    }
    if (__pyx_t_4) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":739
 *             buffer.len = l
 *             if self._buffer is NULL and not flags & python.PyBUF_WRITABLE:
 *                 self._buffer = <char*>buffer.buf             # <<<<<<<<<<<<<<
 *                 self._buffer_len = l
 *                 self._buffer_refcnt = 1
 */
      ((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)__pyx_v_self)->_buffer = ((char *)__pyx_v_buffer->buf);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":740
 *             if self._buffer is NULL and not flags & python.PyBUF_WRITABLE:
 *                 self._buffer = <char*>buffer.buf
 *                 self._buffer_len = l             # <<<<<<<<<<<<<<
 *                 self._buffer_refcnt = 1
 *         else:
 */
      ((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)__pyx_v_self)->_buffer_len = __pyx_v_l;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":741
 *                 self._buffer = <char*>buffer.buf
 *                 self._buffer_len = l
 *                 self._buffer_refcnt = 1             # <<<<<<<<<<<<<<
 *         else:
 *             buffer.buf = <char*>self._buffer
 */
      ((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)__pyx_v_self)->_buffer_refcnt = 1;
      goto __pyx_L7;
    }
    __pyx_L7:;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":743
 *                 self._buffer_refcnt = 1
 *         else:
 *             buffer.buf = <char*>self._buffer             # <<<<<<<<<<<<<<
 *             buffer.len = self._buffer_len
 *             self._buffer_refcnt += 1
 */
    __pyx_v_buffer->buf = ((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)__pyx_v_self)->_buffer;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":744
 *         else:
 *             buffer.buf = <char*>self._buffer
 *             buffer.len = self._buffer_len             # <<<<<<<<<<<<<<
 *             self._buffer_refcnt += 1
 *         if flags & python.PyBUF_WRITABLE:
 */
    __pyx_v_buffer->len = ((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)__pyx_v_self)->_buffer_len;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":745
 *             buffer.buf = <char*>self._buffer
 *             buffer.len = self._buffer_len
 *             self._buffer_refcnt += 1             # <<<<<<<<<<<<<<
 *         if flags & python.PyBUF_WRITABLE:
 *             buffer.readonly = 0
 */
    ((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)__pyx_v_self)->_buffer_refcnt = (((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)__pyx_v_self)->_buffer_refcnt + 1);
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":746
 *             buffer.len = self._buffer_len
 *             self._buffer_refcnt += 1
 *         if flags & python.PyBUF_WRITABLE:             # <<<<<<<<<<<<<<
 *             buffer.readonly = 0
 *         else:
 */
  __pyx_t_5 = (__pyx_v_flags & PyBUF_WRITABLE);
  if (__pyx_t_5) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":747
 *             self._buffer_refcnt += 1
 *         if flags & python.PyBUF_WRITABLE:
 *             buffer.readonly = 0             # <<<<<<<<<<<<<<
 *         else:
 *             buffer.readonly = 1
 */
    __pyx_v_buffer->readonly = 0;
    goto __pyx_L8;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":749
 *             buffer.readonly = 0
 *         else:
 *             buffer.readonly = 1             # <<<<<<<<<<<<<<
 *         if flags & python.PyBUF_FORMAT:
 *             buffer.format = "B"
 */
    __pyx_v_buffer->readonly = 1;
  }
  __pyx_L8:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":750
 *         else:
 *             buffer.readonly = 1
 *         if flags & python.PyBUF_FORMAT:             # <<<<<<<<<<<<<<
 *             buffer.format = "B"
 *         else:
 */
  __pyx_t_5 = (__pyx_v_flags & PyBUF_FORMAT);
  if (__pyx_t_5) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":751
 *             buffer.readonly = 1
 *         if flags & python.PyBUF_FORMAT:
 *             buffer.format = "B"             # <<<<<<<<<<<<<<
 *         else:
 *             buffer.format = NULL
 */
    __pyx_v_buffer->format = __pyx_k__B;
    goto __pyx_L9;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":753
 *             buffer.format = "B"
 *         else:
 *             buffer.format = NULL             # <<<<<<<<<<<<<<
 *         buffer.ndim = 0
 *         buffer.shape = NULL
 */
    __pyx_v_buffer->format = NULL;
  }
  __pyx_L9:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":754
 *         else:
 *             buffer.format = NULL
 *         buffer.ndim = 0             # <<<<<<<<<<<<<<
 *         buffer.shape = NULL
 *         buffer.strides = NULL
 */
  __pyx_v_buffer->ndim = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":755
 *             buffer.format = NULL
 *         buffer.ndim = 0
 *         buffer.shape = NULL             # <<<<<<<<<<<<<<
 *         buffer.strides = NULL
 *         buffer.suboffsets = NULL
 */
  __pyx_v_buffer->shape = NULL;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":756
 *         buffer.ndim = 0
 *         buffer.shape = NULL
 *         buffer.strides = NULL             # <<<<<<<<<<<<<<
 *         buffer.suboffsets = NULL
 *         buffer.itemsize = 1
 */
  __pyx_v_buffer->strides = NULL;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":757
 *         buffer.shape = NULL
 *         buffer.strides = NULL
 *         buffer.suboffsets = NULL             # <<<<<<<<<<<<<<
 *         buffer.itemsize = 1
 *         buffer.internal = NULL
 */
  __pyx_v_buffer->suboffsets = NULL;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":758
 *         buffer.strides = NULL
 *         buffer.suboffsets = NULL
 *         buffer.itemsize = 1             # <<<<<<<<<<<<<<
 *         buffer.internal = NULL
 * 
 */
  __pyx_v_buffer->itemsize = 1;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":759
 *         buffer.suboffsets = NULL
 *         buffer.itemsize = 1
 *         buffer.internal = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __releasebuffer__(self, Py_buffer* buffer):
 */
  __pyx_v_buffer->internal = NULL;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._XSLTResultTree.__getbuffer__");
  __pyx_r = -1;
  __Pyx_GOTREF(__pyx_v_buffer->obj);
  __Pyx_DECREF(__pyx_v_buffer->obj); __pyx_v_buffer->obj = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  if (__pyx_v_buffer->obj == Py_None) {
    __Pyx_GOTREF(Py_None);
    __Pyx_DECREF(Py_None); __pyx_v_buffer->obj = NULL;
  }
  __pyx_L2:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":761
 *         buffer.internal = NULL
 * 
 *     def __releasebuffer__(self, Py_buffer* buffer):             # <<<<<<<<<<<<<<
 *         if buffer is NULL:
 *             return
 */

static CYTHON_UNUSED void __pyx_pf_4lxml_5etree_15_XSLTResultTree_4__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_buffer); /*proto*/
static CYTHON_UNUSED void __pyx_pf_4lxml_5etree_15_XSLTResultTree_4__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_buffer) {
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__releasebuffer__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":762
 * 
 *     def __releasebuffer__(self, Py_buffer* buffer):
 *         if buffer is NULL:             # <<<<<<<<<<<<<<
 *             return
 *         if <char*>buffer.buf is self._buffer:
 */
  __pyx_t_1 = (__pyx_v_buffer == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":763
 *     def __releasebuffer__(self, Py_buffer* buffer):
 *         if buffer is NULL:
 *             return             # <<<<<<<<<<<<<<
 *         if <char*>buffer.buf is self._buffer:
 *             self._buffer_refcnt -= 1
 */
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":764
 *         if buffer is NULL:
 *             return
 *         if <char*>buffer.buf is self._buffer:             # <<<<<<<<<<<<<<
 *             self._buffer_refcnt -= 1
 *             if self._buffer_refcnt == 0:
 */
  __pyx_t_1 = (((char *)__pyx_v_buffer->buf) == ((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)__pyx_v_self)->_buffer);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":765
 *             return
 *         if <char*>buffer.buf is self._buffer:
 *             self._buffer_refcnt -= 1             # <<<<<<<<<<<<<<
 *             if self._buffer_refcnt == 0:
 *                 tree.xmlFree(self._buffer)
 */
    ((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)__pyx_v_self)->_buffer_refcnt = (((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)__pyx_v_self)->_buffer_refcnt - 1);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":766
 *         if <char*>buffer.buf is self._buffer:
 *             self._buffer_refcnt -= 1
 *             if self._buffer_refcnt == 0:             # <<<<<<<<<<<<<<
 *                 tree.xmlFree(self._buffer)
 *                 self._buffer = NULL
 */
    __pyx_t_1 = (((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)__pyx_v_self)->_buffer_refcnt == 0);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":767
 *             self._buffer_refcnt -= 1
 *             if self._buffer_refcnt == 0:
 *                 tree.xmlFree(self._buffer)             # <<<<<<<<<<<<<<
 *                 self._buffer = NULL
 *         else:
 */
      xmlFree(((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)__pyx_v_self)->_buffer);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":768
 *             if self._buffer_refcnt == 0:
 *                 tree.xmlFree(self._buffer)
 *                 self._buffer = NULL             # <<<<<<<<<<<<<<
 *         else:
 *             tree.xmlFree(<char*>buffer.buf)
 */
      ((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)__pyx_v_self)->_buffer = NULL;
      goto __pyx_L7;
    }
    __pyx_L7:;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":770
 *                 self._buffer = NULL
 *         else:
 *             tree.xmlFree(<char*>buffer.buf)             # <<<<<<<<<<<<<<
 *         buffer.buf = NULL
 * 
 */
    xmlFree(((char *)__pyx_v_buffer->buf));
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":771
 *         else:
 *             tree.xmlFree(<char*>buffer.buf)
 *         buffer.buf = NULL             # <<<<<<<<<<<<<<
 * 
 *     property xslt_profile:
 */
  __pyx_v_buffer->buf = NULL;

  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":776
 *         u"""Return an ElementTree with profiling data for the stylesheet run.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef object root
 *             if self._profile is None:
 */

static PyObject *__pyx_pf_4lxml_5etree_15_XSLTResultTree_12xslt_profile___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_15_XSLTResultTree_12xslt_profile___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_v_root;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __pyx_v_root = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":778
 *         def __get__(self):
 *             cdef object root
 *             if self._profile is None:             # <<<<<<<<<<<<<<
 *                 return None
 *             root = self._profile.getroot()
 */
  __pyx_t_1 = (((PyObject *)((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)__pyx_v_self)->_profile) == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":779
 *             cdef object root
 *             if self._profile is None:
 *                 return None             # <<<<<<<<<<<<<<
 *             root = self._profile.getroot()
 *             if root is None:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":780
 *             if self._profile is None:
 *                 return None
 *             root = self._profile.getroot()             # <<<<<<<<<<<<<<
 *             if root is None:
 *                 return None
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__Document *)((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)__pyx_v_self)->_profile->__pyx_vtab)->getroot(((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)__pyx_v_self)->_profile); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_v_root);
  __pyx_v_root = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":781
 *                 return None
 *             root = self._profile.getroot()
 *             if root is None:             # <<<<<<<<<<<<<<
 *                 return None
 *             return ElementTree(root)
 */
  __pyx_t_1 = (__pyx_v_root == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":782
 *             root = self._profile.getroot()
 *             if root is None:
 *                 return None             # <<<<<<<<<<<<<<
 *             return ElementTree(root)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":783
 *             if root is None:
 *                 return None
 *             return ElementTree(root)             # <<<<<<<<<<<<<<
 * 
 *         def __del__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__ElementTree); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(__pyx_v_root);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_root);
  __Pyx_GIVEREF(__pyx_v_root);
  __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._XSLTResultTree.xslt_profile.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_root);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":785
 *             return ElementTree(root)
 * 
 *         def __del__(self):             # <<<<<<<<<<<<<<
 *             self._profile = None
 * 
 */

static int __pyx_pf_4lxml_5etree_15_XSLTResultTree_12xslt_profile_1__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pf_4lxml_5etree_15_XSLTResultTree_12xslt_profile_1__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("__del__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":786
 * 
 *         def __del__(self):
 *             self._profile = None             # <<<<<<<<<<<<<<
 * 
 * cdef _xsltResultTreeFactory(_Document doc, XSLT xslt, _Document profile):
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)__pyx_v_self)->_profile);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)__pyx_v_self)->_profile));
  ((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)__pyx_v_self)->_profile = ((struct LxmlDocument *)Py_None);

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":788
 *             self._profile = None
 * 
 * cdef _xsltResultTreeFactory(_Document doc, XSLT xslt, _Document profile):             # <<<<<<<<<<<<<<
 *     cdef _XSLTResultTree result
 *     result = <_XSLTResultTree>_newElementTree(doc, None, _XSLTResultTree)
 */

static  PyObject *__pyx_f_4lxml_5etree__xsltResultTreeFactory(struct LxmlDocument *__pyx_v_doc, struct __pyx_obj_4lxml_5etree_XSLT *__pyx_v_xslt, struct LxmlDocument *__pyx_v_profile) {
  struct __pyx_obj_4lxml_5etree__XSLTResultTree *__pyx_v_result;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("_xsltResultTreeFactory");
  __pyx_v_result = ((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":790
 * cdef _xsltResultTreeFactory(_Document doc, XSLT xslt, _Document profile):
 *     cdef _XSLTResultTree result
 *     result = <_XSLTResultTree>_newElementTree(doc, None, _XSLTResultTree)             # <<<<<<<<<<<<<<
 *     result._xslt = xslt
 *     result._profile = profile
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__newElementTree(__pyx_v_doc, ((struct LxmlElement *)Py_None), ((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__XSLTResultTree)))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)__pyx_t_1)));
  __Pyx_DECREF(((PyObject *)__pyx_v_result));
  __pyx_v_result = ((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":791
 *     cdef _XSLTResultTree result
 *     result = <_XSLTResultTree>_newElementTree(doc, None, _XSLTResultTree)
 *     result._xslt = xslt             # <<<<<<<<<<<<<<
 *     result._profile = profile
 *     return result
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_xslt));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_xslt));
  __Pyx_GOTREF(__pyx_v_result->_xslt);
  __Pyx_DECREF(((PyObject *)__pyx_v_result->_xslt));
  __pyx_v_result->_xslt = __pyx_v_xslt;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":792
 *     result = <_XSLTResultTree>_newElementTree(doc, None, _XSLTResultTree)
 *     result._xslt = xslt
 *     result._profile = profile             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_profile));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_profile));
  __Pyx_GOTREF(__pyx_v_result->_profile);
  __Pyx_DECREF(((PyObject *)__pyx_v_result->_profile));
  __pyx_v_result->_profile = __pyx_v_profile;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":793
 *     result._xslt = xslt
 *     result._profile = profile
 *     return result             # <<<<<<<<<<<<<<
 * 
 * # functions like "output" and "write" are a potential security risk, but we
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._xsltResultTreeFactory");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":821
 * __findStylesheetByID = None
 * 
 * cdef _findStylesheetByID(_Document doc, id):             # <<<<<<<<<<<<<<
 *     global __findStylesheetByID
 *     if __findStylesheetByID is None:
 */

static  PyObject *__pyx_f_4lxml_5etree__findStylesheetByID(struct LxmlDocument *__pyx_v_doc, PyObject *__pyx_v_id) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("_findStylesheetByID");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":823
 * cdef _findStylesheetByID(_Document doc, id):
 *     global __findStylesheetByID
 *     if __findStylesheetByID is None:             # <<<<<<<<<<<<<<
 *         __findStylesheetByID = XPath(
 *             u"//xsl:stylesheet[@xml:id = $id]",
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_4lxml_5etree___findStylesheetByID) == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":824
 *     global __findStylesheetByID
 *     if __findStylesheetByID is None:
 *         __findStylesheetByID = XPath(             # <<<<<<<<<<<<<<
 *             u"//xsl:stylesheet[@xml:id = $id]",
 *             namespaces={u"xsl" : u"http://www.w3.org/1999/XSL/Transform"})
 */
    __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":826
 *         __findStylesheetByID = XPath(
 *             u"//xsl:stylesheet[@xml:id = $id]",
 *             namespaces={u"xsl" : u"http://www.w3.org/1999/XSL/Transform"})             # <<<<<<<<<<<<<<
 *     return __findStylesheetByID(doc, id=id)
 * 
 */
    __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_u__xsl), ((PyObject *)__pyx_kp_u_371)) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__namespaces), ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __pyx_t_3 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_XPath)), ((PyObject *)__pyx_k_tuple_370), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __Pyx_GOTREF(((PyObject *)__pyx_v_4lxml_5etree___findStylesheetByID));
    __Pyx_DECREF(((PyObject *)__pyx_v_4lxml_5etree___findStylesheetByID));
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_v_4lxml_5etree___findStylesheetByID = ((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":827
 *             u"//xsl:stylesheet[@xml:id = $id]",
 *             namespaces={u"xsl" : u"http://www.w3.org/1999/XSL/Transform"})
 *     return __findStylesheetByID(doc, id=id)             # <<<<<<<<<<<<<<
 * 
 * cdef class _XSLTProcessingInstruction(PIBase):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(((PyObject *)__pyx_v_doc));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_doc));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_doc));
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__id), __pyx_v_id) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = PyEval_CallObjectWithKeywords(((PyObject *)__pyx_v_4lxml_5etree___findStylesheetByID), ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._findStylesheetByID");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":830
 * 
 * cdef class _XSLTProcessingInstruction(PIBase):
 *     def parseXSL(self, parser=None):             # <<<<<<<<<<<<<<
 *         u"""parseXSL(self, parser=None)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_26_XSLTProcessingInstruction_parseXSL(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_26_XSLTProcessingInstruction_parseXSL[] = "parseXSL(self, parser=None)\n\n        Try to parse the stylesheet referenced by this PI and return\n        an ElementTree for it.  If the stylesheet is embedded in the\n        same document (referenced via xml:id), find and return an\n        ElementTree for the stylesheet Element.\n\n        The optional ``parser`` keyword argument can be passed to specify the\n        parser used to read from external stylesheet URLs.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_26_XSLTProcessingInstruction_parseXSL(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_parser = 0;
  struct LxmlDocument *__pyx_v_result_doc;
  struct LxmlElement *__pyx_v_result_node;
  char *__pyx_v_c_href;
  xmlAttr *__pyx_v_c_attr;
  PyObject *__pyx_v_hrefs;
  PyObject *__pyx_v_href_utf;
  PyObject *__pyx_v_root;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__parser,0};
  __Pyx_RefNannySetupContext("parseXSL");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[1] = {0};
    values[0] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parser);
        if (value) { values[0] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "parseXSL") < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_parser = values[0];
  } else {
    __pyx_v_parser = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: __pyx_v_parser = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("parseXSL", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[18]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._XSLTProcessingInstruction.parseXSL");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_result_doc = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_result_node = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_hrefs = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_href_utf = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_root = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":845
 *         cdef char* c_href
 *         cdef xmlAttr* c_attr
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         if self._c_node.content is NULL:
 *             raise ValueError, u"PI lacks content"
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":846
 *         cdef xmlAttr* c_attr
 *         _assertValidNode(self)
 *         if self._c_node.content is NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError, u"PI lacks content"
 *         hrefs = _FIND_PI_HREF(u' ' + funicode(self._c_node.content))
 */
  __pyx_t_2 = (((struct __pyx_obj_4lxml_5etree__XSLTProcessingInstruction *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.__pyx_base._c_node->content == NULL);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":847
 *         _assertValidNode(self)
 *         if self._c_node.content is NULL:
 *             raise ValueError, u"PI lacks content"             # <<<<<<<<<<<<<<
 *         hrefs = _FIND_PI_HREF(u' ' + funicode(self._c_node.content))
 *         if len(hrefs) != 1:
 */
    __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_u_372), 0);
    {__pyx_filename = __pyx_f[18]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":848
 *         if self._c_node.content is NULL:
 *             raise ValueError, u"PI lacks content"
 *         hrefs = _FIND_PI_HREF(u' ' + funicode(self._c_node.content))             # <<<<<<<<<<<<<<
 *         if len(hrefs) != 1:
 *             raise ValueError, u"malformed PI attributes"
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(((struct __pyx_obj_4lxml_5etree__XSLTProcessingInstruction *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.__pyx_base._c_node->content); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_kp_u_13), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(__pyx_v_4lxml_5etree__FIND_PI_HREF, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_v_hrefs);
  __pyx_v_hrefs = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":849
 *             raise ValueError, u"PI lacks content"
 *         hrefs = _FIND_PI_HREF(u' ' + funicode(self._c_node.content))
 *         if len(hrefs) != 1:             # <<<<<<<<<<<<<<
 *             raise ValueError, u"malformed PI attributes"
 *         href_utf = utf8(hrefs[0])
 */
  __pyx_t_5 = PyObject_Length(__pyx_v_hrefs); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = (__pyx_t_5 != 1);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":850
 *         hrefs = _FIND_PI_HREF(u' ' + funicode(self._c_node.content))
 *         if len(hrefs) != 1:
 *             raise ValueError, u"malformed PI attributes"             # <<<<<<<<<<<<<<
 *         href_utf = utf8(hrefs[0])
 *         c_href = _cstr(href_utf)
 */
    __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_u_373), 0);
    {__pyx_filename = __pyx_f[18]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":851
 *         if len(hrefs) != 1:
 *             raise ValueError, u"malformed PI attributes"
 *         href_utf = utf8(hrefs[0])             # <<<<<<<<<<<<<<
 *         c_href = _cstr(href_utf)
 * 
 */
  __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_hrefs, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = ((PyObject *)utf8(__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_v_href_utf);
  __pyx_v_href_utf = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":852
 *             raise ValueError, u"malformed PI attributes"
 *         href_utf = utf8(hrefs[0])
 *         c_href = _cstr(href_utf)             # <<<<<<<<<<<<<<
 * 
 *         if c_href[0] != c'#':
 */
  __pyx_v_c_href = PyBytes_AS_STRING(__pyx_v_href_utf);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":854
 *         c_href = _cstr(href_utf)
 * 
 *         if c_href[0] != c'#':             # <<<<<<<<<<<<<<
 *             # normal URL, try to parse from it
 *             c_href = tree.xmlBuildURI(
 */
  __pyx_t_2 = ((__pyx_v_c_href[0]) != '#');
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":858
 *             c_href = tree.xmlBuildURI(
 *                 c_href,
 *                 tree.xmlNodeGetBase(self._c_node.doc, self._c_node))             # <<<<<<<<<<<<<<
 *             if c_href is not NULL:
 *                 href_utf = c_href
 */
    __pyx_v_c_href = xmlBuildURI(__pyx_v_c_href, xmlNodeGetBase(((struct __pyx_obj_4lxml_5etree__XSLTProcessingInstruction *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.__pyx_base._c_node->doc, ((struct __pyx_obj_4lxml_5etree__XSLTProcessingInstruction *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.__pyx_base._c_node));

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":859
 *                 c_href,
 *                 tree.xmlNodeGetBase(self._c_node.doc, self._c_node))
 *             if c_href is not NULL:             # <<<<<<<<<<<<<<
 *                 href_utf = c_href
 *                 tree.xmlFree(c_href)
 */
    __pyx_t_2 = (__pyx_v_c_href != NULL);
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":860
 *                 tree.xmlNodeGetBase(self._c_node.doc, self._c_node))
 *             if c_href is not NULL:
 *                 href_utf = c_href             # <<<<<<<<<<<<<<
 *                 tree.xmlFree(c_href)
 *             result_doc = _parseDocumentFromURL(href_utf, parser)
 */
      __pyx_t_3 = PyBytes_FromString(__pyx_v_c_href); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
      __Pyx_DECREF(__pyx_v_href_utf);
      __pyx_v_href_utf = ((PyObject *)__pyx_t_3);
      __pyx_t_3 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":861
 *             if c_href is not NULL:
 *                 href_utf = c_href
 *                 tree.xmlFree(c_href)             # <<<<<<<<<<<<<<
 *             result_doc = _parseDocumentFromURL(href_utf, parser)
 *             return _elementTreeFactory(result_doc, None)
 */
      xmlFree(__pyx_v_c_href);
      goto __pyx_L9;
    }
    __pyx_L9:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":862
 *                 href_utf = c_href
 *                 tree.xmlFree(c_href)
 *             result_doc = _parseDocumentFromURL(href_utf, parser)             # <<<<<<<<<<<<<<
 *             return _elementTreeFactory(result_doc, None)
 * 
 */
    if (!(likely(((__pyx_v_parser) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_parser, __pyx_ptype_4lxml_5etree__BaseParser))))) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__parseDocumentFromURL(__pyx_v_href_utf, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_parser))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__pyx_v_result_doc));
    __pyx_v_result_doc = ((struct LxmlDocument *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":863
 *                 tree.xmlFree(c_href)
 *             result_doc = _parseDocumentFromURL(href_utf, parser)
 *             return _elementTreeFactory(result_doc, None)             # <<<<<<<<<<<<<<
 * 
 *         # ID reference to embedded stylesheet
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__elementTreeFactory(__pyx_v_result_doc, ((struct LxmlElement *)Py_None))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
    goto __pyx_L8;
  }
  __pyx_L8:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":867
 *         # ID reference to embedded stylesheet
 *         # try XML:ID lookup
 *         _assertValidDoc(self._doc)             # <<<<<<<<<<<<<<
 *         c_href += 1 # skip leading '#'
 *         c_attr = tree.xmlGetID(self._c_node.doc, c_href)
 */
  __pyx_t_3 = ((PyObject *)((struct __pyx_obj_4lxml_5etree__XSLTProcessingInstruction *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.__pyx_base._doc);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDoc(((struct LxmlDocument *)__pyx_t_3)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":868
 *         # try XML:ID lookup
 *         _assertValidDoc(self._doc)
 *         c_href += 1 # skip leading '#'             # <<<<<<<<<<<<<<
 *         c_attr = tree.xmlGetID(self._c_node.doc, c_href)
 *         if c_attr is not NULL and c_attr.doc is self._c_node.doc:
 */
  __pyx_v_c_href = (__pyx_v_c_href + 1);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":869
 *         _assertValidDoc(self._doc)
 *         c_href += 1 # skip leading '#'
 *         c_attr = tree.xmlGetID(self._c_node.doc, c_href)             # <<<<<<<<<<<<<<
 *         if c_attr is not NULL and c_attr.doc is self._c_node.doc:
 *             result_node = _elementFactory(self._doc, c_attr.parent)
 */
  __pyx_v_c_attr = xmlGetID(((struct __pyx_obj_4lxml_5etree__XSLTProcessingInstruction *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.__pyx_base._c_node->doc, __pyx_v_c_href);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":870
 *         c_href += 1 # skip leading '#'
 *         c_attr = tree.xmlGetID(self._c_node.doc, c_href)
 *         if c_attr is not NULL and c_attr.doc is self._c_node.doc:             # <<<<<<<<<<<<<<
 *             result_node = _elementFactory(self._doc, c_attr.parent)
 *             return _elementTreeFactory(result_node._doc, result_node)
 */
  __pyx_t_2 = (__pyx_v_c_attr != NULL);
  if (__pyx_t_2) {
    __pyx_t_6 = (__pyx_v_c_attr->doc == ((struct __pyx_obj_4lxml_5etree__XSLTProcessingInstruction *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.__pyx_base._c_node->doc);
    __pyx_t_7 = __pyx_t_6;
  } else {
    __pyx_t_7 = __pyx_t_2;
  }
  if (__pyx_t_7) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":871
 *         c_attr = tree.xmlGetID(self._c_node.doc, c_href)
 *         if c_attr is not NULL and c_attr.doc is self._c_node.doc:
 *             result_node = _elementFactory(self._doc, c_attr.parent)             # <<<<<<<<<<<<<<
 *             return _elementTreeFactory(result_node._doc, result_node)
 * 
 */
    __pyx_t_3 = ((PyObject *)((struct __pyx_obj_4lxml_5etree__XSLTProcessingInstruction *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.__pyx_base._doc);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_3), __pyx_v_c_attr->parent)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_v_result_node));
    __pyx_v_result_node = ((struct LxmlElement *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":872
 *         if c_attr is not NULL and c_attr.doc is self._c_node.doc:
 *             result_node = _elementFactory(self._doc, c_attr.parent)
 *             return _elementTreeFactory(result_node._doc, result_node)             # <<<<<<<<<<<<<<
 * 
 *         # try XPath search
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = ((PyObject *)__pyx_v_result_node->_doc);
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__elementTreeFactory(((struct LxmlDocument *)__pyx_t_4), __pyx_v_result_node)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
    goto __pyx_L10;
  }
  __pyx_L10:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":875
 * 
 *         # try XPath search
 *         root = _findStylesheetByID(self._doc, funicode(c_href))             # <<<<<<<<<<<<<<
 *         if not root:
 *             raise ValueError, u"reference to non-existing embedded stylesheet"
 */
  __pyx_t_3 = ((PyObject *)((struct __pyx_obj_4lxml_5etree__XSLTProcessingInstruction *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.__pyx_base._doc);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_href); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_8 = __pyx_f_4lxml_5etree__findStylesheetByID(((struct LxmlDocument *)__pyx_t_3), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_v_root);
  __pyx_v_root = __pyx_t_8;
  __pyx_t_8 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":876
 *         # try XPath search
 *         root = _findStylesheetByID(self._doc, funicode(c_href))
 *         if not root:             # <<<<<<<<<<<<<<
 *             raise ValueError, u"reference to non-existing embedded stylesheet"
 *         elif len(root) > 1:
 */
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_root); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = (!__pyx_t_7);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":877
 *         root = _findStylesheetByID(self._doc, funicode(c_href))
 *         if not root:
 *             raise ValueError, u"reference to non-existing embedded stylesheet"             # <<<<<<<<<<<<<<
 *         elif len(root) > 1:
 *             raise ValueError, u"ambiguous reference to embedded stylesheet"
 */
    __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_u_374), 0);
    {__pyx_filename = __pyx_f[18]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L11;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":878
 *         if not root:
 *             raise ValueError, u"reference to non-existing embedded stylesheet"
 *         elif len(root) > 1:             # <<<<<<<<<<<<<<
 *             raise ValueError, u"ambiguous reference to embedded stylesheet"
 *         result_node = root[0]
 */
  __pyx_t_5 = PyObject_Length(__pyx_v_root); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = (__pyx_t_5 > 1);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":879
 *             raise ValueError, u"reference to non-existing embedded stylesheet"
 *         elif len(root) > 1:
 *             raise ValueError, u"ambiguous reference to embedded stylesheet"             # <<<<<<<<<<<<<<
 *         result_node = root[0]
 *         return _elementTreeFactory(result_node._doc, result_node)
 */
    __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_u_375), 0);
    {__pyx_filename = __pyx_f[18]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L11;
  }
  __pyx_L11:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":880
 *         elif len(root) > 1:
 *             raise ValueError, u"ambiguous reference to embedded stylesheet"
 *         result_node = root[0]             # <<<<<<<<<<<<<<
 *         return _elementTreeFactory(result_node._doc, result_node)
 * 
 */
  __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_root, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_v_result_node));
  __pyx_v_result_node = ((struct LxmlElement *)__pyx_t_8);
  __pyx_t_8 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":881
 *             raise ValueError, u"ambiguous reference to embedded stylesheet"
 *         result_node = root[0]
 *         return _elementTreeFactory(result_node._doc, result_node)             # <<<<<<<<<<<<<<
 * 
 *     def set(self, key, value):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_8 = ((PyObject *)__pyx_v_result_node->_doc);
  __Pyx_INCREF(__pyx_t_8);
  __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__elementTreeFactory(((struct LxmlDocument *)__pyx_t_8), __pyx_v_result_node)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("lxml.etree._XSLTProcessingInstruction.parseXSL");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_result_doc);
  __Pyx_DECREF((PyObject *)__pyx_v_result_node);
  __Pyx_DECREF(__pyx_v_hrefs);
  __Pyx_DECREF(__pyx_v_href_utf);
  __Pyx_DECREF(__pyx_v_root);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":883
 *         return _elementTreeFactory(result_node._doc, result_node)
 * 
 *     def set(self, key, value):             # <<<<<<<<<<<<<<
 *         u"""set(self, key, value)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_26_XSLTProcessingInstruction_1set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_26_XSLTProcessingInstruction_1set[] = "set(self, key, value)\n\n        Sets a pseudo attribute in the text of the processing instruction.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_26_XSLTProcessingInstruction_1set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_value = 0;
  PyObject *__pyx_v_attrib;
  PyObject *__pyx_v_text;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__key,&__pyx_n_s__value,0};
  __Pyx_RefNannySetupContext("set");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__key);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__value);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, 1); {__pyx_filename = __pyx_f[18]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "set") < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_key = values[0];
    __pyx_v_value = values[1];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_key = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_value = PyTuple_GET_ITEM(__pyx_args, 1);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[18]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._XSLTProcessingInstruction.set");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_attrib = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_text = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":888
 *         Sets a pseudo attribute in the text of the processing instruction.
 *         """
 *         if key != u"href":             # <<<<<<<<<<<<<<
 *             raise AttributeError, \
 *                 u"only setting the 'href' attribute is supported on XSLT-PIs"
 */
  __pyx_t_1 = __Pyx_PyUnicode_Equals(__pyx_v_key, ((PyObject *)__pyx_n_u__href), Py_NE); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":889
 *         """
 *         if key != u"href":
 *             raise AttributeError, \             # <<<<<<<<<<<<<<
 *                 u"only setting the 'href' attribute is supported on XSLT-PIs"
 *         if value is None:
 */
    __Pyx_Raise(__pyx_builtin_AttributeError, ((PyObject *)__pyx_kp_u_376), 0);
    {__pyx_filename = __pyx_f[18]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":891
 *             raise AttributeError, \
 *                 u"only setting the 'href' attribute is supported on XSLT-PIs"
 *         if value is None:             # <<<<<<<<<<<<<<
 *             attrib = u""
 *         elif u'"' in value or u'>' in value:
 */
  __pyx_t_1 = (__pyx_v_value == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":892
 *                 u"only setting the 'href' attribute is supported on XSLT-PIs"
 *         if value is None:
 *             attrib = u""             # <<<<<<<<<<<<<<
 *         elif u'"' in value or u'>' in value:
 *             raise ValueError, u"Invalid URL, must not contain '\"' or '>'"
 */
    __Pyx_INCREF(((PyObject *)__pyx_kp_u_25));
    __Pyx_DECREF(((PyObject *)__pyx_v_attrib));
    __pyx_v_attrib = __pyx_kp_u_25;
    goto __pyx_L7;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":893
 *         if value is None:
 *             attrib = u""
 *         elif u'"' in value or u'>' in value:             # <<<<<<<<<<<<<<
 *             raise ValueError, u"Invalid URL, must not contain '\"' or '>'"
 *         else:
 */
  __pyx_t_1 = ((PySequence_Contains(__pyx_v_value, ((PyObject *)__pyx_kp_u_251)))); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (!__pyx_t_1) {
    __pyx_t_2 = ((PySequence_Contains(__pyx_v_value, ((PyObject *)__pyx_kp_u_377)))); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":894
 *             attrib = u""
 *         elif u'"' in value or u'>' in value:
 *             raise ValueError, u"Invalid URL, must not contain '\"' or '>'"             # <<<<<<<<<<<<<<
 *         else:
 *             attrib = u' href="%s"' % value
 */
    __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_u_378), 0);
    {__pyx_filename = __pyx_f[18]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L7;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":896
 *             raise ValueError, u"Invalid URL, must not contain '\"' or '>'"
 *         else:
 *             attrib = u' href="%s"' % value             # <<<<<<<<<<<<<<
 *         text = u' ' + self.text
 *         if _FIND_PI_HREF(text):
 */
    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_379), __pyx_v_value); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_DECREF(((PyObject *)__pyx_v_attrib));
    __pyx_v_attrib = __pyx_t_4;
    __pyx_t_4 = 0;
  }
  __pyx_L7:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":897
 *         else:
 *             attrib = u' href="%s"' % value
 *         text = u' ' + self.text             # <<<<<<<<<<<<<<
 *         if _FIND_PI_HREF(text):
 *             self.text = _REPLACE_PI_HREF(attrib, text)
 */
  __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__text); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyNumber_Add(((PyObject *)__pyx_kp_u_13), __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_v_text);
  __pyx_v_text = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":898
 *             attrib = u' href="%s"' % value
 *         text = u' ' + self.text
 *         if _FIND_PI_HREF(text):             # <<<<<<<<<<<<<<
 *             self.text = _REPLACE_PI_HREF(attrib, text)
 *         else:
 */
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  __Pyx_INCREF(__pyx_v_text);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_text);
  __Pyx_GIVEREF(__pyx_v_text);
  __pyx_t_4 = PyObject_Call(__pyx_v_4lxml_5etree__FIND_PI_HREF, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":899
 *         text = u' ' + self.text
 *         if _FIND_PI_HREF(text):
 *             self.text = _REPLACE_PI_HREF(attrib, text)             # <<<<<<<<<<<<<<
 *         else:
 *             self.text = text + attrib
 */
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_INCREF(((PyObject *)__pyx_v_attrib));
    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_attrib));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_attrib));
    __Pyx_INCREF(__pyx_v_text);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_text);
    __Pyx_GIVEREF(__pyx_v_text);
    __pyx_t_5 = PyObject_Call(__pyx_v_4lxml_5etree__REPLACE_PI_HREF, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__text, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L8;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":901
 *             self.text = _REPLACE_PI_HREF(attrib, text)
 *         else:
 *             self.text = text + attrib             # <<<<<<<<<<<<<<
 * 
 *     def get(self, key, default=None):
 */
    __pyx_t_5 = PyNumber_Add(__pyx_v_text, ((PyObject *)__pyx_v_attrib)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__text, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __pyx_L8:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._XSLTProcessingInstruction.set");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_attrib);
  __Pyx_DECREF(__pyx_v_text);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":903
 *             self.text = text + attrib
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         u"""get(self, key, default=None)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_26_XSLTProcessingInstruction_2get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_26_XSLTProcessingInstruction_2get[] = "get(self, key, default=None)\n\n        Parses a pseudo attribute from the text of the processing instruction.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_26_XSLTProcessingInstruction_2get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_default = 0;
  PyObject *__pyx_v_attr;
  PyObject *__pyx_v_value;
  PyObject *__pyx_r = NULL;
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__key,&__pyx_n_s__default,0};
  __Pyx_RefNannySetupContext("get");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__key);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__default);
        if (value) { values[1] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "get") < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_key = values[0];
    __pyx_v_default = values[1];
  } else {
    __pyx_v_default = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_default = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v_key = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[18]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._XSLTProcessingInstruction.get");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_attr = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_value = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":908
 *         Parses a pseudo attribute from the text of the processing instruction.
 *         """
 *         for attr, value in _FIND_PI_ATTRIBUTES(u' ' + self.text):             # <<<<<<<<<<<<<<
 *             if attr == key:
 *                 return value
 */
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__text); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyNumber_Add(((PyObject *)__pyx_kp_u_13), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(__pyx_v_4lxml_5etree__FIND_PI_ATTRIBUTES, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) {
    __pyx_t_1 = 0; __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2);
  } else {
    __pyx_t_1 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  for (;;) {
    if (likely(PyList_CheckExact(__pyx_t_2))) {
      if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++;
    } else if (likely(PyTuple_CheckExact(__pyx_t_2))) {
      if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++;
    } else {
      __pyx_t_3 = PyIter_Next(__pyx_t_2);
      if (!__pyx_t_3) {
        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    if (PyTuple_CheckExact(__pyx_t_3) && likely(PyTuple_GET_SIZE(__pyx_t_3) == 2)) {
      PyObject* tuple = __pyx_t_3;
      __pyx_t_4 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_4);
      __pyx_t_5 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_v_attr);
      __pyx_v_attr = __pyx_t_4;
      __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_v_value);
      __pyx_v_value = __pyx_t_5;
      __pyx_t_5 = 0;
    } else {
      __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_4 = __Pyx_UnpackItem(__pyx_t_6, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_UnpackItem(__pyx_t_6, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_EndUnpack(__pyx_t_6, 2) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_v_attr);
      __pyx_v_attr = __pyx_t_4;
      __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_v_value);
      __pyx_v_value = __pyx_t_5;
      __pyx_t_5 = 0;
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":909
 *         """
 *         for attr, value in _FIND_PI_ATTRIBUTES(u' ' + self.text):
 *             if attr == key:             # <<<<<<<<<<<<<<
 *                 return value
 *         return default
 */
    __pyx_t_3 = PyObject_RichCompare(__pyx_v_attr, __pyx_v_key, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_7) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":910
 *         for attr, value in _FIND_PI_ATTRIBUTES(u' ' + self.text):
 *             if attr == key:
 *                 return value             # <<<<<<<<<<<<<<
 *         return default
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_value);
      __pyx_r = __pyx_v_value;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L0;
      goto __pyx_L8;
    }
    __pyx_L8:;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":911
 *             if attr == key:
 *                 return value
 *         return default             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_default);
  __pyx_r = __pyx_v_default;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._XSLTProcessingInstruction.get");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_attr);
  __Pyx_DECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":6
 *     u"""Base class of an XSLT extension element.
 *     """
 *     def execute(self, context, self_node, input_node, output_parent):             # <<<<<<<<<<<<<<
 *         u"""execute(self, context, self_node, input_node, output_parent)
 *         Execute this extension element.
 */

static PyObject *__pyx_pf_4lxml_5etree_13XSLTExtension_execute(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_13XSLTExtension_execute[] = "execute(self, context, self_node, input_node, output_parent)\n        Execute this extension element.\n\n        Subclasses must override this method.  They may append\n        elements to the `output_parent` element here, or set its text\n        content.  To this end, the `input_node` provides read-only\n        access to the current node in the input document, and the\n        `self_node` points to the extension element in the stylesheet.\n\n        Note that the `output_parent` parameter may be `None` if there\n        is no parent element in the current context (e.g. no content\n        was added to the output tree yet).\n        ";
static PyObject *__pyx_pf_4lxml_5etree_13XSLTExtension_execute(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_context = 0;
  PyObject *__pyx_v_self_node = 0;
  PyObject *__pyx_v_input_node = 0;
  PyObject *__pyx_v_output_parent = 0;
  PyObject *__pyx_r = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__context,&__pyx_n_s__self_node,&__pyx_n_s__input_node,&__pyx_n_s__output_parent,0};
  __Pyx_RefNannySetupContext("execute");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[4] = {0,0,0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__context);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self_node);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("execute", 1, 4, 4, 1); {__pyx_filename = __pyx_f[19]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__input_node);
      if (likely(values[2])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("execute", 1, 4, 4, 2); {__pyx_filename = __pyx_f[19]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  3:
      values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__output_parent);
      if (likely(values[3])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("execute", 1, 4, 4, 3); {__pyx_filename = __pyx_f[19]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "execute") < 0)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_context = values[0];
    __pyx_v_self_node = values[1];
    __pyx_v_input_node = values[2];
    __pyx_v_output_parent = values[3];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_context = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_self_node = PyTuple_GET_ITEM(__pyx_args, 1);
    __pyx_v_input_node = PyTuple_GET_ITEM(__pyx_args, 2);
    __pyx_v_output_parent = PyTuple_GET_ITEM(__pyx_args, 3);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("execute", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[19]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.XSLTExtension.execute");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":22
 *         pass
 * 
 *     def apply_templates(self, _XSLTContext context not None, node, output_parent=None):             # <<<<<<<<<<<<<<
 *         u"""apply_templates(self, context, node, output_parent=None)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_13XSLTExtension_1apply_templates(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_13XSLTExtension_1apply_templates[] = "apply_templates(self, context, node, output_parent=None)\n\n        Call this method to retrieve the result of applying templates\n        to an element.\n\n        The return value is a list of elements or text strings that\n        were generated by the XSLT processor.\n\n        If you pass an Element as `output_parent` parameter, the result\n        will instead be appended to the element (including attributes\n        etc.) and the return value will be `None`.  This is a safe way\n        to generate content into the output document directly, without\n        having to take care of special values like text or attributes.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_13XSLTExtension_1apply_templates(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_4lxml_5etree__XSLTContext *__pyx_v_context = 0;
  PyObject *__pyx_v_node = 0;
  PyObject *__pyx_v_output_parent = 0;
  xmlNode *__pyx_v_c_parent;
  xmlNode *__pyx_v_c_node;
  xmlNode *__pyx_v_c_context_node;
  PyObject *__pyx_r = NULL;
  xmlNode *__pyx_t_1;
  int __pyx_t_2;
  xmlNode *__pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__context,&__pyx_n_s__node,&__pyx_n_s__output_parent,0};
  __Pyx_RefNannySetupContext("apply_templates");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    values[2] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__context);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__node);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("apply_templates", 0, 2, 3, 1); {__pyx_filename = __pyx_f[19]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__output_parent);
        if (value) { values[2] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "apply_templates") < 0)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__XSLTContext *)values[0]);
    __pyx_v_node = values[1];
    __pyx_v_output_parent = values[2];
  } else {
    __pyx_v_output_parent = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3:
      __pyx_v_output_parent = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2:
      __pyx_v_node = PyTuple_GET_ITEM(__pyx_args, 1);
      __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__XSLTContext *)PyTuple_GET_ITEM(__pyx_args, 0));
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("apply_templates", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[19]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.XSLTExtension.apply_templates");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_context), __pyx_ptype_4lxml_5etree__XSLTContext, 0, "context", 0))) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":40
 *         cdef xmlNode* c_node
 *         cdef xmlNode* c_context_node
 *         assert context._xsltCtxt is not NULL, "XSLT context not initialised"             # <<<<<<<<<<<<<<
 *         c_context_node = _roNodeOf(node)
 *         #assert c_context_node.doc is context._xsltContext.node.doc, \
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!(__pyx_v_context->_xsltCtxt != NULL))) {
    PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_380));
    {__pyx_filename = __pyx_f[19]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":41
 *         cdef xmlNode* c_context_node
 *         assert context._xsltCtxt is not NULL, "XSLT context not initialised"
 *         c_context_node = _roNodeOf(node)             # <<<<<<<<<<<<<<
 *         #assert c_context_node.doc is context._xsltContext.node.doc, \
 *         #    "switching input documents during transformation is not currently supported"
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__roNodeOf(__pyx_v_node); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_context_node = __pyx_t_1;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":45
 *         #    "switching input documents during transformation is not currently supported"
 * 
 *         if output_parent is not None:             # <<<<<<<<<<<<<<
 *             c_parent = _nonRoNodeOf(output_parent)
 *         else:
 */
  __pyx_t_2 = (__pyx_v_output_parent != Py_None);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":46
 * 
 *         if output_parent is not None:
 *             c_parent = _nonRoNodeOf(output_parent)             # <<<<<<<<<<<<<<
 *         else:
 *             c_parent = tree.xmlNewDocNode(
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree__nonRoNodeOf(__pyx_v_output_parent); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_c_parent = __pyx_t_3;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":49
 *         else:
 *             c_parent = tree.xmlNewDocNode(
 *                 context._xsltCtxt.output, NULL, "fake-parent", NULL)             # <<<<<<<<<<<<<<
 * 
 *         c_node = context._xsltCtxt.insert
 */
    __pyx_v_c_parent = xmlNewDocNode(__pyx_v_context->_xsltCtxt->output, NULL, __pyx_k_381, NULL);
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":51
 *                 context._xsltCtxt.output, NULL, "fake-parent", NULL)
 * 
 *         c_node = context._xsltCtxt.insert             # <<<<<<<<<<<<<<
 *         context._xsltCtxt.insert = c_parent
 *         xslt.xsltProcessOneNode(
 */
  __pyx_v_c_node = __pyx_v_context->_xsltCtxt->insert;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":52
 * 
 *         c_node = context._xsltCtxt.insert
 *         context._xsltCtxt.insert = c_parent             # <<<<<<<<<<<<<<
 *         xslt.xsltProcessOneNode(
 *             context._xsltCtxt, c_context_node, NULL)
 */
  __pyx_v_context->_xsltCtxt->insert = __pyx_v_c_parent;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":54
 *         context._xsltCtxt.insert = c_parent
 *         xslt.xsltProcessOneNode(
 *             context._xsltCtxt, c_context_node, NULL)             # <<<<<<<<<<<<<<
 *         context._xsltCtxt.insert = c_node
 * 
 */
  xsltProcessOneNode(__pyx_v_context->_xsltCtxt, __pyx_v_c_context_node, NULL);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":55
 *         xslt.xsltProcessOneNode(
 *             context._xsltCtxt, c_context_node, NULL)
 *         context._xsltCtxt.insert = c_node             # <<<<<<<<<<<<<<
 * 
 *         if output_parent is not None:
 */
  __pyx_v_context->_xsltCtxt->insert = __pyx_v_c_node;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":57
 *         context._xsltCtxt.insert = c_node
 * 
 *         if output_parent is not None:             # <<<<<<<<<<<<<<
 *             return None
 * 
 */
  __pyx_t_2 = (__pyx_v_output_parent != Py_None);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":58
 * 
 *         if output_parent is not None:
 *             return None             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":60
 *             return None
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             return self._collectXSLTResultContent(context, c_parent)
 *         finally:
 */
  /*try:*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":61
 * 
 *         try:
 *             return self._collectXSLTResultContent(context, c_parent)             # <<<<<<<<<<<<<<
 *         finally:
 *             # free all intermediate nodes that will not be freed by proxies
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = ((struct __pyx_vtabstruct_4lxml_5etree_XSLTExtension *)((struct __pyx_obj_4lxml_5etree_XSLTExtension *)__pyx_v_self)->__pyx_vtab)->_collectXSLTResultContent(((struct __pyx_obj_4lxml_5etree_XSLTExtension *)__pyx_v_self), __pyx_v_context, __pyx_v_c_parent); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L9;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L8;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":64
 *         finally:
 *             # free all intermediate nodes that will not be freed by proxies
 *             tree.xmlFreeNode(c_parent)             # <<<<<<<<<<<<<<
 * 
 *     def process_children(self, _XSLTContext context not None, output_parent=None):
 */
  /*finally:*/ {
    int __pyx_why;
    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
    int __pyx_exc_lineno;
    __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 0; goto __pyx_L10;
    __pyx_L8: __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 3; goto __pyx_L10;
    __pyx_L9: {
      __pyx_why = 4;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
      __pyx_exc_lineno = __pyx_lineno;
      goto __pyx_L10;
    }
    __pyx_L10:;
    xmlFreeNode(__pyx_v_c_parent);
    switch (__pyx_why) {
      case 3: goto __pyx_L0;
      case 4: {
        __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
        __pyx_lineno = __pyx_exc_lineno;
        __pyx_exc_type = 0;
        __pyx_exc_value = 0;
        __pyx_exc_tb = 0;
        goto __pyx_L1_error;
      }
    }
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.XSLTExtension.apply_templates");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":66
 *             tree.xmlFreeNode(c_parent)
 * 
 *     def process_children(self, _XSLTContext context not None, output_parent=None):             # <<<<<<<<<<<<<<
 *         u"""process_children(self, context, output_parent=None)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_13XSLTExtension_2process_children(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_13XSLTExtension_2process_children[] = "process_children(self, context, output_parent=None)\n\n        Call this method to process the XSLT content of the extension\n        element itself.\n\n        The return value is a list of elements or text strings that\n        were generated by the XSLT processor.\n\n        If you pass an Element as `output_parent` parameter, the result\n        will instead be appended to the element (including attributes\n        etc.) and the return value will be `None`.  This is a safe way\n        to generate content into the output document directly, without\n        having to take care of special values like text or attributes.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_13XSLTExtension_2process_children(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_4lxml_5etree__XSLTContext *__pyx_v_context = 0;
  PyObject *__pyx_v_output_parent = 0;
  xmlNode *__pyx_v_c_parent;
  xsltTransformContext *__pyx_v_c_ctxt;
  xmlNode *__pyx_v_c_old_output_parent;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  xmlNode *__pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__context,&__pyx_n_s__output_parent,0};
  __Pyx_RefNannySetupContext("process_children");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__context);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__output_parent);
        if (value) { values[1] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "process_children") < 0)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__XSLTContext *)values[0]);
    __pyx_v_output_parent = values[1];
  } else {
    __pyx_v_output_parent = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_output_parent = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__XSLTContext *)PyTuple_GET_ITEM(__pyx_args, 0));
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("process_children", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[19]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.XSLTExtension.process_children");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_context), __pyx_ptype_4lxml_5etree__XSLTContext, 0, "context", 0))) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":82
 *         """
 *         cdef xmlNode* c_parent
 *         cdef xslt.xsltTransformContext* c_ctxt = context._xsltCtxt             # <<<<<<<<<<<<<<
 *         cdef xmlNode* c_old_output_parent = c_ctxt.insert
 *         assert context._xsltCtxt is not NULL, "XSLT context not initialised"
 */
  __pyx_v_c_ctxt = __pyx_v_context->_xsltCtxt;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":83
 *         cdef xmlNode* c_parent
 *         cdef xslt.xsltTransformContext* c_ctxt = context._xsltCtxt
 *         cdef xmlNode* c_old_output_parent = c_ctxt.insert             # <<<<<<<<<<<<<<
 *         assert context._xsltCtxt is not NULL, "XSLT context not initialised"
 * 
 */
  __pyx_v_c_old_output_parent = __pyx_v_c_ctxt->insert;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":84
 *         cdef xslt.xsltTransformContext* c_ctxt = context._xsltCtxt
 *         cdef xmlNode* c_old_output_parent = c_ctxt.insert
 *         assert context._xsltCtxt is not NULL, "XSLT context not initialised"             # <<<<<<<<<<<<<<
 * 
 *         # output_parent node is used for adding results instead of
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!(__pyx_v_context->_xsltCtxt != NULL))) {
    PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_380));
    {__pyx_filename = __pyx_f[19]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":90
 *         # use attributes added to extension element with <xsl:attribute>.
 * 
 *         if output_parent is not None:             # <<<<<<<<<<<<<<
 *             c_parent = _nonRoNodeOf(output_parent)
 *         else:
 */
  __pyx_t_1 = (__pyx_v_output_parent != Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":91
 * 
 *         if output_parent is not None:
 *             c_parent = _nonRoNodeOf(output_parent)             # <<<<<<<<<<<<<<
 *         else:
 *             c_parent = tree.xmlNewDocNode(
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree__nonRoNodeOf(__pyx_v_output_parent); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_c_parent = __pyx_t_2;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":94
 *         else:
 *             c_parent = tree.xmlNewDocNode(
 *                 context._xsltCtxt.output, NULL, "fake-parent", NULL)             # <<<<<<<<<<<<<<
 * 
 *         c_ctxt.insert = _nonRoNodeOf(output_parent)
 */
    __pyx_v_c_parent = xmlNewDocNode(__pyx_v_context->_xsltCtxt->output, NULL, __pyx_k_381, NULL);
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":96
 *                 context._xsltCtxt.output, NULL, "fake-parent", NULL)
 * 
 *         c_ctxt.insert = _nonRoNodeOf(output_parent)             # <<<<<<<<<<<<<<
 *         xslt.xsltApplyOneTemplate(c_ctxt,
 *             c_ctxt.node, c_ctxt.inst.children, NULL, NULL)
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__nonRoNodeOf(__pyx_v_output_parent); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_ctxt->insert = __pyx_t_2;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":98
 *         c_ctxt.insert = _nonRoNodeOf(output_parent)
 *         xslt.xsltApplyOneTemplate(c_ctxt,
 *             c_ctxt.node, c_ctxt.inst.children, NULL, NULL)             # <<<<<<<<<<<<<<
 *         c_ctxt.insert = c_old_output_parent
 * 
 */
  xsltApplyOneTemplate(__pyx_v_c_ctxt, __pyx_v_c_ctxt->node, __pyx_v_c_ctxt->inst->children, NULL, NULL);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":99
 *         xslt.xsltApplyOneTemplate(c_ctxt,
 *             c_ctxt.node, c_ctxt.inst.children, NULL, NULL)
 *         c_ctxt.insert = c_old_output_parent             # <<<<<<<<<<<<<<
 * 
 *         if output_parent is not None:
 */
  __pyx_v_c_ctxt->insert = __pyx_v_c_old_output_parent;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":101
 *         c_ctxt.insert = c_old_output_parent
 * 
 *         if output_parent is not None:             # <<<<<<<<<<<<<<
 *             return None
 * 
 */
  __pyx_t_1 = (__pyx_v_output_parent != Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":102
 * 
 *         if output_parent is not None:
 *             return None             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":104
 *             return None
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             return self._collectXSLTResultContent(context, c_parent)
 *         finally:
 */
  /*try:*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":105
 * 
 *         try:
 *             return self._collectXSLTResultContent(context, c_parent)             # <<<<<<<<<<<<<<
 *         finally:
 *             # free all intermediate nodes that will not be freed by proxies
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree_XSLTExtension *)((struct __pyx_obj_4lxml_5etree_XSLTExtension *)__pyx_v_self)->__pyx_vtab)->_collectXSLTResultContent(((struct __pyx_obj_4lxml_5etree_XSLTExtension *)__pyx_v_self), __pyx_v_context, __pyx_v_c_parent); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L9;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L8;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":108
 *         finally:
 *             # free all intermediate nodes that will not be freed by proxies
 *             tree.xmlFreeNode(c_parent)             # <<<<<<<<<<<<<<
 * 
 *     cdef _collectXSLTResultContent(self, _XSLTContext context, xmlNode* c_parent):
 */
  /*finally:*/ {
    int __pyx_why;
    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
    int __pyx_exc_lineno;
    __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 0; goto __pyx_L10;
    __pyx_L8: __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 3; goto __pyx_L10;
    __pyx_L9: {
      __pyx_why = 4;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
      __pyx_exc_lineno = __pyx_lineno;
      goto __pyx_L10;
    }
    __pyx_L10:;
    xmlFreeNode(__pyx_v_c_parent);
    switch (__pyx_why) {
      case 3: goto __pyx_L0;
      case 4: {
        __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
        __pyx_lineno = __pyx_exc_lineno;
        __pyx_exc_type = 0;
        __pyx_exc_value = 0;
        __pyx_exc_tb = 0;
        goto __pyx_L1_error;
      }
    }
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.XSLTExtension.process_children");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":110
 *             tree.xmlFreeNode(c_parent)
 * 
 *     cdef _collectXSLTResultContent(self, _XSLTContext context, xmlNode* c_parent):             # <<<<<<<<<<<<<<
 *         cdef xmlNode* c_node
 *         cdef xmlNode* c_next
 */

static  PyObject *__pyx_f_4lxml_5etree_13XSLTExtension__collectXSLTResultContent(struct __pyx_obj_4lxml_5etree_XSLTExtension *__pyx_v_self, struct __pyx_obj_4lxml_5etree__XSLTContext *__pyx_v_context, xmlNode *__pyx_v_c_parent) {
  xmlNode *__pyx_v_c_node;
  xmlNode *__pyx_v_c_next;
  struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_proxy;
  PyObject *__pyx_v_results = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("_collectXSLTResultContent");
  __pyx_v_proxy = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":114
 *         cdef xmlNode* c_next
 *         cdef _ReadOnlyProxy proxy
 *         cdef list results = [] # or maybe _collectAttributes(c_parent, 2) ?             # <<<<<<<<<<<<<<
 *         c_node = c_parent.children
 *         while c_node is not NULL:
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_results = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":115
 *         cdef _ReadOnlyProxy proxy
 *         cdef list results = [] # or maybe _collectAttributes(c_parent, 2) ?
 *         c_node = c_parent.children             # <<<<<<<<<<<<<<
 *         while c_node is not NULL:
 *             c_next = c_node.next
 */
  __pyx_v_c_node = __pyx_v_c_parent->children;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":116
 *         cdef list results = [] # or maybe _collectAttributes(c_parent, 2) ?
 *         c_node = c_parent.children
 *         while c_node is not NULL:             # <<<<<<<<<<<<<<
 *             c_next = c_node.next
 *             if c_node.type == tree.XML_TEXT_NODE:
 */
  while (1) {
    __pyx_t_2 = (__pyx_v_c_node != NULL);
    if (!__pyx_t_2) break;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":117
 *         c_node = c_parent.children
 *         while c_node is not NULL:
 *             c_next = c_node.next             # <<<<<<<<<<<<<<
 *             if c_node.type == tree.XML_TEXT_NODE:
 *                 results.append(funicode(c_node.content))
 */
    __pyx_v_c_next = __pyx_v_c_node->next;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":118
 *         while c_node is not NULL:
 *             c_next = c_node.next
 *             if c_node.type == tree.XML_TEXT_NODE:             # <<<<<<<<<<<<<<
 *                 results.append(funicode(c_node.content))
 *             elif c_node.type == tree.XML_ELEMENT_NODE:
 */
    __pyx_t_2 = (__pyx_v_c_node->type == XML_TEXT_NODE);
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":119
 *             c_next = c_node.next
 *             if c_node.type == tree.XML_TEXT_NODE:
 *                 results.append(funicode(c_node.content))             # <<<<<<<<<<<<<<
 *             elif c_node.type == tree.XML_ELEMENT_NODE:
 *                 proxy = _newReadOnlyProxy(
 */
      if (unlikely(__pyx_v_results == Py_None)) {
        PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[19]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
      }
      __pyx_t_1 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_node->content); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = PyList_Append(__pyx_v_results, __pyx_t_1); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L5;
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":120
 *             if c_node.type == tree.XML_TEXT_NODE:
 *                 results.append(funicode(c_node.content))
 *             elif c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *                 proxy = _newReadOnlyProxy(
 *                     context._extension_element_proxy, c_node)
 */
    __pyx_t_2 = (__pyx_v_c_node->type == XML_ELEMENT_NODE);
    if (__pyx_t_2) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":122
 *             elif c_node.type == tree.XML_ELEMENT_NODE:
 *                 proxy = _newReadOnlyProxy(
 *                     context._extension_element_proxy, c_node)             # <<<<<<<<<<<<<<
 *                 results.append(proxy)
 *                 # unlink node and make sure it will be freed later on
 */
      __pyx_t_1 = ((PyObject *)__pyx_v_context->_extension_element_proxy);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__newReadOnlyProxy(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_1), __pyx_v_c_node)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_v_proxy));
      __pyx_v_proxy = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":123
 *                 proxy = _newReadOnlyProxy(
 *                     context._extension_element_proxy, c_node)
 *                 results.append(proxy)             # <<<<<<<<<<<<<<
 *                 # unlink node and make sure it will be freed later on
 *                 tree.xmlUnlinkNode(c_node)
 */
      if (unlikely(__pyx_v_results == Py_None)) {
        PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[19]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
      }
      __pyx_t_3 = PyList_Append(__pyx_v_results, ((PyObject *)__pyx_v_proxy)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":125
 *                 results.append(proxy)
 *                 # unlink node and make sure it will be freed later on
 *                 tree.xmlUnlinkNode(c_node)             # <<<<<<<<<<<<<<
 *                 proxy.free_after_use()
 *             else:
 */
      xmlUnlinkNode(__pyx_v_c_node);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":126
 *                 # unlink node and make sure it will be freed later on
 *                 tree.xmlUnlinkNode(c_node)
 *                 proxy.free_after_use()             # <<<<<<<<<<<<<<
 *             else:
 *                 raise TypeError, \
 */
      ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)__pyx_v_proxy->__pyx_vtab)->free_after_use(__pyx_v_proxy);
      goto __pyx_L5;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":129
 *             else:
 *                 raise TypeError, \
 *                     u"unsupported XSLT result type: %d" % c_node.type             # <<<<<<<<<<<<<<
 *             c_node = c_next
 *         return results
 */
      __pyx_t_4 = PyInt_FromLong(__pyx_v_c_node->type); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_384), __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_1), 0);
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
      {__pyx_filename = __pyx_f[19]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_L5:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":130
 *                 raise TypeError, \
 *                     u"unsupported XSLT result type: %d" % c_node.type
 *             c_node = c_next             # <<<<<<<<<<<<<<
 *         return results
 * 
 */
    __pyx_v_c_node = __pyx_v_c_next;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":131
 *                     u"unsupported XSLT result type: %d" % c_node.type
 *             c_node = c_next
 *         return results             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_results));
  __pyx_r = ((PyObject *)__pyx_v_results);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.XSLTExtension._collectXSLTResultContent");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_proxy);
  __Pyx_XDECREF(__pyx_v_results);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":134
 * 
 * 
 * cdef _registerXSLTExtensions(xslt.xsltTransformContext* c_ctxt,             # <<<<<<<<<<<<<<
 *                              extension_dict):
 *     for ns_utf, name_utf in extension_dict:
 */

static  PyObject *__pyx_f_4lxml_5etree__registerXSLTExtensions(xsltTransformContext *__pyx_v_c_ctxt, PyObject *__pyx_v_extension_dict) {
  PyObject *__pyx_v_ns_utf;
  PyObject *__pyx_v_name_utf;
  PyObject *__pyx_r = NULL;
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("_registerXSLTExtensions");
  __pyx_v_ns_utf = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_name_utf = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":136
 * cdef _registerXSLTExtensions(xslt.xsltTransformContext* c_ctxt,
 *                              extension_dict):
 *     for ns_utf, name_utf in extension_dict:             # <<<<<<<<<<<<<<
 *         xslt.xsltRegisterExtElement(
 *             c_ctxt, _cstr(name_utf), _cstr(ns_utf), _callExtensionElement)
 */
  if (PyList_CheckExact(__pyx_v_extension_dict) || PyTuple_CheckExact(__pyx_v_extension_dict)) {
    __pyx_t_1 = 0; __pyx_t_2 = __pyx_v_extension_dict; __Pyx_INCREF(__pyx_t_2);
  } else {
    __pyx_t_1 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_extension_dict); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
  }
  for (;;) {
    if (likely(PyList_CheckExact(__pyx_t_2))) {
      if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++;
    } else if (likely(PyTuple_CheckExact(__pyx_t_2))) {
      if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++;
    } else {
      __pyx_t_3 = PyIter_Next(__pyx_t_2);
      if (!__pyx_t_3) {
        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    if (PyTuple_CheckExact(__pyx_t_3) && likely(PyTuple_GET_SIZE(__pyx_t_3) == 2)) {
      PyObject* tuple = __pyx_t_3;
      __pyx_t_4 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_4);
      __pyx_t_5 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_v_ns_utf);
      __pyx_v_ns_utf = __pyx_t_4;
      __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_v_name_utf);
      __pyx_v_name_utf = __pyx_t_5;
      __pyx_t_5 = 0;
    } else {
      __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_4 = __Pyx_UnpackItem(__pyx_t_6, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_UnpackItem(__pyx_t_6, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_EndUnpack(__pyx_t_6, 2) < 0) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_v_ns_utf);
      __pyx_v_ns_utf = __pyx_t_4;
      __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_v_name_utf);
      __pyx_v_name_utf = __pyx_t_5;
      __pyx_t_5 = 0;
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":138
 *     for ns_utf, name_utf in extension_dict:
 *         xslt.xsltRegisterExtElement(
 *             c_ctxt, _cstr(name_utf), _cstr(ns_utf), _callExtensionElement)             # <<<<<<<<<<<<<<
 * 
 * cdef void _callExtensionElement(xslt.xsltTransformContext* c_ctxt,
 */
    xsltRegisterExtElement(__pyx_v_c_ctxt, PyBytes_AS_STRING(__pyx_v_name_utf), PyBytes_AS_STRING(__pyx_v_ns_utf), __pyx_f_4lxml_5etree__callExtensionElement);
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._registerXSLTExtensions");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_ns_utf);
  __Pyx_DECREF(__pyx_v_name_utf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":140
 *             c_ctxt, _cstr(name_utf), _cstr(ns_utf), _callExtensionElement)
 * 
 * cdef void _callExtensionElement(xslt.xsltTransformContext* c_ctxt,             # <<<<<<<<<<<<<<
 *                                 xmlNode* c_context_node,
 *                                 xmlNode* c_inst_node,
 */

static  void __pyx_f_4lxml_5etree__callExtensionElement(xsltTransformContext *__pyx_v_c_ctxt, xmlNode *__pyx_v_c_context_node, xmlNode *__pyx_v_c_inst_node, void *__pyx_v_dummy) {
  struct __pyx_obj_4lxml_5etree__XSLTContext *__pyx_v_context;
  struct __pyx_obj_4lxml_5etree_XSLTExtension *__pyx_v_extension;
  PyObject *__pyx_v_dict_result;
  char *__pyx_v_c_uri;
  xmlNode *__pyx_v_c_node;
  struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_context_node = 0;
  struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self_node = 0;
  PyObject *__pyx_v_output_parent;
  PyObject *__pyx_v_e;
  PyObject *__pyx_v_message;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  xmlElementType __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  char *__pyx_t_14;
  #ifdef WITH_THREAD
  PyGILState_STATE _save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_callExtensionElement");
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__XSLTContext *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_extension = ((struct __pyx_obj_4lxml_5etree_XSLTExtension *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_output_parent = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_e = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_message = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":149
 *     cdef char* c_uri
 *     cdef xmlNode* c_node
 *     cdef _ReadOnlyProxy context_node = None, self_node = None             # <<<<<<<<<<<<<<
 *     cdef object output_parent # not restricted to ro-nodes
 *     c_uri = _getNs(c_inst_node)
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_context_node = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)Py_None);
  __Pyx_INCREF(Py_None);
  __pyx_v_self_node = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":151
 *     cdef _ReadOnlyProxy context_node = None, self_node = None
 *     cdef object output_parent # not restricted to ro-nodes
 *     c_uri = _getNs(c_inst_node)             # <<<<<<<<<<<<<<
 *     if c_uri is NULL:
 *         # not allowed, and should never happen
 */
  __pyx_v_c_uri = _getNs(__pyx_v_c_inst_node);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":152
 *     cdef object output_parent # not restricted to ro-nodes
 *     c_uri = _getNs(c_inst_node)
 *     if c_uri is NULL:             # <<<<<<<<<<<<<<
 *         # not allowed, and should never happen
 *         return
 */
  __pyx_t_1 = (__pyx_v_c_uri == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":154
 *     if c_uri is NULL:
 *         # not allowed, and should never happen
 *         return             # <<<<<<<<<<<<<<
 *     if c_ctxt.xpathCtxt.userData is NULL:
 *         # just for safety, should never happen
 */
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":155
 *         # not allowed, and should never happen
 *         return
 *     if c_ctxt.xpathCtxt.userData is NULL:             # <<<<<<<<<<<<<<
 *         # just for safety, should never happen
 *         return
 */
  __pyx_t_1 = (__pyx_v_c_ctxt->xpathCtxt->userData == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":157
 *     if c_ctxt.xpathCtxt.userData is NULL:
 *         # just for safety, should never happen
 *         return             # <<<<<<<<<<<<<<
 *     context = <_XSLTContext>c_ctxt.xpathCtxt.userData
 *     try:
 */
    goto __pyx_L0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":158
 *         # just for safety, should never happen
 *         return
 *     context = <_XSLTContext>c_ctxt.xpathCtxt.userData             # <<<<<<<<<<<<<<
 *     try:
 *         try:
 */
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__XSLTContext *)__pyx_v_c_ctxt->xpathCtxt->userData)));
  __Pyx_DECREF(((PyObject *)__pyx_v_context));
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__XSLTContext *)__pyx_v_c_ctxt->xpathCtxt->userData);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":159
 *         return
 *     context = <_XSLTContext>c_ctxt.xpathCtxt.userData
 *     try:             # <<<<<<<<<<<<<<
 *         try:
 *             dict_result = python.PyDict_GetItem(
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":160
 *     context = <_XSLTContext>c_ctxt.xpathCtxt.userData
 *     try:
 *         try:             # <<<<<<<<<<<<<<
 *             dict_result = python.PyDict_GetItem(
 *                 context._extension_elements, (c_uri, c_inst_node.name))
 */
      {
        PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
        __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
        __Pyx_XGOTREF(__pyx_save_exc_type);
        __Pyx_XGOTREF(__pyx_save_exc_value);
        __Pyx_XGOTREF(__pyx_save_exc_tb);
        /*try:*/ {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":162
 *         try:
 *             dict_result = python.PyDict_GetItem(
 *                 context._extension_elements, (c_uri, c_inst_node.name))             # <<<<<<<<<<<<<<
 *             if dict_result is NULL:
 *                 raise KeyError, \
 */
          __pyx_t_2 = ((PyObject *)__pyx_v_context->_extension_elements);
          __Pyx_INCREF(__pyx_t_2);
          __pyx_t_3 = PyBytes_FromString(__pyx_v_c_uri); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
          __Pyx_GOTREF(((PyObject *)__pyx_t_3));
          __pyx_t_4 = PyBytes_FromString(__pyx_v_c_inst_node->name); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
          __Pyx_GOTREF(((PyObject *)__pyx_t_4));
          __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
          __Pyx_GOTREF(((PyObject *)__pyx_t_5));
          PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_3));
          __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
          PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_t_4));
          __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
          __pyx_t_3 = 0;
          __pyx_t_4 = 0;
          __pyx_v_dict_result = PyDict_GetItem(__pyx_t_2, ((PyObject *)__pyx_t_5));
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":163
 *             dict_result = python.PyDict_GetItem(
 *                 context._extension_elements, (c_uri, c_inst_node.name))
 *             if dict_result is NULL:             # <<<<<<<<<<<<<<
 *                 raise KeyError, \
 *                     u"extension element %s not found" % funicode(c_inst_node.name)
 */
          __pyx_t_1 = (__pyx_v_dict_result == NULL);
          if (__pyx_t_1) {

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":165
 *             if dict_result is NULL:
 *                 raise KeyError, \
 *                     u"extension element %s not found" % funicode(c_inst_node.name)             # <<<<<<<<<<<<<<
 *             extension = <object>dict_result
 * 
 */
            __pyx_t_5 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_inst_node->name); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
            __Pyx_GOTREF(__pyx_t_5);
            __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_385), __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
            __Pyx_GOTREF(((PyObject *)__pyx_t_2));
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            __Pyx_Raise(__pyx_builtin_KeyError, ((PyObject *)__pyx_t_2), 0);
            __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
            {__pyx_filename = __pyx_f[19]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
            goto __pyx_L21;
          }
          __pyx_L21:;

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":166
 *                 raise KeyError, \
 *                     u"extension element %s not found" % funicode(c_inst_node.name)
 *             extension = <object>dict_result             # <<<<<<<<<<<<<<
 * 
 *             try:
 */
          if (!(likely(((((PyObject *)__pyx_v_dict_result)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_dict_result), __pyx_ptype_4lxml_5etree_XSLTExtension))))) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
          __Pyx_INCREF(((PyObject *)__pyx_v_dict_result));
          __Pyx_DECREF(((PyObject *)__pyx_v_extension));
          __pyx_v_extension = ((struct __pyx_obj_4lxml_5etree_XSLTExtension *)((PyObject *)__pyx_v_dict_result));

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":168
 *             extension = <object>dict_result
 * 
 *             try:             # <<<<<<<<<<<<<<
 *                 # build the context proxy nodes
 *                 self_node = _newReadOnlyProxy(None, c_inst_node)
 */
          /*try:*/ {

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":170
 *             try:
 *                 # build the context proxy nodes
 *                 self_node = _newReadOnlyProxy(None, c_inst_node)             # <<<<<<<<<<<<<<
 *                 if _isElement(c_ctxt.insert):
 *                     output_parent = _newAppendOnlyProxy(self_node, c_ctxt.insert)
 */
            __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__newReadOnlyProxy(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)Py_None), __pyx_v_c_inst_node)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L25;}
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_DECREF(((PyObject *)__pyx_v_self_node));
            __pyx_v_self_node = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_2);
            __pyx_t_2 = 0;

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":171
 *                 # build the context proxy nodes
 *                 self_node = _newReadOnlyProxy(None, c_inst_node)
 *                 if _isElement(c_ctxt.insert):             # <<<<<<<<<<<<<<
 *                     output_parent = _newAppendOnlyProxy(self_node, c_ctxt.insert)
 *                 else:
 */
            __pyx_t_1 = _isElement(__pyx_v_c_ctxt->insert);
            if (__pyx_t_1) {

              /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":172
 *                 self_node = _newReadOnlyProxy(None, c_inst_node)
 *                 if _isElement(c_ctxt.insert):
 *                     output_parent = _newAppendOnlyProxy(self_node, c_ctxt.insert)             # <<<<<<<<<<<<<<
 *                 else:
 *                     # may be the document node or other stuff
 */
              __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__newAppendOnlyProxy(__pyx_v_self_node, __pyx_v_c_ctxt->insert)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L25;}
              __Pyx_GOTREF(__pyx_t_2);
              __Pyx_DECREF(__pyx_v_output_parent);
              __pyx_v_output_parent = __pyx_t_2;
              __pyx_t_2 = 0;
              goto __pyx_L27;
            }
            /*else*/ {

              /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":175
 *                 else:
 *                     # may be the document node or other stuff
 *                     output_parent = _newOpaqueAppendOnlyNodeWrapper(c_ctxt.insert)             # <<<<<<<<<<<<<<
 *                 if c_context_node.type in (tree.XML_DOCUMENT_NODE,
 *                                            tree.XML_HTML_DOCUMENT_NODE):
 */
              __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__newOpaqueAppendOnlyNodeWrapper(__pyx_v_c_ctxt->insert)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L25;}
              __Pyx_GOTREF(__pyx_t_2);
              __Pyx_DECREF(__pyx_v_output_parent);
              __pyx_v_output_parent = __pyx_t_2;
              __pyx_t_2 = 0;
            }
            __pyx_L27:;

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":176
 *                     # may be the document node or other stuff
 *                     output_parent = _newOpaqueAppendOnlyNodeWrapper(c_ctxt.insert)
 *                 if c_context_node.type in (tree.XML_DOCUMENT_NODE,             # <<<<<<<<<<<<<<
 *                                            tree.XML_HTML_DOCUMENT_NODE):
 *                     c_node = tree.xmlDocGetRootElement(<xmlDoc*>c_context_node)
 */
            __pyx_t_6 = __pyx_v_c_context_node->type;
            __pyx_t_1 = (__pyx_t_6 == XML_DOCUMENT_NODE);
            if (!__pyx_t_1) {

              /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":177
 *                     output_parent = _newOpaqueAppendOnlyNodeWrapper(c_ctxt.insert)
 *                 if c_context_node.type in (tree.XML_DOCUMENT_NODE,
 *                                            tree.XML_HTML_DOCUMENT_NODE):             # <<<<<<<<<<<<<<
 *                     c_node = tree.xmlDocGetRootElement(<xmlDoc*>c_context_node)
 *                     if c_node is not NULL:
 */
              __pyx_t_7 = (__pyx_t_6 == XML_HTML_DOCUMENT_NODE);
              __pyx_t_8 = __pyx_t_7;
            } else {
              __pyx_t_8 = __pyx_t_1;
            }
            __pyx_t_1 = __pyx_t_8;
            if (__pyx_t_1) {

              /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":178
 *                 if c_context_node.type in (tree.XML_DOCUMENT_NODE,
 *                                            tree.XML_HTML_DOCUMENT_NODE):
 *                     c_node = tree.xmlDocGetRootElement(<xmlDoc*>c_context_node)             # <<<<<<<<<<<<<<
 *                     if c_node is not NULL:
 *                         context_node = _newReadOnlyProxy(self_node, c_node)
 */
              __pyx_v_c_node = xmlDocGetRootElement(((xmlDoc *)__pyx_v_c_context_node));

              /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":179
 *                                            tree.XML_HTML_DOCUMENT_NODE):
 *                     c_node = tree.xmlDocGetRootElement(<xmlDoc*>c_context_node)
 *                     if c_node is not NULL:             # <<<<<<<<<<<<<<
 *                         context_node = _newReadOnlyProxy(self_node, c_node)
 *                     else:
 */
              __pyx_t_1 = (__pyx_v_c_node != NULL);
              if (__pyx_t_1) {

                /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":180
 *                     c_node = tree.xmlDocGetRootElement(<xmlDoc*>c_context_node)
 *                     if c_node is not NULL:
 *                         context_node = _newReadOnlyProxy(self_node, c_node)             # <<<<<<<<<<<<<<
 *                     else:
 *                         context_node = None
 */
                __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__newReadOnlyProxy(__pyx_v_self_node, __pyx_v_c_node)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L25;}
                __Pyx_GOTREF(__pyx_t_2);
                __Pyx_DECREF(((PyObject *)__pyx_v_context_node));
                __pyx_v_context_node = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_2);
                __pyx_t_2 = 0;
                goto __pyx_L29;
              }
              /*else*/ {

                /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":182
 *                         context_node = _newReadOnlyProxy(self_node, c_node)
 *                     else:
 *                         context_node = None             # <<<<<<<<<<<<<<
 *                 elif c_context_node.type in (tree.XML_ATTRIBUTE_NODE,
 *                                              tree.XML_TEXT_NODE,
 */
                __Pyx_INCREF(Py_None);
                __Pyx_DECREF(((PyObject *)__pyx_v_context_node));
                __pyx_v_context_node = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)Py_None);
              }
              __pyx_L29:;
              goto __pyx_L28;
            }

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":183
 *                     else:
 *                         context_node = None
 *                 elif c_context_node.type in (tree.XML_ATTRIBUTE_NODE,             # <<<<<<<<<<<<<<
 *                                              tree.XML_TEXT_NODE,
 *                                              tree.XML_CDATA_SECTION_NODE):
 */
            __pyx_t_6 = __pyx_v_c_context_node->type;
            __pyx_t_1 = (__pyx_t_6 == XML_ATTRIBUTE_NODE);
            if (!__pyx_t_1) {

              /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":184
 *                         context_node = None
 *                 elif c_context_node.type in (tree.XML_ATTRIBUTE_NODE,
 *                                              tree.XML_TEXT_NODE,             # <<<<<<<<<<<<<<
 *                                              tree.XML_CDATA_SECTION_NODE):
 *                     # this isn't easy to support using read-only
 */
              __pyx_t_8 = (__pyx_t_6 == XML_TEXT_NODE);
              __pyx_t_7 = __pyx_t_8;
            } else {
              __pyx_t_7 = __pyx_t_1;
            }
            if (!__pyx_t_7) {

              /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":185
 *                 elif c_context_node.type in (tree.XML_ATTRIBUTE_NODE,
 *                                              tree.XML_TEXT_NODE,
 *                                              tree.XML_CDATA_SECTION_NODE):             # <<<<<<<<<<<<<<
 *                     # this isn't easy to support using read-only
 *                     # nodes, as the smart-string factory must
 */
              __pyx_t_1 = (__pyx_t_6 == XML_CDATA_SECTION_NODE);
              __pyx_t_8 = __pyx_t_1;
            } else {
              __pyx_t_8 = __pyx_t_7;
            }
            __pyx_t_7 = __pyx_t_8;
            if (__pyx_t_7) {

              /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":189
 *                     # nodes, as the smart-string factory must
 *                     # instantiate the parent proxy somehow...
 *                     raise TypeError("Unsupported element type: %d" % c_context_node.type)             # <<<<<<<<<<<<<<
 *                 else:
 *                     context_node  = _newReadOnlyProxy(self_node, c_context_node)
 */
              __pyx_t_2 = PyInt_FromLong(__pyx_v_c_context_node->type); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L25;}
              __Pyx_GOTREF(__pyx_t_2);
              __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_133), __pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L25;}
              __Pyx_GOTREF(((PyObject *)__pyx_t_5));
              __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
              __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L25;}
              __Pyx_GOTREF(((PyObject *)__pyx_t_2));
              PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_5));
              __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
              __pyx_t_5 = 0;
              __pyx_t_5 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L25;}
              __Pyx_GOTREF(__pyx_t_5);
              __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
              __Pyx_Raise(__pyx_t_5, 0, 0);
              __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
              {__pyx_filename = __pyx_f[19]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L25;}
              goto __pyx_L28;
            }
            /*else*/ {

              /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":191
 *                     raise TypeError("Unsupported element type: %d" % c_context_node.type)
 *                 else:
 *                     context_node  = _newReadOnlyProxy(self_node, c_context_node)             # <<<<<<<<<<<<<<
 * 
 *                 # run the XSLT extension
 */
              __pyx_t_5 = ((PyObject *)__pyx_f_4lxml_5etree__newReadOnlyProxy(__pyx_v_self_node, __pyx_v_c_context_node)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L25;}
              __Pyx_GOTREF(__pyx_t_5);
              __Pyx_DECREF(((PyObject *)__pyx_v_context_node));
              __pyx_v_context_node = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_5);
              __pyx_t_5 = 0;
            }
            __pyx_L28:;

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":194
 * 
 *                 # run the XSLT extension
 *                 context._extension_element_proxy = self_node             # <<<<<<<<<<<<<<
 *                 extension.execute(context, self_node, context_node, output_parent)
 *             finally:
 */
            if (!(likely(((((PyObject *)__pyx_v_self_node)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_self_node), __pyx_ptype_4lxml_5etree__ReadOnlyElementProxy))))) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L25;}
            __Pyx_INCREF(((PyObject *)__pyx_v_self_node));
            __Pyx_GIVEREF(((PyObject *)__pyx_v_self_node));
            __Pyx_GOTREF(__pyx_v_context->_extension_element_proxy);
            __Pyx_DECREF(((PyObject *)__pyx_v_context->_extension_element_proxy));
            __pyx_v_context->_extension_element_proxy = ((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self_node);

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":195
 *                 # run the XSLT extension
 *                 context._extension_element_proxy = self_node
 *                 extension.execute(context, self_node, context_node, output_parent)             # <<<<<<<<<<<<<<
 *             finally:
 *                 context._extension_element_proxy = None
 */
            __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_extension), __pyx_n_s__execute); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L25;}
            __Pyx_GOTREF(__pyx_t_5);
            __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L25;}
            __Pyx_GOTREF(((PyObject *)__pyx_t_2));
            __Pyx_INCREF(((PyObject *)__pyx_v_context));
            PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_context));
            __Pyx_GIVEREF(((PyObject *)__pyx_v_context));
            __Pyx_INCREF(((PyObject *)__pyx_v_self_node));
            PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self_node));
            __Pyx_GIVEREF(((PyObject *)__pyx_v_self_node));
            __Pyx_INCREF(((PyObject *)__pyx_v_context_node));
            PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_v_context_node));
            __Pyx_GIVEREF(((PyObject *)__pyx_v_context_node));
            __Pyx_INCREF(__pyx_v_output_parent);
            PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_output_parent);
            __Pyx_GIVEREF(__pyx_v_output_parent);
            __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L25;}
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          }

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":197
 *                 extension.execute(context, self_node, context_node, output_parent)
 *             finally:
 *                 context._extension_element_proxy = None             # <<<<<<<<<<<<<<
 *                 if self_node is not None:
 *                     _freeReadOnlyProxies(self_node)
 */
          /*finally:*/ {
            int __pyx_why;
            PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
            int __pyx_exc_lineno;
            __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
            __pyx_why = 0; goto __pyx_L26;
            __pyx_L25: {
              __pyx_why = 4;
              __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
              __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
              __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
              __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
              __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
              __pyx_exc_lineno = __pyx_lineno;
              goto __pyx_L26;
            }
            __pyx_L26:;
            __Pyx_INCREF(Py_None);
            __Pyx_GIVEREF(Py_None);
            __Pyx_GOTREF(__pyx_v_context->_extension_element_proxy);
            __Pyx_DECREF(((PyObject *)__pyx_v_context->_extension_element_proxy));
            __pyx_v_context->_extension_element_proxy = ((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)Py_None);

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":198
 *             finally:
 *                 context._extension_element_proxy = None
 *                 if self_node is not None:             # <<<<<<<<<<<<<<
 *                     _freeReadOnlyProxies(self_node)
 *         except Exception, e:
 */
            __pyx_t_7 = (((PyObject *)__pyx_v_self_node) != Py_None);
            if (__pyx_t_7) {

              /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":199
 *                 context._extension_element_proxy = None
 *                 if self_node is not None:
 *                     _freeReadOnlyProxies(self_node)             # <<<<<<<<<<<<<<
 *         except Exception, e:
 *             try:
 */
              __pyx_t_4 = __pyx_f_4lxml_5etree__freeReadOnlyProxies(__pyx_v_self_node); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L30_error;}
              __Pyx_GOTREF(__pyx_t_4);
              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
              goto __pyx_L31;
            }
            __pyx_L31:;
            goto __pyx_L32;
            __pyx_L30_error:;
            if (__pyx_why == 4) {
              Py_XDECREF(__pyx_exc_type);
              Py_XDECREF(__pyx_exc_value);
              Py_XDECREF(__pyx_exc_tb);
            }
            goto __pyx_L13_error;
            __pyx_L32:;
            switch (__pyx_why) {
              case 4: {
                __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
                __pyx_lineno = __pyx_exc_lineno;
                __pyx_exc_type = 0;
                __pyx_exc_value = 0;
                __pyx_exc_tb = 0;
                goto __pyx_L13_error;
              }
            }
          }
        }
        __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
        __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
        __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
        goto __pyx_L20_try_end;
        __pyx_L13_error:;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":200
 *                 if self_node is not None:
 *                     _freeReadOnlyProxies(self_node)
 *         except Exception, e:             # <<<<<<<<<<<<<<
 *             try:
 *                 e = unicode(e).encode(u"UTF-8")
 */
        __pyx_t_9 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
        if (__pyx_t_9) {
          __Pyx_AddTraceback("lxml.etree._callExtensionElement");
          if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_2, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;}
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_v_e);
          __pyx_v_e = __pyx_t_2;

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":201
 *                     _freeReadOnlyProxies(self_node)
 *         except Exception, e:
 *             try:             # <<<<<<<<<<<<<<
 *                 e = unicode(e).encode(u"UTF-8")
 *             except:
 */
          {
            PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
            __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
            __Pyx_XGOTREF(__pyx_save_exc_type);
            __Pyx_XGOTREF(__pyx_save_exc_value);
            __Pyx_XGOTREF(__pyx_save_exc_tb);
            /*try:*/ {

              /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":202
 *         except Exception, e:
 *             try:
 *                 e = unicode(e).encode(u"UTF-8")             # <<<<<<<<<<<<<<
 *             except:
 *                 e = repr(e).encode(u"UTF-8")
 */
              __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L35_error;}
              __Pyx_GOTREF(((PyObject *)__pyx_t_3));
              __Pyx_INCREF(__pyx_v_e);
              PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_e);
              __Pyx_GIVEREF(__pyx_v_e);
              __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L35_error;}
              __Pyx_GOTREF(__pyx_t_10);
              __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
              __pyx_t_3 = ((PyObject *)PyUnicode_AsUTF8String(((PyObject*)__pyx_t_10))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L35_error;}
              __Pyx_GOTREF(((PyObject *)__pyx_t_3));
              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
              __Pyx_DECREF(__pyx_v_e);
              __pyx_v_e = ((PyObject *)__pyx_t_3);
              __pyx_t_3 = 0;
            }
            __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
            __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
            __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
            goto __pyx_L42_try_end;
            __pyx_L35_error:;
            __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
            __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

            /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":203
 *             try:
 *                 e = unicode(e).encode(u"UTF-8")
 *             except:             # <<<<<<<<<<<<<<
 *                 e = repr(e).encode(u"UTF-8")
 *             message = python.PyBytes_FromFormat(
 */
            /*except:*/ {
              __Pyx_AddTraceback("lxml.etree._callExtensionElement");
              if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_10, &__pyx_t_11) < 0) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L37_except_error;}
              __Pyx_GOTREF(__pyx_t_3);
              __Pyx_GOTREF(__pyx_t_10);
              __Pyx_GOTREF(__pyx_t_11);

              /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":204
 *                 e = unicode(e).encode(u"UTF-8")
 *             except:
 *                 e = repr(e).encode(u"UTF-8")             # <<<<<<<<<<<<<<
 *             message = python.PyBytes_FromFormat(
 *                 "Error executing extension element '%s': %s",
 */
              __pyx_t_12 = PyObject_Repr(__pyx_v_e); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L37_except_error;}
              __Pyx_GOTREF(__pyx_t_12);
              __pyx_t_13 = PyObject_GetAttr(__pyx_t_12, __pyx_n_s__encode); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L37_except_error;}
              __Pyx_GOTREF(__pyx_t_13);
              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
              __pyx_t_12 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_k_tuple_386), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L37_except_error;}
              __Pyx_GOTREF(__pyx_t_12);
              __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
              __Pyx_DECREF(__pyx_v_e);
              __pyx_v_e = __pyx_t_12;
              __pyx_t_12 = 0;
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
              goto __pyx_L36_exception_handled;
            }
            __pyx_L37_except_error:;
            __Pyx_XGIVEREF(__pyx_save_exc_type);
            __Pyx_XGIVEREF(__pyx_save_exc_value);
            __Pyx_XGIVEREF(__pyx_save_exc_tb);
            __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
            goto __pyx_L15_except_error;
            __pyx_L36_exception_handled:;
            __Pyx_XGIVEREF(__pyx_save_exc_type);
            __Pyx_XGIVEREF(__pyx_save_exc_value);
            __Pyx_XGIVEREF(__pyx_save_exc_tb);
            __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
            __pyx_L42_try_end:;
          }

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":207
 *             message = python.PyBytes_FromFormat(
 *                 "Error executing extension element '%s': %s",
 *                 c_inst_node.name, _cstr(e))             # <<<<<<<<<<<<<<
 *             xslt.xsltTransformError(c_ctxt, NULL, c_inst_node, message)
 *             context._exc._store_raised()
 */
          __pyx_t_11 = ((PyObject *)PyBytes_FromFormat(__pyx_k_387, __pyx_v_c_inst_node->name, PyBytes_AS_STRING(__pyx_v_e))); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;}
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF(((PyObject *)__pyx_v_message));
          __pyx_v_message = ((PyObject*)__pyx_t_11);
          __pyx_t_11 = 0;

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":208
 *                 "Error executing extension element '%s': %s",
 *                 c_inst_node.name, _cstr(e))
 *             xslt.xsltTransformError(c_ctxt, NULL, c_inst_node, message)             # <<<<<<<<<<<<<<
 *             context._exc._store_raised()
 *         except:
 */
          __pyx_t_14 = PyBytes_AsString(((PyObject *)__pyx_v_message)); if (unlikely((!__pyx_t_14) && PyErr_Occurred())) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;}
          xsltTransformError(__pyx_v_c_ctxt, NULL, __pyx_v_c_inst_node, __pyx_t_14);

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":209
 *                 c_inst_node.name, _cstr(e))
 *             xslt.xsltTransformError(c_ctxt, NULL, c_inst_node, message)
 *             context._exc._store_raised()             # <<<<<<<<<<<<<<
 *         except:
 *             # just in case
 */
          ((struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext *)__pyx_v_context->__pyx_base._exc->__pyx_vtab)->_store_raised(__pyx_v_context->__pyx_base._exc);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          goto __pyx_L14_exception_handled;
        }

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":210
 *             xslt.xsltTransformError(c_ctxt, NULL, c_inst_node, message)
 *             context._exc._store_raised()
 *         except:             # <<<<<<<<<<<<<<
 *             # just in case
 *             message = python.PyBytes_FromFormat(
 */
        /*except:*/ {
          __Pyx_AddTraceback("lxml.etree._callExtensionElement");
          if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_2, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;}
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GOTREF(__pyx_t_4);

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":213
 *             # just in case
 *             message = python.PyBytes_FromFormat(
 *                 "Error executing extension element '%s'", c_inst_node.name)             # <<<<<<<<<<<<<<
 *             xslt.xsltTransformError(c_ctxt, NULL, c_inst_node, message)
 *             context._exc._store_raised()
 */
          __pyx_t_11 = ((PyObject *)PyBytes_FromFormat(__pyx_k_388, __pyx_v_c_inst_node->name)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;}
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF(((PyObject *)__pyx_v_message));
          __pyx_v_message = ((PyObject*)__pyx_t_11);
          __pyx_t_11 = 0;

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":214
 *             message = python.PyBytes_FromFormat(
 *                 "Error executing extension element '%s'", c_inst_node.name)
 *             xslt.xsltTransformError(c_ctxt, NULL, c_inst_node, message)             # <<<<<<<<<<<<<<
 *             context._exc._store_raised()
 *     except:
 */
          __pyx_t_14 = PyBytes_AsString(((PyObject *)__pyx_v_message)); if (unlikely((!__pyx_t_14) && PyErr_Occurred())) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;}
          xsltTransformError(__pyx_v_c_ctxt, NULL, __pyx_v_c_inst_node, __pyx_t_14);

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":215
 *                 "Error executing extension element '%s'", c_inst_node.name)
 *             xslt.xsltTransformError(c_ctxt, NULL, c_inst_node, message)
 *             context._exc._store_raised()             # <<<<<<<<<<<<<<
 *     except:
 *         # no Python functions here - everything can fail...
 */
          ((struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext *)__pyx_v_context->__pyx_base._exc->__pyx_vtab)->_store_raised(__pyx_v_context->__pyx_base._exc);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          goto __pyx_L14_exception_handled;
        }
        __pyx_L15_except_error:;
        __Pyx_XGIVEREF(__pyx_save_exc_type);
        __Pyx_XGIVEREF(__pyx_save_exc_value);
        __Pyx_XGIVEREF(__pyx_save_exc_tb);
        __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
        goto __pyx_L5_error;
        __pyx_L14_exception_handled:;
        __Pyx_XGIVEREF(__pyx_save_exc_type);
        __Pyx_XGIVEREF(__pyx_save_exc_value);
        __Pyx_XGIVEREF(__pyx_save_exc_tb);
        __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
        __pyx_L20_try_end:;
      }
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L12_try_end;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":216
 *             xslt.xsltTransformError(c_ctxt, NULL, c_inst_node, message)
 *             context._exc._store_raised()
 *     except:             # <<<<<<<<<<<<<<
 *         # no Python functions here - everything can fail...
 *         xslt.xsltTransformError(c_ctxt, NULL, c_inst_node,
 */
    /*except:*/ {
      __Pyx_AddTraceback("lxml.etree._callExtensionElement");
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_2, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_5);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":218
 *     except:
 *         # no Python functions here - everything can fail...
 *         xslt.xsltTransformError(c_ctxt, NULL, c_inst_node,             # <<<<<<<<<<<<<<
 *                                 "Error during XSLT extension element evaluation")
 *         context._exc._store_raised()
 */
      xsltTransformError(__pyx_v_c_ctxt, NULL, __pyx_v_c_inst_node, __pyx_k_389);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":220
 *         xslt.xsltTransformError(c_ctxt, NULL, c_inst_node,
 *                                 "Error during XSLT extension element evaluation")
 *         context._exc._store_raised()             # <<<<<<<<<<<<<<
 */
      ((struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext *)__pyx_v_context->__pyx_base._exc->__pyx_vtab)->_store_raised(__pyx_v_context->__pyx_base._exc);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L6_exception_handled;
    }
    __pyx_L7_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L6_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L12_try_end:;
  }

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_WriteUnraisable("lxml.etree._callExtensionElement");
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_context);
  __Pyx_DECREF((PyObject *)__pyx_v_extension);
  __Pyx_XDECREF((PyObject *)__pyx_v_context_node);
  __Pyx_XDECREF((PyObject *)__pyx_v_self_node);
  __Pyx_DECREF(__pyx_v_output_parent);
  __Pyx_DECREF(__pyx_v_e);
  __Pyx_DECREF(__pyx_v_message);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(_save);
  #endif
}

/* "src/lxml/lxml.etree.pyx":2988
 *     u"Base class for XML validators."
 *     cdef _ErrorLog _error_log
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._error_log = _ErrorLog()
 * 
 */

static int __pyx_pf_4lxml_5etree_10_Validator___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_10_Validator___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__cinit__");
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;

  /* "src/lxml/lxml.etree.pyx":2989
 *     cdef _ErrorLog _error_log
 *     def __cinit__(self):
 *         self._error_log = _ErrorLog()             # <<<<<<<<<<<<<<
 * 
 *     def validate(self, etree):
 */
  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ErrorLog)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree__Validator *)__pyx_v_self)->_error_log);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__Validator *)__pyx_v_self)->_error_log));
  ((struct __pyx_obj_4lxml_5etree__Validator *)__pyx_v_self)->_error_log = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_t_1);
  __pyx_t_1 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._Validator.__cinit__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":2991
 *         self._error_log = _ErrorLog()
 * 
 *     def validate(self, etree):             # <<<<<<<<<<<<<<
 *         u"""validate(self, etree)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_10_Validator_1validate(PyObject *__pyx_v_self, PyObject *__pyx_v_etree); /*proto*/
static char __pyx_doc_4lxml_5etree_10_Validator_1validate[] = "validate(self, etree)\n\n        Validate the document using this schema.\n\n        Returns true if document is valid, false if not.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_10_Validator_1validate(PyObject *__pyx_v_self, PyObject *__pyx_v_etree) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("validate");

  /* "src/lxml/lxml.etree.pyx":2998
 *         Returns true if document is valid, false if not.
 *         """
 *         return self(etree)             # <<<<<<<<<<<<<<
 * 
 *     def assertValid(self, etree):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_etree);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_etree);
  __Pyx_GIVEREF(__pyx_v_etree);
  __pyx_t_2 = PyObject_Call(__pyx_v_self, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Validator.validate");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":3000
 *         return self(etree)
 * 
 *     def assertValid(self, etree):             # <<<<<<<<<<<<<<
 *         u"""assertValid(self, etree)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_10_Validator_2assertValid(PyObject *__pyx_v_self, PyObject *__pyx_v_etree); /*proto*/
static char __pyx_doc_4lxml_5etree_10_Validator_2assertValid[] = "assertValid(self, etree)\n\n        Raises `DocumentInvalid` if the document does not comply with the schema.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_10_Validator_2assertValid(PyObject *__pyx_v_self, PyObject *__pyx_v_etree) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("assertValid");

  /* "src/lxml/lxml.etree.pyx":3005
 *         Raises `DocumentInvalid` if the document does not comply with the schema.
 *         """
 *         if not self(etree):             # <<<<<<<<<<<<<<
 *             raise DocumentInvalid(self._error_log._buildExceptionMessage(
 *                     u"Document does not comply with schema"),
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3005; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_etree);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_etree);
  __Pyx_GIVEREF(__pyx_v_etree);
  __pyx_t_2 = PyObject_Call(__pyx_v_self, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3005; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3005; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = (!__pyx_t_3);
  if (__pyx_t_4) {

    /* "src/lxml/lxml.etree.pyx":3006
 *         """
 *         if not self(etree):
 *             raise DocumentInvalid(self._error_log._buildExceptionMessage(             # <<<<<<<<<<<<<<
 *                     u"Document does not comply with schema"),
 *                                   self._error_log)
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__DocumentInvalid); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)((struct __pyx_obj_4lxml_5etree__Validator *)__pyx_v_self)->_error_log->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._buildExceptionMessage(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)((struct __pyx_obj_4lxml_5etree__Validator *)__pyx_v_self)->_error_log), ((PyObject *)__pyx_kp_u_390)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);

    /* "src/lxml/lxml.etree.pyx":3008
 *             raise DocumentInvalid(self._error_log._buildExceptionMessage(
 *                     u"Document does not comply with schema"),
 *                                   self._error_log)             # <<<<<<<<<<<<<<
 * 
 *     def assert_(self, etree):
 */
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__Validator *)__pyx_v_self)->_error_log));
    PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)((struct __pyx_obj_4lxml_5etree__Validator *)__pyx_v_self)->_error_log));
    __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__Validator *)__pyx_v_self)->_error_log));
    __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __Pyx_Raise(__pyx_t_1, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._Validator.assertValid");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":3010
 *                                   self._error_log)
 * 
 *     def assert_(self, etree):             # <<<<<<<<<<<<<<
 *         u"""assert_(self, etree)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_10_Validator_3assert_(PyObject *__pyx_v_self, PyObject *__pyx_v_etree); /*proto*/
static char __pyx_doc_4lxml_5etree_10_Validator_3assert_[] = "assert_(self, etree)\n\n        Raises `AssertionError` if the document does not comply with the schema.\n        ";
static PyObject *__pyx_pf_4lxml_5etree_10_Validator_3assert_(PyObject *__pyx_v_self, PyObject *__pyx_v_etree) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("assert_");

  /* "src/lxml/lxml.etree.pyx":3015
 *         Raises `AssertionError` if the document does not comply with the schema.
 *         """
 *         if not self(etree):             # <<<<<<<<<<<<<<
 *             raise AssertionError, self._error_log._buildExceptionMessage(
 *                 u"Document does not comply with schema")
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3015; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_etree);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_etree);
  __Pyx_GIVEREF(__pyx_v_etree);
  __pyx_t_2 = PyObject_Call(__pyx_v_self, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3015; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3015; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = (!__pyx_t_3);
  if (__pyx_t_4) {

    /* "src/lxml/lxml.etree.pyx":3016
 *         """
 *         if not self(etree):
 *             raise AssertionError, self._error_log._buildExceptionMessage(             # <<<<<<<<<<<<<<
 *                 u"Document does not comply with schema")
 * 
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)((struct __pyx_obj_4lxml_5etree__Validator *)__pyx_v_self)->_error_log->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._buildExceptionMessage(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)((struct __pyx_obj_4lxml_5etree__Validator *)__pyx_v_self)->_error_log), ((PyObject *)__pyx_kp_u_390)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_builtin_AssertionError, __pyx_t_2, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Validator.assert_");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":3019
 *                 u"Document does not comply with schema")
 * 
 *     cpdef _append_log_message(self, int domain, int type, int level, int line,             # <<<<<<<<<<<<<<
 *                               message, filename):
 *         self._error_log._receiveGeneric(domain, type, level, line, message,
 */

static PyObject *__pyx_pf_4lxml_5etree_10_Validator_4_append_log_message(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static  PyObject *__pyx_f_4lxml_5etree_10_Validator__append_log_message(struct __pyx_obj_4lxml_5etree__Validator *__pyx_v_self, int __pyx_v_domain, int __pyx_v_type, int __pyx_v_level, int __pyx_v_line, PyObject *__pyx_v_message, PyObject *__pyx_v_filename, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("_append_log_message");
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___append_log_message); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3019; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_4lxml_5etree_10_Validator_4_append_log_message)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyInt_FromLong(__pyx_v_domain); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3019; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyInt_FromLong(__pyx_v_type); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3019; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyInt_FromLong(__pyx_v_level); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3019; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyInt_FromLong(__pyx_v_line); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3019; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyTuple_New(6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3019; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_v_message);
      PyTuple_SET_ITEM(__pyx_t_6, 4, __pyx_v_message);
      __Pyx_GIVEREF(__pyx_v_message);
      __Pyx_INCREF(__pyx_v_filename);
      PyTuple_SET_ITEM(__pyx_t_6, 5, __pyx_v_filename);
      __Pyx_GIVEREF(__pyx_v_filename);
      __pyx_t_2 = 0;
      __pyx_t_3 = 0;
      __pyx_t_4 = 0;
      __pyx_t_5 = 0;
      __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3019; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "src/lxml/lxml.etree.pyx":3022
 *                               message, filename):
 *         self._error_log._receiveGeneric(domain, type, level, line, message,
 *                                         filename)             # <<<<<<<<<<<<<<
 * 
 *     cpdef _clear_error_log(self):
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)__pyx_v_self->_error_log->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._receiveGeneric(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self->_error_log), __pyx_v_domain, __pyx_v_type, __pyx_v_level, __pyx_v_line, __pyx_v_message, __pyx_v_filename);

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._Validator._append_log_message");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":3019
 *                 u"Document does not comply with schema")
 * 
 *     cpdef _append_log_message(self, int domain, int type, int level, int line,             # <<<<<<<<<<<<<<
 *                               message, filename):
 *         self._error_log._receiveGeneric(domain, type, level, line, message,
 */

static PyObject *__pyx_pf_4lxml_5etree_10_Validator_4_append_log_message(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_10_Validator_4_append_log_message(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_domain;
  int __pyx_v_type;
  int __pyx_v_level;
  int __pyx_v_line;
  PyObject *__pyx_v_message = 0;
  PyObject *__pyx_v_filename = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__domain,&__pyx_n_s__type,&__pyx_n_s__level,&__pyx_n_s__line,&__pyx_n_s__message,&__pyx_n_s__filename,0};
  __Pyx_RefNannySetupContext("_append_log_message");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[6] = {0,0,0,0,0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__domain);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__type);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("_append_log_message", 1, 6, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3019; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__level);
      if (likely(values[2])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("_append_log_message", 1, 6, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3019; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  3:
      values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__line);
      if (likely(values[3])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("_append_log_message", 1, 6, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3019; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  4:
      values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__message);
      if (likely(values[4])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("_append_log_message", 1, 6, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3019; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  5:
      values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename);
      if (likely(values[5])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("_append_log_message", 1, 6, 6, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3019; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_append_log_message") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3019; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_domain = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_domain == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3019; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_type = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3019; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_level = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_level == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3019; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_line = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_line == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3019; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_message = values[4];
    __pyx_v_filename = values[5];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_domain = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_domain == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3019; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_type = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3019; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_level = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_level == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3019; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_line = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_line == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3019; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_message = PyTuple_GET_ITEM(__pyx_args, 4);
    __pyx_v_filename = PyTuple_GET_ITEM(__pyx_args, 5);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_append_log_message", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3019; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._Validator._append_log_message");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__Validator *)((struct __pyx_obj_4lxml_5etree__Validator *)__pyx_v_self)->__pyx_vtab)->_append_log_message(((struct __pyx_obj_4lxml_5etree__Validator *)__pyx_v_self), __pyx_v_domain, __pyx_v_type, __pyx_v_level, __pyx_v_line, __pyx_v_message, __pyx_v_filename, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3019; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._Validator._append_log_message");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":3024
 *                                         filename)
 * 
 *     cpdef _clear_error_log(self):             # <<<<<<<<<<<<<<
 *         self._error_log.clear()
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_10_Validator_5_clear_error_log(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static  PyObject *__pyx_f_4lxml_5etree_10_Validator__clear_error_log(struct __pyx_obj_4lxml_5etree__Validator *__pyx_v_self, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_clear_error_log");
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___clear_error_log); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_4lxml_5etree_10_Validator_5_clear_error_log)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "src/lxml/lxml.etree.pyx":3025
 * 
 *     cpdef _clear_error_log(self):
 *         self._error_log.clear()             # <<<<<<<<<<<<<<
 * 
 *     property error_log:
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self->_error_log), __pyx_n_s__clear); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Validator._clear_error_log");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":3024
 *                                         filename)
 * 
 *     cpdef _clear_error_log(self):             # <<<<<<<<<<<<<<
 *         self._error_log.clear()
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_10_Validator_5_clear_error_log(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_10_Validator_5_clear_error_log(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("_clear_error_log");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__Validator *)((struct __pyx_obj_4lxml_5etree__Validator *)__pyx_v_self)->__pyx_vtab)->_clear_error_log(((struct __pyx_obj_4lxml_5etree__Validator *)__pyx_v_self), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._Validator._clear_error_log");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "src/lxml/lxml.etree.pyx":3029
 *     property error_log:
 *         u"The log of validation errors and warnings."
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             assert self._error_log is not None, "XPath evaluator not initialised"
 *             return self._error_log.copy()
 */

static PyObject *__pyx_pf_4lxml_5etree_10_Validator_9error_log___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_4lxml_5etree_10_Validator_9error_log___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__get__");

  /* "src/lxml/lxml.etree.pyx":3030
 *         u"The log of validation errors and warnings."
 *         def __get__(self):
 *             assert self._error_log is not None, "XPath evaluator not initialised"             # <<<<<<<<<<<<<<
 *             return self._error_log.copy()
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  __pyx_t_1 = (((PyObject *)((struct __pyx_obj_4lxml_5etree__Validator *)__pyx_v_self)->_error_log) != Py_None);
  if (unlikely(!__pyx_t_1)) {
    PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_293));
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3030; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif

  /* "src/lxml/lxml.etree.pyx":3031
 *         def __get__(self):
 *             assert self._error_log is not None, "XPath evaluator not initialised"
 *             return self._error_log.copy()             # <<<<<<<<<<<<<<
 * 
 * include "dtd.pxi"        # DTD
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_4lxml_5etree__Validator *)__pyx_v_self)->_error_log), __pyx_n_s__copy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Validator.error_log.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":31
 *     """
 *     cdef tree.xmlDtd* _c_dtd
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._c_dtd = NULL
 * 
 */

static int __pyx_pf_4lxml_5etree_3DTD___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_3DTD___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("__cinit__");
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":32
 *     cdef tree.xmlDtd* _c_dtd
 *     def __cinit__(self):
 *         self._c_dtd = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, file=None, *, external_id=None):
 */
  ((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_v_self)->_c_dtd = NULL;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":34
 *         self._c_dtd = NULL
 * 
 *     def __init__(self, file=None, *, external_id=None):             # <<<<<<<<<<<<<<
 *         _Validator.__init__(self)
 *         if file is not None:
 */

static int __pyx_pf_4lxml_5etree_3DTD_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_3DTD_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_file = 0;
  PyObject *__pyx_v_external_id = 0;
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  xmlDtd *__pyx_t_5;
  char *__pyx_t_6;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__file,&__pyx_n_s__external_id,0};
  __Pyx_RefNannySetupContext("__init__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__file);
        if (value) { values[0] = value; kw_args--; }
      }
    }
    while (kw_args > 0) {
      PyObject* value;
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__external_id);
      if (value) { values[1] = value; if (!(--kw_args)) break; }
      break;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_file = values[0];
    __pyx_v_external_id = values[1];
  } else {
    __pyx_v_file = ((PyObject *)Py_None);
    __pyx_v_external_id = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: __pyx_v_file = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[20]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.DTD.__init__");
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF(__pyx_v_file);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":35
 * 
 *     def __init__(self, file=None, *, external_id=None):
 *         _Validator.__init__(self)             # <<<<<<<<<<<<<<
 *         if file is not None:
 *             if _isString(file):
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Validator)), __pyx_n_s____init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":36
 *     def __init__(self, file=None, *, external_id=None):
 *         _Validator.__init__(self)
 *         if file is not None:             # <<<<<<<<<<<<<<
 *             if _isString(file):
 *                 file = _encodeFilename(file)
 */
  __pyx_t_4 = (__pyx_v_file != Py_None);
  if (__pyx_t_4) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":37
 *         _Validator.__init__(self)
 *         if file is not None:
 *             if _isString(file):             # <<<<<<<<<<<<<<
 *                 file = _encodeFilename(file)
 *                 self._error_log.connect()
 */
    __pyx_t_4 = _isString(__pyx_v_file);
    if (__pyx_t_4) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":38
 *         if file is not None:
 *             if _isString(file):
 *                 file = _encodeFilename(file)             # <<<<<<<<<<<<<<
 *                 self._error_log.connect()
 *                 self._c_dtd = xmlparser.xmlParseDTD(NULL, _cstr(file))
 */
      __pyx_t_3 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_file); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_v_file);
      __pyx_v_file = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":39
 *             if _isString(file):
 *                 file = _encodeFilename(file)
 *                 self._error_log.connect()             # <<<<<<<<<<<<<<
 *                 self._c_dtd = xmlparser.xmlParseDTD(NULL, _cstr(file))
 *                 self._error_log.disconnect()
 */
      ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_v_self)->__pyx_base._error_log->__pyx_base.__pyx_base.__pyx_vtab)->connect(((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_v_self)->__pyx_base._error_log);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":40
 *                 file = _encodeFilename(file)
 *                 self._error_log.connect()
 *                 self._c_dtd = xmlparser.xmlParseDTD(NULL, _cstr(file))             # <<<<<<<<<<<<<<
 *                 self._error_log.disconnect()
 *             elif hasattr(file, u'read'):
 */
      ((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_v_self)->_c_dtd = xmlParseDTD(NULL, PyBytes_AS_STRING(__pyx_v_file));

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":41
 *                 self._error_log.connect()
 *                 self._c_dtd = xmlparser.xmlParseDTD(NULL, _cstr(file))
 *                 self._error_log.disconnect()             # <<<<<<<<<<<<<<
 *             elif hasattr(file, u'read'):
 *                 self._c_dtd = _parseDtdFromFilelike(file)
 */
      ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_v_self)->__pyx_base._error_log->__pyx_base.__pyx_base.__pyx_vtab)->disconnect(((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_v_self)->__pyx_base._error_log);
      goto __pyx_L7;
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":42
 *                 self._c_dtd = xmlparser.xmlParseDTD(NULL, _cstr(file))
 *                 self._error_log.disconnect()
 *             elif hasattr(file, u'read'):             # <<<<<<<<<<<<<<
 *                 self._c_dtd = _parseDtdFromFilelike(file)
 *             else:
 */
    __pyx_t_4 = PyObject_HasAttr(__pyx_v_file, ((PyObject *)__pyx_n_u__read)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_4) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":43
 *                 self._error_log.disconnect()
 *             elif hasattr(file, u'read'):
 *                 self._c_dtd = _parseDtdFromFilelike(file)             # <<<<<<<<<<<<<<
 *             else:
 *                 raise DTDParseError, u"file must be a filename or file-like object"
 */
      __pyx_t_5 = __pyx_f_4lxml_5etree__parseDtdFromFilelike(__pyx_v_file); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      ((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_v_self)->_c_dtd = __pyx_t_5;
      goto __pyx_L7;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":45
 *                 self._c_dtd = _parseDtdFromFilelike(file)
 *             else:
 *                 raise DTDParseError, u"file must be a filename or file-like object"             # <<<<<<<<<<<<<<
 *         elif external_id is not None:
 *             self._error_log.connect()
 */
      __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTDParseError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_Raise(__pyx_t_3, ((PyObject *)__pyx_kp_u_391), 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      {__pyx_filename = __pyx_f[20]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_L7:;
    goto __pyx_L6;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":46
 *             else:
 *                 raise DTDParseError, u"file must be a filename or file-like object"
 *         elif external_id is not None:             # <<<<<<<<<<<<<<
 *             self._error_log.connect()
 *             self._c_dtd = xmlparser.xmlParseDTD(external_id, NULL)
 */
  __pyx_t_4 = (__pyx_v_external_id != Py_None);
  if (__pyx_t_4) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":47
 *                 raise DTDParseError, u"file must be a filename or file-like object"
 *         elif external_id is not None:
 *             self._error_log.connect()             # <<<<<<<<<<<<<<
 *             self._c_dtd = xmlparser.xmlParseDTD(external_id, NULL)
 *             self._error_log.disconnect()
 */
    ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_v_self)->__pyx_base._error_log->__pyx_base.__pyx_base.__pyx_vtab)->connect(((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_v_self)->__pyx_base._error_log);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":48
 *         elif external_id is not None:
 *             self._error_log.connect()
 *             self._c_dtd = xmlparser.xmlParseDTD(external_id, NULL)             # <<<<<<<<<<<<<<
 *             self._error_log.disconnect()
 *         else:
 */
    __pyx_t_6 = PyBytes_AsString(__pyx_v_external_id); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    ((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_v_self)->_c_dtd = xmlParseDTD(__pyx_t_6, NULL);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":49
 *             self._error_log.connect()
 *             self._c_dtd = xmlparser.xmlParseDTD(external_id, NULL)
 *             self._error_log.disconnect()             # <<<<<<<<<<<<<<
 *         else:
 *             raise DTDParseError, u"either filename or external ID required"
 */
    ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_v_self)->__pyx_base._error_log->__pyx_base.__pyx_base.__pyx_vtab)->disconnect(((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_v_self)->__pyx_base._error_log);
    goto __pyx_L6;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":51
 *             self._error_log.disconnect()
 *         else:
 *             raise DTDParseError, u"either filename or external ID required"             # <<<<<<<<<<<<<<
 * 
 *         if self._c_dtd is NULL:
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTDParseError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, ((PyObject *)__pyx_kp_u_392), 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[20]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":53
 *             raise DTDParseError, u"either filename or external ID required"
 * 
 *         if self._c_dtd is NULL:             # <<<<<<<<<<<<<<
 *             raise DTDParseError(
 *                 self._error_log._buildExceptionMessage(u"error parsing DTD"),
 */
  __pyx_t_4 = (((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_v_self)->_c_dtd == NULL);
  if (__pyx_t_4) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":54
 * 
 *         if self._c_dtd is NULL:
 *             raise DTDParseError(             # <<<<<<<<<<<<<<
 *                 self._error_log._buildExceptionMessage(u"error parsing DTD"),
 *                 self._error_log)
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTDParseError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":55
 *         if self._c_dtd is NULL:
 *             raise DTDParseError(
 *                 self._error_log._buildExceptionMessage(u"error parsing DTD"),             # <<<<<<<<<<<<<<
 *                 self._error_log)
 * 
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_v_self)->__pyx_base._error_log->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._buildExceptionMessage(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_v_self)->__pyx_base._error_log), ((PyObject *)__pyx_kp_u_393)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":56
 *             raise DTDParseError(
 *                 self._error_log._buildExceptionMessage(u"error parsing DTD"),
 *                 self._error_log)             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_v_self)->__pyx_base._error_log));
    PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_v_self)->__pyx_base._error_log));
    __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_v_self)->__pyx_base._error_log));
    __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[20]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L8;
  }
  __pyx_L8:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.DTD.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_file);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":58
 *                 self._error_log)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         tree.xmlFreeDtd(self._c_dtd)
 * 
 */

static void __pyx_pf_4lxml_5etree_3DTD_2__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pf_4lxml_5etree_3DTD_2__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannySetupContext("__dealloc__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":59
 * 
 *     def __dealloc__(self):
 *         tree.xmlFreeDtd(self._c_dtd)             # <<<<<<<<<<<<<<
 * 
 *     def __call__(self, etree):
 */
  xmlFreeDtd(((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_v_self)->_c_dtd);

  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":61
 *         tree.xmlFreeDtd(self._c_dtd)
 * 
 *     def __call__(self, etree):             # <<<<<<<<<<<<<<
 *         u"""__call__(self, etree)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_3DTD_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_3DTD_3__call__[] = "__call__(self, etree)\n\n        Validate doc using the DTD.\n\n        Returns true if the document is valid, false if not.\n        ";
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_3DTD_3__call__;
static PyObject *__pyx_pf_4lxml_5etree_3DTD_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_etree = 0;
  struct LxmlDocument *__pyx_v_doc;
  struct LxmlElement *__pyx_v_root_node;
  xmlDoc *__pyx_v_c_doc;
  xmlValidCtxt *__pyx_v_valid_ctxt;
  int __pyx_v_ret;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  xmlDoc *__pyx_t_5;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__etree,0};
  __Pyx_RefNannySetupContext("__call__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[1] = {0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__etree);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__call__") < 0)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_etree = values[0];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_etree = PyTuple_GET_ITEM(__pyx_args, 0);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[20]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.DTD.__call__");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_doc = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_root_node = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":74
 *         cdef int ret
 * 
 *         assert self._c_dtd is not NULL, "DTD not initialised"             # <<<<<<<<<<<<<<
 *         doc = _documentOrRaise(etree)
 *         root_node = _rootNodeOrRaise(etree)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!(((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_v_self)->_c_dtd != NULL))) {
    PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_394));
    {__pyx_filename = __pyx_f[20]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":75
 * 
 *         assert self._c_dtd is not NULL, "DTD not initialised"
 *         doc = _documentOrRaise(etree)             # <<<<<<<<<<<<<<
 *         root_node = _rootNodeOrRaise(etree)
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_doc));
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":76
 *         assert self._c_dtd is not NULL, "DTD not initialised"
 *         doc = _documentOrRaise(etree)
 *         root_node = _rootNodeOrRaise(etree)             # <<<<<<<<<<<<<<
 * 
 *         self._error_log.connect()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_root_node));
  __pyx_v_root_node = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":78
 *         root_node = _rootNodeOrRaise(etree)
 * 
 *         self._error_log.connect()             # <<<<<<<<<<<<<<
 *         valid_ctxt = dtdvalid.xmlNewValidCtxt()
 *         if valid_ctxt is NULL:
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_v_self)->__pyx_base._error_log->__pyx_base.__pyx_base.__pyx_vtab)->connect(((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_v_self)->__pyx_base._error_log);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":79
 * 
 *         self._error_log.connect()
 *         valid_ctxt = dtdvalid.xmlNewValidCtxt()             # <<<<<<<<<<<<<<
 *         if valid_ctxt is NULL:
 *             self._error_log.disconnect()
 */
  __pyx_v_valid_ctxt = xmlNewValidCtxt();

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":80
 *         self._error_log.connect()
 *         valid_ctxt = dtdvalid.xmlNewValidCtxt()
 *         if valid_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             self._error_log.disconnect()
 *             raise DTDError(u"Failed to create validation context",
 */
  __pyx_t_2 = (__pyx_v_valid_ctxt == NULL);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":81
 *         valid_ctxt = dtdvalid.xmlNewValidCtxt()
 *         if valid_ctxt is NULL:
 *             self._error_log.disconnect()             # <<<<<<<<<<<<<<
 *             raise DTDError(u"Failed to create validation context",
 *                            self._error_log)
 */
    ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_v_self)->__pyx_base._error_log->__pyx_base.__pyx_base.__pyx_vtab)->disconnect(((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_v_self)->__pyx_base._error_log);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":82
 *         if valid_ctxt is NULL:
 *             self._error_log.disconnect()
 *             raise DTDError(u"Failed to create validation context",             # <<<<<<<<<<<<<<
 *                            self._error_log)
 * 
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTDError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":83
 *             self._error_log.disconnect()
 *             raise DTDError(u"Failed to create validation context",
 *                            self._error_log)             # <<<<<<<<<<<<<<
 * 
 *         c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 */
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_INCREF(((PyObject *)__pyx_kp_u_395));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_395));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_395));
    __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_v_self)->__pyx_base._error_log));
    PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_v_self)->__pyx_base._error_log));
    __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_v_self)->__pyx_base._error_log));
    __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[20]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":85
 *                            self._error_log)
 * 
 *         c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)             # <<<<<<<<<<<<<<
 *         with nogil:
 *             ret = dtdvalid.xmlValidateDtd(valid_ctxt, c_doc, self._c_dtd)
 */
  __pyx_t_5 = __pyx_f_4lxml_5etree__fakeRootDoc(__pyx_v_doc->_c_doc, __pyx_v_root_node->_c_node); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_doc = __pyx_t_5;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":86
 * 
 *         c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *         with nogil:             # <<<<<<<<<<<<<<
 *             ret = dtdvalid.xmlValidateDtd(valid_ctxt, c_doc, self._c_dtd)
 *         _destroyFakeDoc(doc._c_doc, c_doc)
 */
  {
    #ifdef WITH_THREAD
    PyThreadState *_save;
    #endif
    Py_UNBLOCK_THREADS
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":87
 *         c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *         with nogil:
 *             ret = dtdvalid.xmlValidateDtd(valid_ctxt, c_doc, self._c_dtd)             # <<<<<<<<<<<<<<
 *         _destroyFakeDoc(doc._c_doc, c_doc)
 * 
 */
      __pyx_v_ret = xmlValidateDtd(__pyx_v_valid_ctxt, __pyx_v_c_doc, ((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_v_self)->_c_dtd);
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":86
 * 
 *         c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *         with nogil:             # <<<<<<<<<<<<<<
 *             ret = dtdvalid.xmlValidateDtd(valid_ctxt, c_doc, self._c_dtd)
 *         _destroyFakeDoc(doc._c_doc, c_doc)
 */
    /*finally:*/ {
      Py_BLOCK_THREADS
    }
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":88
 *         with nogil:
 *             ret = dtdvalid.xmlValidateDtd(valid_ctxt, c_doc, self._c_dtd)
 *         _destroyFakeDoc(doc._c_doc, c_doc)             # <<<<<<<<<<<<<<
 * 
 *         dtdvalid.xmlFreeValidCtxt(valid_ctxt)
 */
  __pyx_f_4lxml_5etree__destroyFakeDoc(__pyx_v_doc->_c_doc, __pyx_v_c_doc);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":90
 *         _destroyFakeDoc(doc._c_doc, c_doc)
 * 
 *         dtdvalid.xmlFreeValidCtxt(valid_ctxt)             # <<<<<<<<<<<<<<
 * 
 *         self._error_log.disconnect()
 */
  xmlFreeValidCtxt(__pyx_v_valid_ctxt);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":92
 *         dtdvalid.xmlFreeValidCtxt(valid_ctxt)
 * 
 *         self._error_log.disconnect()             # <<<<<<<<<<<<<<
 *         if ret == -1:
 *             raise DTDValidateError(u"Internal error in DTD validation",
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_v_self)->__pyx_base._error_log->__pyx_base.__pyx_base.__pyx_vtab)->disconnect(((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_v_self)->__pyx_base._error_log);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":93
 * 
 *         self._error_log.disconnect()
 *         if ret == -1:             # <<<<<<<<<<<<<<
 *             raise DTDValidateError(u"Internal error in DTD validation",
 *                                    self._error_log)
 */
  __pyx_t_2 = (__pyx_v_ret == -1);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":94
 *         self._error_log.disconnect()
 *         if ret == -1:
 *             raise DTDValidateError(u"Internal error in DTD validation",             # <<<<<<<<<<<<<<
 *                                    self._error_log)
 *         if ret == 1:
 */
    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTDValidateError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":95
 *         if ret == -1:
 *             raise DTDValidateError(u"Internal error in DTD validation",
 *                                    self._error_log)             # <<<<<<<<<<<<<<
 *         if ret == 1:
 *             return True
 */
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_INCREF(((PyObject *)__pyx_kp_u_396));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_396));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_396));
    __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_v_self)->__pyx_base._error_log));
    PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_v_self)->__pyx_base._error_log));
    __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_v_self)->__pyx_base._error_log));
    __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_1, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[20]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L10;
  }
  __pyx_L10:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":96
 *             raise DTDValidateError(u"Internal error in DTD validation",
 *                                    self._error_log)
 *         if ret == 1:             # <<<<<<<<<<<<<<
 *             return True
 *         else:
 */
  __pyx_t_2 = (__pyx_v_ret == 1);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":97
 *                                    self._error_log)
 *         if ret == 1:
 *             return True             # <<<<<<<<<<<<<<
 *         else:
 *             return False
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    goto __pyx_L11;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":99
 *             return True
 *         else:
 *             return False             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
  }
  __pyx_L11:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.DTD.__call__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_doc);
  __Pyx_DECREF((PyObject *)__pyx_v_root_node);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":102
 * 
 * 
 * cdef tree.xmlDtd* _parseDtdFromFilelike(file) except NULL:             # <<<<<<<<<<<<<<
 *     cdef _ExceptionContext exc_context
 *     cdef _FileReaderContext dtd_parser
 */

static  xmlDtd *__pyx_f_4lxml_5etree__parseDtdFromFilelike(PyObject *__pyx_v_file) {
  struct __pyx_obj_4lxml_5etree__ExceptionContext *__pyx_v_exc_context;
  struct __pyx_obj_4lxml_5etree__FileReaderContext *__pyx_v_dtd_parser;
  struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_error_log;
  xmlDtd *__pyx_v_c_dtd;
  xmlDtd *__pyx_r;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("_parseDtdFromFilelike");
  __pyx_v_exc_context = ((struct __pyx_obj_4lxml_5etree__ExceptionContext *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_dtd_parser = ((struct __pyx_obj_4lxml_5etree__FileReaderContext *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_error_log = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":107
 *     cdef _ErrorLog error_log
 *     cdef tree.xmlDtd* c_dtd
 *     exc_context = _ExceptionContext()             # <<<<<<<<<<<<<<
 *     dtd_parser = _FileReaderContext(file, exc_context, None, None)
 *     error_log = _ErrorLog()
 */
  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ExceptionContext)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_exc_context));
  __pyx_v_exc_context = ((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":108
 *     cdef tree.xmlDtd* c_dtd
 *     exc_context = _ExceptionContext()
 *     dtd_parser = _FileReaderContext(file, exc_context, None, None)             # <<<<<<<<<<<<<<
 *     error_log = _ErrorLog()
 * 
 */
  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_file);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_file);
  __Pyx_GIVEREF(__pyx_v_file);
  __Pyx_INCREF(((PyObject *)__pyx_v_exc_context));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_exc_context));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_exc_context));
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_1, 3, Py_None);
  __Pyx_GIVEREF(Py_None);
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__FileReaderContext)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_v_dtd_parser));
  __pyx_v_dtd_parser = ((struct __pyx_obj_4lxml_5etree__FileReaderContext *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":109
 *     exc_context = _ExceptionContext()
 *     dtd_parser = _FileReaderContext(file, exc_context, None, None)
 *     error_log = _ErrorLog()             # <<<<<<<<<<<<<<
 * 
 *     error_log.connect()
 */
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ErrorLog)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_v_error_log));
  __pyx_v_error_log = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":111
 *     error_log = _ErrorLog()
 * 
 *     error_log.connect()             # <<<<<<<<<<<<<<
 *     c_dtd = dtd_parser._readDtd()
 *     error_log.disconnect()
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)__pyx_v_error_log->__pyx_base.__pyx_base.__pyx_vtab)->connect(__pyx_v_error_log);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":112
 * 
 *     error_log.connect()
 *     c_dtd = dtd_parser._readDtd()             # <<<<<<<<<<<<<<
 *     error_log.disconnect()
 * 
 */
  __pyx_v_c_dtd = ((struct __pyx_vtabstruct_4lxml_5etree__FileReaderContext *)__pyx_v_dtd_parser->__pyx_vtab)->_readDtd(__pyx_v_dtd_parser);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":113
 *     error_log.connect()
 *     c_dtd = dtd_parser._readDtd()
 *     error_log.disconnect()             # <<<<<<<<<<<<<<
 * 
 *     exc_context._raise_if_stored()
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)__pyx_v_error_log->__pyx_base.__pyx_base.__pyx_vtab)->disconnect(__pyx_v_error_log);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":115
 *     error_log.disconnect()
 * 
 *     exc_context._raise_if_stored()             # <<<<<<<<<<<<<<
 *     if c_dtd is NULL:
 *         raise DTDParseError(u"error parsing DTD", error_log)
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext *)__pyx_v_exc_context->__pyx_vtab)->_raise_if_stored(__pyx_v_exc_context); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":116
 * 
 *     exc_context._raise_if_stored()
 *     if c_dtd is NULL:             # <<<<<<<<<<<<<<
 *         raise DTDParseError(u"error parsing DTD", error_log)
 *     return c_dtd
 */
  __pyx_t_4 = (__pyx_v_c_dtd == NULL);
  if (__pyx_t_4) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":117
 *     exc_context._raise_if_stored()
 *     if c_dtd is NULL:
 *         raise DTDParseError(u"error parsing DTD", error_log)             # <<<<<<<<<<<<<<
 *     return c_dtd
 * 
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTDParseError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __Pyx_INCREF(((PyObject *)__pyx_kp_u_393));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_u_393));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_393));
    __Pyx_INCREF(((PyObject *)__pyx_v_error_log));
    PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_error_log));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_error_log));
    __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __Pyx_Raise(__pyx_t_5, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    {__pyx_filename = __pyx_f[20]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":118
 *     if c_dtd is NULL:
 *         raise DTDParseError(u"error parsing DTD", error_log)
 *     return c_dtd             # <<<<<<<<<<<<<<
 * 
 * cdef extern from "etree_defs.h":
 */
  __pyx_r = __pyx_v_c_dtd;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._parseDtdFromFilelike");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_exc_context);
  __Pyx_DECREF((PyObject *)__pyx_v_dtd_parser);
  __Pyx_DECREF((PyObject *)__pyx_v_error_log);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":124
 *     cdef DTD NEW_DTD "PY_NEW" (object t)
 * 
 * cdef DTD _dtdFactory(tree.xmlDtd* c_dtd):             # <<<<<<<<<<<<<<
 *     # do not run through DTD.__init__()!
 *     cdef DTD dtd
 */

static  struct __pyx_obj_4lxml_5etree_DTD *__pyx_f_4lxml_5etree__dtdFactory(xmlDtd *__pyx_v_c_dtd) {
  struct __pyx_obj_4lxml_5etree_DTD *__pyx_v_dtd;
  struct __pyx_obj_4lxml_5etree_DTD *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("_dtdFactory");
  __pyx_v_dtd = ((struct __pyx_obj_4lxml_5etree_DTD *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":127
 *     # do not run through DTD.__init__()!
 *     cdef DTD dtd
 *     if c_dtd is NULL:             # <<<<<<<<<<<<<<
 *         return None
 *     dtd = NEW_DTD(DTD)
 */
  __pyx_t_1 = (__pyx_v_c_dtd == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":128
 *     cdef DTD dtd
 *     if c_dtd is NULL:
 *         return None             # <<<<<<<<<<<<<<
 *     dtd = NEW_DTD(DTD)
 *     dtd._c_dtd = tree.xmlCopyDtd(c_dtd)
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __Pyx_INCREF(Py_None);
    __pyx_r = ((struct __pyx_obj_4lxml_5etree_DTD *)Py_None);
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":129
 *     if c_dtd is NULL:
 *         return None
 *     dtd = NEW_DTD(DTD)             # <<<<<<<<<<<<<<
 *     dtd._c_dtd = tree.xmlCopyDtd(c_dtd)
 *     if dtd._c_dtd is NULL:
 */
  __pyx_t_2 = ((PyObject *)PY_NEW(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_DTD)))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_v_dtd));
  __pyx_v_dtd = ((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":130
 *         return None
 *     dtd = NEW_DTD(DTD)
 *     dtd._c_dtd = tree.xmlCopyDtd(c_dtd)             # <<<<<<<<<<<<<<
 *     if dtd._c_dtd is NULL:
 *         python.PyErr_NoMemory()
 */
  __pyx_v_dtd->_c_dtd = xmlCopyDtd(__pyx_v_c_dtd);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":131
 *     dtd = NEW_DTD(DTD)
 *     dtd._c_dtd = tree.xmlCopyDtd(c_dtd)
 *     if dtd._c_dtd is NULL:             # <<<<<<<<<<<<<<
 *         python.PyErr_NoMemory()
 *     _Validator.__init__(dtd)
 */
  __pyx_t_1 = (__pyx_v_dtd->_c_dtd == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":132
 *     dtd._c_dtd = tree.xmlCopyDtd(c_dtd)
 *     if dtd._c_dtd is NULL:
 *         python.PyErr_NoMemory()             # <<<<<<<<<<<<<<
 *     _Validator.__init__(dtd)
 *     return dtd
 */
    __pyx_t_2 = PyErr_NoMemory(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":133
 *     if dtd._c_dtd is NULL:
 *         python.PyErr_NoMemory()
 *     _Validator.__init__(dtd)             # <<<<<<<<<<<<<<
 *     return dtd
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Validator)), __pyx_n_s____init__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(((PyObject *)__pyx_v_dtd));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_dtd));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_dtd));
  __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":134
 *         python.PyErr_NoMemory()
 *     _Validator.__init__(dtd)
 *     return dtd             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_dtd));
  __pyx_r = __pyx_v_dtd;
  goto __pyx_L0;

  __pyx_r = ((struct __pyx_obj_4lxml_5etree_DTD *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._dtdFactory");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_dtd);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":30
 *     """
 *     cdef relaxng.xmlRelaxNG* _c_schema
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._c_schema = NULL
 * 
 */

static int __pyx_pf_4lxml_5etree_7RelaxNG___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_7RelaxNG___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("__cinit__");
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":31
 *     cdef relaxng.xmlRelaxNG* _c_schema
 *     def __cinit__(self):
 *         self._c_schema = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, etree=None, *, file=None):
 */
  ((struct __pyx_obj_4lxml_5etree_RelaxNG *)__pyx_v_self)->_c_schema = NULL;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":33
 *         self._c_schema = NULL
 * 
 *     def __init__(self, etree=None, *, file=None):             # <<<<<<<<<<<<<<
 *         cdef _Document doc
 *         cdef _Element root_node
 */

static int __pyx_pf_4lxml_5etree_7RelaxNG_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_7RelaxNG_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_etree = 0;
  PyObject *__pyx_v_file = 0;
  struct LxmlDocument *__pyx_v_doc;
  struct LxmlElement *__pyx_v_root_node;
  xmlNode *__pyx_v_c_node;
  xmlDoc *__pyx_v_fake_c_doc;
  char *__pyx_v_c_href;
  xmlRelaxNGParserCtxt *__pyx_v_parser_ctxt;
  PyObject *__pyx_v_filename;
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  xmlDoc *__pyx_t_7;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__etree,&__pyx_n_s__file,0};
  __Pyx_RefNannySetupContext("__init__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__etree);
        if (value) { values[0] = value; kw_args--; }
      }
    }
    while (kw_args > 0) {
      PyObject* value;
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__file);
      if (value) { values[1] = value; if (!(--kw_args)) break; }
      break;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_etree = values[0];
    __pyx_v_file = values[1];
  } else {
    __pyx_v_etree = ((PyObject *)Py_None);
    __pyx_v_file = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: __pyx_v_etree = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[21]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.RelaxNG.__init__");
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_doc = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_root_node = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_filename = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":40
 *         cdef char* c_href
 *         cdef relaxng.xmlRelaxNGParserCtxt* parser_ctxt
 *         _Validator.__init__(self)             # <<<<<<<<<<<<<<
 *         fake_c_doc = NULL
 *         if etree is not None:
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Validator)), __pyx_n_s____init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":41
 *         cdef relaxng.xmlRelaxNGParserCtxt* parser_ctxt
 *         _Validator.__init__(self)
 *         fake_c_doc = NULL             # <<<<<<<<<<<<<<
 *         if etree is not None:
 *             doc = _documentOrRaise(etree)
 */
  __pyx_v_fake_c_doc = NULL;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":42
 *         _Validator.__init__(self)
 *         fake_c_doc = NULL
 *         if etree is not None:             # <<<<<<<<<<<<<<
 *             doc = _documentOrRaise(etree)
 *             root_node = _rootNodeOrRaise(etree)
 */
  __pyx_t_4 = (__pyx_v_etree != Py_None);
  if (__pyx_t_4) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":43
 *         fake_c_doc = NULL
 *         if etree is not None:
 *             doc = _documentOrRaise(etree)             # <<<<<<<<<<<<<<
 *             root_node = _rootNodeOrRaise(etree)
 *             c_node = root_node._c_node
 */
    __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__pyx_v_doc));
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":44
 *         if etree is not None:
 *             doc = _documentOrRaise(etree)
 *             root_node = _rootNodeOrRaise(etree)             # <<<<<<<<<<<<<<
 *             c_node = root_node._c_node
 *             # work around for libxml2 crash bug if document is not RNG at all
 */
    __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__pyx_v_root_node));
    __pyx_v_root_node = ((struct LxmlElement *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":45
 *             doc = _documentOrRaise(etree)
 *             root_node = _rootNodeOrRaise(etree)
 *             c_node = root_node._c_node             # <<<<<<<<<<<<<<
 *             # work around for libxml2 crash bug if document is not RNG at all
 *             if _LIBXML_VERSION_INT < 20624:
 */
    __pyx_v_c_node = __pyx_v_root_node->_c_node;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":47
 *             c_node = root_node._c_node
 *             # work around for libxml2 crash bug if document is not RNG at all
 *             if _LIBXML_VERSION_INT < 20624:             # <<<<<<<<<<<<<<
 *                 c_href = _getNs(c_node)
 *                 if c_href is NULL or \
 */
    __pyx_t_4 = (__pyx_v_4lxml_5etree__LIBXML_VERSION_INT < 20624);
    if (__pyx_t_4) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":48
 *             # work around for libxml2 crash bug if document is not RNG at all
 *             if _LIBXML_VERSION_INT < 20624:
 *                 c_href = _getNs(c_node)             # <<<<<<<<<<<<<<
 *                 if c_href is NULL or \
 *                        cstd.strcmp(c_href,
 */
      __pyx_v_c_href = _getNs(__pyx_v_c_node);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":49
 *             if _LIBXML_VERSION_INT < 20624:
 *                 c_href = _getNs(c_node)
 *                 if c_href is NULL or \             # <<<<<<<<<<<<<<
 *                        cstd.strcmp(c_href,
 *                                    'http://relaxng.org/ns/structure/1.0') != 0:
 */
      __pyx_t_4 = (__pyx_v_c_href == NULL);
      if (!__pyx_t_4) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":50
 *                 c_href = _getNs(c_node)
 *                 if c_href is NULL or \
 *                        cstd.strcmp(c_href,             # <<<<<<<<<<<<<<
 *                                    'http://relaxng.org/ns/structure/1.0') != 0:
 *                     raise RelaxNGParseError, u"Document is not Relax NG"
 */
        __pyx_t_5 = (strcmp(__pyx_v_c_href, __pyx_k_397) != 0);
        __pyx_t_6 = __pyx_t_5;
      } else {
        __pyx_t_6 = __pyx_t_4;
      }
      if (__pyx_t_6) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":52
 *                        cstd.strcmp(c_href,
 *                                    'http://relaxng.org/ns/structure/1.0') != 0:
 *                     raise RelaxNGParseError, u"Document is not Relax NG"             # <<<<<<<<<<<<<<
 *             self._error_log.connect()
 *             fake_c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 */
        __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__RelaxNGParseError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_Raise(__pyx_t_3, ((PyObject *)__pyx_kp_u_398), 0);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        {__pyx_filename = __pyx_f[21]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L8;
      }
      __pyx_L8:;
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":53
 *                                    'http://relaxng.org/ns/structure/1.0') != 0:
 *                     raise RelaxNGParseError, u"Document is not Relax NG"
 *             self._error_log.connect()             # <<<<<<<<<<<<<<
 *             fake_c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *             parser_ctxt = relaxng.xmlRelaxNGNewDocParserCtxt(fake_c_doc)
 */
    ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)((struct __pyx_obj_4lxml_5etree_RelaxNG *)__pyx_v_self)->__pyx_base._error_log->__pyx_base.__pyx_base.__pyx_vtab)->connect(((struct __pyx_obj_4lxml_5etree_RelaxNG *)__pyx_v_self)->__pyx_base._error_log);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":54
 *                     raise RelaxNGParseError, u"Document is not Relax NG"
 *             self._error_log.connect()
 *             fake_c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)             # <<<<<<<<<<<<<<
 *             parser_ctxt = relaxng.xmlRelaxNGNewDocParserCtxt(fake_c_doc)
 *         elif file is not None:
 */
    __pyx_t_7 = __pyx_f_4lxml_5etree__fakeRootDoc(__pyx_v_doc->_c_doc, __pyx_v_root_node->_c_node); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_fake_c_doc = __pyx_t_7;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":55
 *             self._error_log.connect()
 *             fake_c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *             parser_ctxt = relaxng.xmlRelaxNGNewDocParserCtxt(fake_c_doc)             # <<<<<<<<<<<<<<
 *         elif file is not None:
 *             if _isString(file):
 */
    __pyx_v_parser_ctxt = xmlRelaxNGNewDocParserCtxt(__pyx_v_fake_c_doc);
    goto __pyx_L6;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":56
 *             fake_c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *             parser_ctxt = relaxng.xmlRelaxNGNewDocParserCtxt(fake_c_doc)
 *         elif file is not None:             # <<<<<<<<<<<<<<
 *             if _isString(file):
 *                 filename = _encodeFilename(file)
 */
  __pyx_t_6 = (__pyx_v_file != Py_None);
  if (__pyx_t_6) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":57
 *             parser_ctxt = relaxng.xmlRelaxNGNewDocParserCtxt(fake_c_doc)
 *         elif file is not None:
 *             if _isString(file):             # <<<<<<<<<<<<<<
 *                 filename = _encodeFilename(file)
 *                 self._error_log.connect()
 */
    __pyx_t_6 = _isString(__pyx_v_file);
    if (__pyx_t_6) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":58
 *         elif file is not None:
 *             if _isString(file):
 *                 filename = _encodeFilename(file)             # <<<<<<<<<<<<<<
 *                 self._error_log.connect()
 *                 parser_ctxt = relaxng.xmlRelaxNGNewParserCtxt(_cstr(filename))
 */
      __pyx_t_3 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_file); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_v_filename);
      __pyx_v_filename = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":59
 *             if _isString(file):
 *                 filename = _encodeFilename(file)
 *                 self._error_log.connect()             # <<<<<<<<<<<<<<
 *                 parser_ctxt = relaxng.xmlRelaxNGNewParserCtxt(_cstr(filename))
 *             else:
 */
      ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)((struct __pyx_obj_4lxml_5etree_RelaxNG *)__pyx_v_self)->__pyx_base._error_log->__pyx_base.__pyx_base.__pyx_vtab)->connect(((struct __pyx_obj_4lxml_5etree_RelaxNG *)__pyx_v_self)->__pyx_base._error_log);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":60
 *                 filename = _encodeFilename(file)
 *                 self._error_log.connect()
 *                 parser_ctxt = relaxng.xmlRelaxNGNewParserCtxt(_cstr(filename))             # <<<<<<<<<<<<<<
 *             else:
 *                 doc = _parseDocument(file, None, None)
 */
      __pyx_v_parser_ctxt = xmlRelaxNGNewParserCtxt(PyBytes_AS_STRING(__pyx_v_filename));
      goto __pyx_L9;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":62
 *                 parser_ctxt = relaxng.xmlRelaxNGNewParserCtxt(_cstr(filename))
 *             else:
 *                 doc = _parseDocument(file, None, None)             # <<<<<<<<<<<<<<
 *                 self._error_log.connect()
 *                 parser_ctxt = relaxng.xmlRelaxNGNewDocParserCtxt(doc._c_doc)
 */
      __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__parseDocument(__pyx_v_file, ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None), Py_None)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(((PyObject *)__pyx_v_doc));
      __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_3);
      __pyx_t_3 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":63
 *             else:
 *                 doc = _parseDocument(file, None, None)
 *                 self._error_log.connect()             # <<<<<<<<<<<<<<
 *                 parser_ctxt = relaxng.xmlRelaxNGNewDocParserCtxt(doc._c_doc)
 *         else:
 */
      ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)((struct __pyx_obj_4lxml_5etree_RelaxNG *)__pyx_v_self)->__pyx_base._error_log->__pyx_base.__pyx_base.__pyx_vtab)->connect(((struct __pyx_obj_4lxml_5etree_RelaxNG *)__pyx_v_self)->__pyx_base._error_log);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":64
 *                 doc = _parseDocument(file, None, None)
 *                 self._error_log.connect()
 *                 parser_ctxt = relaxng.xmlRelaxNGNewDocParserCtxt(doc._c_doc)             # <<<<<<<<<<<<<<
 *         else:
 *             raise RelaxNGParseError, u"No tree or file given"
 */
      __pyx_v_parser_ctxt = xmlRelaxNGNewDocParserCtxt(__pyx_v_doc->_c_doc);
    }
    __pyx_L9:;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":66
 *                 parser_ctxt = relaxng.xmlRelaxNGNewDocParserCtxt(doc._c_doc)
 *         else:
 *             raise RelaxNGParseError, u"No tree or file given"             # <<<<<<<<<<<<<<
 * 
 *         if parser_ctxt is NULL:
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__RelaxNGParseError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, ((PyObject *)__pyx_kp_u_399), 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[21]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":68
 *             raise RelaxNGParseError, u"No tree or file given"
 * 
 *         if parser_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             self._error_log.disconnect()
 *             if fake_c_doc is not NULL:
 */
  __pyx_t_6 = (__pyx_v_parser_ctxt == NULL);
  if (__pyx_t_6) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":69
 * 
 *         if parser_ctxt is NULL:
 *             self._error_log.disconnect()             # <<<<<<<<<<<<<<
 *             if fake_c_doc is not NULL:
 *                 _destroyFakeDoc(doc._c_doc, fake_c_doc)
 */
    ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)((struct __pyx_obj_4lxml_5etree_RelaxNG *)__pyx_v_self)->__pyx_base._error_log->__pyx_base.__pyx_base.__pyx_vtab)->disconnect(((struct __pyx_obj_4lxml_5etree_RelaxNG *)__pyx_v_self)->__pyx_base._error_log);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":70
 *         if parser_ctxt is NULL:
 *             self._error_log.disconnect()
 *             if fake_c_doc is not NULL:             # <<<<<<<<<<<<<<
 *                 _destroyFakeDoc(doc._c_doc, fake_c_doc)
 *             raise RelaxNGParseError(
 */
    __pyx_t_6 = (__pyx_v_fake_c_doc != NULL);
    if (__pyx_t_6) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":71
 *             self._error_log.disconnect()
 *             if fake_c_doc is not NULL:
 *                 _destroyFakeDoc(doc._c_doc, fake_c_doc)             # <<<<<<<<<<<<<<
 *             raise RelaxNGParseError(
 *                 self._error_log._buildExceptionMessage(
 */
      __pyx_f_4lxml_5etree__destroyFakeDoc(__pyx_v_doc->_c_doc, __pyx_v_fake_c_doc);
      goto __pyx_L11;
    }
    __pyx_L11:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":72
 *             if fake_c_doc is not NULL:
 *                 _destroyFakeDoc(doc._c_doc, fake_c_doc)
 *             raise RelaxNGParseError(             # <<<<<<<<<<<<<<
 *                 self._error_log._buildExceptionMessage(
 *                     u"Document is not parsable as Relax NG"),
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__RelaxNGParseError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":73
 *                 _destroyFakeDoc(doc._c_doc, fake_c_doc)
 *             raise RelaxNGParseError(
 *                 self._error_log._buildExceptionMessage(             # <<<<<<<<<<<<<<
 *                     u"Document is not parsable as Relax NG"),
 *                 self._error_log)
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)((struct __pyx_obj_4lxml_5etree_RelaxNG *)__pyx_v_self)->__pyx_base._error_log->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._buildExceptionMessage(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)((struct __pyx_obj_4lxml_5etree_RelaxNG *)__pyx_v_self)->__pyx_base._error_log), ((PyObject *)__pyx_kp_u_400)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":75
 *                 self._error_log._buildExceptionMessage(
 *                     u"Document is not parsable as Relax NG"),
 *                 self._error_log)             # <<<<<<<<<<<<<<
 *         self._c_schema = relaxng.xmlRelaxNGParse(parser_ctxt)
 *         self._error_log.disconnect()
 */
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_RelaxNG *)__pyx_v_self)->__pyx_base._error_log));
    PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)((struct __pyx_obj_4lxml_5etree_RelaxNG *)__pyx_v_self)->__pyx_base._error_log));
    __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_RelaxNG *)__pyx_v_self)->__pyx_base._error_log));
    __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[21]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L10;
  }
  __pyx_L10:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":76
 *                     u"Document is not parsable as Relax NG"),
 *                 self._error_log)
 *         self._c_schema = relaxng.xmlRelaxNGParse(parser_ctxt)             # <<<<<<<<<<<<<<
 *         self._error_log.disconnect()
 * 
 */
  ((struct __pyx_obj_4lxml_5etree_RelaxNG *)__pyx_v_self)->_c_schema = xmlRelaxNGParse(__pyx_v_parser_ctxt);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":77
 *                 self._error_log)
 *         self._c_schema = relaxng.xmlRelaxNGParse(parser_ctxt)
 *         self._error_log.disconnect()             # <<<<<<<<<<<<<<
 * 
 *         if _LIBXML_VERSION_INT >= 20624:
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)((struct __pyx_obj_4lxml_5etree_RelaxNG *)__pyx_v_self)->__pyx_base._error_log->__pyx_base.__pyx_base.__pyx_vtab)->disconnect(((struct __pyx_obj_4lxml_5etree_RelaxNG *)__pyx_v_self)->__pyx_base._error_log);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":79
 *         self._error_log.disconnect()
 * 
 *         if _LIBXML_VERSION_INT >= 20624:             # <<<<<<<<<<<<<<
 *             relaxng.xmlRelaxNGFreeParserCtxt(parser_ctxt)
 *         if self._c_schema is NULL:
 */
  __pyx_t_6 = (__pyx_v_4lxml_5etree__LIBXML_VERSION_INT >= 20624);
  if (__pyx_t_6) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":80
 * 
 *         if _LIBXML_VERSION_INT >= 20624:
 *             relaxng.xmlRelaxNGFreeParserCtxt(parser_ctxt)             # <<<<<<<<<<<<<<
 *         if self._c_schema is NULL:
 *             if fake_c_doc is not NULL:
 */
    xmlRelaxNGFreeParserCtxt(__pyx_v_parser_ctxt);
    goto __pyx_L12;
  }
  __pyx_L12:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":81
 *         if _LIBXML_VERSION_INT >= 20624:
 *             relaxng.xmlRelaxNGFreeParserCtxt(parser_ctxt)
 *         if self._c_schema is NULL:             # <<<<<<<<<<<<<<
 *             if fake_c_doc is not NULL:
 *                 if _LIBXML_VERSION_INT < 20624:
 */
  __pyx_t_6 = (((struct __pyx_obj_4lxml_5etree_RelaxNG *)__pyx_v_self)->_c_schema == NULL);
  if (__pyx_t_6) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":82
 *             relaxng.xmlRelaxNGFreeParserCtxt(parser_ctxt)
 *         if self._c_schema is NULL:
 *             if fake_c_doc is not NULL:             # <<<<<<<<<<<<<<
 *                 if _LIBXML_VERSION_INT < 20624:
 *                     relaxng.xmlRelaxNGFreeParserCtxt(parser_ctxt)
 */
    __pyx_t_6 = (__pyx_v_fake_c_doc != NULL);
    if (__pyx_t_6) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":83
 *         if self._c_schema is NULL:
 *             if fake_c_doc is not NULL:
 *                 if _LIBXML_VERSION_INT < 20624:             # <<<<<<<<<<<<<<
 *                     relaxng.xmlRelaxNGFreeParserCtxt(parser_ctxt)
 *                 _destroyFakeDoc(doc._c_doc, fake_c_doc)
 */
      __pyx_t_6 = (__pyx_v_4lxml_5etree__LIBXML_VERSION_INT < 20624);
      if (__pyx_t_6) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":84
 *             if fake_c_doc is not NULL:
 *                 if _LIBXML_VERSION_INT < 20624:
 *                     relaxng.xmlRelaxNGFreeParserCtxt(parser_ctxt)             # <<<<<<<<<<<<<<
 *                 _destroyFakeDoc(doc._c_doc, fake_c_doc)
 *             raise RelaxNGParseError(
 */
        xmlRelaxNGFreeParserCtxt(__pyx_v_parser_ctxt);
        goto __pyx_L15;
      }
      __pyx_L15:;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":85
 *                 if _LIBXML_VERSION_INT < 20624:
 *                     relaxng.xmlRelaxNGFreeParserCtxt(parser_ctxt)
 *                 _destroyFakeDoc(doc._c_doc, fake_c_doc)             # <<<<<<<<<<<<<<
 *             raise RelaxNGParseError(
 *                 self._error_log._buildExceptionMessage(
 */
      __pyx_f_4lxml_5etree__destroyFakeDoc(__pyx_v_doc->_c_doc, __pyx_v_fake_c_doc);
      goto __pyx_L14;
    }
    __pyx_L14:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":86
 *                     relaxng.xmlRelaxNGFreeParserCtxt(parser_ctxt)
 *                 _destroyFakeDoc(doc._c_doc, fake_c_doc)
 *             raise RelaxNGParseError(             # <<<<<<<<<<<<<<
 *                 self._error_log._buildExceptionMessage(
 *                     u"Document is not valid Relax NG"),
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__RelaxNGParseError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":87
 *                 _destroyFakeDoc(doc._c_doc, fake_c_doc)
 *             raise RelaxNGParseError(
 *                 self._error_log._buildExceptionMessage(             # <<<<<<<<<<<<<<
 *                     u"Document is not valid Relax NG"),
 *                 self._error_log)
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)((struct __pyx_obj_4lxml_5etree_RelaxNG *)__pyx_v_self)->__pyx_base._error_log->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._buildExceptionMessage(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)((struct __pyx_obj_4lxml_5etree_RelaxNG *)__pyx_v_self)->__pyx_base._error_log), ((PyObject *)__pyx_kp_u_401)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":89
 *                 self._error_log._buildExceptionMessage(
 *                     u"Document is not valid Relax NG"),
 *                 self._error_log)             # <<<<<<<<<<<<<<
 *         if fake_c_doc is not NULL:
 *             _destroyFakeDoc(doc._c_doc, fake_c_doc)
 */
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_RelaxNG *)__pyx_v_self)->__pyx_base._error_log));
    PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)((struct __pyx_obj_4lxml_5etree_RelaxNG *)__pyx_v_self)->__pyx_base._error_log));
    __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_RelaxNG *)__pyx_v_self)->__pyx_base._error_log));
    __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_1, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[21]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L13;
  }
  __pyx_L13:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":90
 *                     u"Document is not valid Relax NG"),
 *                 self._error_log)
 *         if fake_c_doc is not NULL:             # <<<<<<<<<<<<<<
 *             _destroyFakeDoc(doc._c_doc, fake_c_doc)
 * 
 */
  __pyx_t_6 = (__pyx_v_fake_c_doc != NULL);
  if (__pyx_t_6) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":91
 *                 self._error_log)
 *         if fake_c_doc is not NULL:
 *             _destroyFakeDoc(doc._c_doc, fake_c_doc)             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
    __pyx_f_4lxml_5etree__destroyFakeDoc(__pyx_v_doc->_c_doc, __pyx_v_fake_c_doc);
    goto __pyx_L16;
  }
  __pyx_L16:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.RelaxNG.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_doc);
  __Pyx_DECREF((PyObject *)__pyx_v_root_node);
  __Pyx_DECREF(__pyx_v_filename);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":93
 *             _destroyFakeDoc(doc._c_doc, fake_c_doc)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         relaxng.xmlRelaxNGFree(self._c_schema)
 * 
 */

static void __pyx_pf_4lxml_5etree_7RelaxNG_2__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pf_4lxml_5etree_7RelaxNG_2__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannySetupContext("__dealloc__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":94
 * 
 *     def __dealloc__(self):
 *         relaxng.xmlRelaxNGFree(self._c_schema)             # <<<<<<<<<<<<<<
 * 
 *     def __call__(self, etree):
 */
  xmlRelaxNGFree(((struct __pyx_obj_4lxml_5etree_RelaxNG *)__pyx_v_self)->_c_schema);

  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":96
 *         relaxng.xmlRelaxNGFree(self._c_schema)
 * 
 *     def __call__(self, etree):             # <<<<<<<<<<<<<<
 *         u"""__call__(self, etree)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_7RelaxNG_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_7RelaxNG_3__call__[] = "__call__(self, etree)\n\n        Validate doc using Relax NG.\n\n        Returns true if document is valid, false if not.";
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_7RelaxNG_3__call__;
static PyObject *__pyx_pf_4lxml_5etree_7RelaxNG_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_etree = 0;
  struct LxmlDocument *__pyx_v_doc;
  struct LxmlElement *__pyx_v_root_node;
  xmlDoc *__pyx_v_c_doc;
  xmlRelaxNGValidCtxt *__pyx_v_valid_ctxt;
  int __pyx_v_ret;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  xmlDoc *__pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__etree,0};
  __Pyx_RefNannySetupContext("__call__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[1] = {0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__etree);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__call__") < 0)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_etree = values[0];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_etree = PyTuple_GET_ITEM(__pyx_args, 0);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[21]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.RelaxNG.__call__");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_doc = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_root_node = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":108
 *         cdef int ret
 * 
 *         assert self._c_schema is not NULL, "RelaxNG instance not initialised"             # <<<<<<<<<<<<<<
 *         doc = _documentOrRaise(etree)
 *         root_node = _rootNodeOrRaise(etree)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!(((struct __pyx_obj_4lxml_5etree_RelaxNG *)__pyx_v_self)->_c_schema != NULL))) {
    PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_402));
    {__pyx_filename = __pyx_f[21]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":109
 * 
 *         assert self._c_schema is not NULL, "RelaxNG instance not initialised"
 *         doc = _documentOrRaise(etree)             # <<<<<<<<<<<<<<
 *         root_node = _rootNodeOrRaise(etree)
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_doc));
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":110
 *         assert self._c_schema is not NULL, "RelaxNG instance not initialised"
 *         doc = _documentOrRaise(etree)
 *         root_node = _rootNodeOrRaise(etree)             # <<<<<<<<<<<<<<
 * 
 *         self._error_log.connect()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_root_node));
  __pyx_v_root_node = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":112
 *         root_node = _rootNodeOrRaise(etree)
 * 
 *         self._error_log.connect()             # <<<<<<<<<<<<<<
 *         valid_ctxt = relaxng.xmlRelaxNGNewValidCtxt(self._c_schema)
 *         if valid_ctxt is NULL:
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)((struct __pyx_obj_4lxml_5etree_RelaxNG *)__pyx_v_self)->__pyx_base._error_log->__pyx_base.__pyx_base.__pyx_vtab)->connect(((struct __pyx_obj_4lxml_5etree_RelaxNG *)__pyx_v_self)->__pyx_base._error_log);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":113
 * 
 *         self._error_log.connect()
 *         valid_ctxt = relaxng.xmlRelaxNGNewValidCtxt(self._c_schema)             # <<<<<<<<<<<<<<
 *         if valid_ctxt is NULL:
 *             self._error_log.disconnect()
 */
  __pyx_v_valid_ctxt = xmlRelaxNGNewValidCtxt(((struct __pyx_obj_4lxml_5etree_RelaxNG *)__pyx_v_self)->_c_schema);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":114
 *         self._error_log.connect()
 *         valid_ctxt = relaxng.xmlRelaxNGNewValidCtxt(self._c_schema)
 *         if valid_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             self._error_log.disconnect()
 *             python.PyErr_NoMemory()
 */
  __pyx_t_2 = (__pyx_v_valid_ctxt == NULL);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":115
 *         valid_ctxt = relaxng.xmlRelaxNGNewValidCtxt(self._c_schema)
 *         if valid_ctxt is NULL:
 *             self._error_log.disconnect()             # <<<<<<<<<<<<<<
 *             python.PyErr_NoMemory()
 * 
 */
    ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)((struct __pyx_obj_4lxml_5etree_RelaxNG *)__pyx_v_self)->__pyx_base._error_log->__pyx_base.__pyx_base.__pyx_vtab)->disconnect(((struct __pyx_obj_4lxml_5etree_RelaxNG *)__pyx_v_self)->__pyx_base._error_log);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":116
 *         if valid_ctxt is NULL:
 *             self._error_log.disconnect()
 *             python.PyErr_NoMemory()             # <<<<<<<<<<<<<<
 * 
 *         c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 */
    __pyx_t_1 = PyErr_NoMemory(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":118
 *             python.PyErr_NoMemory()
 * 
 *         c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)             # <<<<<<<<<<<<<<
 *         with nogil:
 *             ret = relaxng.xmlRelaxNGValidateDoc(valid_ctxt, c_doc)
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree__fakeRootDoc(__pyx_v_doc->_c_doc, __pyx_v_root_node->_c_node); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_doc = __pyx_t_3;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":119
 * 
 *         c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *         with nogil:             # <<<<<<<<<<<<<<
 *             ret = relaxng.xmlRelaxNGValidateDoc(valid_ctxt, c_doc)
 *         _destroyFakeDoc(doc._c_doc, c_doc)
 */
  {
    #ifdef WITH_THREAD
    PyThreadState *_save;
    #endif
    Py_UNBLOCK_THREADS
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":120
 *         c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *         with nogil:
 *             ret = relaxng.xmlRelaxNGValidateDoc(valid_ctxt, c_doc)             # <<<<<<<<<<<<<<
 *         _destroyFakeDoc(doc._c_doc, c_doc)
 * 
 */
      __pyx_v_ret = xmlRelaxNGValidateDoc(__pyx_v_valid_ctxt, __pyx_v_c_doc);
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":119
 * 
 *         c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *         with nogil:             # <<<<<<<<<<<<<<
 *             ret = relaxng.xmlRelaxNGValidateDoc(valid_ctxt, c_doc)
 *         _destroyFakeDoc(doc._c_doc, c_doc)
 */
    /*finally:*/ {
      Py_BLOCK_THREADS
    }
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":121
 *         with nogil:
 *             ret = relaxng.xmlRelaxNGValidateDoc(valid_ctxt, c_doc)
 *         _destroyFakeDoc(doc._c_doc, c_doc)             # <<<<<<<<<<<<<<
 * 
 *         relaxng.xmlRelaxNGFreeValidCtxt(valid_ctxt)
 */
  __pyx_f_4lxml_5etree__destroyFakeDoc(__pyx_v_doc->_c_doc, __pyx_v_c_doc);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":123
 *         _destroyFakeDoc(doc._c_doc, c_doc)
 * 
 *         relaxng.xmlRelaxNGFreeValidCtxt(valid_ctxt)             # <<<<<<<<<<<<<<
 * 
 *         self._error_log.disconnect()
 */
  xmlRelaxNGFreeValidCtxt(__pyx_v_valid_ctxt);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":125
 *         relaxng.xmlRelaxNGFreeValidCtxt(valid_ctxt)
 * 
 *         self._error_log.disconnect()             # <<<<<<<<<<<<<<
 *         if ret == -1:
 *             raise RelaxNGValidateError(
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)((struct __pyx_obj_4lxml_5etree_RelaxNG *)__pyx_v_self)->__pyx_base._error_log->__pyx_base.__pyx_base.__pyx_vtab)->disconnect(((struct __pyx_obj_4lxml_5etree_RelaxNG *)__pyx_v_self)->__pyx_base._error_log);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":126
 * 
 *         self._error_log.disconnect()
 *         if ret == -1:             # <<<<<<<<<<<<<<
 *             raise RelaxNGValidateError(
 *                 u"Internal error in Relax NG validation",
 */
  __pyx_t_2 = (__pyx_v_ret == -1);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":127
 *         self._error_log.disconnect()
 *         if ret == -1:
 *             raise RelaxNGValidateError(             # <<<<<<<<<<<<<<
 *                 u"Internal error in Relax NG validation",
 *                 self._error_log)
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s_403); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":129
 *             raise RelaxNGValidateError(
 *                 u"Internal error in Relax NG validation",
 *                 self._error_log)             # <<<<<<<<<<<<<<
 *         if ret == 0:
 *             return True
 */
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_INCREF(((PyObject *)__pyx_kp_u_404));
    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_404));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_404));
    __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_RelaxNG *)__pyx_v_self)->__pyx_base._error_log));
    PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)((struct __pyx_obj_4lxml_5etree_RelaxNG *)__pyx_v_self)->__pyx_base._error_log));
    __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_RelaxNG *)__pyx_v_self)->__pyx_base._error_log));
    __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_5, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    {__pyx_filename = __pyx_f[21]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L10;
  }
  __pyx_L10:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":130
 *                 u"Internal error in Relax NG validation",
 *                 self._error_log)
 *         if ret == 0:             # <<<<<<<<<<<<<<
 *             return True
 *         else:
 */
  __pyx_t_2 = (__pyx_v_ret == 0);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":131
 *                 self._error_log)
 *         if ret == 0:
 *             return True             # <<<<<<<<<<<<<<
 *         else:
 *             return False
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;
    goto __pyx_L11;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":133
 *             return True
 *         else:
 *             return False             # <<<<<<<<<<<<<<
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;
  }
  __pyx_L11:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.RelaxNG.__call__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_doc);
  __Pyx_DECREF((PyObject *)__pyx_v_root_node);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":39
 *     cdef bint _has_default_attributes
 *     cdef bint _add_attribute_defaults
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._c_schema = NULL
 *         self._has_default_attributes = True # play safe
 */

static int __pyx_pf_4lxml_5etree_9XMLSchema___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_9XMLSchema___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("__cinit__");
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":40
 *     cdef bint _add_attribute_defaults
 *     def __cinit__(self):
 *         self._c_schema = NULL             # <<<<<<<<<<<<<<
 *         self._has_default_attributes = True # play safe
 *         self._add_attribute_defaults = False
 */
  ((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_v_self)->_c_schema = NULL;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":41
 *     def __cinit__(self):
 *         self._c_schema = NULL
 *         self._has_default_attributes = True # play safe             # <<<<<<<<<<<<<<
 *         self._add_attribute_defaults = False
 * 
 */
  ((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_v_self)->_has_default_attributes = 1;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":42
 *         self._c_schema = NULL
 *         self._has_default_attributes = True # play safe
 *         self._add_attribute_defaults = False             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, etree=None, *, file=None, attribute_defaults=False):
 */
  ((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_v_self)->_add_attribute_defaults = 0;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":44
 *         self._add_attribute_defaults = False
 * 
 *     def __init__(self, etree=None, *, file=None, attribute_defaults=False):             # <<<<<<<<<<<<<<
 *         cdef _Document doc
 *         cdef _Element root_node
 */

static int __pyx_pf_4lxml_5etree_9XMLSchema_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_9XMLSchema_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_etree = 0;
  PyObject *__pyx_v_file = 0;
  PyObject *__pyx_v_attribute_defaults = 0;
  struct LxmlDocument *__pyx_v_doc;
  struct LxmlElement *__pyx_v_root_node;
  xmlDoc *__pyx_v_fake_c_doc;
  xmlNode *__pyx_v_c_node;
  char *__pyx_v_c_href;
  xmlSchemaParserCtxt *__pyx_v_parser_ctxt;
  PyObject *__pyx_v_filename;
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  xmlDoc *__pyx_t_7;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__etree,&__pyx_n_s__file,&__pyx_n_s__attribute_defaults,0};
  __Pyx_RefNannySetupContext("__init__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((PyObject *)Py_None);
    values[2] = __pyx_k_407;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__etree);
        if (value) { values[0] = value; kw_args--; }
      }
    }
    while (kw_args > 0) {
      PyObject* value;
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__file);
      if (value) { values[1] = value; if (!(--kw_args)) break; }
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__attribute_defaults);
      if (value) { values[2] = value; if (!(--kw_args)) break; }
      break;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_etree = values[0];
    __pyx_v_file = values[1];
    __pyx_v_attribute_defaults = values[2];
  } else {
    __pyx_v_etree = ((PyObject *)Py_None);
    __pyx_v_file = ((PyObject *)Py_None);
    __pyx_v_attribute_defaults = __pyx_k_407;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: __pyx_v_etree = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[22]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.XMLSchema.__init__");
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_doc = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_root_node = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_filename = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":52
 *         cdef xmlschema.xmlSchemaParserCtxt* parser_ctxt
 * 
 *         self._add_attribute_defaults = attribute_defaults             # <<<<<<<<<<<<<<
 *         _Validator.__init__(self)
 *         fake_c_doc = NULL
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_attribute_defaults); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_v_self)->_add_attribute_defaults = __pyx_t_1;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":53
 * 
 *         self._add_attribute_defaults = attribute_defaults
 *         _Validator.__init__(self)             # <<<<<<<<<<<<<<
 *         fake_c_doc = NULL
 *         if etree is not None:
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Validator)), __pyx_n_s____init__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":54
 *         self._add_attribute_defaults = attribute_defaults
 *         _Validator.__init__(self)
 *         fake_c_doc = NULL             # <<<<<<<<<<<<<<
 *         if etree is not None:
 *             doc = _documentOrRaise(etree)
 */
  __pyx_v_fake_c_doc = NULL;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":55
 *         _Validator.__init__(self)
 *         fake_c_doc = NULL
 *         if etree is not None:             # <<<<<<<<<<<<<<
 *             doc = _documentOrRaise(etree)
 *             root_node = _rootNodeOrRaise(etree)
 */
  __pyx_t_1 = (__pyx_v_etree != Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":56
 *         fake_c_doc = NULL
 *         if etree is not None:
 *             doc = _documentOrRaise(etree)             # <<<<<<<<<<<<<<
 *             root_node = _rootNodeOrRaise(etree)
 * 
 */
    __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(((PyObject *)__pyx_v_doc));
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":57
 *         if etree is not None:
 *             doc = _documentOrRaise(etree)
 *             root_node = _rootNodeOrRaise(etree)             # <<<<<<<<<<<<<<
 * 
 *             # work around for libxml2 bug if document is not XML schema at all
 */
    __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(((PyObject *)__pyx_v_root_node));
    __pyx_v_root_node = ((struct LxmlElement *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":60
 * 
 *             # work around for libxml2 bug if document is not XML schema at all
 *             if _LIBXML_VERSION_INT < 20624:             # <<<<<<<<<<<<<<
 *                 c_node = root_node._c_node
 *                 c_href = _getNs(c_node)
 */
    __pyx_t_1 = (__pyx_v_4lxml_5etree__LIBXML_VERSION_INT < 20624);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":61
 *             # work around for libxml2 bug if document is not XML schema at all
 *             if _LIBXML_VERSION_INT < 20624:
 *                 c_node = root_node._c_node             # <<<<<<<<<<<<<<
 *                 c_href = _getNs(c_node)
 *                 if c_href is NULL or \
 */
      __pyx_v_c_node = __pyx_v_root_node->_c_node;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":62
 *             if _LIBXML_VERSION_INT < 20624:
 *                 c_node = root_node._c_node
 *                 c_href = _getNs(c_node)             # <<<<<<<<<<<<<<
 *                 if c_href is NULL or \
 *                        cstd.strcmp(c_href, 'http://www.w3.org/2001/XMLSchema') != 0:
 */
      __pyx_v_c_href = _getNs(__pyx_v_c_node);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":63
 *                 c_node = root_node._c_node
 *                 c_href = _getNs(c_node)
 *                 if c_href is NULL or \             # <<<<<<<<<<<<<<
 *                        cstd.strcmp(c_href, 'http://www.w3.org/2001/XMLSchema') != 0:
 *                     raise XMLSchemaParseError, u"Document is not XML Schema"
 */
      __pyx_t_1 = (__pyx_v_c_href == NULL);
      if (!__pyx_t_1) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":64
 *                 c_href = _getNs(c_node)
 *                 if c_href is NULL or \
 *                        cstd.strcmp(c_href, 'http://www.w3.org/2001/XMLSchema') != 0:             # <<<<<<<<<<<<<<
 *                     raise XMLSchemaParseError, u"Document is not XML Schema"
 * 
 */
        __pyx_t_5 = (strcmp(__pyx_v_c_href, __pyx_k_408) != 0);
        __pyx_t_6 = __pyx_t_5;
      } else {
        __pyx_t_6 = __pyx_t_1;
      }
      if (__pyx_t_6) {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":65
 *                 if c_href is NULL or \
 *                        cstd.strcmp(c_href, 'http://www.w3.org/2001/XMLSchema') != 0:
 *                     raise XMLSchemaParseError, u"Document is not XML Schema"             # <<<<<<<<<<<<<<
 * 
 *             fake_c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 */
        __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__XMLSchemaParseError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_Raise(__pyx_t_4, ((PyObject *)__pyx_kp_u_409), 0);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        {__pyx_filename = __pyx_f[22]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L8;
      }
      __pyx_L8:;
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":67
 *                     raise XMLSchemaParseError, u"Document is not XML Schema"
 * 
 *             fake_c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)             # <<<<<<<<<<<<<<
 *             self._error_log.connect()
 *             parser_ctxt = xmlschema.xmlSchemaNewDocParserCtxt(fake_c_doc)
 */
    __pyx_t_7 = __pyx_f_4lxml_5etree__fakeRootDoc(__pyx_v_doc->_c_doc, __pyx_v_root_node->_c_node); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_fake_c_doc = __pyx_t_7;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":68
 * 
 *             fake_c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *             self._error_log.connect()             # <<<<<<<<<<<<<<
 *             parser_ctxt = xmlschema.xmlSchemaNewDocParserCtxt(fake_c_doc)
 *         elif file is not None:
 */
    ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_v_self)->__pyx_base._error_log->__pyx_base.__pyx_base.__pyx_vtab)->connect(((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_v_self)->__pyx_base._error_log);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":69
 *             fake_c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *             self._error_log.connect()
 *             parser_ctxt = xmlschema.xmlSchemaNewDocParserCtxt(fake_c_doc)             # <<<<<<<<<<<<<<
 *         elif file is not None:
 *             if _isString(file):
 */
    __pyx_v_parser_ctxt = xmlSchemaNewDocParserCtxt(__pyx_v_fake_c_doc);
    goto __pyx_L6;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":70
 *             self._error_log.connect()
 *             parser_ctxt = xmlschema.xmlSchemaNewDocParserCtxt(fake_c_doc)
 *         elif file is not None:             # <<<<<<<<<<<<<<
 *             if _isString(file):
 *                 doc = None
 */
  __pyx_t_6 = (__pyx_v_file != Py_None);
  if (__pyx_t_6) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":71
 *             parser_ctxt = xmlschema.xmlSchemaNewDocParserCtxt(fake_c_doc)
 *         elif file is not None:
 *             if _isString(file):             # <<<<<<<<<<<<<<
 *                 doc = None
 *                 filename = _encodeFilename(file)
 */
    __pyx_t_6 = _isString(__pyx_v_file);
    if (__pyx_t_6) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":72
 *         elif file is not None:
 *             if _isString(file):
 *                 doc = None             # <<<<<<<<<<<<<<
 *                 filename = _encodeFilename(file)
 *                 self._error_log.connect()
 */
      __Pyx_INCREF(Py_None);
      __Pyx_DECREF(((PyObject *)__pyx_v_doc));
      __pyx_v_doc = ((struct LxmlDocument *)Py_None);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":73
 *             if _isString(file):
 *                 doc = None
 *                 filename = _encodeFilename(file)             # <<<<<<<<<<<<<<
 *                 self._error_log.connect()
 *                 parser_ctxt = xmlschema.xmlSchemaNewParserCtxt(_cstr(filename))
 */
      __pyx_t_4 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_file); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_v_filename);
      __pyx_v_filename = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":74
 *                 doc = None
 *                 filename = _encodeFilename(file)
 *                 self._error_log.connect()             # <<<<<<<<<<<<<<
 *                 parser_ctxt = xmlschema.xmlSchemaNewParserCtxt(_cstr(filename))
 *             else:
 */
      ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_v_self)->__pyx_base._error_log->__pyx_base.__pyx_base.__pyx_vtab)->connect(((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_v_self)->__pyx_base._error_log);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":75
 *                 filename = _encodeFilename(file)
 *                 self._error_log.connect()
 *                 parser_ctxt = xmlschema.xmlSchemaNewParserCtxt(_cstr(filename))             # <<<<<<<<<<<<<<
 *             else:
 *                 doc = _parseDocument(file, None, None)
 */
      __pyx_v_parser_ctxt = xmlSchemaNewParserCtxt(PyBytes_AS_STRING(__pyx_v_filename));
      goto __pyx_L9;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":77
 *                 parser_ctxt = xmlschema.xmlSchemaNewParserCtxt(_cstr(filename))
 *             else:
 *                 doc = _parseDocument(file, None, None)             # <<<<<<<<<<<<<<
 *                 self._error_log.connect()
 *                 parser_ctxt = xmlschema.xmlSchemaNewDocParserCtxt(doc._c_doc)
 */
      __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__parseDocument(__pyx_v_file, ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None), Py_None)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(((PyObject *)__pyx_v_doc));
      __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":78
 *             else:
 *                 doc = _parseDocument(file, None, None)
 *                 self._error_log.connect()             # <<<<<<<<<<<<<<
 *                 parser_ctxt = xmlschema.xmlSchemaNewDocParserCtxt(doc._c_doc)
 *         else:
 */
      ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_v_self)->__pyx_base._error_log->__pyx_base.__pyx_base.__pyx_vtab)->connect(((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_v_self)->__pyx_base._error_log);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":79
 *                 doc = _parseDocument(file, None, None)
 *                 self._error_log.connect()
 *                 parser_ctxt = xmlschema.xmlSchemaNewDocParserCtxt(doc._c_doc)             # <<<<<<<<<<<<<<
 *         else:
 *             raise XMLSchemaParseError, u"No tree or file given"
 */
      __pyx_v_parser_ctxt = xmlSchemaNewDocParserCtxt(__pyx_v_doc->_c_doc);
    }
    __pyx_L9:;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":81
 *                 parser_ctxt = xmlschema.xmlSchemaNewDocParserCtxt(doc._c_doc)
 *         else:
 *             raise XMLSchemaParseError, u"No tree or file given"             # <<<<<<<<<<<<<<
 * 
 *         if parser_ctxt is not NULL:
 */
    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__XMLSchemaParseError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_Raise(__pyx_t_4, ((PyObject *)__pyx_kp_u_399), 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[22]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":83
 *             raise XMLSchemaParseError, u"No tree or file given"
 * 
 *         if parser_ctxt is not NULL:             # <<<<<<<<<<<<<<
 *             if doc is None:
 *                 with nogil:
 */
  __pyx_t_6 = (__pyx_v_parser_ctxt != NULL);
  if (__pyx_t_6) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":84
 * 
 *         if parser_ctxt is not NULL:
 *             if doc is None:             # <<<<<<<<<<<<<<
 *                 with nogil:
 *                     self._c_schema = xmlschema.xmlSchemaParse(parser_ctxt)
 */
    __pyx_t_6 = (((PyObject *)__pyx_v_doc) == Py_None);
    if (__pyx_t_6) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":85
 *         if parser_ctxt is not NULL:
 *             if doc is None:
 *                 with nogil:             # <<<<<<<<<<<<<<
 *                     self._c_schema = xmlschema.xmlSchemaParse(parser_ctxt)
 *             else:
 */
      {
        #ifdef WITH_THREAD
        PyThreadState *_save;
        #endif
        Py_UNBLOCK_THREADS
        /*try:*/ {

          /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":86
 *             if doc is None:
 *                 with nogil:
 *                     self._c_schema = xmlschema.xmlSchemaParse(parser_ctxt)             # <<<<<<<<<<<<<<
 *             else:
 *                 # calling xmlSchemaParse on a schema with imports or
 */
          ((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_v_self)->_c_schema = xmlSchemaParse(__pyx_v_parser_ctxt);
        }

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":85
 *         if parser_ctxt is not NULL:
 *             if doc is None:
 *                 with nogil:             # <<<<<<<<<<<<<<
 *                     self._c_schema = xmlschema.xmlSchemaParse(parser_ctxt)
 *             else:
 */
        /*finally:*/ {
          Py_BLOCK_THREADS
        }
      }
      goto __pyx_L11;
    }
    /*else*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":92
 *                 # context for parsing, so push an implied context to route
 *                 # resolve requests to the document's parser
 *                 __GLOBAL_PARSER_CONTEXT.pushImpliedContextFromParser(doc._parser)             # <<<<<<<<<<<<<<
 *                 self._c_schema = xmlschema.xmlSchemaParse(parser_ctxt)
 *                 __GLOBAL_PARSER_CONTEXT.popImpliedContext()
 */
      __pyx_t_4 = ((PyObject *)__pyx_v_doc->_parser);
      __Pyx_INCREF(__pyx_t_4);
      ((struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext *)__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT->__pyx_vtab)->pushImpliedContextFromParser(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_4));
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":93
 *                 # resolve requests to the document's parser
 *                 __GLOBAL_PARSER_CONTEXT.pushImpliedContextFromParser(doc._parser)
 *                 self._c_schema = xmlschema.xmlSchemaParse(parser_ctxt)             # <<<<<<<<<<<<<<
 *                 __GLOBAL_PARSER_CONTEXT.popImpliedContext()
 * 
 */
      ((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_v_self)->_c_schema = xmlSchemaParse(__pyx_v_parser_ctxt);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":94
 *                 __GLOBAL_PARSER_CONTEXT.pushImpliedContextFromParser(doc._parser)
 *                 self._c_schema = xmlschema.xmlSchemaParse(parser_ctxt)
 *                 __GLOBAL_PARSER_CONTEXT.popImpliedContext()             # <<<<<<<<<<<<<<
 * 
 *             if _LIBXML_VERSION_INT >= 20624:
 */
      ((struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext *)__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT->__pyx_vtab)->popImpliedContext(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT);
    }
    __pyx_L11:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":96
 *                 __GLOBAL_PARSER_CONTEXT.popImpliedContext()
 * 
 *             if _LIBXML_VERSION_INT >= 20624:             # <<<<<<<<<<<<<<
 *                 xmlschema.xmlSchemaFreeParserCtxt(parser_ctxt)
 * 
 */
    __pyx_t_6 = (__pyx_v_4lxml_5etree__LIBXML_VERSION_INT >= 20624);
    if (__pyx_t_6) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":97
 * 
 *             if _LIBXML_VERSION_INT >= 20624:
 *                 xmlschema.xmlSchemaFreeParserCtxt(parser_ctxt)             # <<<<<<<<<<<<<<
 * 
 *         self._error_log.disconnect()
 */
      xmlSchemaFreeParserCtxt(__pyx_v_parser_ctxt);
      goto __pyx_L15;
    }
    __pyx_L15:;
    goto __pyx_L10;
  }
  __pyx_L10:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":99
 *                 xmlschema.xmlSchemaFreeParserCtxt(parser_ctxt)
 * 
 *         self._error_log.disconnect()             # <<<<<<<<<<<<<<
 * 
 *         if fake_c_doc is not NULL:
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_v_self)->__pyx_base._error_log->__pyx_base.__pyx_base.__pyx_vtab)->disconnect(((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_v_self)->__pyx_base._error_log);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":101
 *         self._error_log.disconnect()
 * 
 *         if fake_c_doc is not NULL:             # <<<<<<<<<<<<<<
 *             _destroyFakeDoc(doc._c_doc, fake_c_doc)
 * 
 */
  __pyx_t_6 = (__pyx_v_fake_c_doc != NULL);
  if (__pyx_t_6) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":102
 * 
 *         if fake_c_doc is not NULL:
 *             _destroyFakeDoc(doc._c_doc, fake_c_doc)             # <<<<<<<<<<<<<<
 * 
 *         if self._c_schema is NULL:
 */
    __pyx_f_4lxml_5etree__destroyFakeDoc(__pyx_v_doc->_c_doc, __pyx_v_fake_c_doc);
    goto __pyx_L16;
  }
  __pyx_L16:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":104
 *             _destroyFakeDoc(doc._c_doc, fake_c_doc)
 * 
 *         if self._c_schema is NULL:             # <<<<<<<<<<<<<<
 *             raise XMLSchemaParseError(
 *                 self._error_log._buildExceptionMessage(
 */
  __pyx_t_6 = (((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_v_self)->_c_schema == NULL);
  if (__pyx_t_6) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":105
 * 
 *         if self._c_schema is NULL:
 *             raise XMLSchemaParseError(             # <<<<<<<<<<<<<<
 *                 self._error_log._buildExceptionMessage(
 *                     u"Document is not valid XML Schema"),
 */
    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__XMLSchemaParseError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":106
 *         if self._c_schema is NULL:
 *             raise XMLSchemaParseError(
 *                 self._error_log._buildExceptionMessage(             # <<<<<<<<<<<<<<
 *                     u"Document is not valid XML Schema"),
 *                 self._error_log)
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_v_self)->__pyx_base._error_log->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._buildExceptionMessage(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_v_self)->__pyx_base._error_log), ((PyObject *)__pyx_kp_u_410)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":108
 *                 self._error_log._buildExceptionMessage(
 *                     u"Document is not valid XML Schema"),
 *                 self._error_log)             # <<<<<<<<<<<<<<
 * 
 *         if doc is not None:
 */
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_v_self)->__pyx_base._error_log));
    PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_v_self)->__pyx_base._error_log));
    __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_v_self)->__pyx_base._error_log));
    __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[22]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L17;
  }
  __pyx_L17:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":110
 *                 self._error_log)
 * 
 *         if doc is not None:             # <<<<<<<<<<<<<<
 *             self._has_default_attributes = _check_for_default_attributes(doc)
 *         self._add_attribute_defaults = attribute_defaults and \
 */
  __pyx_t_6 = (((PyObject *)__pyx_v_doc) != Py_None);
  if (__pyx_t_6) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":111
 * 
 *         if doc is not None:
 *             self._has_default_attributes = _check_for_default_attributes(doc)             # <<<<<<<<<<<<<<
 *         self._add_attribute_defaults = attribute_defaults and \
 *                                        self._has_default_attributes
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_INCREF(((PyObject *)__pyx_v_doc));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_doc));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_doc));
    __pyx_t_2 = PyObject_Call(((PyObject *)__pyx_v_4lxml_5etree__check_for_default_attributes), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    ((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_v_self)->_has_default_attributes = __pyx_t_6;
    goto __pyx_L18;
  }
  __pyx_L18:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":112
 *         if doc is not None:
 *             self._has_default_attributes = _check_for_default_attributes(doc)
 *         self._add_attribute_defaults = attribute_defaults and \             # <<<<<<<<<<<<<<
 *                                        self._has_default_attributes
 * 
 */
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_attribute_defaults); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_6) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":113
 *             self._has_default_attributes = _check_for_default_attributes(doc)
 *         self._add_attribute_defaults = attribute_defaults and \
 *                                        self._has_default_attributes             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
    __pyx_t_2 = __Pyx_PyBool_FromLong(((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_v_self)->_has_default_attributes); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __pyx_t_2;
    __pyx_t_2 = 0;
  } else {
    __Pyx_INCREF(__pyx_v_attribute_defaults);
    __pyx_t_3 = __pyx_v_attribute_defaults;
  }
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":112
 *         if doc is not None:
 *             self._has_default_attributes = _check_for_default_attributes(doc)
 *         self._add_attribute_defaults = attribute_defaults and \             # <<<<<<<<<<<<<<
 *                                        self._has_default_attributes
 * 
 */
  ((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_v_self)->_add_attribute_defaults = __pyx_t_6;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.XMLSchema.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_doc);
  __Pyx_DECREF((PyObject *)__pyx_v_root_node);
  __Pyx_DECREF(__pyx_v_filename);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":115
 *                                        self._has_default_attributes
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         xmlschema.xmlSchemaFree(self._c_schema)
 * 
 */

static void __pyx_pf_4lxml_5etree_9XMLSchema_2__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pf_4lxml_5etree_9XMLSchema_2__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannySetupContext("__dealloc__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":116
 * 
 *     def __dealloc__(self):
 *         xmlschema.xmlSchemaFree(self._c_schema)             # <<<<<<<<<<<<<<
 * 
 *     def __call__(self, etree):
 */
  xmlSchemaFree(((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_v_self)->_c_schema);

  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":118
 *         xmlschema.xmlSchemaFree(self._c_schema)
 * 
 *     def __call__(self, etree):             # <<<<<<<<<<<<<<
 *         u"""__call__(self, etree)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_9XMLSchema_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_9XMLSchema_3__call__[] = "__call__(self, etree)\n\n        Validate doc using XML Schema.\n\n        Returns true if document is valid, false if not.\n        ";
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_9XMLSchema_3__call__;
static PyObject *__pyx_pf_4lxml_5etree_9XMLSchema_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_etree = 0;
  xmlSchemaValidCtxt *__pyx_v_valid_ctxt;
  struct LxmlDocument *__pyx_v_doc;
  struct LxmlElement *__pyx_v_root_node;
  xmlDoc *__pyx_v_c_doc;
  int __pyx_v_ret;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  xmlDoc *__pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__etree,0};
  __Pyx_RefNannySetupContext("__call__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[1] = {0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__etree);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__call__") < 0)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_etree = values[0];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_etree = PyTuple_GET_ITEM(__pyx_args, 0);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[22]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.XMLSchema.__call__");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_doc = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_root_node = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":131
 *         cdef int ret
 * 
 *         assert self._c_schema is not NULL, "Schema instance not initialised"             # <<<<<<<<<<<<<<
 *         doc = _documentOrRaise(etree)
 *         root_node = _rootNodeOrRaise(etree)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!(((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_v_self)->_c_schema != NULL))) {
    PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_411));
    {__pyx_filename = __pyx_f[22]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":132
 * 
 *         assert self._c_schema is not NULL, "Schema instance not initialised"
 *         doc = _documentOrRaise(etree)             # <<<<<<<<<<<<<<
 *         root_node = _rootNodeOrRaise(etree)
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_doc));
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":133
 *         assert self._c_schema is not NULL, "Schema instance not initialised"
 *         doc = _documentOrRaise(etree)
 *         root_node = _rootNodeOrRaise(etree)             # <<<<<<<<<<<<<<
 * 
 *         self._error_log.connect()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_root_node));
  __pyx_v_root_node = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":135
 *         root_node = _rootNodeOrRaise(etree)
 * 
 *         self._error_log.connect()             # <<<<<<<<<<<<<<
 *         valid_ctxt = xmlschema.xmlSchemaNewValidCtxt(self._c_schema)
 *         if valid_ctxt is NULL:
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_v_self)->__pyx_base._error_log->__pyx_base.__pyx_base.__pyx_vtab)->connect(((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_v_self)->__pyx_base._error_log);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":136
 * 
 *         self._error_log.connect()
 *         valid_ctxt = xmlschema.xmlSchemaNewValidCtxt(self._c_schema)             # <<<<<<<<<<<<<<
 *         if valid_ctxt is NULL:
 *             self._error_log.disconnect()
 */
  __pyx_v_valid_ctxt = xmlSchemaNewValidCtxt(((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_v_self)->_c_schema);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":137
 *         self._error_log.connect()
 *         valid_ctxt = xmlschema.xmlSchemaNewValidCtxt(self._c_schema)
 *         if valid_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             self._error_log.disconnect()
 *             return python.PyErr_NoMemory()
 */
  __pyx_t_2 = (__pyx_v_valid_ctxt == NULL);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":138
 *         valid_ctxt = xmlschema.xmlSchemaNewValidCtxt(self._c_schema)
 *         if valid_ctxt is NULL:
 *             self._error_log.disconnect()             # <<<<<<<<<<<<<<
 *             return python.PyErr_NoMemory()
 * 
 */
    ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_v_self)->__pyx_base._error_log->__pyx_base.__pyx_base.__pyx_vtab)->disconnect(((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_v_self)->__pyx_base._error_log);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":139
 *         if valid_ctxt is NULL:
 *             self._error_log.disconnect()
 *             return python.PyErr_NoMemory()             # <<<<<<<<<<<<<<
 * 
 *         if self._add_attribute_defaults:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = PyErr_NoMemory(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":141
 *             return python.PyErr_NoMemory()
 * 
 *         if self._add_attribute_defaults:             # <<<<<<<<<<<<<<
 *             xmlschema.xmlSchemaSetValidOptions(
 *                 valid_ctxt, xmlschema.XML_SCHEMA_VAL_VC_I_CREATE)
 */
  if (((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_v_self)->_add_attribute_defaults) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":143
 *         if self._add_attribute_defaults:
 *             xmlschema.xmlSchemaSetValidOptions(
 *                 valid_ctxt, xmlschema.XML_SCHEMA_VAL_VC_I_CREATE)             # <<<<<<<<<<<<<<
 * 
 *         c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 */
    xmlSchemaSetValidOptions(__pyx_v_valid_ctxt, XML_SCHEMA_VAL_VC_I_CREATE);
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":145
 *                 valid_ctxt, xmlschema.XML_SCHEMA_VAL_VC_I_CREATE)
 * 
 *         c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)             # <<<<<<<<<<<<<<
 *         with nogil:
 *             ret = xmlschema.xmlSchemaValidateDoc(valid_ctxt, c_doc)
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree__fakeRootDoc(__pyx_v_doc->_c_doc, __pyx_v_root_node->_c_node); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_doc = __pyx_t_3;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":146
 * 
 *         c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *         with nogil:             # <<<<<<<<<<<<<<
 *             ret = xmlschema.xmlSchemaValidateDoc(valid_ctxt, c_doc)
 *         _destroyFakeDoc(doc._c_doc, c_doc)
 */
  {
    #ifdef WITH_THREAD
    PyThreadState *_save;
    #endif
    Py_UNBLOCK_THREADS
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":147
 *         c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *         with nogil:
 *             ret = xmlschema.xmlSchemaValidateDoc(valid_ctxt, c_doc)             # <<<<<<<<<<<<<<
 *         _destroyFakeDoc(doc._c_doc, c_doc)
 * 
 */
      __pyx_v_ret = xmlSchemaValidateDoc(__pyx_v_valid_ctxt, __pyx_v_c_doc);
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":146
 * 
 *         c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *         with nogil:             # <<<<<<<<<<<<<<
 *             ret = xmlschema.xmlSchemaValidateDoc(valid_ctxt, c_doc)
 *         _destroyFakeDoc(doc._c_doc, c_doc)
 */
    /*finally:*/ {
      Py_BLOCK_THREADS
    }
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":148
 *         with nogil:
 *             ret = xmlschema.xmlSchemaValidateDoc(valid_ctxt, c_doc)
 *         _destroyFakeDoc(doc._c_doc, c_doc)             # <<<<<<<<<<<<<<
 * 
 *         xmlschema.xmlSchemaFreeValidCtxt(valid_ctxt)
 */
  __pyx_f_4lxml_5etree__destroyFakeDoc(__pyx_v_doc->_c_doc, __pyx_v_c_doc);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":150
 *         _destroyFakeDoc(doc._c_doc, c_doc)
 * 
 *         xmlschema.xmlSchemaFreeValidCtxt(valid_ctxt)             # <<<<<<<<<<<<<<
 * 
 *         self._error_log.disconnect()
 */
  xmlSchemaFreeValidCtxt(__pyx_v_valid_ctxt);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":152
 *         xmlschema.xmlSchemaFreeValidCtxt(valid_ctxt)
 * 
 *         self._error_log.disconnect()             # <<<<<<<<<<<<<<
 *         if ret == -1:
 *             raise XMLSchemaValidateError(
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_v_self)->__pyx_base._error_log->__pyx_base.__pyx_base.__pyx_vtab)->disconnect(((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_v_self)->__pyx_base._error_log);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":153
 * 
 *         self._error_log.disconnect()
 *         if ret == -1:             # <<<<<<<<<<<<<<
 *             raise XMLSchemaValidateError(
 *                 u"Internal error in XML Schema validation.",
 */
  __pyx_t_2 = (__pyx_v_ret == -1);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":154
 *         self._error_log.disconnect()
 *         if ret == -1:
 *             raise XMLSchemaValidateError(             # <<<<<<<<<<<<<<
 *                 u"Internal error in XML Schema validation.",
 *                 self._error_log)
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s_412); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":156
 *             raise XMLSchemaValidateError(
 *                 u"Internal error in XML Schema validation.",
 *                 self._error_log)             # <<<<<<<<<<<<<<
 *         if ret == 0:
 *             return True
 */
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_INCREF(((PyObject *)__pyx_kp_u_413));
    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_413));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_413));
    __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_v_self)->__pyx_base._error_log));
    PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_v_self)->__pyx_base._error_log));
    __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_v_self)->__pyx_base._error_log));
    __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_5, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    {__pyx_filename = __pyx_f[22]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L11;
  }
  __pyx_L11:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":157
 *                 u"Internal error in XML Schema validation.",
 *                 self._error_log)
 *         if ret == 0:             # <<<<<<<<<<<<<<
 *             return True
 *         else:
 */
  __pyx_t_2 = (__pyx_v_ret == 0);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":158
 *                 self._error_log)
 *         if ret == 0:
 *             return True             # <<<<<<<<<<<<<<
 *         else:
 *             return False
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;
    goto __pyx_L12;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":160
 *             return True
 *         else:
 *             return False             # <<<<<<<<<<<<<<
 * 
 *     cdef _ParserSchemaValidationContext _newSaxValidator(
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;
  }
  __pyx_L12:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.XMLSchema.__call__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_doc);
  __Pyx_DECREF((PyObject *)__pyx_v_root_node);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":162
 *             return False
 * 
 *     cdef _ParserSchemaValidationContext _newSaxValidator(             # <<<<<<<<<<<<<<
 *             self, bint add_default_attributes):
 *         cdef _ParserSchemaValidationContext context
 */

static  struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *__pyx_f_4lxml_5etree_9XMLSchema__newSaxValidator(struct __pyx_obj_4lxml_5etree_XMLSchema *__pyx_v_self, int __pyx_v_add_default_attributes) {
  struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *__pyx_v_context;
  struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("_newSaxValidator");
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":165
 *             self, bint add_default_attributes):
 *         cdef _ParserSchemaValidationContext context
 *         context = NEW_SCHEMA_CONTEXT(_ParserSchemaValidationContext)             # <<<<<<<<<<<<<<
 *         context._schema = self
 *         context._add_default_attributes = (self._has_default_attributes and (
 */
  __pyx_t_1 = ((PyObject *)PY_NEW(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ParserSchemaValidationContext)))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_context));
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":166
 *         cdef _ParserSchemaValidationContext context
 *         context = NEW_SCHEMA_CONTEXT(_ParserSchemaValidationContext)
 *         context._schema = self             # <<<<<<<<<<<<<<
 *         context._add_default_attributes = (self._has_default_attributes and (
 *             add_default_attributes or self._add_attribute_defaults))
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __Pyx_GOTREF(__pyx_v_context->_schema);
  __Pyx_DECREF(((PyObject *)__pyx_v_context->_schema));
  __pyx_v_context->_schema = __pyx_v_self;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":167
 *         context = NEW_SCHEMA_CONTEXT(_ParserSchemaValidationContext)
 *         context._schema = self
 *         context._add_default_attributes = (self._has_default_attributes and (             # <<<<<<<<<<<<<<
 *             add_default_attributes or self._add_attribute_defaults))
 *         return context
 */
  if (__pyx_v_self->_has_default_attributes) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":168
 *         context._schema = self
 *         context._add_default_attributes = (self._has_default_attributes and (
 *             add_default_attributes or self._add_attribute_defaults))             # <<<<<<<<<<<<<<
 *         return context
 * 
 */
    if (!__pyx_v_add_default_attributes) {
      __pyx_t_2 = __pyx_v_self->_add_attribute_defaults;
    } else {
      __pyx_t_2 = __pyx_v_add_default_attributes;
    }
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_v_self->_has_default_attributes;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":167
 *         context = NEW_SCHEMA_CONTEXT(_ParserSchemaValidationContext)
 *         context._schema = self
 *         context._add_default_attributes = (self._has_default_attributes and (             # <<<<<<<<<<<<<<
 *             add_default_attributes or self._add_attribute_defaults))
 *         return context
 */
  __pyx_v_context->_add_default_attributes = __pyx_t_3;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":169
 *         context._add_default_attributes = (self._has_default_attributes and (
 *             add_default_attributes or self._add_attribute_defaults))
 *         return context             # <<<<<<<<<<<<<<
 * 
 * cdef class _ParserSchemaValidationContext:
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_context));
  __pyx_r = __pyx_v_context;
  goto __pyx_L0;

  __pyx_r = ((struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.XMLSchema._newSaxValidator");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_context);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":176
 *     cdef xmlschema.xmlSchemaSAXPlugStruct* _sax_plug
 *     cdef bint _add_default_attributes
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._valid_ctxt = NULL
 *         self._sax_plug = NULL
 */

static int __pyx_pf_4lxml_5etree_30_ParserSchemaValidationContext___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_30_ParserSchemaValidationContext___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("__cinit__");
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":177
 *     cdef bint _add_default_attributes
 *     def __cinit__(self):
 *         self._valid_ctxt = NULL             # <<<<<<<<<<<<<<
 *         self._sax_plug = NULL
 *         self._add_default_attributes = False
 */
  ((struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *)__pyx_v_self)->_valid_ctxt = NULL;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":178
 *     def __cinit__(self):
 *         self._valid_ctxt = NULL
 *         self._sax_plug = NULL             # <<<<<<<<<<<<<<
 *         self._add_default_attributes = False
 * 
 */
  ((struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *)__pyx_v_self)->_sax_plug = NULL;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":179
 *         self._valid_ctxt = NULL
 *         self._sax_plug = NULL
 *         self._add_default_attributes = False             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  ((struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *)__pyx_v_self)->_add_default_attributes = 0;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":181
 *         self._add_default_attributes = False
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         self.disconnect()
 *         if self._valid_ctxt:
 */

static void __pyx_pf_4lxml_5etree_30_ParserSchemaValidationContext_1__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pf_4lxml_5etree_30_ParserSchemaValidationContext_1__dealloc__(PyObject *__pyx_v_self) {
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__dealloc__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":182
 * 
 *     def __dealloc__(self):
 *         self.disconnect()             # <<<<<<<<<<<<<<
 *         if self._valid_ctxt:
 *             xmlschema.xmlSchemaFreeValidCtxt(self._valid_ctxt)
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__ParserSchemaValidationContext *)((struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *)__pyx_v_self)->__pyx_vtab)->disconnect(((struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *)__pyx_v_self));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":183
 *     def __dealloc__(self):
 *         self.disconnect()
 *         if self._valid_ctxt:             # <<<<<<<<<<<<<<
 *             xmlschema.xmlSchemaFreeValidCtxt(self._valid_ctxt)
 * 
 */
  __pyx_t_1 = (((struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *)__pyx_v_self)->_valid_ctxt != 0);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":184
 *         self.disconnect()
 *         if self._valid_ctxt:
 *             xmlschema.xmlSchemaFreeValidCtxt(self._valid_ctxt)             # <<<<<<<<<<<<<<
 * 
 *     cdef _ParserSchemaValidationContext copy(self):
 */
    xmlSchemaFreeValidCtxt(((struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *)__pyx_v_self)->_valid_ctxt);
    goto __pyx_L5;
  }
  __pyx_L5:;

  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":186
 *             xmlschema.xmlSchemaFreeValidCtxt(self._valid_ctxt)
 * 
 *     cdef _ParserSchemaValidationContext copy(self):             # <<<<<<<<<<<<<<
 *         assert self._schema is not None, "_ParserSchemaValidationContext not initialised"
 *         return self._schema._newSaxValidator(
 */

static  struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *__pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_copy(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("copy");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":187
 * 
 *     cdef _ParserSchemaValidationContext copy(self):
 *         assert self._schema is not None, "_ParserSchemaValidationContext not initialised"             # <<<<<<<<<<<<<<
 *         return self._schema._newSaxValidator(
 *             self._add_default_attributes)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  __pyx_t_1 = (((PyObject *)__pyx_v_self->_schema) != Py_None);
  if (unlikely(!__pyx_t_1)) {
    PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_414));
    {__pyx_filename = __pyx_f[22]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":188
 *     cdef _ParserSchemaValidationContext copy(self):
 *         assert self._schema is not None, "_ParserSchemaValidationContext not initialised"
 *         return self._schema._newSaxValidator(             # <<<<<<<<<<<<<<
 *             self._add_default_attributes)
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":189
 *         assert self._schema is not None, "_ParserSchemaValidationContext not initialised"
 *         return self._schema._newSaxValidator(
 *             self._add_default_attributes)             # <<<<<<<<<<<<<<
 * 
 *     cdef void inject_default_attributes(self, xmlDoc* c_doc):
 */
  __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree_XMLSchema *)__pyx_v_self->_schema->__pyx_base.__pyx_vtab)->_newSaxValidator(__pyx_v_self->_schema, __pyx_v_self->_add_default_attributes)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = ((struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = ((struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ParserSchemaValidationContext.copy");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":191
 *             self._add_default_attributes)
 * 
 *     cdef void inject_default_attributes(self, xmlDoc* c_doc):             # <<<<<<<<<<<<<<
 *         # we currently need to insert default attributes manually
 *         # after parsing, as libxml2 does not support this at parse
 */

static  void __pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_inject_default_attributes(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *__pyx_v_self, xmlDoc *__pyx_v_c_doc) {
  __Pyx_RefNannySetupContext("inject_default_attributes");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":195
 *         # after parsing, as libxml2 does not support this at parse
 *         # time
 *         if self._add_default_attributes:             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 xmlschema.xmlSchemaValidateDoc(self._valid_ctxt, c_doc)
 */
  if (__pyx_v_self->_add_default_attributes) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":196
 *         # time
 *         if self._add_default_attributes:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 xmlschema.xmlSchemaValidateDoc(self._valid_ctxt, c_doc)
 * 
 */
    {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      #endif
      Py_UNBLOCK_THREADS
      /*try:*/ {

        /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":197
 *         if self._add_default_attributes:
 *             with nogil:
 *                 xmlschema.xmlSchemaValidateDoc(self._valid_ctxt, c_doc)             # <<<<<<<<<<<<<<
 * 
 *     cdef int connect(self, xmlparser.xmlParserCtxt* c_ctxt) except -1:
 */
        xmlSchemaValidateDoc(__pyx_v_self->_valid_ctxt, __pyx_v_c_doc);
      }

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":196
 *         # time
 *         if self._add_default_attributes:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 xmlschema.xmlSchemaValidateDoc(self._valid_ctxt, c_doc)
 * 
 */
      /*finally:*/ {
        Py_BLOCK_THREADS
      }
    }
    goto __pyx_L3;
  }
  __pyx_L3:;

  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":199
 *                 xmlschema.xmlSchemaValidateDoc(self._valid_ctxt, c_doc)
 * 
 *     cdef int connect(self, xmlparser.xmlParserCtxt* c_ctxt) except -1:             # <<<<<<<<<<<<<<
 *         if self._valid_ctxt is NULL:
 *             self._valid_ctxt = xmlschema.xmlSchemaNewValidCtxt(
 */

static  int __pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_connect(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *__pyx_v_self, xmlParserCtxt *__pyx_v_c_ctxt) {
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("connect");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":200
 * 
 *     cdef int connect(self, xmlparser.xmlParserCtxt* c_ctxt) except -1:
 *         if self._valid_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             self._valid_ctxt = xmlschema.xmlSchemaNewValidCtxt(
 *                 self._schema._c_schema)
 */
  __pyx_t_1 = (__pyx_v_self->_valid_ctxt == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":201
 *     cdef int connect(self, xmlparser.xmlParserCtxt* c_ctxt) except -1:
 *         if self._valid_ctxt is NULL:
 *             self._valid_ctxt = xmlschema.xmlSchemaNewValidCtxt(             # <<<<<<<<<<<<<<
 *                 self._schema._c_schema)
 *             if self._valid_ctxt is NULL:
 */
    __pyx_v_self->_valid_ctxt = xmlSchemaNewValidCtxt(__pyx_v_self->_schema->_c_schema);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":203
 *             self._valid_ctxt = xmlschema.xmlSchemaNewValidCtxt(
 *                 self._schema._c_schema)
 *             if self._valid_ctxt is NULL:             # <<<<<<<<<<<<<<
 *                 return python.PyErr_NoMemory()
 *             if self._add_default_attributes:
 */
    __pyx_t_1 = (__pyx_v_self->_valid_ctxt == NULL);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":204
 *                 self._schema._c_schema)
 *             if self._valid_ctxt is NULL:
 *                 return python.PyErr_NoMemory()             # <<<<<<<<<<<<<<
 *             if self._add_default_attributes:
 *                 xmlschema.xmlSchemaSetValidOptions(
 */
      __pyx_t_2 = PyErr_NoMemory(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_3;
      goto __pyx_L0;
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":205
 *             if self._valid_ctxt is NULL:
 *                 return python.PyErr_NoMemory()
 *             if self._add_default_attributes:             # <<<<<<<<<<<<<<
 *                 xmlschema.xmlSchemaSetValidOptions(
 *                     self._valid_ctxt,
 */
    if (__pyx_v_self->_add_default_attributes) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":208
 *                 xmlschema.xmlSchemaSetValidOptions(
 *                     self._valid_ctxt,
 *                     xmlschema.XML_SCHEMA_VAL_VC_I_CREATE)             # <<<<<<<<<<<<<<
 *         self._sax_plug = xmlschema.xmlSchemaSAXPlug(
 *             self._valid_ctxt, &c_ctxt.sax, &c_ctxt.userData)
 */
      xmlSchemaSetValidOptions(__pyx_v_self->_valid_ctxt, XML_SCHEMA_VAL_VC_I_CREATE);
      goto __pyx_L5;
    }
    __pyx_L5:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":209
 *                     self._valid_ctxt,
 *                     xmlschema.XML_SCHEMA_VAL_VC_I_CREATE)
 *         self._sax_plug = xmlschema.xmlSchemaSAXPlug(             # <<<<<<<<<<<<<<
 *             self._valid_ctxt, &c_ctxt.sax, &c_ctxt.userData)
 * 
 */
  __pyx_v_self->_sax_plug = xmlSchemaSAXPlug(__pyx_v_self->_valid_ctxt, (&__pyx_v_c_ctxt->sax), (&__pyx_v_c_ctxt->userData));

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ParserSchemaValidationContext.connect");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":212
 *             self._valid_ctxt, &c_ctxt.sax, &c_ctxt.userData)
 * 
 *     cdef void disconnect(self):             # <<<<<<<<<<<<<<
 *         if self._sax_plug is not NULL:
 *             xmlschema.xmlSchemaSAXUnplug(self._sax_plug)
 */

static  void __pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_disconnect(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *__pyx_v_self) {
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("disconnect");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":213
 * 
 *     cdef void disconnect(self):
 *         if self._sax_plug is not NULL:             # <<<<<<<<<<<<<<
 *             xmlschema.xmlSchemaSAXUnplug(self._sax_plug)
 *             self._sax_plug = NULL
 */
  __pyx_t_1 = (__pyx_v_self->_sax_plug != NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":214
 *     cdef void disconnect(self):
 *         if self._sax_plug is not NULL:
 *             xmlschema.xmlSchemaSAXUnplug(self._sax_plug)             # <<<<<<<<<<<<<<
 *             self._sax_plug = NULL
 * 
 */
    xmlSchemaSAXUnplug(__pyx_v_self->_sax_plug);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":215
 *         if self._sax_plug is not NULL:
 *             xmlschema.xmlSchemaSAXUnplug(self._sax_plug)
 *             self._sax_plug = NULL             # <<<<<<<<<<<<<<
 * 
 *     cdef bint isvalid(self):
 */
    __pyx_v_self->_sax_plug = NULL;
    goto __pyx_L3;
  }
  __pyx_L3:;

  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":217
 *             self._sax_plug = NULL
 * 
 *     cdef bint isvalid(self):             # <<<<<<<<<<<<<<
 *         if self._valid_ctxt is NULL:
 *             return 1 # valid
 */

static  int __pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_isvalid(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *__pyx_v_self) {
  int __pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("isvalid");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":218
 * 
 *     cdef bint isvalid(self):
 *         if self._valid_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             return 1 # valid
 *         return xmlschema.xmlSchemaIsValid(self._valid_ctxt)
 */
  __pyx_t_1 = (__pyx_v_self->_valid_ctxt == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":219
 *     cdef bint isvalid(self):
 *         if self._valid_ctxt is NULL:
 *             return 1 # valid             # <<<<<<<<<<<<<<
 *         return xmlschema.xmlSchemaIsValid(self._valid_ctxt)
 * 
 */
    __pyx_r = 1;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":220
 *         if self._valid_ctxt is NULL:
 *             return 1 # valid
 *         return xmlschema.xmlSchemaIsValid(self._valid_ctxt)             # <<<<<<<<<<<<<<
 * 
 * cdef extern from "etree_defs.h":
 */
  __pyx_r = xmlSchemaIsValid(__pyx_v_self->_valid_ctxt);
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":73
 *     cdef schematron.xmlSchematron* _c_schema
 *     cdef xmlDoc* _c_schema_doc
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._c_schema = NULL
 *         self._c_schema_doc = NULL
 */

static int __pyx_pf_4lxml_5etree_10Schematron___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_10Schematron___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("__cinit__");
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":74
 *     cdef xmlDoc* _c_schema_doc
 *     def __cinit__(self):
 *         self._c_schema = NULL             # <<<<<<<<<<<<<<
 *         self._c_schema_doc = NULL
 * 
 */
  ((struct __pyx_obj_4lxml_5etree_Schematron *)__pyx_v_self)->_c_schema = NULL;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":75
 *     def __cinit__(self):
 *         self._c_schema = NULL
 *         self._c_schema_doc = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, etree=None, *, file=None):
 */
  ((struct __pyx_obj_4lxml_5etree_Schematron *)__pyx_v_self)->_c_schema_doc = NULL;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":77
 *         self._c_schema_doc = NULL
 * 
 *     def __init__(self, etree=None, *, file=None):             # <<<<<<<<<<<<<<
 *         cdef _Document doc
 *         cdef _Element root_node
 */

static int __pyx_pf_4lxml_5etree_10Schematron_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_4lxml_5etree_10Schematron_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_etree = 0;
  PyObject *__pyx_v_file = 0;
  struct LxmlDocument *__pyx_v_doc;
  struct LxmlElement *__pyx_v_root_node;
  xmlSchematronParserCtxt *__pyx_v_parser_ctxt;
  PyObject *__pyx_v_filename;
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  xmlDoc *__pyx_t_5;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__etree,&__pyx_n_s__file,0};
  __Pyx_RefNannySetupContext("__init__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__etree);
        if (value) { values[0] = value; kw_args--; }
      }
    }
    while (kw_args > 0) {
      PyObject* value;
      value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__file);
      if (value) { values[1] = value; if (!(--kw_args)) break; }
      break;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_etree = values[0];
    __pyx_v_file = values[1];
  } else {
    __pyx_v_etree = ((PyObject *)Py_None);
    __pyx_v_file = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: __pyx_v_etree = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[23]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.Schematron.__init__");
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_doc = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_root_node = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_filename = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":83
 *         cdef char* c_href
 *         cdef schematron.xmlSchematronParserCtxt* parser_ctxt
 *         _Validator.__init__(self)             # <<<<<<<<<<<<<<
 *         if not config.ENABLE_SCHEMATRON:
 *             raise SchematronError, \
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Validator)), __pyx_n_s____init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":84
 *         cdef schematron.xmlSchematronParserCtxt* parser_ctxt
 *         _Validator.__init__(self)
 *         if not config.ENABLE_SCHEMATRON:             # <<<<<<<<<<<<<<
 *             raise SchematronError, \
 *                 u"lxml.etree was compiled without Schematron support."
 */
  __pyx_t_4 = (!ENABLE_SCHEMATRON);
  if (__pyx_t_4) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":85
 *         _Validator.__init__(self)
 *         if not config.ENABLE_SCHEMATRON:
 *             raise SchematronError, \             # <<<<<<<<<<<<<<
 *                 u"lxml.etree was compiled without Schematron support."
 *         if etree is not None:
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__SchematronError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, ((PyObject *)__pyx_kp_u_415), 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[23]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":87
 *             raise SchematronError, \
 *                 u"lxml.etree was compiled without Schematron support."
 *         if etree is not None:             # <<<<<<<<<<<<<<
 *             doc = _documentOrRaise(etree)
 *             root_node = _rootNodeOrRaise(etree)
 */
  __pyx_t_4 = (__pyx_v_etree != Py_None);
  if (__pyx_t_4) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":88
 *                 u"lxml.etree was compiled without Schematron support."
 *         if etree is not None:
 *             doc = _documentOrRaise(etree)             # <<<<<<<<<<<<<<
 *             root_node = _rootNodeOrRaise(etree)
 *             self._c_schema_doc = _copyDocRoot(doc._c_doc, root_node._c_node)
 */
    __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__pyx_v_doc));
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":89
 *         if etree is not None:
 *             doc = _documentOrRaise(etree)
 *             root_node = _rootNodeOrRaise(etree)             # <<<<<<<<<<<<<<
 *             self._c_schema_doc = _copyDocRoot(doc._c_doc, root_node._c_node)
 *             self._error_log.connect()
 */
    __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__pyx_v_root_node));
    __pyx_v_root_node = ((struct LxmlElement *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":90
 *             doc = _documentOrRaise(etree)
 *             root_node = _rootNodeOrRaise(etree)
 *             self._c_schema_doc = _copyDocRoot(doc._c_doc, root_node._c_node)             # <<<<<<<<<<<<<<
 *             self._error_log.connect()
 *             parser_ctxt = schematron.xmlSchematronNewDocParserCtxt(
 */
    __pyx_t_5 = __pyx_f_4lxml_5etree__copyDocRoot(__pyx_v_doc->_c_doc, __pyx_v_root_node->_c_node); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    ((struct __pyx_obj_4lxml_5etree_Schematron *)__pyx_v_self)->_c_schema_doc = __pyx_t_5;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":91
 *             root_node = _rootNodeOrRaise(etree)
 *             self._c_schema_doc = _copyDocRoot(doc._c_doc, root_node._c_node)
 *             self._error_log.connect()             # <<<<<<<<<<<<<<
 *             parser_ctxt = schematron.xmlSchematronNewDocParserCtxt(
 *                 self._c_schema_doc)
 */
    ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)((struct __pyx_obj_4lxml_5etree_Schematron *)__pyx_v_self)->__pyx_base._error_log->__pyx_base.__pyx_base.__pyx_vtab)->connect(((struct __pyx_obj_4lxml_5etree_Schematron *)__pyx_v_self)->__pyx_base._error_log);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":93
 *             self._error_log.connect()
 *             parser_ctxt = schematron.xmlSchematronNewDocParserCtxt(
 *                 self._c_schema_doc)             # <<<<<<<<<<<<<<
 *         elif file is not None:
 *             filename = _getFilenameForFile(file)
 */
    __pyx_v_parser_ctxt = xmlSchematronNewDocParserCtxt(((struct __pyx_obj_4lxml_5etree_Schematron *)__pyx_v_self)->_c_schema_doc);
    goto __pyx_L7;
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":94
 *             parser_ctxt = schematron.xmlSchematronNewDocParserCtxt(
 *                 self._c_schema_doc)
 *         elif file is not None:             # <<<<<<<<<<<<<<
 *             filename = _getFilenameForFile(file)
 *             if filename is None:
 */
  __pyx_t_4 = (__pyx_v_file != Py_None);
  if (__pyx_t_4) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":95
 *                 self._c_schema_doc)
 *         elif file is not None:
 *             filename = _getFilenameForFile(file)             # <<<<<<<<<<<<<<
 *             if filename is None:
 *                 # XXX assume a string object
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree__getFilenameForFile(__pyx_v_file); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_v_filename);
    __pyx_v_filename = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":96
 *         elif file is not None:
 *             filename = _getFilenameForFile(file)
 *             if filename is None:             # <<<<<<<<<<<<<<
 *                 # XXX assume a string object
 *                 filename = file
 */
    __pyx_t_4 = (__pyx_v_filename == Py_None);
    if (__pyx_t_4) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":98
 *             if filename is None:
 *                 # XXX assume a string object
 *                 filename = file             # <<<<<<<<<<<<<<
 *             filename = _encodeFilename(filename)
 *             self._error_log.connect()
 */
      __Pyx_INCREF(__pyx_v_file);
      __Pyx_DECREF(__pyx_v_filename);
      __pyx_v_filename = __pyx_v_file;
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":99
 *                 # XXX assume a string object
 *                 filename = file
 *             filename = _encodeFilename(filename)             # <<<<<<<<<<<<<<
 *             self._error_log.connect()
 *             parser_ctxt = schematron.xmlSchematronNewParserCtxt(_cstr(filename))
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_filename); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_v_filename);
    __pyx_v_filename = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":100
 *                 filename = file
 *             filename = _encodeFilename(filename)
 *             self._error_log.connect()             # <<<<<<<<<<<<<<
 *             parser_ctxt = schematron.xmlSchematronNewParserCtxt(_cstr(filename))
 *         else:
 */
    ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)((struct __pyx_obj_4lxml_5etree_Schematron *)__pyx_v_self)->__pyx_base._error_log->__pyx_base.__pyx_base.__pyx_vtab)->connect(((struct __pyx_obj_4lxml_5etree_Schematron *)__pyx_v_self)->__pyx_base._error_log);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":101
 *             filename = _encodeFilename(filename)
 *             self._error_log.connect()
 *             parser_ctxt = schematron.xmlSchematronNewParserCtxt(_cstr(filename))             # <<<<<<<<<<<<<<
 *         else:
 *             raise SchematronParseError, u"No tree or file given"
 */
    __pyx_v_parser_ctxt = xmlSchematronNewParserCtxt(PyBytes_AS_STRING(__pyx_v_filename));
    goto __pyx_L7;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":103
 *             parser_ctxt = schematron.xmlSchematronNewParserCtxt(_cstr(filename))
 *         else:
 *             raise SchematronParseError, u"No tree or file given"             # <<<<<<<<<<<<<<
 * 
 *         if parser_ctxt is NULL:
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s_416); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, ((PyObject *)__pyx_kp_u_399), 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[23]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L7:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":105
 *             raise SchematronParseError, u"No tree or file given"
 * 
 *         if parser_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             self._error_log.disconnect()
 *             if self._c_schema_doc is not NULL:
 */
  __pyx_t_4 = (__pyx_v_parser_ctxt == NULL);
  if (__pyx_t_4) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":106
 * 
 *         if parser_ctxt is NULL:
 *             self._error_log.disconnect()             # <<<<<<<<<<<<<<
 *             if self._c_schema_doc is not NULL:
 *                 tree.xmlFreeDoc(self._c_schema_doc)
 */
    ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)((struct __pyx_obj_4lxml_5etree_Schematron *)__pyx_v_self)->__pyx_base._error_log->__pyx_base.__pyx_base.__pyx_vtab)->disconnect(((struct __pyx_obj_4lxml_5etree_Schematron *)__pyx_v_self)->__pyx_base._error_log);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":107
 *         if parser_ctxt is NULL:
 *             self._error_log.disconnect()
 *             if self._c_schema_doc is not NULL:             # <<<<<<<<<<<<<<
 *                 tree.xmlFreeDoc(self._c_schema_doc)
 *                 self._c_schema_doc = NULL
 */
    __pyx_t_4 = (((struct __pyx_obj_4lxml_5etree_Schematron *)__pyx_v_self)->_c_schema_doc != NULL);
    if (__pyx_t_4) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":108
 *             self._error_log.disconnect()
 *             if self._c_schema_doc is not NULL:
 *                 tree.xmlFreeDoc(self._c_schema_doc)             # <<<<<<<<<<<<<<
 *                 self._c_schema_doc = NULL
 *             python.PyErr_NoMemory()
 */
      xmlFreeDoc(((struct __pyx_obj_4lxml_5etree_Schematron *)__pyx_v_self)->_c_schema_doc);

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":109
 *             if self._c_schema_doc is not NULL:
 *                 tree.xmlFreeDoc(self._c_schema_doc)
 *                 self._c_schema_doc = NULL             # <<<<<<<<<<<<<<
 *             python.PyErr_NoMemory()
 *             return
 */
      ((struct __pyx_obj_4lxml_5etree_Schematron *)__pyx_v_self)->_c_schema_doc = NULL;
      goto __pyx_L10;
    }
    __pyx_L10:;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":110
 *                 tree.xmlFreeDoc(self._c_schema_doc)
 *                 self._c_schema_doc = NULL
 *             python.PyErr_NoMemory()             # <<<<<<<<<<<<<<
 *             return
 * 
 */
    __pyx_t_3 = PyErr_NoMemory(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":111
 *                 self._c_schema_doc = NULL
 *             python.PyErr_NoMemory()
 *             return             # <<<<<<<<<<<<<<
 * 
 *         self._c_schema = schematron.xmlSchematronParse(parser_ctxt)
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L9;
  }
  __pyx_L9:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":113
 *             return
 * 
 *         self._c_schema = schematron.xmlSchematronParse(parser_ctxt)             # <<<<<<<<<<<<<<
 *         self._error_log.disconnect()
 * 
 */
  ((struct __pyx_obj_4lxml_5etree_Schematron *)__pyx_v_self)->_c_schema = xmlSchematronParse(__pyx_v_parser_ctxt);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":114
 * 
 *         self._c_schema = schematron.xmlSchematronParse(parser_ctxt)
 *         self._error_log.disconnect()             # <<<<<<<<<<<<<<
 * 
 *         schematron.xmlSchematronFreeParserCtxt(parser_ctxt)
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)((struct __pyx_obj_4lxml_5etree_Schematron *)__pyx_v_self)->__pyx_base._error_log->__pyx_base.__pyx_base.__pyx_vtab)->disconnect(((struct __pyx_obj_4lxml_5etree_Schematron *)__pyx_v_self)->__pyx_base._error_log);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":116
 *         self._error_log.disconnect()
 * 
 *         schematron.xmlSchematronFreeParserCtxt(parser_ctxt)             # <<<<<<<<<<<<<<
 *         if self._c_schema is NULL:
 *             raise SchematronParseError(
 */
  xmlSchematronFreeParserCtxt(__pyx_v_parser_ctxt);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":117
 * 
 *         schematron.xmlSchematronFreeParserCtxt(parser_ctxt)
 *         if self._c_schema is NULL:             # <<<<<<<<<<<<<<
 *             raise SchematronParseError(
 *                 u"Document is not a valid Schematron schema",
 */
  __pyx_t_4 = (((struct __pyx_obj_4lxml_5etree_Schematron *)__pyx_v_self)->_c_schema == NULL);
  if (__pyx_t_4) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":118
 *         schematron.xmlSchematronFreeParserCtxt(parser_ctxt)
 *         if self._c_schema is NULL:
 *             raise SchematronParseError(             # <<<<<<<<<<<<<<
 *                 u"Document is not a valid Schematron schema",
 *                 self._error_log)
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s_416); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":120
 *             raise SchematronParseError(
 *                 u"Document is not a valid Schematron schema",
 *                 self._error_log)             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __Pyx_INCREF(((PyObject *)__pyx_kp_u_417));
    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_u_417));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_417));
    __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_Schematron *)__pyx_v_self)->__pyx_base._error_log));
    PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((struct __pyx_obj_4lxml_5etree_Schematron *)__pyx_v_self)->__pyx_base._error_log));
    __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_Schematron *)__pyx_v_self)->__pyx_base._error_log));
    __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_1, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[23]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L11;
  }
  __pyx_L11:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.Schematron.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_doc);
  __Pyx_DECREF((PyObject *)__pyx_v_root_node);
  __Pyx_DECREF(__pyx_v_filename);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":122
 *                 self._error_log)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         schematron.xmlSchematronFree(self._c_schema)
 *         if _LIBXML_VERSION_INT >= 20631:
 */

static void __pyx_pf_4lxml_5etree_10Schematron_2__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pf_4lxml_5etree_10Schematron_2__dealloc__(PyObject *__pyx_v_self) {
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__dealloc__");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":123
 * 
 *     def __dealloc__(self):
 *         schematron.xmlSchematronFree(self._c_schema)             # <<<<<<<<<<<<<<
 *         if _LIBXML_VERSION_INT >= 20631:
 *             # earlier libxml2 versions may have freed the document in
 */
  xmlSchematronFree(((struct __pyx_obj_4lxml_5etree_Schematron *)__pyx_v_self)->_c_schema);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":124
 *     def __dealloc__(self):
 *         schematron.xmlSchematronFree(self._c_schema)
 *         if _LIBXML_VERSION_INT >= 20631:             # <<<<<<<<<<<<<<
 *             # earlier libxml2 versions may have freed the document in
 *             # xmlSchematronFree() already, we don't know ...
 */
  __pyx_t_1 = (__pyx_v_4lxml_5etree__LIBXML_VERSION_INT >= 20631);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":127
 *             # earlier libxml2 versions may have freed the document in
 *             # xmlSchematronFree() already, we don't know ...
 *             if self._c_schema_doc is not NULL:             # <<<<<<<<<<<<<<
 *                 tree.xmlFreeDoc(self._c_schema_doc)
 * 
 */
    __pyx_t_1 = (((struct __pyx_obj_4lxml_5etree_Schematron *)__pyx_v_self)->_c_schema_doc != NULL);
    if (__pyx_t_1) {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":128
 *             # xmlSchematronFree() already, we don't know ...
 *             if self._c_schema_doc is not NULL:
 *                 tree.xmlFreeDoc(self._c_schema_doc)             # <<<<<<<<<<<<<<
 * 
 *     def __call__(self, etree):
 */
      xmlFreeDoc(((struct __pyx_obj_4lxml_5etree_Schematron *)__pyx_v_self)->_c_schema_doc);
      goto __pyx_L6;
    }
    __pyx_L6:;
    goto __pyx_L5;
  }
  __pyx_L5:;

  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":130
 *                 tree.xmlFreeDoc(self._c_schema_doc)
 * 
 *     def __call__(self, etree):             # <<<<<<<<<<<<<<
 *         u"""__call__(self, etree)
 * 
 */

static PyObject *__pyx_pf_4lxml_5etree_10Schematron_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_10Schematron_3__call__[] = "__call__(self, etree)\n\n        Validate doc using Schematron.\n\n        Returns true if document is valid, false if not.";
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_10Schematron_3__call__;
static PyObject *__pyx_pf_4lxml_5etree_10Schematron_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_etree = 0;
  struct LxmlDocument *__pyx_v_doc;
  struct LxmlElement *__pyx_v_root_node;
  xmlDoc *__pyx_v_c_doc;
  xmlSchematronValidCtxt *__pyx_v_valid_ctxt;
  int __pyx_v_ret;
  int __pyx_v_options;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  xmlDoc *__pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__etree,0};
  __Pyx_RefNannySetupContext("__call__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[1] = {0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__etree);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__call__") < 0)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_etree = values[0];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_etree = PyTuple_GET_ITEM(__pyx_args, 0);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[23]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.Schematron.__call__");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_doc = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_root_node = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":143
 *         cdef int options
 * 
 *         assert self._c_schema is not NULL, "Schematron instance not initialised"             # <<<<<<<<<<<<<<
 *         doc = _documentOrRaise(etree)
 *         root_node = _rootNodeOrRaise(etree)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!(((struct __pyx_obj_4lxml_5etree_Schematron *)__pyx_v_self)->_c_schema != NULL))) {
    PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_418));
    {__pyx_filename = __pyx_f[23]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":144
 * 
 *         assert self._c_schema is not NULL, "Schematron instance not initialised"
 *         doc = _documentOrRaise(etree)             # <<<<<<<<<<<<<<
 *         root_node = _rootNodeOrRaise(etree)
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_doc));
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":145
 *         assert self._c_schema is not NULL, "Schematron instance not initialised"
 *         doc = _documentOrRaise(etree)
 *         root_node = _rootNodeOrRaise(etree)             # <<<<<<<<<<<<<<
 * 
 *         if _LIBXML_VERSION_INT >= 20632 and \
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_root_node));
  __pyx_v_root_node = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":147
 *         root_node = _rootNodeOrRaise(etree)
 * 
 *         if _LIBXML_VERSION_INT >= 20632 and \             # <<<<<<<<<<<<<<
 *                 schematron.XML_SCHEMATRON_OUT_ERROR != 0:
 *             options = schematron.XML_SCHEMATRON_OUT_ERROR
 */
  __pyx_t_2 = (__pyx_v_4lxml_5etree__LIBXML_VERSION_INT >= 20632);
  if (__pyx_t_2) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":148
 * 
 *         if _LIBXML_VERSION_INT >= 20632 and \
 *                 schematron.XML_SCHEMATRON_OUT_ERROR != 0:             # <<<<<<<<<<<<<<
 *             options = schematron.XML_SCHEMATRON_OUT_ERROR
 *         else:
 */
    __pyx_t_3 = (XML_SCHEMATRON_OUT_ERROR != 0);
    __pyx_t_4 = __pyx_t_3;
  } else {
    __pyx_t_4 = __pyx_t_2;
  }
  if (__pyx_t_4) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":149
 *         if _LIBXML_VERSION_INT >= 20632 and \
 *                 schematron.XML_SCHEMATRON_OUT_ERROR != 0:
 *             options = schematron.XML_SCHEMATRON_OUT_ERROR             # <<<<<<<<<<<<<<
 *         else:
 *             options = schematron.XML_SCHEMATRON_OUT_QUIET
 */
    __pyx_v_options = XML_SCHEMATRON_OUT_ERROR;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":151
 *             options = schematron.XML_SCHEMATRON_OUT_ERROR
 *         else:
 *             options = schematron.XML_SCHEMATRON_OUT_QUIET             # <<<<<<<<<<<<<<
 *             # hack to switch off stderr output
 *             options = options | schematron.XML_SCHEMATRON_OUT_XML
 */
    __pyx_v_options = XML_SCHEMATRON_OUT_QUIET;

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":153
 *             options = schematron.XML_SCHEMATRON_OUT_QUIET
 *             # hack to switch off stderr output
 *             options = options | schematron.XML_SCHEMATRON_OUT_XML             # <<<<<<<<<<<<<<
 * 
 *         valid_ctxt = schematron.xmlSchematronNewValidCtxt(
 */
    __pyx_v_options = (__pyx_v_options | XML_SCHEMATRON_OUT_XML);
  }
  __pyx_L6:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":156
 * 
 *         valid_ctxt = schematron.xmlSchematronNewValidCtxt(
 *             self._c_schema, options)             # <<<<<<<<<<<<<<
 *         if valid_ctxt is NULL:
 *             return python.PyErr_NoMemory()
 */
  __pyx_v_valid_ctxt = xmlSchematronNewValidCtxt(((struct __pyx_obj_4lxml_5etree_Schematron *)__pyx_v_self)->_c_schema, __pyx_v_options);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":157
 *         valid_ctxt = schematron.xmlSchematronNewValidCtxt(
 *             self._c_schema, options)
 *         if valid_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             return python.PyErr_NoMemory()
 * 
 */
  __pyx_t_4 = (__pyx_v_valid_ctxt == NULL);
  if (__pyx_t_4) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":158
 *             self._c_schema, options)
 *         if valid_ctxt is NULL:
 *             return python.PyErr_NoMemory()             # <<<<<<<<<<<<<<
 * 
 *         self._error_log.connect()
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = PyErr_NoMemory(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":160
 *             return python.PyErr_NoMemory()
 * 
 *         self._error_log.connect()             # <<<<<<<<<<<<<<
 *         if _LIBXML_VERSION_INT >= 20632:
 *             schematron.xmlSchematronSetValidStructuredErrors(
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)((struct __pyx_obj_4lxml_5etree_Schematron *)__pyx_v_self)->__pyx_base._error_log->__pyx_base.__pyx_base.__pyx_vtab)->connect(((struct __pyx_obj_4lxml_5etree_Schematron *)__pyx_v_self)->__pyx_base._error_log);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":161
 * 
 *         self._error_log.connect()
 *         if _LIBXML_VERSION_INT >= 20632:             # <<<<<<<<<<<<<<
 *             schematron.xmlSchematronSetValidStructuredErrors(
 *                 valid_ctxt, _receiveError, <void*>self._error_log)
 */
  __pyx_t_4 = (__pyx_v_4lxml_5etree__LIBXML_VERSION_INT >= 20632);
  if (__pyx_t_4) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":163
 *         if _LIBXML_VERSION_INT >= 20632:
 *             schematron.xmlSchematronSetValidStructuredErrors(
 *                 valid_ctxt, _receiveError, <void*>self._error_log)             # <<<<<<<<<<<<<<
 *         c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *         with nogil:
 */
    xmlSchematronSetValidStructuredErrors(__pyx_v_valid_ctxt, __pyx_f_4lxml_5etree__receiveError, ((void *)((struct __pyx_obj_4lxml_5etree_Schematron *)__pyx_v_self)->__pyx_base._error_log));
    goto __pyx_L8;
  }
  __pyx_L8:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":164
 *             schematron.xmlSchematronSetValidStructuredErrors(
 *                 valid_ctxt, _receiveError, <void*>self._error_log)
 *         c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)             # <<<<<<<<<<<<<<
 *         with nogil:
 *             ret = schematron.xmlSchematronValidateDoc(valid_ctxt, c_doc)
 */
  __pyx_t_5 = __pyx_f_4lxml_5etree__fakeRootDoc(__pyx_v_doc->_c_doc, __pyx_v_root_node->_c_node); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_doc = __pyx_t_5;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":165
 *                 valid_ctxt, _receiveError, <void*>self._error_log)
 *         c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *         with nogil:             # <<<<<<<<<<<<<<
 *             ret = schematron.xmlSchematronValidateDoc(valid_ctxt, c_doc)
 *         _destroyFakeDoc(doc._c_doc, c_doc)
 */
  {
    #ifdef WITH_THREAD
    PyThreadState *_save;
    #endif
    Py_UNBLOCK_THREADS
    /*try:*/ {

      /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":166
 *         c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *         with nogil:
 *             ret = schematron.xmlSchematronValidateDoc(valid_ctxt, c_doc)             # <<<<<<<<<<<<<<
 *         _destroyFakeDoc(doc._c_doc, c_doc)
 *         self._error_log.disconnect()
 */
      __pyx_v_ret = xmlSchematronValidateDoc(__pyx_v_valid_ctxt, __pyx_v_c_doc);
    }

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":165
 *                 valid_ctxt, _receiveError, <void*>self._error_log)
 *         c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *         with nogil:             # <<<<<<<<<<<<<<
 *             ret = schematron.xmlSchematronValidateDoc(valid_ctxt, c_doc)
 *         _destroyFakeDoc(doc._c_doc, c_doc)
 */
    /*finally:*/ {
      Py_BLOCK_THREADS
    }
  }

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":167
 *         with nogil:
 *             ret = schematron.xmlSchematronValidateDoc(valid_ctxt, c_doc)
 *         _destroyFakeDoc(doc._c_doc, c_doc)             # <<<<<<<<<<<<<<
 *         self._error_log.disconnect()
 * 
 */
  __pyx_f_4lxml_5etree__destroyFakeDoc(__pyx_v_doc->_c_doc, __pyx_v_c_doc);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":168
 *             ret = schematron.xmlSchematronValidateDoc(valid_ctxt, c_doc)
 *         _destroyFakeDoc(doc._c_doc, c_doc)
 *         self._error_log.disconnect()             # <<<<<<<<<<<<<<
 * 
 *         schematron.xmlSchematronFreeValidCtxt(valid_ctxt)
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)((struct __pyx_obj_4lxml_5etree_Schematron *)__pyx_v_self)->__pyx_base._error_log->__pyx_base.__pyx_base.__pyx_vtab)->disconnect(((struct __pyx_obj_4lxml_5etree_Schematron *)__pyx_v_self)->__pyx_base._error_log);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":170
 *         self._error_log.disconnect()
 * 
 *         schematron.xmlSchematronFreeValidCtxt(valid_ctxt)             # <<<<<<<<<<<<<<
 * 
 *         if ret == -1:
 */
  xmlSchematronFreeValidCtxt(__pyx_v_valid_ctxt);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":172
 *         schematron.xmlSchematronFreeValidCtxt(valid_ctxt)
 * 
 *         if ret == -1:             # <<<<<<<<<<<<<<
 *             raise SchematronValidateError(
 *                 u"Internal error in Schematron validation",
 */
  __pyx_t_4 = (__pyx_v_ret == -1);
  if (__pyx_t_4) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":173
 * 
 *         if ret == -1:
 *             raise SchematronValidateError(             # <<<<<<<<<<<<<<
 *                 u"Internal error in Schematron validation",
 *                 self._error_log)
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s_419); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":175
 *             raise SchematronValidateError(
 *                 u"Internal error in Schematron validation",
 *                 self._error_log)             # <<<<<<<<<<<<<<
 *         if ret == 0:
 *             return True
 */
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
    __Pyx_INCREF(((PyObject *)__pyx_kp_u_420));
    PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_kp_u_420));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_420));
    __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_Schematron *)__pyx_v_self)->__pyx_base._error_log));
    PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)((struct __pyx_obj_4lxml_5etree_Schematron *)__pyx_v_self)->__pyx_base._error_log));
    __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_Schematron *)__pyx_v_self)->__pyx_base._error_log));
    __pyx_t_7 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
    __Pyx_Raise(__pyx_t_7, 0, 0);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    {__pyx_filename = __pyx_f[23]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L12;
  }
  __pyx_L12:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":176
 *                 u"Internal error in Schematron validation",
 *                 self._error_log)
 *         if ret == 0:             # <<<<<<<<<<<<<<
 *             return True
 *         else:
 */
  __pyx_t_4 = (__pyx_v_ret == 0);
  if (__pyx_t_4) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":177
 *                 self._error_log)
 *         if ret == 0:
 *             return True             # <<<<<<<<<<<<<<
 *         else:
 *             return False
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_7 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_r = __pyx_t_7;
    __pyx_t_7 = 0;
    goto __pyx_L0;
    goto __pyx_L13;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":179
 *             return True
 *         else:
 *             return False             # <<<<<<<<<<<<<<
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_7 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_r = __pyx_t_7;
    __pyx_t_7 = 0;
    goto __pyx_L0;
  }
  __pyx_L13:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree.Schematron.__call__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_doc);
  __Pyx_DECREF((PyObject *)__pyx_v_root_node);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":3
 * # Public C API for lxml.etree
 * 
 * cdef public api _Element deepcopyNodeToDocument(_Document doc, xmlNode* c_root):             # <<<<<<<<<<<<<<
 *     u"Recursively copy the element into the document. doc is not modified."
 *     cdef xmlNode* c_node
 */

 DL_EXPORT(struct LxmlElement) *deepcopyNodeToDocument(struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_root) {
  xmlNode *__pyx_v_c_node;
  struct LxmlElement *__pyx_r = NULL;
  xmlNode *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("deepcopyNodeToDocument");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":6
 *     u"Recursively copy the element into the document. doc is not modified."
 *     cdef xmlNode* c_node
 *     c_node = _copyNodeToDoc(c_root, doc._c_doc)             # <<<<<<<<<<<<<<
 *     return _elementFactory(doc, c_node)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__copyNodeToDoc(__pyx_v_c_root, __pyx_v_doc->_c_doc); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_node = __pyx_t_1;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":7
 *     cdef xmlNode* c_node
 *     c_node = _copyNodeToDoc(c_root, doc._c_doc)
 *     return _elementFactory(doc, c_node)             # <<<<<<<<<<<<<<
 * 
 * cdef public api _ElementTree elementTreeFactory(_Element context_node):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(__pyx_v_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = ((struct LxmlElement *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.deepcopyNodeToDocument");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":9
 *     return _elementFactory(doc, c_node)
 * 
 * cdef public api _ElementTree elementTreeFactory(_Element context_node):             # <<<<<<<<<<<<<<
 *     return newElementTree(context_node, _ElementTree)
 * 
 */

 DL_EXPORT(struct LxmlElementTree) *elementTreeFactory(struct LxmlElement *__pyx_v_context_node) {
  struct LxmlElementTree *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("elementTreeFactory");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":10
 * 
 * cdef public api _ElementTree elementTreeFactory(_Element context_node):
 *     return newElementTree(context_node, _ElementTree)             # <<<<<<<<<<<<<<
 * 
 * cdef public api _ElementTree newElementTree(_Element context_node,
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = ((PyObject *)newElementTree(__pyx_v_context_node, ((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ElementTree)))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((struct LxmlElementTree *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = ((struct LxmlElementTree *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.elementTreeFactory");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":12
 *     return newElementTree(context_node, _ElementTree)
 * 
 * cdef public api _ElementTree newElementTree(_Element context_node,             # <<<<<<<<<<<<<<
 *                                         object subclass):
 *     if <void*>context_node is NULL or context_node is None:
 */

 DL_EXPORT(struct LxmlElementTree) *newElementTree(struct LxmlElement *__pyx_v_context_node, PyObject *__pyx_v_subclass) {
  struct LxmlElementTree *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("newElementTree");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":14
 * cdef public api _ElementTree newElementTree(_Element context_node,
 *                                         object subclass):
 *     if <void*>context_node is NULL or context_node is None:             # <<<<<<<<<<<<<<
 *         raise TypeError
 * 
 */
  __pyx_t_1 = (((void *)__pyx_v_context_node) == NULL);
  if (!__pyx_t_1) {
    __pyx_t_2 = (((PyObject *)__pyx_v_context_node) == Py_None);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":15
 *                                         object subclass):
 *     if <void*>context_node is NULL or context_node is None:
 *         raise TypeError             # <<<<<<<<<<<<<<
 * 
 *     return _newElementTree(context_node._doc, context_node, subclass)
 */
    __Pyx_Raise(__pyx_builtin_TypeError, 0, 0);
    {__pyx_filename = __pyx_f[24]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":17
 *         raise TypeError
 * 
 *     return _newElementTree(context_node._doc, context_node, subclass)             # <<<<<<<<<<<<<<
 * 
 * cdef public api _Element elementFactory(_Document doc, xmlNode* c_node):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_4 = ((PyObject *)__pyx_v_context_node->_doc);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_5 = ((PyObject *)__pyx_f_4lxml_5etree__newElementTree(((struct LxmlDocument *)__pyx_t_4), __pyx_v_context_node, __pyx_v_subclass)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = ((struct LxmlElementTree *)__pyx_t_5);
  __pyx_t_5 = 0;
  goto __pyx_L0;

  __pyx_r = ((struct LxmlElementTree *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.newElementTree");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":19
 *     return _newElementTree(context_node._doc, context_node, subclass)
 * 
 * cdef public api _Element elementFactory(_Document doc, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     if c_node is NULL or doc is None:
 *         raise TypeError
 */

 DL_EXPORT(struct LxmlElement) *elementFactory(struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node) {
  struct LxmlElement *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("elementFactory");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":20
 * 
 * cdef public api _Element elementFactory(_Document doc, xmlNode* c_node):
 *     if c_node is NULL or doc is None:             # <<<<<<<<<<<<<<
 *         raise TypeError
 *     return _elementFactory(doc, c_node)
 */
  __pyx_t_1 = (__pyx_v_c_node == NULL);
  if (!__pyx_t_1) {
    __pyx_t_2 = (((PyObject *)__pyx_v_doc) == Py_None);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":21
 * cdef public api _Element elementFactory(_Document doc, xmlNode* c_node):
 *     if c_node is NULL or doc is None:
 *         raise TypeError             # <<<<<<<<<<<<<<
 *     return _elementFactory(doc, c_node)
 * 
 */
    __Pyx_Raise(__pyx_builtin_TypeError, 0, 0);
    {__pyx_filename = __pyx_f[24]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":22
 *     if c_node is NULL or doc is None:
 *         raise TypeError
 *     return _elementFactory(doc, c_node)             # <<<<<<<<<<<<<<
 * 
 * cdef public api _Element makeElement(tag, _Document doc, parser,
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(__pyx_v_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = ((struct LxmlElement *)__pyx_t_4);
  __pyx_t_4 = 0;
  goto __pyx_L0;

  __pyx_r = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.elementFactory");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":24
 *     return _elementFactory(doc, c_node)
 * 
 * cdef public api _Element makeElement(tag, _Document doc, parser,             # <<<<<<<<<<<<<<
 *                                  text, tail, attrib, nsmap):
 *     return _makeElement(tag, NULL, doc, parser, text, tail, attrib, nsmap, None)
 */

 DL_EXPORT(struct LxmlElement) *makeElement(PyObject *__pyx_v_tag, struct LxmlDocument *__pyx_v_doc, PyObject *__pyx_v_parser, PyObject *__pyx_v_text, PyObject *__pyx_v_tail, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap) {
  struct LxmlElement *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("makeElement");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":26
 * cdef public api _Element makeElement(tag, _Document doc, parser,
 *                                  text, tail, attrib, nsmap):
 *     return _makeElement(tag, NULL, doc, parser, text, tail, attrib, nsmap, None)             # <<<<<<<<<<<<<<
 * 
 * cdef public api _Element makeSubElement(_Element parent, tag, text, tail,
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  if (!(likely(((__pyx_v_parser) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_parser, __pyx_ptype_4lxml_5etree__BaseParser))))) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__makeElement(__pyx_v_tag, NULL, __pyx_v_doc, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_parser), __pyx_v_text, __pyx_v_tail, __pyx_v_attrib, __pyx_v_nsmap, Py_None)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.makeElement");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":28
 *     return _makeElement(tag, NULL, doc, parser, text, tail, attrib, nsmap, None)
 * 
 * cdef public api _Element makeSubElement(_Element parent, tag, text, tail,             # <<<<<<<<<<<<<<
 *                                     attrib, nsmap):
 *     return _makeSubElement(parent, tag, text, tail, attrib, nsmap, None)
 */

 DL_EXPORT(struct LxmlElement) *makeSubElement(struct LxmlElement *__pyx_v_parent, PyObject *__pyx_v_tag, PyObject *__pyx_v_text, PyObject *__pyx_v_tail, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap) {
  struct LxmlElement *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("makeSubElement");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":30
 * cdef public api _Element makeSubElement(_Element parent, tag, text, tail,
 *                                     attrib, nsmap):
 *     return _makeSubElement(parent, tag, text, tail, attrib, nsmap, None)             # <<<<<<<<<<<<<<
 * 
 * cdef public api void setElementClassLookupFunction(
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__makeSubElement(__pyx_v_parent, __pyx_v_tag, __pyx_v_text, __pyx_v_tail, __pyx_v_attrib, __pyx_v_nsmap, Py_None)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.makeSubElement");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":32
 *     return _makeSubElement(parent, tag, text, tail, attrib, nsmap, None)
 * 
 * cdef public api void setElementClassLookupFunction(             # <<<<<<<<<<<<<<
 *     _element_class_lookup_function function, state):
 *     _setElementClassLookupFunction(function, state)
 */

 DL_EXPORT(void) setElementClassLookupFunction(_element_class_lookup_function __pyx_v_function, PyObject *__pyx_v_state) {
  __Pyx_RefNannySetupContext("setElementClassLookupFunction");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":34
 * cdef public api void setElementClassLookupFunction(
 *     _element_class_lookup_function function, state):
 *     _setElementClassLookupFunction(function, state)             # <<<<<<<<<<<<<<
 * 
 * cdef public api object lookupDefaultElementClass(state, doc, xmlNode* c_node):
 */
  __pyx_f_4lxml_5etree__setElementClassLookupFunction(__pyx_v_function, __pyx_v_state);

  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":36
 *     _setElementClassLookupFunction(function, state)
 * 
 * cdef public api object lookupDefaultElementClass(state, doc, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     return _lookupDefaultElementClass(state, doc, c_node)
 * 
 */

 DL_EXPORT(PyObject) *lookupDefaultElementClass(PyObject *__pyx_v_state, PyObject *__pyx_v_doc, xmlNode *__pyx_v_c_node) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("lookupDefaultElementClass");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":37
 * 
 * cdef public api object lookupDefaultElementClass(state, doc, xmlNode* c_node):
 *     return _lookupDefaultElementClass(state, doc, c_node)             # <<<<<<<<<<<<<<
 * 
 * cdef public api object lookupNamespaceElementClass(state, doc, xmlNode* c_node):
 */
  __Pyx_XDECREF(__pyx_r);
  if (!(likely(((__pyx_v_doc) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_doc, __pyx_ptype_4lxml_5etree__Document))))) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __pyx_f_4lxml_5etree__lookupDefaultElementClass(__pyx_v_state, ((struct LxmlDocument *)__pyx_v_doc), __pyx_v_c_node); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.lookupDefaultElementClass");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":39
 *     return _lookupDefaultElementClass(state, doc, c_node)
 * 
 * cdef public api object lookupNamespaceElementClass(state, doc, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     return _find_nselement_class(state, doc, c_node)
 * 
 */

 DL_EXPORT(PyObject) *lookupNamespaceElementClass(PyObject *__pyx_v_state, PyObject *__pyx_v_doc, xmlNode *__pyx_v_c_node) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("lookupNamespaceElementClass");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":40
 * 
 * cdef public api object lookupNamespaceElementClass(state, doc, xmlNode* c_node):
 *     return _find_nselement_class(state, doc, c_node)             # <<<<<<<<<<<<<<
 * 
 * cdef public api object callLookupFallback(FallbackElementClassLookup lookup,
 */
  __Pyx_XDECREF(__pyx_r);
  if (!(likely(((__pyx_v_doc) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_doc, __pyx_ptype_4lxml_5etree__Document))))) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __pyx_f_4lxml_5etree__find_nselement_class(__pyx_v_state, ((struct LxmlDocument *)__pyx_v_doc), __pyx_v_c_node); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.lookupNamespaceElementClass");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":42
 *     return _find_nselement_class(state, doc, c_node)
 * 
 * cdef public api object callLookupFallback(FallbackElementClassLookup lookup,             # <<<<<<<<<<<<<<
 *                                       _Document doc, xmlNode* c_node):
 *     return _callLookupFallback(lookup, doc, c_node)
 */

 DL_EXPORT(PyObject) *callLookupFallback(struct LxmlFallbackElementClassLookup *__pyx_v_lookup, struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("callLookupFallback");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":44
 * cdef public api object callLookupFallback(FallbackElementClassLookup lookup,
 *                                       _Document doc, xmlNode* c_node):
 *     return _callLookupFallback(lookup, doc, c_node)             # <<<<<<<<<<<<<<
 * 
 * cdef public api int tagMatches(xmlNode* c_node, char* c_href, char* c_name):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__callLookupFallback(__pyx_v_lookup, __pyx_v_doc, __pyx_v_c_node); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.callLookupFallback");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":46
 *     return _callLookupFallback(lookup, doc, c_node)
 * 
 * cdef public api int tagMatches(xmlNode* c_node, char* c_href, char* c_name):             # <<<<<<<<<<<<<<
 *     if c_node is NULL:
 *         return -1
 */

 DL_EXPORT(int) tagMatches(xmlNode *__pyx_v_c_node, char *__pyx_v_c_href, char *__pyx_v_c_name) {
  int __pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("tagMatches");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":47
 * 
 * cdef public api int tagMatches(xmlNode* c_node, char* c_href, char* c_name):
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         return -1
 *     return _tagMatches(c_node, c_href, c_name)
 */
  __pyx_t_1 = (__pyx_v_c_node == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":48
 * cdef public api int tagMatches(xmlNode* c_node, char* c_href, char* c_name):
 *     if c_node is NULL:
 *         return -1             # <<<<<<<<<<<<<<
 *     return _tagMatches(c_node, c_href, c_name)
 * 
 */
    __pyx_r = -1;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":49
 *     if c_node is NULL:
 *         return -1
 *     return _tagMatches(c_node, c_href, c_name)             # <<<<<<<<<<<<<<
 * 
 * cdef public api _Document documentOrRaise(object input):
 */
  __pyx_r = __pyx_f_4lxml_5etree__tagMatches(__pyx_v_c_node, __pyx_v_c_href, __pyx_v_c_name);
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":51
 *     return _tagMatches(c_node, c_href, c_name)
 * 
 * cdef public api _Document documentOrRaise(object input):             # <<<<<<<<<<<<<<
 *     return _documentOrRaise(input)
 * 
 */

 DL_EXPORT(struct LxmlDocument) *documentOrRaise(PyObject *__pyx_v_input) {
  struct LxmlDocument *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("documentOrRaise");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":52
 * 
 * cdef public api _Document documentOrRaise(object input):
 *     return _documentOrRaise(input)             # <<<<<<<<<<<<<<
 * 
 * cdef public api _Element rootNodeOrRaise(object input):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v_input)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.documentOrRaise");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":54
 *     return _documentOrRaise(input)
 * 
 * cdef public api _Element rootNodeOrRaise(object input):             # <<<<<<<<<<<<<<
 *     return _rootNodeOrRaise(input)
 * 
 */

 DL_EXPORT(struct LxmlElement) *rootNodeOrRaise(PyObject *__pyx_v_input) {
  struct LxmlElement *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("rootNodeOrRaise");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":55
 * 
 * cdef public api _Element rootNodeOrRaise(object input):
 *     return _rootNodeOrRaise(input)             # <<<<<<<<<<<<<<
 * 
 * cdef public api bint hasText(xmlNode* c_node):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v_input)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.rootNodeOrRaise");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":57
 *     return _rootNodeOrRaise(input)
 * 
 * cdef public api bint hasText(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     return _hasText(c_node)
 * 
 */

 DL_EXPORT(int) hasText(xmlNode *__pyx_v_c_node) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("hasText");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":58
 * 
 * cdef public api bint hasText(xmlNode* c_node):
 *     return _hasText(c_node)             # <<<<<<<<<<<<<<
 * 
 * cdef public api bint hasTail(xmlNode* c_node):
 */
  __pyx_r = __pyx_f_4lxml_5etree__hasText(__pyx_v_c_node);
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":60
 *     return _hasText(c_node)
 * 
 * cdef public api bint hasTail(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     return _hasTail(c_node)
 * 
 */

 DL_EXPORT(int) hasTail(xmlNode *__pyx_v_c_node) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("hasTail");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":61
 * 
 * cdef public api bint hasTail(xmlNode* c_node):
 *     return _hasTail(c_node)             # <<<<<<<<<<<<<<
 * 
 * cdef public api object textOf(xmlNode* c_node):
 */
  __pyx_r = __pyx_f_4lxml_5etree__hasTail(__pyx_v_c_node);
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":63
 *     return _hasTail(c_node)
 * 
 * cdef public api object textOf(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     if c_node is NULL:
 *         return None
 */

 DL_EXPORT(PyObject) *textOf(xmlNode *__pyx_v_c_node) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("textOf");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":64
 * 
 * cdef public api object textOf(xmlNode* c_node):
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         return None
 *     return _collectText(c_node.children)
 */
  __pyx_t_1 = (__pyx_v_c_node == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":65
 * cdef public api object textOf(xmlNode* c_node):
 *     if c_node is NULL:
 *         return None             # <<<<<<<<<<<<<<
 *     return _collectText(c_node.children)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":66
 *     if c_node is NULL:
 *         return None
 *     return _collectText(c_node.children)             # <<<<<<<<<<<<<<
 * 
 * cdef public api object tailOf(xmlNode* c_node):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree__collectText(__pyx_v_c_node->children); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.textOf");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":68
 *     return _collectText(c_node.children)
 * 
 * cdef public api object tailOf(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     if c_node is NULL:
 *         return None
 */

 DL_EXPORT(PyObject) *tailOf(xmlNode *__pyx_v_c_node) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("tailOf");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":69
 * 
 * cdef public api object tailOf(xmlNode* c_node):
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         return None
 *     return _collectText(c_node.next)
 */
  __pyx_t_1 = (__pyx_v_c_node == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":70
 * cdef public api object tailOf(xmlNode* c_node):
 *     if c_node is NULL:
 *         return None             # <<<<<<<<<<<<<<
 *     return _collectText(c_node.next)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":71
 *     if c_node is NULL:
 *         return None
 *     return _collectText(c_node.next)             # <<<<<<<<<<<<<<
 * 
 * cdef public api int setNodeText(xmlNode* c_node, text) except -1:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree__collectText(__pyx_v_c_node->next); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.tailOf");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":73
 *     return _collectText(c_node.next)
 * 
 * cdef public api int setNodeText(xmlNode* c_node, text) except -1:             # <<<<<<<<<<<<<<
 *     if c_node is NULL:
 *         raise ValueError
 */

 DL_EXPORT(int) setNodeText(xmlNode *__pyx_v_c_node, PyObject *__pyx_v_text) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setNodeText");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":74
 * 
 * cdef public api int setNodeText(xmlNode* c_node, text) except -1:
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         raise ValueError
 *     return _setNodeText(c_node, text)
 */
  __pyx_t_1 = (__pyx_v_c_node == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":75
 * cdef public api int setNodeText(xmlNode* c_node, text) except -1:
 *     if c_node is NULL:
 *         raise ValueError             # <<<<<<<<<<<<<<
 *     return _setNodeText(c_node, text)
 * 
 */
    __Pyx_Raise(__pyx_builtin_ValueError, 0, 0);
    {__pyx_filename = __pyx_f[24]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":76
 *     if c_node is NULL:
 *         raise ValueError
 *     return _setNodeText(c_node, text)             # <<<<<<<<<<<<<<
 * 
 * cdef public api int setTailText(xmlNode* c_node, text) except -1:
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__setNodeText(__pyx_v_c_node, __pyx_v_text); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_t_2;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.setNodeText");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":78
 *     return _setNodeText(c_node, text)
 * 
 * cdef public api int setTailText(xmlNode* c_node, text) except -1:             # <<<<<<<<<<<<<<
 *     if c_node is NULL:
 *         raise ValueError
 */

 DL_EXPORT(int) setTailText(xmlNode *__pyx_v_c_node, PyObject *__pyx_v_text) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("setTailText");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":79
 * 
 * cdef public api int setTailText(xmlNode* c_node, text) except -1:
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         raise ValueError
 *     return _setTailText(c_node, text)
 */
  __pyx_t_1 = (__pyx_v_c_node == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":80
 * cdef public api int setTailText(xmlNode* c_node, text) except -1:
 *     if c_node is NULL:
 *         raise ValueError             # <<<<<<<<<<<<<<
 *     return _setTailText(c_node, text)
 * 
 */
    __Pyx_Raise(__pyx_builtin_ValueError, 0, 0);
    {__pyx_filename = __pyx_f[24]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":81
 *     if c_node is NULL:
 *         raise ValueError
 *     return _setTailText(c_node, text)             # <<<<<<<<<<<<<<
 * 
 * cdef public api object attributeValue(xmlNode* c_element, xmlAttr* c_attrib_node):
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__setTailText(__pyx_v_c_node, __pyx_v_text); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_t_2;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.setTailText");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":83
 *     return _setTailText(c_node, text)
 * 
 * cdef public api object attributeValue(xmlNode* c_element, xmlAttr* c_attrib_node):             # <<<<<<<<<<<<<<
 *     return _attributeValue(c_element, c_attrib_node)
 * 
 */

 DL_EXPORT(PyObject) *attributeValue(xmlNode *__pyx_v_c_element, xmlAttr *__pyx_v_c_attrib_node) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("attributeValue");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":84
 * 
 * cdef public api object attributeValue(xmlNode* c_element, xmlAttr* c_attrib_node):
 *     return _attributeValue(c_element, c_attrib_node)             # <<<<<<<<<<<<<<
 * 
 * cdef public api object attributeValueFromNsName(xmlNode* c_element,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__attributeValue(__pyx_v_c_element, __pyx_v_c_attrib_node); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.attributeValue");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":86
 *     return _attributeValue(c_element, c_attrib_node)
 * 
 * cdef public api object attributeValueFromNsName(xmlNode* c_element,             # <<<<<<<<<<<<<<
 *                                             char* ns, char* name):
 *     return _attributeValueFromNsName(c_element, ns, name)
 */

 DL_EXPORT(PyObject) *attributeValueFromNsName(xmlNode *__pyx_v_c_element, char *__pyx_v_ns, char *__pyx_v_name) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("attributeValueFromNsName");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":88
 * cdef public api object attributeValueFromNsName(xmlNode* c_element,
 *                                             char* ns, char* name):
 *     return _attributeValueFromNsName(c_element, ns, name)             # <<<<<<<<<<<<<<
 * 
 * cdef public api object getAttributeValue(_Element element, key, default):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__attributeValueFromNsName(__pyx_v_c_element, __pyx_v_ns, __pyx_v_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.attributeValueFromNsName");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":90
 *     return _attributeValueFromNsName(c_element, ns, name)
 * 
 * cdef public api object getAttributeValue(_Element element, key, default):             # <<<<<<<<<<<<<<
 *     return _getAttributeValue(element, key, default)
 * 
 */

 DL_EXPORT(PyObject) *getAttributeValue(struct LxmlElement *__pyx_v_element, PyObject *__pyx_v_key, PyObject *__pyx_v_default) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getAttributeValue");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":91
 * 
 * cdef public api object getAttributeValue(_Element element, key, default):
 *     return _getAttributeValue(element, key, default)             # <<<<<<<<<<<<<<
 * 
 * cdef public api object iterattributes(_Element element, int keysvalues):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__getAttributeValue(__pyx_v_element, __pyx_v_key, __pyx_v_default); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.getAttributeValue");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":93
 *     return _getAttributeValue(element, key, default)
 * 
 * cdef public api object iterattributes(_Element element, int keysvalues):             # <<<<<<<<<<<<<<
 *     return _attributeIteratorFactory(element, keysvalues)
 * 
 */

 DL_EXPORT(PyObject) *iterattributes(struct LxmlElement *__pyx_v_element, int __pyx_v_keysvalues) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("iterattributes");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":94
 * 
 * cdef public api object iterattributes(_Element element, int keysvalues):
 *     return _attributeIteratorFactory(element, keysvalues)             # <<<<<<<<<<<<<<
 * 
 * cdef public api list collectAttributes(xmlNode* c_element, int keysvalues):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__attributeIteratorFactory(__pyx_v_element, __pyx_v_keysvalues); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.iterattributes");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":96
 *     return _attributeIteratorFactory(element, keysvalues)
 * 
 * cdef public api list collectAttributes(xmlNode* c_element, int keysvalues):             # <<<<<<<<<<<<<<
 *     return _collectAttributes(c_element, keysvalues)
 * 
 */

 DL_EXPORT(PyObject) *collectAttributes(xmlNode *__pyx_v_c_element, int __pyx_v_keysvalues) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("collectAttributes");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":97
 * 
 * cdef public api list collectAttributes(xmlNode* c_element, int keysvalues):
 *     return _collectAttributes(c_element, keysvalues)             # <<<<<<<<<<<<<<
 * 
 * cdef public api int setAttributeValue(_Element element, key, value) except -1:
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__collectAttributes(__pyx_v_c_element, __pyx_v_keysvalues)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.collectAttributes");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":99
 *     return _collectAttributes(c_element, keysvalues)
 * 
 * cdef public api int setAttributeValue(_Element element, key, value) except -1:             # <<<<<<<<<<<<<<
 *     return _setAttributeValue(element, key, value)
 * 
 */

 DL_EXPORT(int) setAttributeValue(struct LxmlElement *__pyx_v_element, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
  int __pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setAttributeValue");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":100
 * 
 * cdef public api int setAttributeValue(_Element element, key, value) except -1:
 *     return _setAttributeValue(element, key, value)             # <<<<<<<<<<<<<<
 * 
 * cdef public api int delAttribute(_Element element, key) except -1:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__setAttributeValue(__pyx_v_element, __pyx_v_key, __pyx_v_value); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.setAttributeValue");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":102
 *     return _setAttributeValue(element, key, value)
 * 
 * cdef public api int delAttribute(_Element element, key) except -1:             # <<<<<<<<<<<<<<
 *     return _delAttribute(element, key)
 * 
 */

 DL_EXPORT(int) delAttribute(struct LxmlElement *__pyx_v_element, PyObject *__pyx_v_key) {
  int __pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("delAttribute");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":103
 * 
 * cdef public api int delAttribute(_Element element, key) except -1:
 *     return _delAttribute(element, key)             # <<<<<<<<<<<<<<
 * 
 * cdef public api int delAttributeFromNsName(tree.xmlNode* c_element,
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__delAttribute(__pyx_v_element, __pyx_v_key); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.delAttribute");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":105
 *     return _delAttribute(element, key)
 * 
 * cdef public api int delAttributeFromNsName(tree.xmlNode* c_element,             # <<<<<<<<<<<<<<
 *                                        char* c_href, char* c_name):
 *     return _delAttributeFromNsName(c_element, c_href, c_name)
 */

 DL_EXPORT(int) delAttributeFromNsName(xmlNode *__pyx_v_c_element, char *__pyx_v_c_href, char *__pyx_v_c_name) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("delAttributeFromNsName");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":107
 * cdef public api int delAttributeFromNsName(tree.xmlNode* c_element,
 *                                        char* c_href, char* c_name):
 *     return _delAttributeFromNsName(c_element, c_href, c_name)             # <<<<<<<<<<<<<<
 * 
 * cdef public api bint hasChild(xmlNode* c_node):
 */
  __pyx_r = __pyx_f_4lxml_5etree__delAttributeFromNsName(__pyx_v_c_element, __pyx_v_c_href, __pyx_v_c_name);
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":109
 *     return _delAttributeFromNsName(c_element, c_href, c_name)
 * 
 * cdef public api bint hasChild(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     return _hasChild(c_node)
 * 
 */

 DL_EXPORT(int) hasChild(xmlNode *__pyx_v_c_node) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("hasChild");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":110
 * 
 * cdef public api bint hasChild(xmlNode* c_node):
 *     return _hasChild(c_node)             # <<<<<<<<<<<<<<
 * 
 * cdef public api xmlNode* findChild(xmlNode* c_node, Py_ssize_t index):
 */
  __pyx_r = __pyx_f_4lxml_5etree__hasChild(__pyx_v_c_node);
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":112
 *     return _hasChild(c_node)
 * 
 * cdef public api xmlNode* findChild(xmlNode* c_node, Py_ssize_t index):             # <<<<<<<<<<<<<<
 *     return _findChild(c_node, index)
 * 
 */

 DL_EXPORT(xmlNode) *findChild(xmlNode *__pyx_v_c_node, Py_ssize_t __pyx_v_index) {
  xmlNode *__pyx_r;
  __Pyx_RefNannySetupContext("findChild");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":113
 * 
 * cdef public api xmlNode* findChild(xmlNode* c_node, Py_ssize_t index):
 *     return _findChild(c_node, index)             # <<<<<<<<<<<<<<
 * 
 * cdef public api xmlNode* findChildForwards(xmlNode* c_node, Py_ssize_t index):
 */
  __pyx_r = __pyx_f_4lxml_5etree__findChild(__pyx_v_c_node, __pyx_v_index);
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":115
 *     return _findChild(c_node, index)
 * 
 * cdef public api xmlNode* findChildForwards(xmlNode* c_node, Py_ssize_t index):             # <<<<<<<<<<<<<<
 *     return _findChildForwards(c_node, index)
 * 
 */

 DL_EXPORT(xmlNode) *findChildForwards(xmlNode *__pyx_v_c_node, Py_ssize_t __pyx_v_index) {
  xmlNode *__pyx_r;
  __Pyx_RefNannySetupContext("findChildForwards");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":116
 * 
 * cdef public api xmlNode* findChildForwards(xmlNode* c_node, Py_ssize_t index):
 *     return _findChildForwards(c_node, index)             # <<<<<<<<<<<<<<
 * 
 * cdef public api xmlNode* findChildBackwards(xmlNode* c_node, Py_ssize_t index):
 */
  __pyx_r = __pyx_f_4lxml_5etree__findChildForwards(__pyx_v_c_node, __pyx_v_index);
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":118
 *     return _findChildForwards(c_node, index)
 * 
 * cdef public api xmlNode* findChildBackwards(xmlNode* c_node, Py_ssize_t index):             # <<<<<<<<<<<<<<
 *     return _findChildBackwards(c_node, index)
 * 
 */

 DL_EXPORT(xmlNode) *findChildBackwards(xmlNode *__pyx_v_c_node, Py_ssize_t __pyx_v_index) {
  xmlNode *__pyx_r;
  __Pyx_RefNannySetupContext("findChildBackwards");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":119
 * 
 * cdef public api xmlNode* findChildBackwards(xmlNode* c_node, Py_ssize_t index):
 *     return _findChildBackwards(c_node, index)             # <<<<<<<<<<<<<<
 * 
 * cdef public api xmlNode* nextElement(xmlNode* c_node):
 */
  __pyx_r = __pyx_f_4lxml_5etree__findChildBackwards(__pyx_v_c_node, __pyx_v_index);
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":121
 *     return _findChildBackwards(c_node, index)
 * 
 * cdef public api xmlNode* nextElement(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     return _nextElement(c_node)
 * 
 */

 DL_EXPORT(xmlNode) *nextElement(xmlNode *__pyx_v_c_node) {
  xmlNode *__pyx_r;
  __Pyx_RefNannySetupContext("nextElement");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":122
 * 
 * cdef public api xmlNode* nextElement(xmlNode* c_node):
 *     return _nextElement(c_node)             # <<<<<<<<<<<<<<
 * 
 * cdef public api xmlNode* previousElement(xmlNode* c_node):
 */
  __pyx_r = __pyx_f_4lxml_5etree__nextElement(__pyx_v_c_node);
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":124
 *     return _nextElement(c_node)
 * 
 * cdef public api xmlNode* previousElement(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     return _previousElement(c_node)
 * 
 */

 DL_EXPORT(xmlNode) *previousElement(xmlNode *__pyx_v_c_node) {
  xmlNode *__pyx_r;
  __Pyx_RefNannySetupContext("previousElement");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":125
 * 
 * cdef public api xmlNode* previousElement(xmlNode* c_node):
 *     return _previousElement(c_node)             # <<<<<<<<<<<<<<
 * 
 * cdef public api void appendChild(_Element parent, _Element child):
 */
  __pyx_r = __pyx_f_4lxml_5etree__previousElement(__pyx_v_c_node);
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":127
 *     return _previousElement(c_node)
 * 
 * cdef public api void appendChild(_Element parent, _Element child):             # <<<<<<<<<<<<<<
 *     _appendChild(parent, child)
 * 
 */

 DL_EXPORT(void) appendChild(struct LxmlElement *__pyx_v_parent, struct LxmlElement *__pyx_v_child) {
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("appendChild");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":128
 * 
 * cdef public api void appendChild(_Element parent, _Element child):
 *     _appendChild(parent, child)             # <<<<<<<<<<<<<<
 * 
 * cdef public api object pyunicode(char* s):
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__appendChild(__pyx_v_parent, __pyx_v_child); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("lxml.etree.appendChild");
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":130
 *     _appendChild(parent, child)
 * 
 * cdef public api object pyunicode(char* s):             # <<<<<<<<<<<<<<
 *     if s is NULL:
 *         raise TypeError
 */

 DL_EXPORT(PyObject) *pyunicode(char *__pyx_v_s) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("pyunicode");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":131
 * 
 * cdef public api object pyunicode(char* s):
 *     if s is NULL:             # <<<<<<<<<<<<<<
 *         raise TypeError
 *     return funicode(s)
 */
  __pyx_t_1 = (__pyx_v_s == NULL);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":132
 * cdef public api object pyunicode(char* s):
 *     if s is NULL:
 *         raise TypeError             # <<<<<<<<<<<<<<
 *     return funicode(s)
 * 
 */
    __Pyx_Raise(__pyx_builtin_TypeError, 0, 0);
    {__pyx_filename = __pyx_f[24]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":133
 *     if s is NULL:
 *         raise TypeError
 *     return funicode(s)             # <<<<<<<<<<<<<<
 * 
 * cdef public api bytes utf8(object s):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_s); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.pyunicode");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":135
 *     return funicode(s)
 * 
 * cdef public api bytes utf8(object s):             # <<<<<<<<<<<<<<
 *     return _utf8(s)
 * 
 */

 DL_EXPORT(PyObject) *utf8(PyObject *__pyx_v_s) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("utf8");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":136
 * 
 * cdef public api bytes utf8(object s):
 *     return _utf8(s)             # <<<<<<<<<<<<<<
 * 
 * cdef public api tuple getNsTag(object tag):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__utf8(__pyx_v_s)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.utf8");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":138
 *     return _utf8(s)
 * 
 * cdef public api tuple getNsTag(object tag):             # <<<<<<<<<<<<<<
 *     return _getNsTag(tag)
 * 
 */

 DL_EXPORT(PyObject) *getNsTag(PyObject *__pyx_v_tag) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getNsTag");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":139
 * 
 * cdef public api tuple getNsTag(object tag):
 *     return _getNsTag(tag)             # <<<<<<<<<<<<<<
 * 
 * cdef public api tuple getNsTagWithEmptyNs(object tag):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__getNsTag(__pyx_v_tag)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.getNsTag");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":141
 *     return _getNsTag(tag)
 * 
 * cdef public api tuple getNsTagWithEmptyNs(object tag):             # <<<<<<<<<<<<<<
 *     return _getNsTagWithEmptyNs(tag)
 * 
 */

 DL_EXPORT(PyObject) *getNsTagWithEmptyNs(PyObject *__pyx_v_tag) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getNsTagWithEmptyNs");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":142
 * 
 * cdef public api tuple getNsTagWithEmptyNs(object tag):
 *     return _getNsTagWithEmptyNs(tag)             # <<<<<<<<<<<<<<
 * 
 * cdef public api object namespacedName(xmlNode* c_node):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__getNsTagWithEmptyNs(__pyx_v_tag)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.getNsTagWithEmptyNs");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":144
 *     return _getNsTagWithEmptyNs(tag)
 * 
 * cdef public api object namespacedName(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     return _namespacedName(c_node)
 * 
 */

 DL_EXPORT(PyObject) *namespacedName(xmlNode *__pyx_v_c_node) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("namespacedName");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":145
 * 
 * cdef public api object namespacedName(xmlNode* c_node):
 *     return _namespacedName(c_node)             # <<<<<<<<<<<<<<
 * 
 * cdef public api object namespacedNameFromNsName(char* href, char* name):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__namespacedName(__pyx_v_c_node); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.namespacedName");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":147
 *     return _namespacedName(c_node)
 * 
 * cdef public api object namespacedNameFromNsName(char* href, char* name):             # <<<<<<<<<<<<<<
 *     return _namespacedNameFromNsName(href, name)
 * 
 */

 DL_EXPORT(PyObject) *namespacedNameFromNsName(char *__pyx_v_href, char *__pyx_v_name) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("namespacedNameFromNsName");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":148
 * 
 * cdef public api object namespacedNameFromNsName(char* href, char* name):
 *     return _namespacedNameFromNsName(href, name)             # <<<<<<<<<<<<<<
 * 
 * cdef public api void iteratorStoreNext(_ElementIterator iterator, _Element node):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__namespacedNameFromNsName(__pyx_v_href, __pyx_v_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.namespacedNameFromNsName");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":150
 *     return _namespacedNameFromNsName(href, name)
 * 
 * cdef public api void iteratorStoreNext(_ElementIterator iterator, _Element node):             # <<<<<<<<<<<<<<
 *     iterator._storeNext(node)
 * 
 */

 DL_EXPORT(void) iteratorStoreNext(struct LxmlElementIterator *__pyx_v_iterator, struct LxmlElement *__pyx_v_node) {
  __Pyx_RefNannySetupContext("iteratorStoreNext");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":151
 * 
 * cdef public api void iteratorStoreNext(_ElementIterator iterator, _Element node):
 *     iterator._storeNext(node)             # <<<<<<<<<<<<<<
 * 
 * cdef public api void initTagMatch(_ElementTagMatcher matcher, tag):
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__ElementIterator *)__pyx_v_iterator->__pyx_base.__pyx_vtab)->_storeNext(__pyx_v_iterator, __pyx_v_node);

  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":153
 *     iterator._storeNext(node)
 * 
 * cdef public api void initTagMatch(_ElementTagMatcher matcher, tag):             # <<<<<<<<<<<<<<
 *     matcher._initTagMatch(tag)
 * 
 */

 DL_EXPORT(void) initTagMatch(struct LxmlElementTagMatcher *__pyx_v_matcher, PyObject *__pyx_v_tag) {
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("initTagMatch");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":154
 * 
 * cdef public api void initTagMatch(_ElementTagMatcher matcher, tag):
 *     matcher._initTagMatch(tag)             # <<<<<<<<<<<<<<
 * 
 * cdef public api tree.xmlNs* findOrBuildNodeNsPrefix(
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ElementTagMatcher *)__pyx_v_matcher->__pyx_vtab)->_initTagMatch(__pyx_v_matcher, __pyx_v_tag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_WriteUnraisable("lxml.etree.initTagMatch");
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":156
 *     matcher._initTagMatch(tag)
 * 
 * cdef public api tree.xmlNs* findOrBuildNodeNsPrefix(             # <<<<<<<<<<<<<<
 *     _Document doc, xmlNode* c_node, char* href, char* prefix) except NULL:
 *     if doc is None:
 */

 DL_EXPORT(xmlNs) *findOrBuildNodeNsPrefix(struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node, char *__pyx_v_href, char *__pyx_v_prefix) {
  xmlNs *__pyx_r;
  int __pyx_t_1;
  xmlNs *__pyx_t_2;
  __Pyx_RefNannySetupContext("findOrBuildNodeNsPrefix");

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":158
 * cdef public api tree.xmlNs* findOrBuildNodeNsPrefix(
 *     _Document doc, xmlNode* c_node, char* href, char* prefix) except NULL:
 *     if doc is None:             # <<<<<<<<<<<<<<
 *         raise TypeError
 *     return doc._findOrBuildNodeNs(c_node, href, prefix, 0)
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_doc) == Py_None);
  if (__pyx_t_1) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":159
 *     _Document doc, xmlNode* c_node, char* href, char* prefix) except NULL:
 *     if doc is None:
 *         raise TypeError             # <<<<<<<<<<<<<<
 *     return doc._findOrBuildNodeNs(c_node, href, prefix, 0)
 */
    __Pyx_Raise(__pyx_builtin_TypeError, 0, 0);
    {__pyx_filename = __pyx_f[24]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/public-api.pxi":160
 *     if doc is None:
 *         raise TypeError
 *     return doc._findOrBuildNodeNs(c_node, href, prefix, 0)             # <<<<<<<<<<<<<<
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__Document *)__pyx_v_doc->__pyx_vtab)->_findOrBuildNodeNs(__pyx_v_doc, __pyx_v_c_node, __pyx_v_href, __pyx_v_prefix, 0); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_t_2;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.findOrBuildNodeNsPrefix");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static struct __pyx_vtabstruct_4lxml_5etree__TempStore __pyx_vtable_4lxml_5etree__TempStore;

static PyObject *__pyx_tp_new_4lxml_5etree__TempStore(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__TempStore *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__TempStore *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__TempStore;
  p->_storage = ((PyObject*)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__TempStore(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__TempStore *p = (struct __pyx_obj_4lxml_5etree__TempStore *)o;
  Py_XDECREF(((PyObject *)p->_storage));
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree__TempStore(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__TempStore *p = (struct __pyx_obj_4lxml_5etree__TempStore *)o;
  if (p->_storage) {
    e = (*v)(p->_storage, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__TempStore(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__TempStore *p = (struct __pyx_obj_4lxml_5etree__TempStore *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->_storage);
  p->_storage = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__TempStore[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__TempStore = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__TempStore = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__TempStore = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__TempStore = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree__TempStore = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._TempStore"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__TempStore), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__TempStore, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number__TempStore, /*tp_as_number*/
  &__pyx_tp_as_sequence__TempStore, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__TempStore, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__TempStore, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__TempStore, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__TempStore, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__TempStore, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_4lxml_5etree_10_TempStore___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__TempStore, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext __pyx_vtable_4lxml_5etree__ExceptionContext;

static PyObject *__pyx_tp_new_4lxml_5etree__ExceptionContext(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ExceptionContext *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ExceptionContext *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__ExceptionContext;
  p->_exc_info = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__ExceptionContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ExceptionContext *p = (struct __pyx_obj_4lxml_5etree__ExceptionContext *)o;
  Py_XDECREF(p->_exc_info);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree__ExceptionContext(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__ExceptionContext *p = (struct __pyx_obj_4lxml_5etree__ExceptionContext *)o;
  if (p->_exc_info) {
    e = (*v)(p->_exc_info, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__ExceptionContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ExceptionContext *p = (struct __pyx_obj_4lxml_5etree__ExceptionContext *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->_exc_info);
  p->_exc_info = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__ExceptionContext[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__ExceptionContext = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__ExceptionContext = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__ExceptionContext = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__ExceptionContext = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree__ExceptionContext = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._ExceptionContext"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ExceptionContext), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ExceptionContext, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number__ExceptionContext, /*tp_as_number*/
  &__pyx_tp_as_sequence__ExceptionContext, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__ExceptionContext, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__ExceptionContext, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ExceptionContext, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ExceptionContext, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__ExceptionContext, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__ExceptionContext, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__Document __pyx_vtable_4lxml_5etree__Document;

static PyObject *__pyx_tp_new_4lxml_5etree__Document(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct LxmlDocument *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct LxmlDocument *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__Document;
  p->_prefix_tail = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__Document(PyObject *o) {
  struct LxmlDocument *p = (struct LxmlDocument *)o;
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pf_4lxml_5etree_9_Document___dealloc__(o);
    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_XDECREF(((PyObject *)p->_prefix_tail));
  Py_XDECREF(((PyObject *)p->_parser));
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree__Document(PyObject *o, visitproc v, void *a) {
  int e;
  struct LxmlDocument *p = (struct LxmlDocument *)o;
  if (p->_prefix_tail) {
    e = (*v)(p->_prefix_tail, a); if (e) return e;
  }
  if (p->_parser) {
    e = (*v)(((PyObject*)p->_parser), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__Document(PyObject *o) {
  struct LxmlDocument *p = (struct LxmlDocument *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->_prefix_tail);
  p->_prefix_tail = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_parser);
  p->_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__Document[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__Document = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__Document = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__Document = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__Document = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

DL_EXPORT(PyTypeObject) LxmlDocumentType = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._Document"), /*tp_name*/
  sizeof(struct LxmlDocument), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__Document, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number__Document, /*tp_as_number*/
  &__pyx_tp_as_sequence__Document, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__Document, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__Document, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("Internal base class to reference a libxml document.\n\n    When instances of this class are garbage collected, the libxml\n    document is cleaned up.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__Document, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__Document, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__Document, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__Document, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static PyObject *__pyx_tp_new_4lxml_5etree__Element(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct LxmlElement *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct LxmlElement *)o);
  p->_doc = ((struct LxmlDocument *)Py_None); Py_INCREF(Py_None);
  p->_tag = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__Element(PyObject *o) {
  struct LxmlElement *p = (struct LxmlElement *)o;
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pf_4lxml_5etree_8_Element_1__dealloc__(o);
    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_XDECREF(((PyObject *)p->_doc));
  Py_XDECREF(p->_tag);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree__Element(PyObject *o, visitproc v, void *a) {
  int e;
  struct LxmlElement *p = (struct LxmlElement *)o;
  if (p->_doc) {
    e = (*v)(((PyObject*)p->_doc), a); if (e) return e;
  }
  if (p->_tag) {
    e = (*v)(p->_tag, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__Element(PyObject *o) {
  struct LxmlElement *p = (struct LxmlElement *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->_doc);
  p->_doc = ((struct LxmlDocument *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_tag);
  p->_tag = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}
static PyObject *__pyx_sq_item_4lxml_5etree__Element(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static int __pyx_mp_ass_subscript_4lxml_5etree__Element(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_pf_4lxml_5etree_8_Element_2__setitem__(o, i, v);
  }
  else {
    return __pyx_pf_4lxml_5etree_8_Element_3__delitem__(o, i);
  }
}

static PyObject *__pyx_getprop_4lxml_5etree_8_Element_tag(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_8_Element_3tag___get__(o);
}

static int __pyx_setprop_4lxml_5etree_8_Element_tag(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_4lxml_5etree_8_Element_3tag_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_4lxml_5etree_8_Element_attrib(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_8_Element_6attrib___get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_8_Element_text(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_8_Element_4text___get__(o);
}

static int __pyx_setprop_4lxml_5etree_8_Element_text(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_4lxml_5etree_8_Element_4text_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_4lxml_5etree_8_Element_tail(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_8_Element_4tail___get__(o);
}

static int __pyx_setprop_4lxml_5etree_8_Element_tail(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_4lxml_5etree_8_Element_4tail_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_4lxml_5etree_8_Element_prefix(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_8_Element_6prefix___get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_8_Element_sourceline(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_8_Element_10sourceline___get__(o);
}

static int __pyx_setprop_4lxml_5etree_8_Element_sourceline(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_4lxml_5etree_8_Element_10sourceline_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_4lxml_5etree_8_Element_nsmap(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_8_Element_5nsmap___get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_8_Element_base(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_8_Element_4base___get__(o);
}

static int __pyx_setprop_4lxml_5etree_8_Element_base(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_4lxml_5etree_8_Element_4base_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyMethodDef __pyx_methods_4lxml_5etree__Element[] = {
  {__Pyx_NAMESTR("_init"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element__init, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element__init)},
  {__Pyx_NAMESTR("__deepcopy__"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_4__deepcopy__, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_4__deepcopy__)},
  {__Pyx_NAMESTR("__copy__"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_5__copy__, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_5__copy__)},
  {__Pyx_NAMESTR("set"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_6set, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_6set)},
  {__Pyx_NAMESTR("append"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_7append, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_7append)},
  {__Pyx_NAMESTR("addnext"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_8addnext, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_8addnext)},
  {__Pyx_NAMESTR("addprevious"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_9addprevious, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_9addprevious)},
  {__Pyx_NAMESTR("extend"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_10extend, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_10extend)},
  {__Pyx_NAMESTR("clear"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_11clear, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_11clear)},
  {__Pyx_NAMESTR("insert"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_12insert, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_12insert)},
  {__Pyx_NAMESTR("remove"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_13remove, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_13remove)},
  {__Pyx_NAMESTR("replace"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_14replace, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_14replace)},
  {__Pyx_NAMESTR("__reversed__"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_21__reversed__, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_21__reversed__)},
  {__Pyx_NAMESTR("index"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_22index, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_22index)},
  {__Pyx_NAMESTR("get"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_23get, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_23get)},
  {__Pyx_NAMESTR("keys"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_24keys, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_24keys)},
  {__Pyx_NAMESTR("values"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_25values, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_25values)},
  {__Pyx_NAMESTR("items"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_26items, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_26items)},
  {__Pyx_NAMESTR("getchildren"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_27getchildren, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_27getchildren)},
  {__Pyx_NAMESTR("getparent"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_28getparent, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_28getparent)},
  {__Pyx_NAMESTR("getnext"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_29getnext, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_29getnext)},
  {__Pyx_NAMESTR("getprevious"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_30getprevious, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_30getprevious)},
  {__Pyx_NAMESTR("itersiblings"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_31itersiblings, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_31itersiblings)},
  {__Pyx_NAMESTR("iterancestors"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_32iterancestors, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_32iterancestors)},
  {__Pyx_NAMESTR("iterdescendants"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_33iterdescendants, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_33iterdescendants)},
  {__Pyx_NAMESTR("iterchildren"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_34iterchildren, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_34iterchildren)},
  {__Pyx_NAMESTR("getroottree"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_35getroottree, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_35getroottree)},
  {__Pyx_NAMESTR("getiterator"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_36getiterator, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_36getiterator)},
  {__Pyx_NAMESTR("iter"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_37iter, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_37iter)},
  {__Pyx_NAMESTR("itertext"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_38itertext, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_38itertext)},
  {__Pyx_NAMESTR("makeelement"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_39makeelement, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_39makeelement)},
  {__Pyx_NAMESTR("find"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_40find, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_40find)},
  {__Pyx_NAMESTR("findtext"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_41findtext, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_41findtext)},
  {__Pyx_NAMESTR("findall"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_42findall, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_42findall)},
  {__Pyx_NAMESTR("iterfind"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_43iterfind, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_43iterfind)},
  {__Pyx_NAMESTR("xpath"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_44xpath, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_44xpath)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__Element[] = {
  {(char *)"tag", __pyx_getprop_4lxml_5etree_8_Element_tag, __pyx_setprop_4lxml_5etree_8_Element_tag, __Pyx_DOCSTR(__pyx_k_421), 0},
  {(char *)"attrib", __pyx_getprop_4lxml_5etree_8_Element_attrib, 0, __Pyx_DOCSTR(__pyx_k_422), 0},
  {(char *)"text", __pyx_getprop_4lxml_5etree_8_Element_text, __pyx_setprop_4lxml_5etree_8_Element_text, __Pyx_DOCSTR(__pyx_k_423), 0},
  {(char *)"tail", __pyx_getprop_4lxml_5etree_8_Element_tail, __pyx_setprop_4lxml_5etree_8_Element_tail, __Pyx_DOCSTR(__pyx_k_424), 0},
  {(char *)"prefix", __pyx_getprop_4lxml_5etree_8_Element_prefix, 0, __Pyx_DOCSTR(__pyx_k_425), 0},
  {(char *)"sourceline", __pyx_getprop_4lxml_5etree_8_Element_sourceline, __pyx_setprop_4lxml_5etree_8_Element_sourceline, __Pyx_DOCSTR(__pyx_k_426), 0},
  {(char *)"nsmap", __pyx_getprop_4lxml_5etree_8_Element_nsmap, 0, __Pyx_DOCSTR(__pyx_k_427), 0},
  {(char *)"base", __pyx_getprop_4lxml_5etree_8_Element_base, __pyx_setprop_4lxml_5etree_8_Element_base, __Pyx_DOCSTR(__pyx_k_428), 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__Element = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  __pyx_pf_4lxml_5etree_8_Element_18__nonzero__, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__Element = {
  __pyx_pf_4lxml_5etree_8_Element_17__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_4lxml_5etree__Element, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  __pyx_pf_4lxml_5etree_8_Element_19__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__Element = {
  __pyx_pf_4lxml_5etree_8_Element_17__len__, /*mp_length*/
  __pyx_pf_4lxml_5etree_8_Element_16__getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_4lxml_5etree__Element, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__Element = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

DL_EXPORT(PyTypeObject) LxmlElementType = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._Element"), /*tp_name*/
  sizeof(struct LxmlElement), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__Element, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pf_4lxml_5etree_8_Element_15__repr__, /*tp_repr*/
  &__pyx_tp_as_number__Element, /*tp_as_number*/
  &__pyx_tp_as_sequence__Element, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__Element, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__Element, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("Element class.\n\n    References a document object and a libxml node.\n\n    By pointing to a Document instance, a reference is kept to\n    _Document as long as there is some pointer to a node in it.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__Element, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__Element, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pf_4lxml_5etree_8_Element_20__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__Element, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__Element, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__Element, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__BaseParser __pyx_vtable_4lxml_5etree__BaseParser;

static PyObject *__pyx_tp_new_4lxml_5etree__BaseParser(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__BaseParser *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__BaseParser *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__BaseParser;
  p->_class_lookup = ((struct LxmlElementClassLookup *)Py_None); Py_INCREF(Py_None);
  p->_resolvers = ((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)Py_None); Py_INCREF(Py_None);
  p->_parser_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)Py_None); Py_INCREF(Py_None);
  p->_push_parser_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)Py_None); Py_INCREF(Py_None);
  p->_schema = ((struct __pyx_obj_4lxml_5etree_XMLSchema *)Py_None); Py_INCREF(Py_None);
  p->_filename = Py_None; Py_INCREF(Py_None);
  p->target = Py_None; Py_INCREF(Py_None);
  p->_default_encoding = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__BaseParser(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__BaseParser *p = (struct __pyx_obj_4lxml_5etree__BaseParser *)o;
  Py_XDECREF(((PyObject *)p->_class_lookup));
  Py_XDECREF(((PyObject *)p->_resolvers));
  Py_XDECREF(((PyObject *)p->_parser_context));
  Py_XDECREF(((PyObject *)p->_push_parser_context));
  Py_XDECREF(((PyObject *)p->_schema));
  Py_XDECREF(p->_filename);
  Py_XDECREF(p->target);
  Py_XDECREF(p->_default_encoding);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree__BaseParser(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__BaseParser *p = (struct __pyx_obj_4lxml_5etree__BaseParser *)o;
  if (p->_class_lookup) {
    e = (*v)(((PyObject*)p->_class_lookup), a); if (e) return e;
  }
  if (p->_resolvers) {
    e = (*v)(((PyObject*)p->_resolvers), a); if (e) return e;
  }
  if (p->_parser_context) {
    e = (*v)(((PyObject*)p->_parser_context), a); if (e) return e;
  }
  if (p->_push_parser_context) {
    e = (*v)(((PyObject*)p->_push_parser_context), a); if (e) return e;
  }
  if (p->_schema) {
    e = (*v)(((PyObject*)p->_schema), a); if (e) return e;
  }
  if (p->_filename) {
    e = (*v)(p->_filename, a); if (e) return e;
  }
  if (p->target) {
    e = (*v)(p->target, a); if (e) return e;
  }
  if (p->_default_encoding) {
    e = (*v)(p->_default_encoding, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__BaseParser(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__BaseParser *p = (struct __pyx_obj_4lxml_5etree__BaseParser *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->_class_lookup);
  p->_class_lookup = ((struct LxmlElementClassLookup *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_resolvers);
  p->_resolvers = ((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_parser_context);
  p->_parser_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_push_parser_context);
  p->_push_parser_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_schema);
  p->_schema = ((struct __pyx_obj_4lxml_5etree_XMLSchema *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_filename);
  p->_filename = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->target);
  p->target = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_default_encoding);
  p->_default_encoding = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_11_BaseParser_error_log(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_11_BaseParser_9error_log___get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_11_BaseParser_resolvers(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_11_BaseParser_9resolvers___get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_11_BaseParser_version(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_11_BaseParser_7version___get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_11_BaseParser_target(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_11_BaseParser_6target___get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__BaseParser[] = {
  {__Pyx_NAMESTR("setElementClassLookup"), (PyCFunction)__pyx_pf_4lxml_5etree_11_BaseParser_1setElementClassLookup, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_11_BaseParser_1setElementClassLookup)},
  {__Pyx_NAMESTR("set_element_class_lookup"), (PyCFunction)__pyx_pf_4lxml_5etree_11_BaseParser_2set_element_class_lookup, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_11_BaseParser_2set_element_class_lookup)},
  {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_pf_4lxml_5etree_11_BaseParser_3copy, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_11_BaseParser_3copy)},
  {__Pyx_NAMESTR("makeelement"), (PyCFunction)__pyx_pf_4lxml_5etree_11_BaseParser_4makeelement, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_11_BaseParser_4makeelement)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__BaseParser[] = {
  {(char *)"error_log", __pyx_getprop_4lxml_5etree_11_BaseParser_error_log, 0, __Pyx_DOCSTR(__pyx_k_429), 0},
  {(char *)"resolvers", __pyx_getprop_4lxml_5etree_11_BaseParser_resolvers, 0, __Pyx_DOCSTR(__pyx_k_430), 0},
  {(char *)"version", __pyx_getprop_4lxml_5etree_11_BaseParser_version, 0, __Pyx_DOCSTR(__pyx_k_431), 0},
  {(char *)"target", __pyx_getprop_4lxml_5etree_11_BaseParser_target, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__BaseParser = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__BaseParser = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__BaseParser = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__BaseParser = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree__BaseParser = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._BaseParser"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__BaseParser), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__BaseParser, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number__BaseParser, /*tp_as_number*/
  &__pyx_tp_as_sequence__BaseParser, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__BaseParser, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__BaseParser, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__BaseParser, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__BaseParser, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__BaseParser, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__BaseParser, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_4lxml_5etree_11_BaseParser___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__BaseParser, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static PyObject *__pyx_tp_new_4lxml_5etree_QName(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_QName *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_QName *)o);
  p->text = Py_None; Py_INCREF(Py_None);
  p->localname = Py_None; Py_INCREF(Py_None);
  p->namespace = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_QName(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_QName *p = (struct __pyx_obj_4lxml_5etree_QName *)o;
  Py_XDECREF(p->text);
  Py_XDECREF(p->localname);
  Py_XDECREF(p->namespace);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree_QName(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree_QName *p = (struct __pyx_obj_4lxml_5etree_QName *)o;
  if (p->text) {
    e = (*v)(p->text, a); if (e) return e;
  }
  if (p->localname) {
    e = (*v)(p->localname, a); if (e) return e;
  }
  if (p->namespace) {
    e = (*v)(p->namespace, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree_QName(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_QName *p = (struct __pyx_obj_4lxml_5etree_QName *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->text);
  p->text = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->localname);
  p->localname = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->namespace);
  p->namespace = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_5QName_text(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_5QName_4text___get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_5QName_localname(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_5QName_9localname___get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_5QName_namespace(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_5QName_9namespace___get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree_QName[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree_QName[] = {
  {(char *)"text", __pyx_getprop_4lxml_5etree_5QName_text, 0, 0, 0},
  {(char *)"localname", __pyx_getprop_4lxml_5etree_5QName_localname, 0, 0, 0},
  {(char *)"namespace", __pyx_getprop_4lxml_5etree_5QName_namespace, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_QName = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_QName = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_QName = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_QName = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree_QName = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.QName"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_QName), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_QName, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_QName, /*tp_as_number*/
  &__pyx_tp_as_sequence_QName, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_QName, /*tp_as_mapping*/
  __pyx_pf_4lxml_5etree_5QName_2__hash__, /*tp_hash*/
  0, /*tp_call*/
  __pyx_pf_4lxml_5etree_5QName_1__str__, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_QName, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("QName(text_or_uri, tag=None)\n\n    QName wrapper for qualified XML names.\n\n    Pass a tag name by itself or a namespace URI and a tag name to\n    create a qualified name.\n\n    The ``text`` property holds the qualified name in\n    ``{namespace}tagname`` notation.  The ``namespace`` and\n    ``localname`` properties hold the respective parts of the tag\n    name.\n\n    You can pass QName objects wherever a tag name is expected.  Also,\n    setting Element text from a QName will resolve the namespace\n    prefix and set a qualified text value.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_QName, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_QName, /*tp_clear*/
  __pyx_pf_4lxml_5etree_5QName_3__richcmp__, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_QName, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree_QName, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_4lxml_5etree_5QName___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_QName, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__LogEntry __pyx_vtable_4lxml_5etree__LogEntry;

static PyObject *__pyx_tp_new_4lxml_5etree__LogEntry(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__LogEntry *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__LogEntry *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__LogEntry;
  p->message = Py_None; Py_INCREF(Py_None);
  p->filename = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__LogEntry(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__LogEntry *p = (struct __pyx_obj_4lxml_5etree__LogEntry *)o;
  Py_XDECREF(p->message);
  Py_XDECREF(p->filename);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree__LogEntry(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__LogEntry *p = (struct __pyx_obj_4lxml_5etree__LogEntry *)o;
  if (p->message) {
    e = (*v)(p->message, a); if (e) return e;
  }
  if (p->filename) {
    e = (*v)(p->filename, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__LogEntry(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__LogEntry *p = (struct __pyx_obj_4lxml_5etree__LogEntry *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->message);
  p->message = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->filename);
  p->filename = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_9_LogEntry_domain_name(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_9_LogEntry_11domain_name___get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_9_LogEntry_type_name(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_9_LogEntry_9type_name___get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_9_LogEntry_level_name(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_9_LogEntry_10level_name___get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_9_LogEntry_domain(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_9_LogEntry_6domain___get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_9_LogEntry_type(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_9_LogEntry_4type___get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_9_LogEntry_level(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_9_LogEntry_5level___get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_9_LogEntry_line(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_9_LogEntry_4line___get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_9_LogEntry_column(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_9_LogEntry_6column___get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_9_LogEntry_message(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_9_LogEntry_7message___get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_9_LogEntry_filename(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_9_LogEntry_8filename___get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__LogEntry[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__LogEntry[] = {
  {(char *)"domain_name", __pyx_getprop_4lxml_5etree_9_LogEntry_domain_name, 0, __Pyx_DOCSTR(__pyx_k_432), 0},
  {(char *)"type_name", __pyx_getprop_4lxml_5etree_9_LogEntry_type_name, 0, __Pyx_DOCSTR(__pyx_k_433), 0},
  {(char *)"level_name", __pyx_getprop_4lxml_5etree_9_LogEntry_level_name, 0, __Pyx_DOCSTR(__pyx_k_434), 0},
  {(char *)"domain", __pyx_getprop_4lxml_5etree_9_LogEntry_domain, 0, 0, 0},
  {(char *)"type", __pyx_getprop_4lxml_5etree_9_LogEntry_type, 0, 0, 0},
  {(char *)"level", __pyx_getprop_4lxml_5etree_9_LogEntry_level, 0, 0, 0},
  {(char *)"line", __pyx_getprop_4lxml_5etree_9_LogEntry_line, 0, 0, 0},
  {(char *)"column", __pyx_getprop_4lxml_5etree_9_LogEntry_column, 0, 0, 0},
  {(char *)"message", __pyx_getprop_4lxml_5etree_9_LogEntry_message, 0, 0, 0},
  {(char *)"filename", __pyx_getprop_4lxml_5etree_9_LogEntry_filename, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__LogEntry = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__LogEntry = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__LogEntry = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__LogEntry = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree__LogEntry = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._LogEntry"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__LogEntry), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__LogEntry, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pf_4lxml_5etree_9_LogEntry___repr__, /*tp_repr*/
  &__pyx_tp_as_number__LogEntry, /*tp_as_number*/
  &__pyx_tp_as_sequence__LogEntry, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__LogEntry, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__LogEntry, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("A log message entry from an error log.\n\n    Attributes:\n\n    - message: the message text\n    - domain: the domain ID (see lxml.etree.ErrorDomains)\n    - type: the message type ID (see lxml.etree.ErrorTypes)\n    - level: the log level ID (see lxml.etree.ErrorLevels)\n    - line: the line at which the message originated (if applicable)\n    - column: the character column at which the message originated (if applicable)\n    - filename: the name of the file in which the message originated (if applicable)\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__LogEntry, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__LogEntry, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__LogEntry, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__LogEntry, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__LogEntry, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__BaseErrorLog __pyx_vtable_4lxml_5etree__BaseErrorLog;

static PyObject *__pyx_tp_new_4lxml_5etree__BaseErrorLog(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__BaseErrorLog *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__BaseErrorLog;
  p->_first_error = ((struct __pyx_obj_4lxml_5etree__LogEntry *)Py_None); Py_INCREF(Py_None);
  p->last_error = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__BaseErrorLog(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__BaseErrorLog *p = (struct __pyx_obj_4lxml_5etree__BaseErrorLog *)o;
  Py_XDECREF(((PyObject *)p->_first_error));
  Py_XDECREF(p->last_error);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree__BaseErrorLog(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__BaseErrorLog *p = (struct __pyx_obj_4lxml_5etree__BaseErrorLog *)o;
  if (p->_first_error) {
    e = (*v)(((PyObject*)p->_first_error), a); if (e) return e;
  }
  if (p->last_error) {
    e = (*v)(p->last_error, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__BaseErrorLog(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__BaseErrorLog *p = (struct __pyx_obj_4lxml_5etree__BaseErrorLog *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->_first_error);
  p->_first_error = ((struct __pyx_obj_4lxml_5etree__LogEntry *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->last_error);
  p->last_error = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_13_BaseErrorLog_last_error(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_13_BaseErrorLog_10last_error___get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__BaseErrorLog[] = {
  {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_pf_4lxml_5etree_13_BaseErrorLog_1copy, METH_NOARGS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__BaseErrorLog[] = {
  {(char *)"last_error", __pyx_getprop_4lxml_5etree_13_BaseErrorLog_last_error, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__BaseErrorLog = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__BaseErrorLog = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__BaseErrorLog = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__BaseErrorLog = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree__BaseErrorLog = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._BaseErrorLog"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__BaseErrorLog), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__BaseErrorLog, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pf_4lxml_5etree_13_BaseErrorLog_2__repr__, /*tp_repr*/
  &__pyx_tp_as_number__BaseErrorLog, /*tp_as_number*/
  &__pyx_tp_as_sequence__BaseErrorLog, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__BaseErrorLog, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__BaseErrorLog, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__BaseErrorLog, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__BaseErrorLog, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__BaseErrorLog, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__BaseErrorLog, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_4lxml_5etree_13_BaseErrorLog___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__BaseErrorLog, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__ListErrorLog __pyx_vtable_4lxml_5etree__ListErrorLog;

static PyObject *__pyx_tp_new_4lxml_5etree__ListErrorLog(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ListErrorLog *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__BaseErrorLog(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ListErrorLog *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__BaseErrorLog*)__pyx_vtabptr_4lxml_5etree__ListErrorLog;
  p->_entries = ((PyObject*)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__ListErrorLog(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ListErrorLog *p = (struct __pyx_obj_4lxml_5etree__ListErrorLog *)o;
  Py_XDECREF(((PyObject *)p->_entries));
  __pyx_tp_dealloc_4lxml_5etree__BaseErrorLog(o);
}

static int __pyx_tp_traverse_4lxml_5etree__ListErrorLog(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__ListErrorLog *p = (struct __pyx_obj_4lxml_5etree__ListErrorLog *)o;
  e = __pyx_tp_traverse_4lxml_5etree__BaseErrorLog(o, v, a); if (e) return e;
  if (p->_entries) {
    e = (*v)(p->_entries, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__ListErrorLog(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ListErrorLog *p = (struct __pyx_obj_4lxml_5etree__ListErrorLog *)o;
  PyObject* tmp;
  __pyx_tp_clear_4lxml_5etree__BaseErrorLog(o);
  tmp = ((PyObject*)p->_entries);
  p->_entries = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}
static PyObject *__pyx_sq_item_4lxml_5etree__ListErrorLog(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static PyMethodDef __pyx_methods_4lxml_5etree__ListErrorLog[] = {
  {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_pf_4lxml_5etree_13_ListErrorLog_1copy, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_13_ListErrorLog_1copy)},
  {__Pyx_NAMESTR("filter_domains"), (PyCFunction)__pyx_pf_4lxml_5etree_13_ListErrorLog_8filter_domains, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_13_ListErrorLog_8filter_domains)},
  {__Pyx_NAMESTR("filter_types"), (PyCFunction)__pyx_pf_4lxml_5etree_13_ListErrorLog_9filter_types, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_13_ListErrorLog_9filter_types)},
  {__Pyx_NAMESTR("filter_levels"), (PyCFunction)__pyx_pf_4lxml_5etree_13_ListErrorLog_10filter_levels, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_13_ListErrorLog_10filter_levels)},
  {__Pyx_NAMESTR("filter_from_level"), (PyCFunction)__pyx_pf_4lxml_5etree_13_ListErrorLog_11filter_from_level, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_13_ListErrorLog_11filter_from_level)},
  {__Pyx_NAMESTR("filter_from_fatals"), (PyCFunction)__pyx_pf_4lxml_5etree_13_ListErrorLog_12filter_from_fatals, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_13_ListErrorLog_12filter_from_fatals)},
  {__Pyx_NAMESTR("filter_from_errors"), (PyCFunction)__pyx_pf_4lxml_5etree_13_ListErrorLog_13filter_from_errors, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_13_ListErrorLog_13filter_from_errors)},
  {__Pyx_NAMESTR("filter_from_warnings"), (PyCFunction)__pyx_pf_4lxml_5etree_13_ListErrorLog_14filter_from_warnings, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_13_ListErrorLog_14filter_from_warnings)},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__ListErrorLog = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  __pyx_pf_4lxml_5etree_13_ListErrorLog_7__nonzero__, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__ListErrorLog = {
  __pyx_pf_4lxml_5etree_13_ListErrorLog_5__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_4lxml_5etree__ListErrorLog, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  __pyx_pf_4lxml_5etree_13_ListErrorLog_6__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__ListErrorLog = {
  __pyx_pf_4lxml_5etree_13_ListErrorLog_5__len__, /*mp_length*/
  __pyx_pf_4lxml_5etree_13_ListErrorLog_4__getitem__, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__ListErrorLog = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree__ListErrorLog = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._ListErrorLog"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ListErrorLog), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ListErrorLog, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pf_4lxml_5etree_13_ListErrorLog_3__repr__, /*tp_repr*/
  &__pyx_tp_as_number__ListErrorLog, /*tp_as_number*/
  &__pyx_tp_as_sequence__ListErrorLog, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__ListErrorLog, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__ListErrorLog, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("Immutable base version of a list based error log."), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ListErrorLog, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ListErrorLog, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pf_4lxml_5etree_13_ListErrorLog_2__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__ListErrorLog, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_4lxml_5etree_13_ListErrorLog___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__ListErrorLog, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__ErrorLog __pyx_vtable_4lxml_5etree__ErrorLog;

static PyObject *__pyx_tp_new_4lxml_5etree__ErrorLog(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ErrorLog *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ListErrorLog(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)o);
  p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__BaseErrorLog*)__pyx_vtabptr_4lxml_5etree__ErrorLog;
  return o;
}

static PyMethodDef __pyx_methods_4lxml_5etree__ErrorLog[] = {
  {__Pyx_NAMESTR("clear"), (PyCFunction)__pyx_pf_4lxml_5etree_9_ErrorLog_1clear, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_pf_4lxml_5etree_9_ErrorLog_2copy, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_9_ErrorLog_2copy)},
  {__Pyx_NAMESTR("receive"), (PyCFunction)__pyx_pf_4lxml_5etree_9_ErrorLog_4receive, METH_O, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__ErrorLog = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__ErrorLog = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__ErrorLog = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__ErrorLog = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree__ErrorLog = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._ErrorLog"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ErrorLog), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ListErrorLog, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number__ErrorLog, /*tp_as_number*/
  &__pyx_tp_as_sequence__ErrorLog, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__ErrorLog, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__ErrorLog, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ListErrorLog, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ListErrorLog, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pf_4lxml_5etree_9_ErrorLog_3__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__ErrorLog, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_4lxml_5etree_9_ErrorLog___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__ErrorLog, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__DomainErrorLog __pyx_vtable_4lxml_5etree__DomainErrorLog;

static PyObject *__pyx_tp_new_4lxml_5etree__DomainErrorLog(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__DomainErrorLog *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ListErrorLog(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__DomainErrorLog *)o);
  p->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__BaseErrorLog*)__pyx_vtabptr_4lxml_5etree__DomainErrorLog;
  return o;
}

static PyMethodDef __pyx_methods_4lxml_5etree__DomainErrorLog[] = {
  {__Pyx_NAMESTR("receive"), (PyCFunction)__pyx_pf_4lxml_5etree_15_DomainErrorLog_1receive, METH_O, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__DomainErrorLog = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__DomainErrorLog = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__DomainErrorLog = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__DomainErrorLog = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree__DomainErrorLog = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._DomainErrorLog"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__DomainErrorLog), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ListErrorLog, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number__DomainErrorLog, /*tp_as_number*/
  &__pyx_tp_as_sequence__DomainErrorLog, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__DomainErrorLog, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__DomainErrorLog, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ListErrorLog, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ListErrorLog, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__DomainErrorLog, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_4lxml_5etree_15_DomainErrorLog___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__DomainErrorLog, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__RotatingErrorLog __pyx_vtable_4lxml_5etree__RotatingErrorLog;

static PyObject *__pyx_tp_new_4lxml_5etree__RotatingErrorLog(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__RotatingErrorLog *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ListErrorLog(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__RotatingErrorLog *)o);
  p->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__BaseErrorLog*)__pyx_vtabptr_4lxml_5etree__RotatingErrorLog;
  return o;
}

static PyMethodDef __pyx_methods_4lxml_5etree__RotatingErrorLog[] = {
  {__Pyx_NAMESTR("receive"), (PyCFunction)__pyx_pf_4lxml_5etree_17_RotatingErrorLog_1receive, METH_O, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__RotatingErrorLog = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__RotatingErrorLog = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__RotatingErrorLog = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__RotatingErrorLog = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree__RotatingErrorLog = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._RotatingErrorLog"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__RotatingErrorLog), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ListErrorLog, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number__RotatingErrorLog, /*tp_as_number*/
  &__pyx_tp_as_sequence__RotatingErrorLog, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__RotatingErrorLog, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__RotatingErrorLog, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ListErrorLog, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ListErrorLog, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__RotatingErrorLog, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_4lxml_5etree_17_RotatingErrorLog___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__RotatingErrorLog, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_PyErrorLog __pyx_vtable_4lxml_5etree_PyErrorLog;

static PyObject *__pyx_tp_new_4lxml_5etree_PyErrorLog(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_PyErrorLog *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__BaseErrorLog(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_PyErrorLog *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__BaseErrorLog*)__pyx_vtabptr_4lxml_5etree_PyErrorLog;
  p->level_map = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_map_level = Py_None; Py_INCREF(Py_None);
  p->_log = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_PyErrorLog(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_PyErrorLog *p = (struct __pyx_obj_4lxml_5etree_PyErrorLog *)o;
  Py_XDECREF(((PyObject *)p->level_map));
  Py_XDECREF(p->_map_level);
  Py_XDECREF(p->_log);
  __pyx_tp_dealloc_4lxml_5etree__BaseErrorLog(o);
}

static int __pyx_tp_traverse_4lxml_5etree_PyErrorLog(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree_PyErrorLog *p = (struct __pyx_obj_4lxml_5etree_PyErrorLog *)o;
  e = __pyx_tp_traverse_4lxml_5etree__BaseErrorLog(o, v, a); if (e) return e;
  if (p->level_map) {
    e = (*v)(p->level_map, a); if (e) return e;
  }
  if (p->_map_level) {
    e = (*v)(p->_map_level, a); if (e) return e;
  }
  if (p->_log) {
    e = (*v)(p->_log, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree_PyErrorLog(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_PyErrorLog *p = (struct __pyx_obj_4lxml_5etree_PyErrorLog *)o;
  PyObject* tmp;
  __pyx_tp_clear_4lxml_5etree__BaseErrorLog(o);
  tmp = ((PyObject*)p->level_map);
  p->level_map = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_map_level);
  p->_map_level = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_log);
  p->_log = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_10PyErrorLog_level_map(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_10PyErrorLog_9level_map___get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree_PyErrorLog[] = {
  {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_pf_4lxml_5etree_10PyErrorLog_1copy, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_10PyErrorLog_1copy)},
  {__Pyx_NAMESTR("log"), (PyCFunction)__pyx_pf_4lxml_5etree_10PyErrorLog_2log, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_10PyErrorLog_2log)},
  {__Pyx_NAMESTR("receive"), (PyCFunction)__pyx_pf_4lxml_5etree_10PyErrorLog_3receive, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_10PyErrorLog_3receive)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree_PyErrorLog[] = {
  {(char *)"level_map", __pyx_getprop_4lxml_5etree_10PyErrorLog_level_map, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_PyErrorLog = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_PyErrorLog = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_PyErrorLog = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_PyErrorLog = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree_PyErrorLog = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.PyErrorLog"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_PyErrorLog), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_PyErrorLog, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_PyErrorLog, /*tp_as_number*/
  &__pyx_tp_as_sequence_PyErrorLog, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_PyErrorLog, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_PyErrorLog, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("PyErrorLog(self, logger_name=None, logger=None)\n    A global error log that connects to the Python stdlib logging package.\n\n    The constructor accepts an optional logger name or a readily\n    instantiated logger instance.\n\n    If you want to change the mapping between libxml2's ErrorLevels and Python\n    logging levels, you can modify the level_map dictionary from a subclass.\n\n    The default mapping is::\n\n            ErrorLevels.WARNING = logging.WARNING\n            ErrorLevels.ERROR   = logging.ERROR\n            ErrorLevels.FATAL   = logging.CRITICAL\n\n    You can also override the method ``receive()`` that takes a LogEntry\n    object and calls ``self.log(log_entry, format_string, arg1, arg2, ...)``\n    with appropriate data.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_PyErrorLog, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_PyErrorLog, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_PyErrorLog, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree_PyErrorLog, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_4lxml_5etree_10PyErrorLog___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_PyErrorLog, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static PyObject *__pyx_tp_new_4lxml_5etree_DocInfo(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_DocInfo *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_DocInfo *)o);
  p->_doc = ((struct LxmlDocument *)Py_None); Py_INCREF(Py_None);
  if (__pyx_pf_4lxml_5etree_7DocInfo___cinit__(o, a, k) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_DocInfo(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_DocInfo *p = (struct __pyx_obj_4lxml_5etree_DocInfo *)o;
  Py_XDECREF(((PyObject *)p->_doc));
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree_DocInfo(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree_DocInfo *p = (struct __pyx_obj_4lxml_5etree_DocInfo *)o;
  if (p->_doc) {
    e = (*v)(((PyObject*)p->_doc), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree_DocInfo(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_DocInfo *p = (struct __pyx_obj_4lxml_5etree_DocInfo *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->_doc);
  p->_doc = ((struct LxmlDocument *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_7DocInfo_root_name(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_7DocInfo_9root_name___get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_7DocInfo_public_id(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_7DocInfo_9public_id___get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_7DocInfo_system_url(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_7DocInfo_10system_url___get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_7DocInfo_xml_version(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_7DocInfo_11xml_version___get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_7DocInfo_encoding(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_7DocInfo_8encoding___get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_7DocInfo_standalone(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_7DocInfo_10standalone___get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_7DocInfo_URL(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_7DocInfo_3URL___get__(o);
}

static int __pyx_setprop_4lxml_5etree_7DocInfo_URL(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_4lxml_5etree_7DocInfo_3URL_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_4lxml_5etree_7DocInfo_doctype(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_7DocInfo_7doctype___get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_7DocInfo_internalDTD(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_7DocInfo_11internalDTD___get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_7DocInfo_externalDTD(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_7DocInfo_11externalDTD___get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree_DocInfo[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree_DocInfo[] = {
  {(char *)"root_name", __pyx_getprop_4lxml_5etree_7DocInfo_root_name, 0, __Pyx_DOCSTR(__pyx_k_435), 0},
  {(char *)"public_id", __pyx_getprop_4lxml_5etree_7DocInfo_public_id, 0, __Pyx_DOCSTR(__pyx_k_436), 0},
  {(char *)"system_url", __pyx_getprop_4lxml_5etree_7DocInfo_system_url, 0, __Pyx_DOCSTR(__pyx_k_437), 0},
  {(char *)"xml_version", __pyx_getprop_4lxml_5etree_7DocInfo_xml_version, 0, __Pyx_DOCSTR(__pyx_k_438), 0},
  {(char *)"encoding", __pyx_getprop_4lxml_5etree_7DocInfo_encoding, 0, __Pyx_DOCSTR(__pyx_k_439), 0},
  {(char *)"standalone", __pyx_getprop_4lxml_5etree_7DocInfo_standalone, 0, __Pyx_DOCSTR(__pyx_k_440), 0},
  {(char *)"URL", __pyx_getprop_4lxml_5etree_7DocInfo_URL, __pyx_setprop_4lxml_5etree_7DocInfo_URL, __Pyx_DOCSTR(__pyx_k_441), 0},
  {(char *)"doctype", __pyx_getprop_4lxml_5etree_7DocInfo_doctype, 0, __Pyx_DOCSTR(__pyx_k_442), 0},
  {(char *)"internalDTD", __pyx_getprop_4lxml_5etree_7DocInfo_internalDTD, 0, __Pyx_DOCSTR(__pyx_k_443), 0},
  {(char *)"externalDTD", __pyx_getprop_4lxml_5etree_7DocInfo_externalDTD, 0, __Pyx_DOCSTR(__pyx_k_444), 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_DocInfo = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_DocInfo = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_DocInfo = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_DocInfo = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree_DocInfo = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.DocInfo"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_DocInfo), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_DocInfo, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_DocInfo, /*tp_as_number*/
  &__pyx_tp_as_sequence_DocInfo, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_DocInfo, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_DocInfo, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("Document information provided by parser and DTD."), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_DocInfo, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_DocInfo, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_DocInfo, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree_DocInfo, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_DocInfo, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree___ContentOnlyElement __pyx_vtable_4lxml_5etree___ContentOnlyElement;

static PyObject *__pyx_tp_new_4lxml_5etree___ContentOnlyElement(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree___ContentOnlyElement *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__Element(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree___ContentOnlyElement *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree___ContentOnlyElement;
  return o;
}
static PyObject *__pyx_sq_item_4lxml_5etree___ContentOnlyElement(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static int __pyx_mp_ass_subscript_4lxml_5etree___ContentOnlyElement(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_pf_4lxml_5etree_20__ContentOnlyElement_3__setitem__(o, i, v);
  }
  else {
    if (__pyx_ptype_4lxml_5etree__Element->tp_as_mapping && __pyx_ptype_4lxml_5etree__Element->tp_as_mapping->mp_ass_subscript)
      return __pyx_ptype_4lxml_5etree__Element->tp_as_mapping->mp_ass_subscript(o, i, v);
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by %s", Py_TYPE(o)->tp_name);
    return -1;
  }
}

static PyObject *__pyx_getprop_4lxml_5etree_20__ContentOnlyElement_attrib(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_20__ContentOnlyElement_6attrib___get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_20__ContentOnlyElement_text(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_20__ContentOnlyElement_4text___get__(o);
}

static int __pyx_setprop_4lxml_5etree_20__ContentOnlyElement_text(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_4lxml_5etree_20__ContentOnlyElement_4text_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyMethodDef __pyx_methods_4lxml_5etree___ContentOnlyElement[] = {
  {__Pyx_NAMESTR("set"), (PyCFunction)__pyx_pf_4lxml_5etree_20__ContentOnlyElement_set, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_20__ContentOnlyElement_set)},
  {__Pyx_NAMESTR("append"), (PyCFunction)__pyx_pf_4lxml_5etree_20__ContentOnlyElement_1append, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_20__ContentOnlyElement_1append)},
  {__Pyx_NAMESTR("insert"), (PyCFunction)__pyx_pf_4lxml_5etree_20__ContentOnlyElement_2insert, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_20__ContentOnlyElement_2insert)},
  {__Pyx_NAMESTR("get"), (PyCFunction)__pyx_pf_4lxml_5etree_20__ContentOnlyElement_6get, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_20__ContentOnlyElement_6get)},
  {__Pyx_NAMESTR("keys"), (PyCFunction)__pyx_pf_4lxml_5etree_20__ContentOnlyElement_7keys, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_20__ContentOnlyElement_7keys)},
  {__Pyx_NAMESTR("items"), (PyCFunction)__pyx_pf_4lxml_5etree_20__ContentOnlyElement_8items, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_20__ContentOnlyElement_8items)},
  {__Pyx_NAMESTR("values"), (PyCFunction)__pyx_pf_4lxml_5etree_20__ContentOnlyElement_9values, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_20__ContentOnlyElement_9values)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree___ContentOnlyElement[] = {
  {(char *)"attrib", __pyx_getprop_4lxml_5etree_20__ContentOnlyElement_attrib, 0, 0, 0},
  {(char *)"text", __pyx_getprop_4lxml_5etree_20__ContentOnlyElement_text, __pyx_setprop_4lxml_5etree_20__ContentOnlyElement_text, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number___ContentOnlyElement = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence___ContentOnlyElement = {
  __pyx_pf_4lxml_5etree_20__ContentOnlyElement_5__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_4lxml_5etree___ContentOnlyElement, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping___ContentOnlyElement = {
  __pyx_pf_4lxml_5etree_20__ContentOnlyElement_5__len__, /*mp_length*/
  __pyx_pf_4lxml_5etree_20__ContentOnlyElement_4__getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_4lxml_5etree___ContentOnlyElement, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer___ContentOnlyElement = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree___ContentOnlyElement = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.__ContentOnlyElement"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree___ContentOnlyElement), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__Element, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number___ContentOnlyElement, /*tp_as_number*/
  &__pyx_tp_as_sequence___ContentOnlyElement, /*tp_as_sequence*/
  &__pyx_tp_as_mapping___ContentOnlyElement, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer___ContentOnlyElement, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__Element, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__Element, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree___ContentOnlyElement, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree___ContentOnlyElement, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree___ContentOnlyElement, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__Comment __pyx_vtable_4lxml_5etree__Comment;

static PyObject *__pyx_tp_new_4lxml_5etree__Comment(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__Comment *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__Element(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__Comment *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree___ContentOnlyElement*)__pyx_vtabptr_4lxml_5etree__Comment;
  return o;
}

static PyObject *__pyx_getprop_4lxml_5etree_8_Comment_tag(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_8_Comment_3tag___get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__Comment[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__Comment[] = {
  {(char *)"tag", __pyx_getprop_4lxml_5etree_8_Comment_tag, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__Comment = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__Comment = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__Comment = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__Comment = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree__Comment = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._Comment"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__Comment), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__Element, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pf_4lxml_5etree_8_Comment___repr__, /*tp_repr*/
  &__pyx_tp_as_number__Comment, /*tp_as_number*/
  &__pyx_tp_as_sequence__Comment, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__Comment, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__Comment, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__Element, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__Element, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__Comment, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__Comment, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__Comment, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__ProcessingInstruction __pyx_vtable_4lxml_5etree__ProcessingInstruction;

static PyObject *__pyx_tp_new_4lxml_5etree__ProcessingInstruction(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ProcessingInstruction *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__Element(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ProcessingInstruction *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree___ContentOnlyElement*)__pyx_vtabptr_4lxml_5etree__ProcessingInstruction;
  return o;
}

static PyObject *__pyx_getprop_4lxml_5etree_22_ProcessingInstruction_tag(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_22_ProcessingInstruction_3tag___get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_22_ProcessingInstruction_target(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_22_ProcessingInstruction_6target___get__(o);
}

static int __pyx_setprop_4lxml_5etree_22_ProcessingInstruction_target(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_4lxml_5etree_22_ProcessingInstruction_6target_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyMethodDef __pyx_methods_4lxml_5etree__ProcessingInstruction[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__ProcessingInstruction[] = {
  {(char *)"tag", __pyx_getprop_4lxml_5etree_22_ProcessingInstruction_tag, 0, 0, 0},
  {(char *)"target", __pyx_getprop_4lxml_5etree_22_ProcessingInstruction_target, __pyx_setprop_4lxml_5etree_22_ProcessingInstruction_target, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__ProcessingInstruction = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__ProcessingInstruction = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__ProcessingInstruction = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__ProcessingInstruction = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree__ProcessingInstruction = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._ProcessingInstruction"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ProcessingInstruction), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__Element, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pf_4lxml_5etree_22_ProcessingInstruction___repr__, /*tp_repr*/
  &__pyx_tp_as_number__ProcessingInstruction, /*tp_as_number*/
  &__pyx_tp_as_sequence__ProcessingInstruction, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__ProcessingInstruction, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__ProcessingInstruction, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__Element, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__Element, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__ProcessingInstruction, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__ProcessingInstruction, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__ProcessingInstruction, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__Entity __pyx_vtable_4lxml_5etree__Entity;

static PyObject *__pyx_tp_new_4lxml_5etree__Entity(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__Entity *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__Element(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__Entity *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree___ContentOnlyElement*)__pyx_vtabptr_4lxml_5etree__Entity;
  return o;
}

static PyObject *__pyx_getprop_4lxml_5etree_7_Entity_tag(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_7_Entity_3tag___get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_7_Entity_name(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_7_Entity_4name___get__(o);
}

static int __pyx_setprop_4lxml_5etree_7_Entity_name(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_4lxml_5etree_7_Entity_4name_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_4lxml_5etree_7_Entity_text(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_7_Entity_4text___get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__Entity[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__Entity[] = {
  {(char *)"tag", __pyx_getprop_4lxml_5etree_7_Entity_tag, 0, 0, 0},
  {(char *)"name", __pyx_getprop_4lxml_5etree_7_Entity_name, __pyx_setprop_4lxml_5etree_7_Entity_name, 0, 0},
  {(char *)"text", __pyx_getprop_4lxml_5etree_7_Entity_text, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__Entity = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__Entity = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__Entity = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__Entity = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree__Entity = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._Entity"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__Entity), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__Element, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pf_4lxml_5etree_7_Entity___repr__, /*tp_repr*/
  &__pyx_tp_as_number__Entity, /*tp_as_number*/
  &__pyx_tp_as_sequence__Entity, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__Entity, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__Entity, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__Element, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__Element, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__Entity, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__Entity, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__Entity, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__ElementTree __pyx_vtable_4lxml_5etree__ElementTree;

static PyObject *__pyx_tp_new_4lxml_5etree__ElementTree(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct LxmlElementTree *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct LxmlElementTree *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__ElementTree;
  p->_doc = ((struct LxmlDocument *)Py_None); Py_INCREF(Py_None);
  p->_context_node = ((struct LxmlElement *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__ElementTree(PyObject *o) {
  struct LxmlElementTree *p = (struct LxmlElementTree *)o;
  Py_XDECREF(((PyObject *)p->_doc));
  Py_XDECREF(((PyObject *)p->_context_node));
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree__ElementTree(PyObject *o, visitproc v, void *a) {
  int e;
  struct LxmlElementTree *p = (struct LxmlElementTree *)o;
  if (p->_doc) {
    e = (*v)(((PyObject*)p->_doc), a); if (e) return e;
  }
  if (p->_context_node) {
    e = (*v)(((PyObject*)p->_context_node), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__ElementTree(PyObject *o) {
  struct LxmlElementTree *p = (struct LxmlElementTree *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->_doc);
  p->_doc = ((struct LxmlDocument *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_context_node);
  p->_context_node = ((struct LxmlElement *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_12_ElementTree_docinfo(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_12_ElementTree_7docinfo___get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_12_ElementTree_parser(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_12_ElementTree_6parser___get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__ElementTree[] = {
  {__Pyx_NAMESTR("parse"), (PyCFunction)__pyx_pf_4lxml_5etree_12_ElementTree_parse, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_12_ElementTree_parse)},
  {__Pyx_NAMESTR("_setroot"), (PyCFunction)__pyx_pf_4lxml_5etree_12_ElementTree_1_setroot, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_12_ElementTree_1_setroot)},
  {__Pyx_NAMESTR("getroot"), (PyCFunction)__pyx_pf_4lxml_5etree_12_ElementTree_2getroot, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_12_ElementTree_2getroot)},
  {__Pyx_NAMESTR("__copy__"), (PyCFunction)__pyx_pf_4lxml_5etree_12_ElementTree_3__copy__, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("__deepcopy__"), (PyCFunction)__pyx_pf_4lxml_5etree_12_ElementTree_4__deepcopy__, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("write"), (PyCFunction)__pyx_pf_4lxml_5etree_12_ElementTree_5write, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_12_ElementTree_5write)},
  {__Pyx_NAMESTR("getpath"), (PyCFunction)__pyx_pf_4lxml_5etree_12_ElementTree_6getpath, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_12_ElementTree_6getpath)},
  {__Pyx_NAMESTR("getiterator"), (PyCFunction)__pyx_pf_4lxml_5etree_12_ElementTree_7getiterator, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_12_ElementTree_7getiterator)},
  {__Pyx_NAMESTR("iter"), (PyCFunction)__pyx_pf_4lxml_5etree_12_ElementTree_8iter, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_12_ElementTree_8iter)},
  {__Pyx_NAMESTR("find"), (PyCFunction)__pyx_pf_4lxml_5etree_12_ElementTree_9find, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_12_ElementTree_9find)},
  {__Pyx_NAMESTR("findtext"), (PyCFunction)__pyx_pf_4lxml_5etree_12_ElementTree_10findtext, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_12_ElementTree_10findtext)},
  {__Pyx_NAMESTR("findall"), (PyCFunction)__pyx_pf_4lxml_5etree_12_ElementTree_11findall, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_12_ElementTree_11findall)},
  {__Pyx_NAMESTR("iterfind"), (PyCFunction)__pyx_pf_4lxml_5etree_12_ElementTree_12iterfind, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_12_ElementTree_12iterfind)},
  {__Pyx_NAMESTR("xpath"), (PyCFunction)__pyx_pf_4lxml_5etree_12_ElementTree_13xpath, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_12_ElementTree_13xpath)},
  {__Pyx_NAMESTR("xslt"), (PyCFunction)__pyx_pf_4lxml_5etree_12_ElementTree_14xslt, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_12_ElementTree_14xslt)},
  {__Pyx_NAMESTR("relaxng"), (PyCFunction)__pyx_pf_4lxml_5etree_12_ElementTree_15relaxng, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_12_ElementTree_15relaxng)},
  {__Pyx_NAMESTR("xmlschema"), (PyCFunction)__pyx_pf_4lxml_5etree_12_ElementTree_16xmlschema, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_12_ElementTree_16xmlschema)},
  {__Pyx_NAMESTR("xinclude"), (PyCFunction)__pyx_pf_4lxml_5etree_12_ElementTree_17xinclude, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_12_ElementTree_17xinclude)},
  {__Pyx_NAMESTR("write_c14n"), (PyCFunction)__pyx_pf_4lxml_5etree_12_ElementTree_18write_c14n, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_12_ElementTree_18write_c14n)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__ElementTree[] = {
  {(char *)"docinfo", __pyx_getprop_4lxml_5etree_12_ElementTree_docinfo, 0, __Pyx_DOCSTR(__pyx_k_445), 0},
  {(char *)"parser", __pyx_getprop_4lxml_5etree_12_ElementTree_parser, 0, __Pyx_DOCSTR(__pyx_k_446), 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__ElementTree = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__ElementTree = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__ElementTree = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__ElementTree = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

DL_EXPORT(PyTypeObject) LxmlElementTreeType = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._ElementTree"), /*tp_name*/
  sizeof(struct LxmlElementTree), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ElementTree, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number__ElementTree, /*tp_as_number*/
  &__pyx_tp_as_sequence__ElementTree, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__ElementTree, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__ElementTree, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ElementTree, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ElementTree, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__ElementTree, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__ElementTree, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__ElementTree, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static PyObject *__pyx_tp_new_4lxml_5etree__Attrib(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__Attrib *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__Attrib *)o);
  p->_element = ((struct LxmlElement *)Py_None); Py_INCREF(Py_None);
  if (__pyx_pf_4lxml_5etree_7_Attrib___cinit__(o, a, k) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__Attrib(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__Attrib *p = (struct __pyx_obj_4lxml_5etree__Attrib *)o;
  Py_XDECREF(((PyObject *)p->_element));
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree__Attrib(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__Attrib *p = (struct __pyx_obj_4lxml_5etree__Attrib *)o;
  if (p->_element) {
    e = (*v)(((PyObject*)p->_element), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__Attrib(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__Attrib *p = (struct __pyx_obj_4lxml_5etree__Attrib *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->_element);
  p->_element = ((struct LxmlElement *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}
static PyObject *__pyx_sq_item_4lxml_5etree__Attrib(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static int __pyx_mp_ass_subscript_4lxml_5etree__Attrib(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_pf_4lxml_5etree_7_Attrib_1__setitem__(o, i, v);
  }
  else {
    return __pyx_pf_4lxml_5etree_7_Attrib_2__delitem__(o, i);
  }
}

static PyMethodDef __pyx_methods_4lxml_5etree__Attrib[] = {
  {__Pyx_NAMESTR("update"), (PyCFunction)__pyx_pf_4lxml_5etree_7_Attrib_3update, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("pop"), (PyCFunction)__pyx_pf_4lxml_5etree_7_Attrib_4pop, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("clear"), (PyCFunction)__pyx_pf_4lxml_5etree_7_Attrib_5clear, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("get"), (PyCFunction)__pyx_pf_4lxml_5etree_7_Attrib_10get, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("keys"), (PyCFunction)__pyx_pf_4lxml_5etree_7_Attrib_11keys, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("iterkeys"), (PyCFunction)__pyx_pf_4lxml_5etree_7_Attrib_13iterkeys, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("values"), (PyCFunction)__pyx_pf_4lxml_5etree_7_Attrib_14values, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("itervalues"), (PyCFunction)__pyx_pf_4lxml_5etree_7_Attrib_15itervalues, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("items"), (PyCFunction)__pyx_pf_4lxml_5etree_7_Attrib_16items, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("iteritems"), (PyCFunction)__pyx_pf_4lxml_5etree_7_Attrib_17iteritems, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("has_key"), (PyCFunction)__pyx_pf_4lxml_5etree_7_Attrib_18has_key, METH_O, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__Attrib = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  __pyx_pf_4lxml_5etree_7_Attrib_8__nonzero__, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__Attrib = {
  __pyx_pf_4lxml_5etree_7_Attrib_9__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_4lxml_5etree__Attrib, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  __pyx_pf_4lxml_5etree_7_Attrib_19__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__Attrib = {
  __pyx_pf_4lxml_5etree_7_Attrib_9__len__, /*mp_length*/
  __pyx_pf_4lxml_5etree_7_Attrib_7__getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_4lxml_5etree__Attrib, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__Attrib = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree__Attrib = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._Attrib"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__Attrib), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__Attrib, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pf_4lxml_5etree_7_Attrib_6__repr__, /*tp_repr*/
  &__pyx_tp_as_number__Attrib, /*tp_as_number*/
  &__pyx_tp_as_sequence__Attrib, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__Attrib, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__Attrib, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("A dict-like proxy for the ``Element.attrib`` property.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__Attrib, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__Attrib, /*tp_clear*/
  __pyx_pf_4lxml_5etree_7_Attrib_20__richcmp__, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pf_4lxml_5etree_7_Attrib_12__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__Attrib, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__Attrib, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static PyObject *__pyx_tp_new_4lxml_5etree__AttribIterator(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__AttribIterator *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__AttribIterator *)o);
  p->_node = ((struct LxmlElement *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__AttribIterator(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__AttribIterator *p = (struct __pyx_obj_4lxml_5etree__AttribIterator *)o;
  Py_XDECREF(((PyObject *)p->_node));
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree__AttribIterator(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__AttribIterator *p = (struct __pyx_obj_4lxml_5etree__AttribIterator *)o;
  if (p->_node) {
    e = (*v)(((PyObject*)p->_node), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__AttribIterator(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__AttribIterator *p = (struct __pyx_obj_4lxml_5etree__AttribIterator *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->_node);
  p->_node = ((struct LxmlElement *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__AttribIterator[] = {
  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_4lxml_5etree_15_AttribIterator_1__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__AttribIterator = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__AttribIterator = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__AttribIterator = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__AttribIterator = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree__AttribIterator = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._AttribIterator"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__AttribIterator), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__AttribIterator, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number__AttribIterator, /*tp_as_number*/
  &__pyx_tp_as_sequence__AttribIterator, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__AttribIterator, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__AttribIterator, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("Attribute iterator - for internal use only!\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__AttribIterator, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__AttribIterator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pf_4lxml_5etree_15_AttribIterator___iter__, /*tp_iter*/
  __pyx_pf_4lxml_5etree_15_AttribIterator_1__next__, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__AttribIterator, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__AttribIterator, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__ElementTagMatcher __pyx_vtable_4lxml_5etree__ElementTagMatcher;

static PyObject *__pyx_tp_new_4lxml_5etree__ElementTagMatcher(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct LxmlElementTagMatcher *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct LxmlElementTagMatcher *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__ElementTagMatcher;
  p->_pystrings = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__ElementTagMatcher(PyObject *o) {
  struct LxmlElementTagMatcher *p = (struct LxmlElementTagMatcher *)o;
  Py_XDECREF(p->_pystrings);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree__ElementTagMatcher(PyObject *o, visitproc v, void *a) {
  int e;
  struct LxmlElementTagMatcher *p = (struct LxmlElementTagMatcher *)o;
  if (p->_pystrings) {
    e = (*v)(p->_pystrings, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__ElementTagMatcher(PyObject *o) {
  struct LxmlElementTagMatcher *p = (struct LxmlElementTagMatcher *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->_pystrings);
  p->_pystrings = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__ElementTagMatcher[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__ElementTagMatcher = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__ElementTagMatcher = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__ElementTagMatcher = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__ElementTagMatcher = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

DL_EXPORT(PyTypeObject) LxmlElementTagMatcherType = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._ElementTagMatcher"), /*tp_name*/
  sizeof(struct LxmlElementTagMatcher), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ElementTagMatcher, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number__ElementTagMatcher, /*tp_as_number*/
  &__pyx_tp_as_sequence__ElementTagMatcher, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__ElementTagMatcher, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__ElementTagMatcher, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ElementTagMatcher, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ElementTagMatcher, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__ElementTagMatcher, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__ElementTagMatcher, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__ElementIterator __pyx_vtable_4lxml_5etree__ElementIterator;

static PyObject *__pyx_tp_new_4lxml_5etree__ElementIterator(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct LxmlElementIterator *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ElementTagMatcher(t, a, k);
  if (!o) return 0;
  p = ((struct LxmlElementIterator *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__ElementTagMatcher*)__pyx_vtabptr_4lxml_5etree__ElementIterator;
  p->_node = ((struct LxmlElement *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__ElementIterator(PyObject *o) {
  struct LxmlElementIterator *p = (struct LxmlElementIterator *)o;
  Py_XDECREF(((PyObject *)p->_node));
  __pyx_tp_dealloc_4lxml_5etree__ElementTagMatcher(o);
}

static int __pyx_tp_traverse_4lxml_5etree__ElementIterator(PyObject *o, visitproc v, void *a) {
  int e;
  struct LxmlElementIterator *p = (struct LxmlElementIterator *)o;
  e = __pyx_tp_traverse_4lxml_5etree__ElementTagMatcher(o, v, a); if (e) return e;
  if (p->_node) {
    e = (*v)(((PyObject*)p->_node), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__ElementIterator(PyObject *o) {
  struct LxmlElementIterator *p = (struct LxmlElementIterator *)o;
  PyObject* tmp;
  __pyx_tp_clear_4lxml_5etree__ElementTagMatcher(o);
  tmp = ((PyObject*)p->_node);
  p->_node = ((struct LxmlElement *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__ElementIterator[] = {
  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_4lxml_5etree_16_ElementIterator_1__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__ElementIterator = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__ElementIterator = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__ElementIterator = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__ElementIterator = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

DL_EXPORT(PyTypeObject) LxmlElementIteratorType = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._ElementIterator"), /*tp_name*/
  sizeof(struct LxmlElementIterator), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ElementIterator, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number__ElementIterator, /*tp_as_number*/
  &__pyx_tp_as_sequence__ElementIterator, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__ElementIterator, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__ElementIterator, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ElementIterator, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ElementIterator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pf_4lxml_5etree_16_ElementIterator___iter__, /*tp_iter*/
  __pyx_pf_4lxml_5etree_16_ElementIterator_1__next__, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__ElementIterator, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__ElementIterator, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_ElementChildIterator __pyx_vtable_4lxml_5etree_ElementChildIterator;

static PyObject *__pyx_tp_new_4lxml_5etree_ElementChildIterator(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_ElementChildIterator *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ElementIterator(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_ElementChildIterator *)o);
  p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__ElementTagMatcher*)__pyx_vtabptr_4lxml_5etree_ElementChildIterator;
  if (__pyx_pf_4lxml_5etree_20ElementChildIterator___cinit__(o, a, k) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static PyMethodDef __pyx_methods_4lxml_5etree_ElementChildIterator[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_ElementChildIterator = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_ElementChildIterator = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_ElementChildIterator = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_ElementChildIterator = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree_ElementChildIterator = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.ElementChildIterator"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_ElementChildIterator), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ElementIterator, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_ElementChildIterator, /*tp_as_number*/
  &__pyx_tp_as_sequence_ElementChildIterator, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_ElementChildIterator, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_ElementChildIterator, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("ElementChildIterator(self, node, tag=None, reversed=False)\n    Iterates over the children of an element.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ElementIterator, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ElementIterator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_ElementChildIterator, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_ElementChildIterator, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_SiblingsIterator __pyx_vtable_4lxml_5etree_SiblingsIterator;

static PyObject *__pyx_tp_new_4lxml_5etree_SiblingsIterator(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_SiblingsIterator *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ElementIterator(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_SiblingsIterator *)o);
  p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__ElementTagMatcher*)__pyx_vtabptr_4lxml_5etree_SiblingsIterator;
  if (__pyx_pf_4lxml_5etree_16SiblingsIterator___cinit__(o, a, k) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static PyMethodDef __pyx_methods_4lxml_5etree_SiblingsIterator[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_SiblingsIterator = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_SiblingsIterator = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_SiblingsIterator = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_SiblingsIterator = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree_SiblingsIterator = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.SiblingsIterator"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_SiblingsIterator), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ElementIterator, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_SiblingsIterator, /*tp_as_number*/
  &__pyx_tp_as_sequence_SiblingsIterator, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_SiblingsIterator, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_SiblingsIterator, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("SiblingsIterator(self, node, tag=None, preceding=False)\n    Iterates over the siblings of an element.\n\n    You can pass the boolean keyword ``preceding`` to specify the direction.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ElementIterator, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ElementIterator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_SiblingsIterator, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_SiblingsIterator, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_AncestorsIterator __pyx_vtable_4lxml_5etree_AncestorsIterator;

static PyObject *__pyx_tp_new_4lxml_5etree_AncestorsIterator(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_AncestorsIterator *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ElementIterator(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_AncestorsIterator *)o);
  p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__ElementTagMatcher*)__pyx_vtabptr_4lxml_5etree_AncestorsIterator;
  if (__pyx_pf_4lxml_5etree_17AncestorsIterator___cinit__(o, a, k) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static PyMethodDef __pyx_methods_4lxml_5etree_AncestorsIterator[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_AncestorsIterator = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_AncestorsIterator = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_AncestorsIterator = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_AncestorsIterator = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree_AncestorsIterator = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.AncestorsIterator"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_AncestorsIterator), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ElementIterator, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_AncestorsIterator, /*tp_as_number*/
  &__pyx_tp_as_sequence_AncestorsIterator, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_AncestorsIterator, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_AncestorsIterator, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("AncestorsIterator(self, node, tag=None)\n    Iterates over the ancestors of an element (from parent to parent).\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ElementIterator, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ElementIterator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_AncestorsIterator, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_AncestorsIterator, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_ElementDepthFirstIterator __pyx_vtable_4lxml_5etree_ElementDepthFirstIterator;

static PyObject *__pyx_tp_new_4lxml_5etree_ElementDepthFirstIterator(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ElementTagMatcher(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__ElementTagMatcher*)__pyx_vtabptr_4lxml_5etree_ElementDepthFirstIterator;
  p->_next_node = ((struct LxmlElement *)Py_None); Py_INCREF(Py_None);
  p->_top_node = ((struct LxmlElement *)Py_None); Py_INCREF(Py_None);
  if (__pyx_pf_4lxml_5etree_25ElementDepthFirstIterator___cinit__(o, a, k) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_ElementDepthFirstIterator(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *p = (struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *)o;
  Py_XDECREF(((PyObject *)p->_next_node));
  Py_XDECREF(((PyObject *)p->_top_node));
  __pyx_tp_dealloc_4lxml_5etree__ElementTagMatcher(o);
}

static int __pyx_tp_traverse_4lxml_5etree_ElementDepthFirstIterator(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *p = (struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *)o;
  e = __pyx_tp_traverse_4lxml_5etree__ElementTagMatcher(o, v, a); if (e) return e;
  if (p->_next_node) {
    e = (*v)(((PyObject*)p->_next_node), a); if (e) return e;
  }
  if (p->_top_node) {
    e = (*v)(((PyObject*)p->_top_node), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree_ElementDepthFirstIterator(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *p = (struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *)o;
  PyObject* tmp;
  __pyx_tp_clear_4lxml_5etree__ElementTagMatcher(o);
  tmp = ((PyObject*)p->_next_node);
  p->_next_node = ((struct LxmlElement *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_top_node);
  p->_top_node = ((struct LxmlElement *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree_ElementDepthFirstIterator[] = {
  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_4lxml_5etree_25ElementDepthFirstIterator_2__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_ElementDepthFirstIterator = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_ElementDepthFirstIterator = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_ElementDepthFirstIterator = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_ElementDepthFirstIterator = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree_ElementDepthFirstIterator = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.ElementDepthFirstIterator"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_ElementDepthFirstIterator, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_ElementDepthFirstIterator, /*tp_as_number*/
  &__pyx_tp_as_sequence_ElementDepthFirstIterator, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_ElementDepthFirstIterator, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_ElementDepthFirstIterator, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("ElementDepthFirstIterator(self, node, tag=None, inclusive=True)\n    Iterates over an element and its sub-elements in document order (depth\n    first pre-order).\n\n    Note that this also includes comments, entities and processing\n    instructions.  To filter them out, check if the ``tag`` property\n    of the returned element is a string (i.e. not None and not a\n    factory function), or pass the ``Element`` factory for the ``tag``\n    keyword.\n\n    If the optional ``tag`` argument is not None, the iterator returns only\n    the elements that match the respective name and namespace.\n\n    The optional boolean argument 'inclusive' defaults to True and can be set\n    to False to exclude the start element itself.\n\n    Note that the behaviour of this iterator is completely undefined if the\n    tree it traverses is modified during iteration.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_ElementDepthFirstIterator, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_ElementDepthFirstIterator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pf_4lxml_5etree_25ElementDepthFirstIterator_1__iter__, /*tp_iter*/
  __pyx_pf_4lxml_5etree_25ElementDepthFirstIterator_2__next__, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_ElementDepthFirstIterator, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_ElementDepthFirstIterator, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static PyObject *__pyx_tp_new_4lxml_5etree_ElementTextIterator(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_ElementTextIterator *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_ElementTextIterator *)o);
  p->_nextEvent = Py_None; Py_INCREF(Py_None);
  p->_start_element = ((struct LxmlElement *)Py_None); Py_INCREF(Py_None);
  if (__pyx_pf_4lxml_5etree_19ElementTextIterator___cinit__(o, a, k) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_ElementTextIterator(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_ElementTextIterator *p = (struct __pyx_obj_4lxml_5etree_ElementTextIterator *)o;
  Py_XDECREF(p->_nextEvent);
  Py_XDECREF(((PyObject *)p->_start_element));
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree_ElementTextIterator(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree_ElementTextIterator *p = (struct __pyx_obj_4lxml_5etree_ElementTextIterator *)o;
  if (p->_nextEvent) {
    e = (*v)(p->_nextEvent, a); if (e) return e;
  }
  if (p->_start_element) {
    e = (*v)(((PyObject*)p->_start_element), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree_ElementTextIterator(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_ElementTextIterator *p = (struct __pyx_obj_4lxml_5etree_ElementTextIterator *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->_nextEvent);
  p->_nextEvent = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_start_element);
  p->_start_element = ((struct LxmlElement *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree_ElementTextIterator[] = {
  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_4lxml_5etree_19ElementTextIterator_2__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_ElementTextIterator = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_ElementTextIterator = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_ElementTextIterator = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_ElementTextIterator = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree_ElementTextIterator = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.ElementTextIterator"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_ElementTextIterator), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_ElementTextIterator, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_ElementTextIterator, /*tp_as_number*/
  &__pyx_tp_as_sequence_ElementTextIterator, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_ElementTextIterator, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_ElementTextIterator, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("ElementTextIterator(self, element, tag=None, with_tail=True)\n    Iterates over the text content of a subtree.\n\n    You can pass the ``tag`` keyword argument to restrict text content to a\n    specific tag name.\n\n    You can set the ``with_tail`` keyword argument to ``False`` to skip over\n    tail text.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_ElementTextIterator, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_ElementTextIterator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pf_4lxml_5etree_19ElementTextIterator_1__iter__, /*tp_iter*/
  __pyx_pf_4lxml_5etree_19ElementTextIterator_2__next__, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_ElementTextIterator, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_ElementTextIterator, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static PyObject *__pyx_tp_new_4lxml_5etree_CDATA(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_CDATA *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_CDATA *)o);
  p->_utf8_data = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_CDATA(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_CDATA *p = (struct __pyx_obj_4lxml_5etree_CDATA *)o;
  Py_XDECREF(p->_utf8_data);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree_CDATA(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree_CDATA *p = (struct __pyx_obj_4lxml_5etree_CDATA *)o;
  if (p->_utf8_data) {
    e = (*v)(p->_utf8_data, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree_CDATA(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_CDATA *p = (struct __pyx_obj_4lxml_5etree_CDATA *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->_utf8_data);
  p->_utf8_data = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree_CDATA[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_CDATA = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_CDATA = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_CDATA = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_CDATA = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree_CDATA = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.CDATA"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_CDATA), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_CDATA, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_CDATA, /*tp_as_number*/
  &__pyx_tp_as_sequence_CDATA, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_CDATA, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_CDATA, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("CDATA(data)\n\n    CDATA factory.  This factory creates an opaque data object that\n    can be used to set Element text.  The usual way to use it is::\n\n        >>> from lxml import etree\n        >>> el = etree.Element('content')\n        >>> el.text = etree.CDATA('a string')\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_CDATA, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_CDATA, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_CDATA, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_4lxml_5etree_5CDATA___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_CDATA, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy __pyx_vtable_4lxml_5etree__ReadOnlyProxy;

static PyObject *__pyx_tp_new_4lxml_5etree__ReadOnlyProxy(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__ReadOnlyProxy;
  p->_source_proxy = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)Py_None); Py_INCREF(Py_None);
  p->_dependent_proxies = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (__pyx_pf_4lxml_5etree_14_ReadOnlyProxy___cinit__(o, __pyx_empty_tuple, NULL) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__ReadOnlyProxy(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *p = (struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)o;
  Py_XDECREF(((PyObject *)p->_source_proxy));
  Py_XDECREF(((PyObject *)p->_dependent_proxies));
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree__ReadOnlyProxy(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *p = (struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)o;
  if (p->_source_proxy) {
    e = (*v)(((PyObject*)p->_source_proxy), a); if (e) return e;
  }
  if (p->_dependent_proxies) {
    e = (*v)(p->_dependent_proxies, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__ReadOnlyProxy(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *p = (struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->_source_proxy);
  p->_source_proxy = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_dependent_proxies);
  p->_dependent_proxies = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}
static PyObject *__pyx_sq_item_4lxml_5etree__ReadOnlyProxy(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static PyObject *__pyx_getprop_4lxml_5etree_14_ReadOnlyProxy_tag(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_3tag___get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_14_ReadOnlyProxy_text(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_4text___get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_14_ReadOnlyProxy_tail(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_4tail___get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_14_ReadOnlyProxy_sourceline(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_10sourceline___get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__ReadOnlyProxy[] = {
  {__Pyx_NAMESTR("__deepcopy__"), (PyCFunction)__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_5__deepcopy__, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_14_ReadOnlyProxy_5__deepcopy__)},
  {__Pyx_NAMESTR("__copy__"), (PyCFunction)__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_6__copy__, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_14_ReadOnlyProxy_6__copy__)},
  {__Pyx_NAMESTR("iterchildren"), (PyCFunction)__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_8iterchildren, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_14_ReadOnlyProxy_8iterchildren)},
  {__Pyx_NAMESTR("getchildren"), (PyCFunction)__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_9getchildren, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_14_ReadOnlyProxy_9getchildren)},
  {__Pyx_NAMESTR("getparent"), (PyCFunction)__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_10getparent, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_14_ReadOnlyProxy_10getparent)},
  {__Pyx_NAMESTR("getnext"), (PyCFunction)__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_11getnext, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_14_ReadOnlyProxy_11getnext)},
  {__Pyx_NAMESTR("getprevious"), (PyCFunction)__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_12getprevious, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_14_ReadOnlyProxy_12getprevious)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__ReadOnlyProxy[] = {
  {(char *)"tag", __pyx_getprop_4lxml_5etree_14_ReadOnlyProxy_tag, 0, __Pyx_DOCSTR(__pyx_k_421), 0},
  {(char *)"text", __pyx_getprop_4lxml_5etree_14_ReadOnlyProxy_text, 0, __Pyx_DOCSTR(__pyx_k_423), 0},
  {(char *)"tail", __pyx_getprop_4lxml_5etree_14_ReadOnlyProxy_tail, 0, __Pyx_DOCSTR(__pyx_k_424), 0},
  {(char *)"sourceline", __pyx_getprop_4lxml_5etree_14_ReadOnlyProxy_sourceline, 0, __Pyx_DOCSTR(__pyx_k_426), 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__ReadOnlyProxy = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_4__nonzero__, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__ReadOnlyProxy = {
  __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_3__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_4lxml_5etree__ReadOnlyProxy, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__ReadOnlyProxy = {
  __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_3__len__, /*mp_length*/
  __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_2__getitem__, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__ReadOnlyProxy = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree__ReadOnlyProxy = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._ReadOnlyProxy"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ReadOnlyProxy, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_1__repr__, /*tp_repr*/
  &__pyx_tp_as_number__ReadOnlyProxy, /*tp_as_number*/
  &__pyx_tp_as_sequence__ReadOnlyProxy, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__ReadOnlyProxy, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__ReadOnlyProxy, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("A read-only proxy class suitable for PIs/Comments (for internal use only!)."), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ReadOnlyProxy, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ReadOnlyProxy, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_7__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__ReadOnlyProxy, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__ReadOnlyProxy, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__ReadOnlyProxy, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyPIProxy __pyx_vtable_4lxml_5etree__ReadOnlyPIProxy;

static PyObject *__pyx_tp_new_4lxml_5etree__ReadOnlyPIProxy(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ReadOnlyPIProxy *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ReadOnlyProxy(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ReadOnlyPIProxy *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy*)__pyx_vtabptr_4lxml_5etree__ReadOnlyPIProxy;
  return o;
}

static PyObject *__pyx_getprop_4lxml_5etree_16_ReadOnlyPIProxy_target(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_16_ReadOnlyPIProxy_6target___get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__ReadOnlyPIProxy[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__ReadOnlyPIProxy[] = {
  {(char *)"target", __pyx_getprop_4lxml_5etree_16_ReadOnlyPIProxy_target, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__ReadOnlyPIProxy = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__ReadOnlyPIProxy = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__ReadOnlyPIProxy = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__ReadOnlyPIProxy = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree__ReadOnlyPIProxy = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._ReadOnlyPIProxy"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ReadOnlyPIProxy), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ReadOnlyProxy, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number__ReadOnlyPIProxy, /*tp_as_number*/
  &__pyx_tp_as_sequence__ReadOnlyPIProxy, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__ReadOnlyPIProxy, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__ReadOnlyPIProxy, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("A read-only proxy for processing instructions (for internal use only!)"), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ReadOnlyProxy, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ReadOnlyProxy, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__ReadOnlyPIProxy, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__ReadOnlyPIProxy, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__ReadOnlyPIProxy, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyEntityProxy __pyx_vtable_4lxml_5etree__ReadOnlyEntityProxy;

static PyObject *__pyx_tp_new_4lxml_5etree__ReadOnlyEntityProxy(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ReadOnlyEntityProxy *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ReadOnlyProxy(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ReadOnlyEntityProxy *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy*)__pyx_vtabptr_4lxml_5etree__ReadOnlyEntityProxy;
  return o;
}

static PyObject *__pyx_getprop_4lxml_5etree_20_ReadOnlyEntityProxy_name(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_20_ReadOnlyEntityProxy_4name___get__(o);
}

static int __pyx_setprop_4lxml_5etree_20_ReadOnlyEntityProxy_name(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_4lxml_5etree_20_ReadOnlyEntityProxy_4name_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_4lxml_5etree_20_ReadOnlyEntityProxy_text(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_20_ReadOnlyEntityProxy_4text___get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__ReadOnlyEntityProxy[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__ReadOnlyEntityProxy[] = {
  {(char *)"name", __pyx_getprop_4lxml_5etree_20_ReadOnlyEntityProxy_name, __pyx_setprop_4lxml_5etree_20_ReadOnlyEntityProxy_name, 0, 0},
  {(char *)"text", __pyx_getprop_4lxml_5etree_20_ReadOnlyEntityProxy_text, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__ReadOnlyEntityProxy = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__ReadOnlyEntityProxy = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__ReadOnlyEntityProxy = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__ReadOnlyEntityProxy = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree__ReadOnlyEntityProxy = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._ReadOnlyEntityProxy"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ReadOnlyEntityProxy), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ReadOnlyProxy, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number__ReadOnlyEntityProxy, /*tp_as_number*/
  &__pyx_tp_as_sequence__ReadOnlyEntityProxy, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__ReadOnlyEntityProxy, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__ReadOnlyEntityProxy, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("A read-only proxy for entity references (for internal use only!)"), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ReadOnlyProxy, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ReadOnlyProxy, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__ReadOnlyEntityProxy, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__ReadOnlyEntityProxy, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__ReadOnlyEntityProxy, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyElementProxy __pyx_vtable_4lxml_5etree__ReadOnlyElementProxy;

static PyObject *__pyx_tp_new_4lxml_5etree__ReadOnlyElementProxy(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ReadOnlyProxy(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy*)__pyx_vtabptr_4lxml_5etree__ReadOnlyElementProxy;
  return o;
}

static PyObject *__pyx_getprop_4lxml_5etree_21_ReadOnlyElementProxy_attrib(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_6attrib___get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_21_ReadOnlyElementProxy_prefix(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_6prefix___get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__ReadOnlyElementProxy[] = {
  {__Pyx_NAMESTR("get"), (PyCFunction)__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_get, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy_get)},
  {__Pyx_NAMESTR("keys"), (PyCFunction)__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_1keys, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy_1keys)},
  {__Pyx_NAMESTR("values"), (PyCFunction)__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_2values, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy_2values)},
  {__Pyx_NAMESTR("items"), (PyCFunction)__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_3items, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy_3items)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__ReadOnlyElementProxy[] = {
  {(char *)"attrib", __pyx_getprop_4lxml_5etree_21_ReadOnlyElementProxy_attrib, 0, 0, 0},
  {(char *)"prefix", __pyx_getprop_4lxml_5etree_21_ReadOnlyElementProxy_prefix, 0, __Pyx_DOCSTR(__pyx_k_425), 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__ReadOnlyElementProxy = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__ReadOnlyElementProxy = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__ReadOnlyElementProxy = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__ReadOnlyElementProxy = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree__ReadOnlyElementProxy = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._ReadOnlyElementProxy"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ReadOnlyProxy, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number__ReadOnlyElementProxy, /*tp_as_number*/
  &__pyx_tp_as_sequence__ReadOnlyElementProxy, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__ReadOnlyElementProxy, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__ReadOnlyElementProxy, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("The main read-only Element proxy class (for internal use only!)."), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ReadOnlyProxy, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ReadOnlyProxy, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__ReadOnlyElementProxy, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__ReadOnlyElementProxy, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__ReadOnlyElementProxy, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static PyObject *__pyx_tp_new_4lxml_5etree__OpaqueNodeWrapper(PyTypeObject *t, PyObject *a, PyObject *k) {
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__OpaqueNodeWrapper(PyObject *o) {
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__OpaqueNodeWrapper[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__OpaqueNodeWrapper = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__OpaqueNodeWrapper = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__OpaqueNodeWrapper = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__OpaqueNodeWrapper = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree__OpaqueNodeWrapper = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._OpaqueNodeWrapper"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__OpaqueNodeWrapper), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__OpaqueNodeWrapper, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number__OpaqueNodeWrapper, /*tp_as_number*/
  &__pyx_tp_as_sequence__OpaqueNodeWrapper, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__OpaqueNodeWrapper, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__OpaqueNodeWrapper, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__OpaqueNodeWrapper, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_4lxml_5etree_18_OpaqueNodeWrapper___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__OpaqueNodeWrapper, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__OpaqueDocumentWrapper __pyx_vtable_4lxml_5etree__OpaqueDocumentWrapper;

static PyObject *__pyx_tp_new_4lxml_5etree__OpaqueDocumentWrapper(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__OpaqueNodeWrapper(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__OpaqueDocumentWrapper;
  return o;
}

static PyMethodDef __pyx_methods_4lxml_5etree__OpaqueDocumentWrapper[] = {
  {__Pyx_NAMESTR("append"), (PyCFunction)__pyx_pf_4lxml_5etree_22_OpaqueDocumentWrapper_append, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_22_OpaqueDocumentWrapper_append)},
  {__Pyx_NAMESTR("extend"), (PyCFunction)__pyx_pf_4lxml_5etree_22_OpaqueDocumentWrapper_1extend, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_22_OpaqueDocumentWrapper_1extend)},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__OpaqueDocumentWrapper = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__OpaqueDocumentWrapper = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__OpaqueDocumentWrapper = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__OpaqueDocumentWrapper = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree__OpaqueDocumentWrapper = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._OpaqueDocumentWrapper"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__OpaqueNodeWrapper, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number__OpaqueDocumentWrapper, /*tp_as_number*/
  &__pyx_tp_as_sequence__OpaqueDocumentWrapper, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__OpaqueDocumentWrapper, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__OpaqueDocumentWrapper, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__OpaqueDocumentWrapper, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__OpaqueDocumentWrapper, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__ModifyContentOnlyProxy __pyx_vtable_4lxml_5etree__ModifyContentOnlyProxy;

static PyObject *__pyx_tp_new_4lxml_5etree__ModifyContentOnlyProxy(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ModifyContentOnlyProxy *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ReadOnlyProxy(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ModifyContentOnlyProxy *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy*)__pyx_vtabptr_4lxml_5etree__ModifyContentOnlyProxy;
  return o;
}

static PyObject *__pyx_getprop_4lxml_5etree_23_ModifyContentOnlyProxy_text(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_23_ModifyContentOnlyProxy_4text___get__(o);
}

static int __pyx_setprop_4lxml_5etree_23_ModifyContentOnlyProxy_text(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_4lxml_5etree_23_ModifyContentOnlyProxy_4text_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyMethodDef __pyx_methods_4lxml_5etree__ModifyContentOnlyProxy[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__ModifyContentOnlyProxy[] = {
  {(char *)"text", __pyx_getprop_4lxml_5etree_23_ModifyContentOnlyProxy_text, __pyx_setprop_4lxml_5etree_23_ModifyContentOnlyProxy_text, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__ModifyContentOnlyProxy = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__ModifyContentOnlyProxy = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__ModifyContentOnlyProxy = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__ModifyContentOnlyProxy = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree__ModifyContentOnlyProxy = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._ModifyContentOnlyProxy"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ModifyContentOnlyProxy), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ReadOnlyProxy, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number__ModifyContentOnlyProxy, /*tp_as_number*/
  &__pyx_tp_as_sequence__ModifyContentOnlyProxy, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__ModifyContentOnlyProxy, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__ModifyContentOnlyProxy, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("A read-only proxy that allows changing the text content.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ReadOnlyProxy, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ReadOnlyProxy, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__ModifyContentOnlyProxy, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__ModifyContentOnlyProxy, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__ModifyContentOnlyProxy, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__ModifyContentOnlyPIProxy __pyx_vtable_4lxml_5etree__ModifyContentOnlyPIProxy;

static PyObject *__pyx_tp_new_4lxml_5etree__ModifyContentOnlyPIProxy(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ModifyContentOnlyPIProxy *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ReadOnlyProxy(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ModifyContentOnlyPIProxy *)o);
  p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy*)__pyx_vtabptr_4lxml_5etree__ModifyContentOnlyPIProxy;
  return o;
}

static PyObject *__pyx_getprop_4lxml_5etree_25_ModifyContentOnlyPIProxy_target(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_25_ModifyContentOnlyPIProxy_6target___get__(o);
}

static int __pyx_setprop_4lxml_5etree_25_ModifyContentOnlyPIProxy_target(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_4lxml_5etree_25_ModifyContentOnlyPIProxy_6target_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyMethodDef __pyx_methods_4lxml_5etree__ModifyContentOnlyPIProxy[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__ModifyContentOnlyPIProxy[] = {
  {(char *)"target", __pyx_getprop_4lxml_5etree_25_ModifyContentOnlyPIProxy_target, __pyx_setprop_4lxml_5etree_25_ModifyContentOnlyPIProxy_target, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__ModifyContentOnlyPIProxy = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__ModifyContentOnlyPIProxy = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__ModifyContentOnlyPIProxy = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__ModifyContentOnlyPIProxy = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree__ModifyContentOnlyPIProxy = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._ModifyContentOnlyPIProxy"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ModifyContentOnlyPIProxy), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ReadOnlyProxy, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number__ModifyContentOnlyPIProxy, /*tp_as_number*/
  &__pyx_tp_as_sequence__ModifyContentOnlyPIProxy, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__ModifyContentOnlyPIProxy, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__ModifyContentOnlyPIProxy, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("A read-only proxy that allows changing the text/target content of a\n    processing instruction.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ReadOnlyProxy, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ReadOnlyProxy, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__ModifyContentOnlyPIProxy, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__ModifyContentOnlyPIProxy, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__ModifyContentOnlyPIProxy, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__ModifyContentOnlyEntityProxy __pyx_vtable_4lxml_5etree__ModifyContentOnlyEntityProxy;

static PyObject *__pyx_tp_new_4lxml_5etree__ModifyContentOnlyEntityProxy(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ModifyContentOnlyEntityProxy *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ReadOnlyProxy(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ModifyContentOnlyEntityProxy *)o);
  p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy*)__pyx_vtabptr_4lxml_5etree__ModifyContentOnlyEntityProxy;
  return o;
}

static PyObject *__pyx_getprop_4lxml_5etree_29_ModifyContentOnlyEntityProxy_name(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_29_ModifyContentOnlyEntityProxy_4name___get__(o);
}

static int __pyx_setprop_4lxml_5etree_29_ModifyContentOnlyEntityProxy_name(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_4lxml_5etree_29_ModifyContentOnlyEntityProxy_4name_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyMethodDef __pyx_methods_4lxml_5etree__ModifyContentOnlyEntityProxy[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__ModifyContentOnlyEntityProxy[] = {
  {(char *)"name", __pyx_getprop_4lxml_5etree_29_ModifyContentOnlyEntityProxy_name, __pyx_setprop_4lxml_5etree_29_ModifyContentOnlyEntityProxy_name, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__ModifyContentOnlyEntityProxy = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__ModifyContentOnlyEntityProxy = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__ModifyContentOnlyEntityProxy = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__ModifyContentOnlyEntityProxy = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree__ModifyContentOnlyEntityProxy = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._ModifyContentOnlyEntityProxy"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ModifyContentOnlyEntityProxy), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ReadOnlyProxy, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number__ModifyContentOnlyEntityProxy, /*tp_as_number*/
  &__pyx_tp_as_sequence__ModifyContentOnlyEntityProxy, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__ModifyContentOnlyEntityProxy, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__ModifyContentOnlyEntityProxy, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("A read-only proxy for entity references (for internal use only!)"), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ReadOnlyProxy, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ReadOnlyProxy, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__ModifyContentOnlyEntityProxy, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__ModifyContentOnlyEntityProxy, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__ModifyContentOnlyEntityProxy, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__AppendOnlyElementProxy __pyx_vtable_4lxml_5etree__AppendOnlyElementProxy;

static PyObject *__pyx_tp_new_4lxml_5etree__AppendOnlyElementProxy(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ReadOnlyProxy(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *)o);
  p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy*)__pyx_vtabptr_4lxml_5etree__AppendOnlyElementProxy;
  return o;
}

static PyObject *__pyx_getprop_4lxml_5etree_23_AppendOnlyElementProxy_text(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_23_AppendOnlyElementProxy_4text___get__(o);
}

static int __pyx_setprop_4lxml_5etree_23_AppendOnlyElementProxy_text(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_4lxml_5etree_23_AppendOnlyElementProxy_4text_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyMethodDef __pyx_methods_4lxml_5etree__AppendOnlyElementProxy[] = {
  {__Pyx_NAMESTR("append"), (PyCFunction)__pyx_pf_4lxml_5etree_23_AppendOnlyElementProxy_append, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_23_AppendOnlyElementProxy_append)},
  {__Pyx_NAMESTR("extend"), (PyCFunction)__pyx_pf_4lxml_5etree_23_AppendOnlyElementProxy_1extend, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_23_AppendOnlyElementProxy_1extend)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__AppendOnlyElementProxy[] = {
  {(char *)"text", __pyx_getprop_4lxml_5etree_23_AppendOnlyElementProxy_text, __pyx_setprop_4lxml_5etree_23_AppendOnlyElementProxy_text, __Pyx_DOCSTR(__pyx_k_447), 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__AppendOnlyElementProxy = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__AppendOnlyElementProxy = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__AppendOnlyElementProxy = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__AppendOnlyElementProxy = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree__AppendOnlyElementProxy = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._AppendOnlyElementProxy"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ReadOnlyProxy, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number__AppendOnlyElementProxy, /*tp_as_number*/
  &__pyx_tp_as_sequence__AppendOnlyElementProxy, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__AppendOnlyElementProxy, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__AppendOnlyElementProxy, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("A read-only element that allows adding children and changing the\n    text content (i.e. everything that adds to the subtree).\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ReadOnlyProxy, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ReadOnlyProxy, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__AppendOnlyElementProxy, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__AppendOnlyElementProxy, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__AppendOnlyElementProxy, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static PyObject *__pyx_tp_new_4lxml_5etree_ElementBase(PyTypeObject *t, PyObject *a, PyObject *k) {
  PyObject *o = __pyx_tp_new_4lxml_5etree__Element(t, a, k);
  if (!o) return 0;
  return o;
}

static PyMethodDef __pyx_methods_4lxml_5etree_ElementBase[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_ElementBase = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_ElementBase = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_ElementBase = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_ElementBase = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

DL_EXPORT(PyTypeObject) LxmlElementBaseType = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.ElementBase"), /*tp_name*/
  sizeof(struct LxmlElementBase), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__Element, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_ElementBase, /*tp_as_number*/
  &__pyx_tp_as_sequence_ElementBase, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_ElementBase, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_ElementBase, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("ElementBase(*children, attrib=None, nsmap=None, **_extra)\n\n    The public Element class.  All custom Element classes must inherit\n    from this one.  To create an Element, use the `Element()` factory.\n\n    BIG FAT WARNING: Subclasses *must not* override __init__ or\n    __new__ as it is absolutely undefined when these objects will be\n    created or destroyed.  All persistent state of Elements must be\n    stored in the underlying XML.  If you really need to initialize\n    the object after creation, you can implement an ``_init(self)``\n    method that will be called directly after object creation.\n\n    Subclasses of this class can be instantiated to create a new\n    Element.  By default, the tag name will be the class name and the\n    namespace will be empty.  You can modify this with the following\n    class attributes:\n\n    * TAG - the tag name, possibly containing a namespace in Clark\n      notation\n\n    * NAMESPACE - the default namespace URI, unless provided as part\n      of the TAG attribute.\n\n    * HTML - flag if the class is an HTML tag, as opposed to an XML\n      tag.  This only applies to un-namespaced tags and defaults to\n      false (i.e. XML).\n\n    * PARSER - the parser that provides the configuration for the\n      newly created document.  Providing an HTML parser here will\n      default to creating an HTML element.\n\n    In user code, the latter three are commonly inherited in class\n    hierarchies that implement a common namespace.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__Element, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__Element, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_ElementBase, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_4lxml_5etree_11ElementBase___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_ElementBase, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_CommentBase __pyx_vtable_4lxml_5etree_CommentBase;

static PyObject *__pyx_tp_new_4lxml_5etree_CommentBase(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_CommentBase *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__Element(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_CommentBase *)o);
  p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree___ContentOnlyElement*)__pyx_vtabptr_4lxml_5etree_CommentBase;
  return o;
}

static PyMethodDef __pyx_methods_4lxml_5etree_CommentBase[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_CommentBase = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_CommentBase = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_CommentBase = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_CommentBase = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree_CommentBase = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.CommentBase"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_CommentBase), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__Element, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_CommentBase, /*tp_as_number*/
  &__pyx_tp_as_sequence_CommentBase, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_CommentBase, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_CommentBase, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("All custom Comment classes must inherit from this one.\n\n    To create an XML Comment instance, use the ``Comment()`` factory.\n\n    Subclasses *must not* override __init__ or __new__ as it is\n    absolutely undefined when these objects will be created or\n    destroyed.  All persistent state of Comments must be stored in the\n    underlying XML.  If you really need to initialize the object after\n    creation, you can implement an ``_init(self)`` method that will be\n    called after object creation.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__Element, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__Element, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_CommentBase, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_4lxml_5etree_11CommentBase___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_CommentBase, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_PIBase __pyx_vtable_4lxml_5etree_PIBase;

static PyObject *__pyx_tp_new_4lxml_5etree_PIBase(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_PIBase *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__Element(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_PIBase *)o);
  p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree___ContentOnlyElement*)__pyx_vtabptr_4lxml_5etree_PIBase;
  return o;
}

static PyMethodDef __pyx_methods_4lxml_5etree_PIBase[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_PIBase = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_PIBase = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_PIBase = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_PIBase = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree_PIBase = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.PIBase"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_PIBase), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__Element, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_PIBase, /*tp_as_number*/
  &__pyx_tp_as_sequence_PIBase, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_PIBase, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_PIBase, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("All custom Processing Instruction classes must inherit from this one.\n\n    To create an XML ProcessingInstruction instance, use the ``PI()``\n    factory.\n\n    Subclasses *must not* override __init__ or __new__ as it is\n    absolutely undefined when these objects will be created or\n    destroyed.  All persistent state of PIs must be stored in the\n    underlying XML.  If you really need to initialize the object after\n    creation, you can implement an ``_init(self)`` method that will be\n    called after object creation.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__Element, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__Element, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_PIBase, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_4lxml_5etree_6PIBase___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_PIBase, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_EntityBase __pyx_vtable_4lxml_5etree_EntityBase;

static PyObject *__pyx_tp_new_4lxml_5etree_EntityBase(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_EntityBase *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__Element(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_EntityBase *)o);
  p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree___ContentOnlyElement*)__pyx_vtabptr_4lxml_5etree_EntityBase;
  return o;
}

static PyMethodDef __pyx_methods_4lxml_5etree_EntityBase[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_EntityBase = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_EntityBase = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_EntityBase = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_EntityBase = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree_EntityBase = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.EntityBase"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_EntityBase), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__Element, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_EntityBase, /*tp_as_number*/
  &__pyx_tp_as_sequence_EntityBase, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_EntityBase, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_EntityBase, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("All custom Entity classes must inherit from this one.\n\n    To create an XML Entity instance, use the ``Entity()`` factory.\n\n    Subclasses *must not* override __init__ or __new__ as it is\n    absolutely undefined when these objects will be created or\n    destroyed.  All persistent state of Entities must be stored in the\n    underlying XML.  If you really need to initialize the object after\n    creation, you can implement an ``_init(self)`` method that will be\n    called after object creation.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__Element, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__Element, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_EntityBase, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_4lxml_5etree_10EntityBase___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_EntityBase, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static PyObject *__pyx_tp_new_4lxml_5etree_ElementClassLookup(PyTypeObject *t, PyObject *a, PyObject *k) {
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  if (__pyx_pf_4lxml_5etree_18ElementClassLookup___cinit__(o, __pyx_empty_tuple, NULL) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_ElementClassLookup(PyObject *o) {
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree_ElementClassLookup[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_ElementClassLookup = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_ElementClassLookup = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_ElementClassLookup = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_ElementClassLookup = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

DL_EXPORT(PyTypeObject) LxmlElementClassLookupType = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.ElementClassLookup"), /*tp_name*/
  sizeof(struct LxmlElementClassLookup), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_ElementClassLookup, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_ElementClassLookup, /*tp_as_number*/
  &__pyx_tp_as_sequence_ElementClassLookup, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_ElementClassLookup, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_ElementClassLookup, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  __Pyx_DOCSTR("ElementClassLookup(self)\n    Superclass of Element class lookups.\n    "), /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_ElementClassLookup, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_ElementClassLookup, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_FallbackElementClassLookup __pyx_vtable_4lxml_5etree_FallbackElementClassLookup;

static PyObject *__pyx_tp_new_4lxml_5etree_FallbackElementClassLookup(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct LxmlFallbackElementClassLookup *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree_ElementClassLookup(t, a, k);
  if (!o) return 0;
  p = ((struct LxmlFallbackElementClassLookup *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree_FallbackElementClassLookup;
  p->fallback = ((struct LxmlElementClassLookup *)Py_None); Py_INCREF(Py_None);
  if (__pyx_pf_4lxml_5etree_26FallbackElementClassLookup___cinit__(o, __pyx_empty_tuple, NULL) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_FallbackElementClassLookup(PyObject *o) {
  struct LxmlFallbackElementClassLookup *p = (struct LxmlFallbackElementClassLookup *)o;
  Py_XDECREF(((PyObject *)p->fallback));
  __pyx_tp_dealloc_4lxml_5etree_ElementClassLookup(o);
}

static int __pyx_tp_traverse_4lxml_5etree_FallbackElementClassLookup(PyObject *o, visitproc v, void *a) {
  int e;
  struct LxmlFallbackElementClassLookup *p = (struct LxmlFallbackElementClassLookup *)o;
  if (__pyx_ptype_4lxml_5etree_ElementClassLookup->tp_traverse) {
    e = __pyx_ptype_4lxml_5etree_ElementClassLookup->tp_traverse(o, v, a); if (e) return e;
  }
  if (p->fallback) {
    e = (*v)(((PyObject*)p->fallback), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree_FallbackElementClassLookup(PyObject *o) {
  struct LxmlFallbackElementClassLookup *p = (struct LxmlFallbackElementClassLookup *)o;
  PyObject* tmp;
  if (__pyx_ptype_4lxml_5etree_ElementClassLookup->tp_clear) {
    __pyx_ptype_4lxml_5etree_ElementClassLookup->tp_clear(o);
  }
  tmp = ((PyObject*)p->fallback);
  p->fallback = ((struct LxmlElementClassLookup *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_26FallbackElementClassLookup_fallback(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_26FallbackElementClassLookup_8fallback___get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree_FallbackElementClassLookup[] = {
  {__Pyx_NAMESTR("set_fallback"), (PyCFunction)__pyx_pf_4lxml_5etree_26FallbackElementClassLookup_2set_fallback, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_26FallbackElementClassLookup_2set_fallback)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree_FallbackElementClassLookup[] = {
  {(char *)"fallback", __pyx_getprop_4lxml_5etree_26FallbackElementClassLookup_fallback, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_FallbackElementClassLookup = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_FallbackElementClassLookup = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_FallbackElementClassLookup = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_FallbackElementClassLookup = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

DL_EXPORT(PyTypeObject) LxmlFallbackElementClassLookupType = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.FallbackElementClassLookup"), /*tp_name*/
  sizeof(struct LxmlFallbackElementClassLookup), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_FallbackElementClassLookup, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_FallbackElementClassLookup, /*tp_as_number*/
  &__pyx_tp_as_sequence_FallbackElementClassLookup, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_FallbackElementClassLookup, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_FallbackElementClassLookup, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("FallbackElementClassLookup(self, fallback=None)\n\n    Superclass of Element class lookups with additional fallback.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_FallbackElementClassLookup, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_FallbackElementClassLookup, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_FallbackElementClassLookup, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree_FallbackElementClassLookup, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_4lxml_5etree_26FallbackElementClassLookup_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_FallbackElementClassLookup, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static PyObject *__pyx_tp_new_4lxml_5etree_ElementDefaultClassLookup(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree_ElementClassLookup(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)o);
  p->element_class = Py_None; Py_INCREF(Py_None);
  p->comment_class = Py_None; Py_INCREF(Py_None);
  p->pi_class = Py_None; Py_INCREF(Py_None);
  p->entity_class = Py_None; Py_INCREF(Py_None);
  if (__pyx_pf_4lxml_5etree_25ElementDefaultClassLookup___cinit__(o, __pyx_empty_tuple, NULL) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_ElementDefaultClassLookup(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *p = (struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)o;
  Py_XDECREF(p->element_class);
  Py_XDECREF(p->comment_class);
  Py_XDECREF(p->pi_class);
  Py_XDECREF(p->entity_class);
  __pyx_tp_dealloc_4lxml_5etree_ElementClassLookup(o);
}

static int __pyx_tp_traverse_4lxml_5etree_ElementDefaultClassLookup(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *p = (struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)o;
  if (__pyx_ptype_4lxml_5etree_ElementClassLookup->tp_traverse) {
    e = __pyx_ptype_4lxml_5etree_ElementClassLookup->tp_traverse(o, v, a); if (e) return e;
  }
  if (p->element_class) {
    e = (*v)(p->element_class, a); if (e) return e;
  }
  if (p->comment_class) {
    e = (*v)(p->comment_class, a); if (e) return e;
  }
  if (p->pi_class) {
    e = (*v)(p->pi_class, a); if (e) return e;
  }
  if (p->entity_class) {
    e = (*v)(p->entity_class, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree_ElementDefaultClassLookup(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *p = (struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)o;
  PyObject* tmp;
  if (__pyx_ptype_4lxml_5etree_ElementClassLookup->tp_clear) {
    __pyx_ptype_4lxml_5etree_ElementClassLookup->tp_clear(o);
  }
  tmp = ((PyObject*)p->element_class);
  p->element_class = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->comment_class);
  p->comment_class = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->pi_class);
  p->pi_class = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->entity_class);
  p->entity_class = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_25ElementDefaultClassLookup_element_class(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_25ElementDefaultClassLookup_13element_class___get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_25ElementDefaultClassLookup_comment_class(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_25ElementDefaultClassLookup_13comment_class___get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_25ElementDefaultClassLookup_pi_class(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_25ElementDefaultClassLookup_8pi_class___get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_25ElementDefaultClassLookup_entity_class(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_25ElementDefaultClassLookup_12entity_class___get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree_ElementDefaultClassLookup[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree_ElementDefaultClassLookup[] = {
  {(char *)"element_class", __pyx_getprop_4lxml_5etree_25ElementDefaultClassLookup_element_class, 0, 0, 0},
  {(char *)"comment_class", __pyx_getprop_4lxml_5etree_25ElementDefaultClassLookup_comment_class, 0, 0, 0},
  {(char *)"pi_class", __pyx_getprop_4lxml_5etree_25ElementDefaultClassLookup_pi_class, 0, 0, 0},
  {(char *)"entity_class", __pyx_getprop_4lxml_5etree_25ElementDefaultClassLookup_entity_class, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_ElementDefaultClassLookup = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_ElementDefaultClassLookup = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_ElementDefaultClassLookup = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_ElementDefaultClassLookup = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree_ElementDefaultClassLookup = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.ElementDefaultClassLookup"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_ElementDefaultClassLookup, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_ElementDefaultClassLookup, /*tp_as_number*/
  &__pyx_tp_as_sequence_ElementDefaultClassLookup, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_ElementDefaultClassLookup, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_ElementDefaultClassLookup, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("ElementDefaultClassLookup(self, element=None, comment=None, pi=None, entity=None)\n    Element class lookup scheme that always returns the default Element\n    class.\n\n    The keyword arguments ``element``, ``comment``, ``pi`` and ``entity``\n    accept the respective Element classes.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_ElementDefaultClassLookup, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_ElementDefaultClassLookup, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_ElementDefaultClassLookup, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree_ElementDefaultClassLookup, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_4lxml_5etree_25ElementDefaultClassLookup_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_ElementDefaultClassLookup, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_AttributeBasedElementClassLookup __pyx_vtable_4lxml_5etree_AttributeBasedElementClassLookup;

static PyObject *__pyx_tp_new_4lxml_5etree_AttributeBasedElementClassLookup(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree_FallbackElementClassLookup(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree_FallbackElementClassLookup*)__pyx_vtabptr_4lxml_5etree_AttributeBasedElementClassLookup;
  p->_class_mapping = Py_None; Py_INCREF(Py_None);
  p->_pytag = Py_None; Py_INCREF(Py_None);
  if (__pyx_pf_4lxml_5etree_32AttributeBasedElementClassLookup___cinit__(o, __pyx_empty_tuple, NULL) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_AttributeBasedElementClassLookup(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *p = (struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *)o;
  Py_XDECREF(p->_class_mapping);
  Py_XDECREF(p->_pytag);
  __pyx_tp_dealloc_4lxml_5etree_FallbackElementClassLookup(o);
}

static int __pyx_tp_traverse_4lxml_5etree_AttributeBasedElementClassLookup(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *p = (struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *)o;
  e = __pyx_tp_traverse_4lxml_5etree_FallbackElementClassLookup(o, v, a); if (e) return e;
  if (p->_class_mapping) {
    e = (*v)(p->_class_mapping, a); if (e) return e;
  }
  if (p->_pytag) {
    e = (*v)(p->_pytag, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree_AttributeBasedElementClassLookup(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *p = (struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *)o;
  PyObject* tmp;
  __pyx_tp_clear_4lxml_5etree_FallbackElementClassLookup(o);
  tmp = ((PyObject*)p->_class_mapping);
  p->_class_mapping = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_pytag);
  p->_pytag = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree_AttributeBasedElementClassLookup[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_AttributeBasedElementClassLookup = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_AttributeBasedElementClassLookup = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_AttributeBasedElementClassLookup = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_AttributeBasedElementClassLookup = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree_AttributeBasedElementClassLookup = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.AttributeBasedElementClassLookup"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_AttributeBasedElementClassLookup, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_AttributeBasedElementClassLookup, /*tp_as_number*/
  &__pyx_tp_as_sequence_AttributeBasedElementClassLookup, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_AttributeBasedElementClassLookup, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_AttributeBasedElementClassLookup, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("AttributeBasedElementClassLookup(self, attribute_name, class_mapping, fallback=None)\n    Checks an attribute of an Element and looks up the value in a\n    class dictionary.\n\n    Arguments:\n      - attribute name - '{ns}name' style string\n      - class mapping  - Python dict mapping attribute values to Element classes\n      - fallback       - optional fallback lookup mechanism\n\n    A None key in the class mapping will be checked if the attribute is\n    missing.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_AttributeBasedElementClassLookup, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_AttributeBasedElementClassLookup, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_AttributeBasedElementClassLookup, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_4lxml_5etree_32AttributeBasedElementClassLookup_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_AttributeBasedElementClassLookup, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_ParserBasedElementClassLookup __pyx_vtable_4lxml_5etree_ParserBasedElementClassLookup;

static PyObject *__pyx_tp_new_4lxml_5etree_ParserBasedElementClassLookup(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_ParserBasedElementClassLookup *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree_FallbackElementClassLookup(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_ParserBasedElementClassLookup *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree_FallbackElementClassLookup*)__pyx_vtabptr_4lxml_5etree_ParserBasedElementClassLookup;
  if (__pyx_pf_4lxml_5etree_29ParserBasedElementClassLookup___cinit__(o, __pyx_empty_tuple, NULL) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static PyMethodDef __pyx_methods_4lxml_5etree_ParserBasedElementClassLookup[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_ParserBasedElementClassLookup = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_ParserBasedElementClassLookup = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_ParserBasedElementClassLookup = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_ParserBasedElementClassLookup = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree_ParserBasedElementClassLookup = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.ParserBasedElementClassLookup"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_ParserBasedElementClassLookup), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_FallbackElementClassLookup, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_ParserBasedElementClassLookup, /*tp_as_number*/
  &__pyx_tp_as_sequence_ParserBasedElementClassLookup, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_ParserBasedElementClassLookup, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_ParserBasedElementClassLookup, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("ParserBasedElementClassLookup(self, fallback=None)\n    Element class lookup based on the XML parser.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_FallbackElementClassLookup, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_FallbackElementClassLookup, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_ParserBasedElementClassLookup, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_ParserBasedElementClassLookup, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_CustomElementClassLookup __pyx_vtable_4lxml_5etree_CustomElementClassLookup;

static PyObject *__pyx_tp_new_4lxml_5etree_CustomElementClassLookup(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_CustomElementClassLookup *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree_FallbackElementClassLookup(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_CustomElementClassLookup *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree_FallbackElementClassLookup*)__pyx_vtabptr_4lxml_5etree_CustomElementClassLookup;
  if (__pyx_pf_4lxml_5etree_24CustomElementClassLookup___cinit__(o, __pyx_empty_tuple, NULL) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static PyMethodDef __pyx_methods_4lxml_5etree_CustomElementClassLookup[] = {
  {__Pyx_NAMESTR("lookup"), (PyCFunction)__pyx_pf_4lxml_5etree_24CustomElementClassLookup_1lookup, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_24CustomElementClassLookup_1lookup)},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_CustomElementClassLookup = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_CustomElementClassLookup = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_CustomElementClassLookup = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_CustomElementClassLookup = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree_CustomElementClassLookup = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.CustomElementClassLookup"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_CustomElementClassLookup), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_FallbackElementClassLookup, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_CustomElementClassLookup, /*tp_as_number*/
  &__pyx_tp_as_sequence_CustomElementClassLookup, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_CustomElementClassLookup, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_CustomElementClassLookup, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("CustomElementClassLookup(self, fallback=None)\n    Element class lookup based on a subclass method.\n\n    You can inherit from this class and override the method::\n\n        lookup(self, type, doc, namespace, name)\n\n    to lookup the element class for a node. Arguments of the method:\n    * type:      one of 'element', 'comment', 'PI', 'entity'\n    * doc:       document that the node is in\n    * namespace: namespace URI of the node (or None for comments/PIs/entities)\n    * name:      name of the element/entity, None for comments, target for PIs\n\n    If you return None from this method, the fallback will be called.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_FallbackElementClassLookup, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_FallbackElementClassLookup, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_CustomElementClassLookup, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_CustomElementClassLookup, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_PythonElementClassLookup __pyx_vtable_4lxml_5etree_PythonElementClassLookup;

static PyObject *__pyx_tp_new_4lxml_5etree_PythonElementClassLookup(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_PythonElementClassLookup *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree_FallbackElementClassLookup(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_PythonElementClassLookup *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree_FallbackElementClassLookup*)__pyx_vtabptr_4lxml_5etree_PythonElementClassLookup;
  if (__pyx_pf_4lxml_5etree_24PythonElementClassLookup___cinit__(o, __pyx_empty_tuple, NULL) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static PyMethodDef __pyx_methods_4lxml_5etree_PythonElementClassLookup[] = {
  {__Pyx_NAMESTR("lookup"), (PyCFunction)__pyx_pf_4lxml_5etree_24PythonElementClassLookup_1lookup, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_24PythonElementClassLookup_1lookup)},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_PythonElementClassLookup = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_PythonElementClassLookup = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_PythonElementClassLookup = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_PythonElementClassLookup = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree_PythonElementClassLookup = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.PythonElementClassLookup"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_PythonElementClassLookup), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_FallbackElementClassLookup, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_PythonElementClassLookup, /*tp_as_number*/
  &__pyx_tp_as_sequence_PythonElementClassLookup, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_PythonElementClassLookup, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_PythonElementClassLookup, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("PythonElementClassLookup(self, fallback=None)\n    Element class lookup based on a subclass method.\n\n    This class lookup scheme allows access to the entire XML tree in\n    read-only mode.  To use it, re-implement the ``lookup(self, doc,\n    root)`` method in a subclass::\n\n        >>> from lxml import etree, pyclasslookup\n        >>>\n        >>> class MyElementClass(etree.ElementBase):\n        ...     honkey = True\n        ...\n        >>> class MyLookup(pyclasslookup.PythonElementClassLookup):\n        ...     def lookup(self, doc, root):\n        ...         if root.tag == \"sometag\":\n        ...             return MyElementClass\n        ...         else:\n        ...             for child in root:\n        ...                 if child.tag == \"someothertag\":\n        ...                     return MyElementClass\n        ...         # delegate to default\n        ...         return None\n\n    If you return None from this method, the fallback will be called.\n\n    The first argument is the opaque document instance that contains\n    the Element.  The second argument is a lightweight Element proxy\n    implementation that is only valid during the lookup.  Do not try\n    to keep a reference to it.  Once the lookup is done, the proxy\n    will be invalid.\n\n    Also, you cannot wrap such a read-only Element in an ElementTree,\n    and you must take care not to keep a reference to them outside of\n    the `lookup()` method.\n\n    Note that the API of the Element objects is not complete.  It is\n    purely read-only and does not support all features of the normal\n    `lxml.etree` API (such as XPath, extended slicing or some\n    iteration methods).\n\n    See http://codespeak.net/lxml/element_classes.html\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_FallbackElementClassLookup, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_FallbackElementClassLookup, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_PythonElementClassLookup, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_PythonElementClassLookup, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__NamespaceRegistry __pyx_vtable_4lxml_5etree__NamespaceRegistry;

static PyObject *__pyx_tp_new_4lxml_5etree__NamespaceRegistry(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__NamespaceRegistry *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__NamespaceRegistry;
  p->_ns_uri = Py_None; Py_INCREF(Py_None);
  p->_ns_uri_utf = Py_None; Py_INCREF(Py_None);
  p->_entries = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (__pyx_pf_4lxml_5etree_18_NamespaceRegistry___cinit__(o, a, k) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__NamespaceRegistry(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__NamespaceRegistry *p = (struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)o;
  Py_XDECREF(p->_ns_uri);
  Py_XDECREF(p->_ns_uri_utf);
  Py_XDECREF(((PyObject *)p->_entries));
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree__NamespaceRegistry(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__NamespaceRegistry *p = (struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)o;
  if (p->_ns_uri) {
    e = (*v)(p->_ns_uri, a); if (e) return e;
  }
  if (p->_ns_uri_utf) {
    e = (*v)(p->_ns_uri_utf, a); if (e) return e;
  }
  if (p->_entries) {
    e = (*v)(p->_entries, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__NamespaceRegistry(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__NamespaceRegistry *p = (struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->_ns_uri);
  p->_ns_uri = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_ns_uri_utf);
  p->_ns_uri_utf = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_entries);
  p->_entries = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}
static PyObject *__pyx_sq_item_4lxml_5etree__NamespaceRegistry(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static int __pyx_mp_ass_subscript_4lxml_5etree__NamespaceRegistry(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript assignment not supported by %s", Py_TYPE(o)->tp_name);
    return -1;
  }
  else {
    return __pyx_pf_4lxml_5etree_18_NamespaceRegistry_3__delitem__(o, i);
  }
}

static PyMethodDef __pyx_methods_4lxml_5etree__NamespaceRegistry[] = {
  {__Pyx_NAMESTR("update"), (PyCFunction)__pyx_pf_4lxml_5etree_18_NamespaceRegistry_1update, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_18_NamespaceRegistry_1update)},
  {__Pyx_NAMESTR("items"), (PyCFunction)__pyx_pf_4lxml_5etree_18_NamespaceRegistry_5items, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("iteritems"), (PyCFunction)__pyx_pf_4lxml_5etree_18_NamespaceRegistry_6iteritems, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("clear"), (PyCFunction)__pyx_pf_4lxml_5etree_18_NamespaceRegistry_7clear, METH_NOARGS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__NamespaceRegistry = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__NamespaceRegistry = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_4lxml_5etree__NamespaceRegistry, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__NamespaceRegistry = {
  0, /*mp_length*/
  __pyx_pf_4lxml_5etree_18_NamespaceRegistry_2__getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_4lxml_5etree__NamespaceRegistry, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__NamespaceRegistry = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree__NamespaceRegistry = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._NamespaceRegistry"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__NamespaceRegistry), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__NamespaceRegistry, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number__NamespaceRegistry, /*tp_as_number*/
  &__pyx_tp_as_sequence__NamespaceRegistry, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__NamespaceRegistry, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__NamespaceRegistry, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("Dictionary-like namespace registry"), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__NamespaceRegistry, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__NamespaceRegistry, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pf_4lxml_5etree_18_NamespaceRegistry_4__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__NamespaceRegistry, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__NamespaceRegistry, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__ClassNamespaceRegistry __pyx_vtable_4lxml_5etree__ClassNamespaceRegistry;

static PyObject *__pyx_tp_new_4lxml_5etree__ClassNamespaceRegistry(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ClassNamespaceRegistry *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__NamespaceRegistry(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ClassNamespaceRegistry *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__NamespaceRegistry*)__pyx_vtabptr_4lxml_5etree__ClassNamespaceRegistry;
  return o;
}

static int __pyx_mp_ass_subscript_4lxml_5etree__ClassNamespaceRegistry(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_pf_4lxml_5etree_23_ClassNamespaceRegistry___setitem__(o, i, v);
  }
  else {
    if (__pyx_ptype_4lxml_5etree__NamespaceRegistry->tp_as_mapping && __pyx_ptype_4lxml_5etree__NamespaceRegistry->tp_as_mapping->mp_ass_subscript)
      return __pyx_ptype_4lxml_5etree__NamespaceRegistry->tp_as_mapping->mp_ass_subscript(o, i, v);
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by %s", Py_TYPE(o)->tp_name);
    return -1;
  }
}

static PyMethodDef __pyx_methods_4lxml_5etree__ClassNamespaceRegistry[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__ClassNamespaceRegistry = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__ClassNamespaceRegistry = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__ClassNamespaceRegistry = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  __pyx_mp_ass_subscript_4lxml_5etree__ClassNamespaceRegistry, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__ClassNamespaceRegistry = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree__ClassNamespaceRegistry = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._ClassNamespaceRegistry"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ClassNamespaceRegistry), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__NamespaceRegistry, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pf_4lxml_5etree_23_ClassNamespaceRegistry_1__repr__, /*tp_repr*/
  &__pyx_tp_as_number__ClassNamespaceRegistry, /*tp_as_number*/
  &__pyx_tp_as_sequence__ClassNamespaceRegistry, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__ClassNamespaceRegistry, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__ClassNamespaceRegistry, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("Dictionary-like registry for namespace implementation classes"), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__NamespaceRegistry, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__NamespaceRegistry, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__ClassNamespaceRegistry, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__ClassNamespaceRegistry, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_ElementNamespaceClassLookup __pyx_vtable_4lxml_5etree_ElementNamespaceClassLookup;

static PyObject *__pyx_tp_new_4lxml_5etree_ElementNamespaceClassLookup(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree_FallbackElementClassLookup(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree_FallbackElementClassLookup*)__pyx_vtabptr_4lxml_5etree_ElementNamespaceClassLookup;
  p->_namespace_registries = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (__pyx_pf_4lxml_5etree_27ElementNamespaceClassLookup___cinit__(o, __pyx_empty_tuple, NULL) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_ElementNamespaceClassLookup(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *p = (struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *)o;
  Py_XDECREF(((PyObject *)p->_namespace_registries));
  __pyx_tp_dealloc_4lxml_5etree_FallbackElementClassLookup(o);
}

static int __pyx_tp_traverse_4lxml_5etree_ElementNamespaceClassLookup(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *p = (struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *)o;
  e = __pyx_tp_traverse_4lxml_5etree_FallbackElementClassLookup(o, v, a); if (e) return e;
  if (p->_namespace_registries) {
    e = (*v)(p->_namespace_registries, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree_ElementNamespaceClassLookup(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *p = (struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *)o;
  PyObject* tmp;
  __pyx_tp_clear_4lxml_5etree_FallbackElementClassLookup(o);
  tmp = ((PyObject*)p->_namespace_registries);
  p->_namespace_registries = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree_ElementNamespaceClassLookup[] = {
  {__Pyx_NAMESTR("get_namespace"), (PyCFunction)__pyx_pf_4lxml_5etree_27ElementNamespaceClassLookup_2get_namespace, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_27ElementNamespaceClassLookup_2get_namespace)},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_ElementNamespaceClassLookup = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_ElementNamespaceClassLookup = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_ElementNamespaceClassLookup = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_ElementNamespaceClassLookup = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree_ElementNamespaceClassLookup = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.ElementNamespaceClassLookup"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_ElementNamespaceClassLookup, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_ElementNamespaceClassLookup, /*tp_as_number*/
  &__pyx_tp_as_sequence_ElementNamespaceClassLookup, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_ElementNamespaceClassLookup, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_ElementNamespaceClassLookup, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("ElementNamespaceClassLookup(self, fallback=None)\n\n    Element class lookup scheme that searches the Element class in the\n    Namespace registry.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_ElementNamespaceClassLookup, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_ElementNamespaceClassLookup, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_ElementNamespaceClassLookup, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_4lxml_5etree_27ElementNamespaceClassLookup_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_ElementNamespaceClassLookup, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__FunctionNamespaceRegistry __pyx_vtable_4lxml_5etree__FunctionNamespaceRegistry;

static PyObject *__pyx_tp_new_4lxml_5etree__FunctionNamespaceRegistry(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__FunctionNamespaceRegistry *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__NamespaceRegistry(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__FunctionNamespaceRegistry *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__NamespaceRegistry*)__pyx_vtabptr_4lxml_5etree__FunctionNamespaceRegistry;
  return o;
}

static int __pyx_mp_ass_subscript_4lxml_5etree__FunctionNamespaceRegistry(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_pf_4lxml_5etree_26_FunctionNamespaceRegistry___setitem__(o, i, v);
  }
  else {
    if (__pyx_ptype_4lxml_5etree__NamespaceRegistry->tp_as_mapping && __pyx_ptype_4lxml_5etree__NamespaceRegistry->tp_as_mapping->mp_ass_subscript)
      return __pyx_ptype_4lxml_5etree__NamespaceRegistry->tp_as_mapping->mp_ass_subscript(o, i, v);
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by %s", Py_TYPE(o)->tp_name);
    return -1;
  }
}

static PyMethodDef __pyx_methods_4lxml_5etree__FunctionNamespaceRegistry[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__FunctionNamespaceRegistry = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__FunctionNamespaceRegistry = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__FunctionNamespaceRegistry = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  __pyx_mp_ass_subscript_4lxml_5etree__FunctionNamespaceRegistry, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__FunctionNamespaceRegistry = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree__FunctionNamespaceRegistry = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._FunctionNamespaceRegistry"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__FunctionNamespaceRegistry), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__NamespaceRegistry, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pf_4lxml_5etree_26_FunctionNamespaceRegistry_1__repr__, /*tp_repr*/
  &__pyx_tp_as_number__FunctionNamespaceRegistry, /*tp_as_number*/
  &__pyx_tp_as_sequence__FunctionNamespaceRegistry, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__FunctionNamespaceRegistry, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__FunctionNamespaceRegistry, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__NamespaceRegistry, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__NamespaceRegistry, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__FunctionNamespaceRegistry, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__FunctionNamespaceRegistry, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__XPathFunctionNamespaceRegistry __pyx_vtable_4lxml_5etree__XPathFunctionNamespaceRegistry;

static PyObject *__pyx_tp_new_4lxml_5etree__XPathFunctionNamespaceRegistry(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__NamespaceRegistry(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *)o);
  p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__NamespaceRegistry*)__pyx_vtabptr_4lxml_5etree__XPathFunctionNamespaceRegistry;
  p->_prefix = Py_None; Py_INCREF(Py_None);
  p->_prefix_utf = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__XPathFunctionNamespaceRegistry(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *p = (struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *)o;
  Py_XDECREF(p->_prefix);
  Py_XDECREF(p->_prefix_utf);
  __pyx_tp_dealloc_4lxml_5etree__NamespaceRegistry(o);
}

static int __pyx_tp_traverse_4lxml_5etree__XPathFunctionNamespaceRegistry(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *p = (struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *)o;
  e = __pyx_tp_traverse_4lxml_5etree__NamespaceRegistry(o, v, a); if (e) return e;
  if (p->_prefix) {
    e = (*v)(p->_prefix, a); if (e) return e;
  }
  if (p->_prefix_utf) {
    e = (*v)(p->_prefix_utf, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__XPathFunctionNamespaceRegistry(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *p = (struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *)o;
  PyObject* tmp;
  __pyx_tp_clear_4lxml_5etree__NamespaceRegistry(o);
  tmp = ((PyObject*)p->_prefix);
  p->_prefix = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_prefix_utf);
  p->_prefix_utf = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_31_XPathFunctionNamespaceRegistry_prefix(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_31_XPathFunctionNamespaceRegistry_6prefix_1__get__(o);
}

static int __pyx_setprop_4lxml_5etree_31_XPathFunctionNamespaceRegistry_prefix(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_4lxml_5etree_31_XPathFunctionNamespaceRegistry_6prefix_2__set__(o, v);
  }
  else {
    return __pyx_pf_4lxml_5etree_31_XPathFunctionNamespaceRegistry_6prefix___del__(o);
  }
}

static PyMethodDef __pyx_methods_4lxml_5etree__XPathFunctionNamespaceRegistry[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__XPathFunctionNamespaceRegistry[] = {
  {(char *)"prefix", __pyx_getprop_4lxml_5etree_31_XPathFunctionNamespaceRegistry_prefix, __pyx_setprop_4lxml_5etree_31_XPathFunctionNamespaceRegistry_prefix, __Pyx_DOCSTR(__pyx_k_448), 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__XPathFunctionNamespaceRegistry = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__XPathFunctionNamespaceRegistry = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__XPathFunctionNamespaceRegistry = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__XPathFunctionNamespaceRegistry = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree__XPathFunctionNamespaceRegistry = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._XPathFunctionNamespaceRegistry"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__XPathFunctionNamespaceRegistry, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number__XPathFunctionNamespaceRegistry, /*tp_as_number*/
  &__pyx_tp_as_sequence__XPathFunctionNamespaceRegistry, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__XPathFunctionNamespaceRegistry, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__XPathFunctionNamespaceRegistry, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__XPathFunctionNamespaceRegistry, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__XPathFunctionNamespaceRegistry, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__XPathFunctionNamespaceRegistry, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__XPathFunctionNamespaceRegistry, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__XPathFunctionNamespaceRegistry, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static PyObject *__pyx_tp_new_4lxml_5etree__InputDocument(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__InputDocument *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__InputDocument *)o);
  p->_data_bytes = Py_None; Py_INCREF(Py_None);
  p->_filename = Py_None; Py_INCREF(Py_None);
  p->_file = Py_None; Py_INCREF(Py_None);
  if (__pyx_pf_4lxml_5etree_14_InputDocument___cinit__(o, __pyx_empty_tuple, NULL) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__InputDocument(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__InputDocument *p = (struct __pyx_obj_4lxml_5etree__InputDocument *)o;
  Py_XDECREF(p->_data_bytes);
  Py_XDECREF(p->_filename);
  Py_XDECREF(p->_file);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree__InputDocument(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__InputDocument *p = (struct __pyx_obj_4lxml_5etree__InputDocument *)o;
  if (p->_data_bytes) {
    e = (*v)(p->_data_bytes, a); if (e) return e;
  }
  if (p->_filename) {
    e = (*v)(p->_filename, a); if (e) return e;
  }
  if (p->_file) {
    e = (*v)(p->_file, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__InputDocument(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__InputDocument *p = (struct __pyx_obj_4lxml_5etree__InputDocument *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->_data_bytes);
  p->_data_bytes = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_filename);
  p->_filename = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_file);
  p->_file = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__InputDocument[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__InputDocument = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__InputDocument = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__InputDocument = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__InputDocument = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree__InputDocument = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._InputDocument"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__InputDocument), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__InputDocument, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number__InputDocument, /*tp_as_number*/
  &__pyx_tp_as_sequence__InputDocument, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__InputDocument, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__InputDocument, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__InputDocument, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__InputDocument, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__InputDocument, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__InputDocument, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static PyObject *__pyx_tp_new_4lxml_5etree_Resolver(PyTypeObject *t, PyObject *a, PyObject *k) {
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_Resolver(PyObject *o) {
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree_Resolver[] = {
  {__Pyx_NAMESTR("resolve"), (PyCFunction)__pyx_pf_4lxml_5etree_8Resolver_resolve, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8Resolver_resolve)},
  {__Pyx_NAMESTR("resolve_empty"), (PyCFunction)__pyx_pf_4lxml_5etree_8Resolver_1resolve_empty, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8Resolver_1resolve_empty)},
  {__Pyx_NAMESTR("resolve_string"), (PyCFunction)__pyx_pf_4lxml_5etree_8Resolver_2resolve_string, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8Resolver_2resolve_string)},
  {__Pyx_NAMESTR("resolve_filename"), (PyCFunction)__pyx_pf_4lxml_5etree_8Resolver_3resolve_filename, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8Resolver_3resolve_filename)},
  {__Pyx_NAMESTR("resolve_file"), (PyCFunction)__pyx_pf_4lxml_5etree_8Resolver_4resolve_file, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8Resolver_4resolve_file)},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_Resolver = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_Resolver = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_Resolver = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_Resolver = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree_Resolver = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.Resolver"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_Resolver), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_Resolver, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_Resolver, /*tp_as_number*/
  &__pyx_tp_as_sequence_Resolver, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_Resolver, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_Resolver, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  __Pyx_DOCSTR("This is the base class of all resolvers."), /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_Resolver, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_Resolver, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__ResolverRegistry __pyx_vtable_4lxml_5etree__ResolverRegistry;

static PyObject *__pyx_tp_new_4lxml_5etree__ResolverRegistry(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ResolverRegistry *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__ResolverRegistry;
  p->_resolvers = Py_None; Py_INCREF(Py_None);
  p->_default_resolver = ((struct __pyx_obj_4lxml_5etree_Resolver *)Py_None); Py_INCREF(Py_None);
  if (__pyx_pf_4lxml_5etree_17_ResolverRegistry___cinit__(o, a, k) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__ResolverRegistry(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ResolverRegistry *p = (struct __pyx_obj_4lxml_5etree__ResolverRegistry *)o;
  Py_XDECREF(p->_resolvers);
  Py_XDECREF(((PyObject *)p->_default_resolver));
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree__ResolverRegistry(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__ResolverRegistry *p = (struct __pyx_obj_4lxml_5etree__ResolverRegistry *)o;
  if (p->_resolvers) {
    e = (*v)(p->_resolvers, a); if (e) return e;
  }
  if (p->_default_resolver) {
    e = (*v)(((PyObject*)p->_default_resolver), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__ResolverRegistry(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ResolverRegistry *p = (struct __pyx_obj_4lxml_5etree__ResolverRegistry *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->_resolvers);
  p->_resolvers = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_default_resolver);
  p->_default_resolver = ((struct __pyx_obj_4lxml_5etree_Resolver *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__ResolverRegistry[] = {
  {__Pyx_NAMESTR("add"), (PyCFunction)__pyx_pf_4lxml_5etree_17_ResolverRegistry_1add, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_17_ResolverRegistry_1add)},
  {__Pyx_NAMESTR("remove"), (PyCFunction)__pyx_pf_4lxml_5etree_17_ResolverRegistry_2remove, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_17_ResolverRegistry_2remove)},
  {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_pf_4lxml_5etree_17_ResolverRegistry_3copy, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_17_ResolverRegistry_3copy)},
  {__Pyx_NAMESTR("resolve"), (PyCFunction)__pyx_pf_4lxml_5etree_17_ResolverRegistry_4resolve, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_17_ResolverRegistry_4resolve)},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__ResolverRegistry = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__ResolverRegistry = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__ResolverRegistry = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__ResolverRegistry = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree__ResolverRegistry = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._ResolverRegistry"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ResolverRegistry), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ResolverRegistry, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pf_4lxml_5etree_17_ResolverRegistry_5__repr__, /*tp_repr*/
  &__pyx_tp_as_number__ResolverRegistry, /*tp_as_number*/
  &__pyx_tp_as_sequence__ResolverRegistry, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__ResolverRegistry, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__ResolverRegistry, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ResolverRegistry, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ResolverRegistry, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__ResolverRegistry, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__ResolverRegistry, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__ResolverContext __pyx_vtable_4lxml_5etree__ResolverContext;

static PyObject *__pyx_tp_new_4lxml_5etree__ResolverContext(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ResolverContext *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ExceptionContext(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ResolverContext *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext*)__pyx_vtabptr_4lxml_5etree__ResolverContext;
  p->_resolvers = ((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)Py_None); Py_INCREF(Py_None);
  p->_storage = ((struct __pyx_obj_4lxml_5etree__TempStore *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__ResolverContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ResolverContext *p = (struct __pyx_obj_4lxml_5etree__ResolverContext *)o;
  Py_XDECREF(((PyObject *)p->_resolvers));
  Py_XDECREF(((PyObject *)p->_storage));
  __pyx_tp_dealloc_4lxml_5etree__ExceptionContext(o);
}

static int __pyx_tp_traverse_4lxml_5etree__ResolverContext(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__ResolverContext *p = (struct __pyx_obj_4lxml_5etree__ResolverContext *)o;
  e = __pyx_tp_traverse_4lxml_5etree__ExceptionContext(o, v, a); if (e) return e;
  if (p->_resolvers) {
    e = (*v)(((PyObject*)p->_resolvers), a); if (e) return e;
  }
  if (p->_storage) {
    e = (*v)(((PyObject*)p->_storage), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__ResolverContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ResolverContext *p = (struct __pyx_obj_4lxml_5etree__ResolverContext *)o;
  PyObject* tmp;
  __pyx_tp_clear_4lxml_5etree__ExceptionContext(o);
  tmp = ((PyObject*)p->_resolvers);
  p->_resolvers = ((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_storage);
  p->_storage = ((struct __pyx_obj_4lxml_5etree__TempStore *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__ResolverContext[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__ResolverContext = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__ResolverContext = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__ResolverContext = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__ResolverContext = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree__ResolverContext = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._ResolverContext"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ResolverContext), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ResolverContext, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number__ResolverContext, /*tp_as_number*/
  &__pyx_tp_as_sequence__ResolverContext, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__ResolverContext, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__ResolverContext, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ResolverContext, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ResolverContext, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__ResolverContext, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__ResolverContext, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__ParserContext __pyx_vtable_4lxml_5etree__ParserContext;

static PyObject *__pyx_tp_new_4lxml_5etree__ParserContext(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ParserContext *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ResolverContext(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ParserContext *)o);
  p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext*)__pyx_vtabptr_4lxml_5etree__ParserContext;
  p->_error_log = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)Py_None); Py_INCREF(Py_None);
  p->_validator = ((struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *)Py_None); Py_INCREF(Py_None);
  if (__pyx_pf_4lxml_5etree_14_ParserContext___cinit__(o, __pyx_empty_tuple, NULL) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__ParserContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ParserContext *p = (struct __pyx_obj_4lxml_5etree__ParserContext *)o;
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pf_4lxml_5etree_14_ParserContext_1__dealloc__(o);
    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_XDECREF(((PyObject *)p->_error_log));
  Py_XDECREF(((PyObject *)p->_validator));
  __pyx_tp_dealloc_4lxml_5etree__ResolverContext(o);
}

static int __pyx_tp_traverse_4lxml_5etree__ParserContext(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__ParserContext *p = (struct __pyx_obj_4lxml_5etree__ParserContext *)o;
  e = __pyx_tp_traverse_4lxml_5etree__ResolverContext(o, v, a); if (e) return e;
  if (p->_error_log) {
    e = (*v)(((PyObject*)p->_error_log), a); if (e) return e;
  }
  if (p->_validator) {
    e = (*v)(((PyObject*)p->_validator), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__ParserContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ParserContext *p = (struct __pyx_obj_4lxml_5etree__ParserContext *)o;
  PyObject* tmp;
  __pyx_tp_clear_4lxml_5etree__ResolverContext(o);
  tmp = ((PyObject*)p->_error_log);
  p->_error_log = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_validator);
  p->_validator = ((struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__ParserContext[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__ParserContext = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__ParserContext = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__ParserContext = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__ParserContext = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree__ParserContext = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._ParserContext"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ParserContext), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ParserContext, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number__ParserContext, /*tp_as_number*/
  &__pyx_tp_as_sequence__ParserContext, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__ParserContext, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__ParserContext, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ParserContext, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ParserContext, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__ParserContext, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__ParserContext, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext __pyx_vtable_4lxml_5etree__SaxParserContext;

static PyObject *__pyx_tp_new_4lxml_5etree__SaxParserContext(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__SaxParserContext *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ParserContext(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)o);
  p->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext*)__pyx_vtabptr_4lxml_5etree__SaxParserContext;
  p->_target = ((struct __pyx_obj_4lxml_5etree__SaxParserTarget *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__SaxParserContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__SaxParserContext *p = (struct __pyx_obj_4lxml_5etree__SaxParserContext *)o;
  Py_XDECREF(((PyObject *)p->_target));
  __pyx_tp_dealloc_4lxml_5etree__ParserContext(o);
}

static int __pyx_tp_traverse_4lxml_5etree__SaxParserContext(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__SaxParserContext *p = (struct __pyx_obj_4lxml_5etree__SaxParserContext *)o;
  e = __pyx_tp_traverse_4lxml_5etree__ParserContext(o, v, a); if (e) return e;
  if (p->_target) {
    e = (*v)(((PyObject*)p->_target), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__SaxParserContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__SaxParserContext *p = (struct __pyx_obj_4lxml_5etree__SaxParserContext *)o;
  PyObject* tmp;
  __pyx_tp_clear_4lxml_5etree__ParserContext(o);
  tmp = ((PyObject*)p->_target);
  p->_target = ((struct __pyx_obj_4lxml_5etree__SaxParserTarget *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__SaxParserContext[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__SaxParserContext = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__SaxParserContext = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__SaxParserContext = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__SaxParserContext = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree__SaxParserContext = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._SaxParserContext"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__SaxParserContext), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__SaxParserContext, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number__SaxParserContext, /*tp_as_number*/
  &__pyx_tp_as_sequence__SaxParserContext, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__SaxParserContext, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__SaxParserContext, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("This class maps SAX2 events to method calls.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__SaxParserContext, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__SaxParserContext, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__SaxParserContext, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__SaxParserContext, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__TargetParserContext __pyx_vtable_4lxml_5etree__TargetParserContext;

static PyObject *__pyx_tp_new_4lxml_5etree__TargetParserContext(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__TargetParserContext *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__SaxParserContext(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__TargetParserContext *)o);
  p->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext*)__pyx_vtabptr_4lxml_5etree__TargetParserContext;
  p->_python_target = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__TargetParserContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__TargetParserContext *p = (struct __pyx_obj_4lxml_5etree__TargetParserContext *)o;
  Py_XDECREF(p->_python_target);
  __pyx_tp_dealloc_4lxml_5etree__SaxParserContext(o);
}

static int __pyx_tp_traverse_4lxml_5etree__TargetParserContext(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__TargetParserContext *p = (struct __pyx_obj_4lxml_5etree__TargetParserContext *)o;
  e = __pyx_tp_traverse_4lxml_5etree__SaxParserContext(o, v, a); if (e) return e;
  if (p->_python_target) {
    e = (*v)(p->_python_target, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__TargetParserContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__TargetParserContext *p = (struct __pyx_obj_4lxml_5etree__TargetParserContext *)o;
  PyObject* tmp;
  __pyx_tp_clear_4lxml_5etree__SaxParserContext(o);
  tmp = ((PyObject*)p->_python_target);
  p->_python_target = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__TargetParserContext[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__TargetParserContext = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__TargetParserContext = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__TargetParserContext = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__TargetParserContext = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree__TargetParserContext = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._TargetParserContext"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__TargetParserContext), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__TargetParserContext, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number__TargetParserContext, /*tp_as_number*/
  &__pyx_tp_as_sequence__TargetParserContext, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__TargetParserContext, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__TargetParserContext, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("This class maps SAX2 events to the ET parser target interface.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__TargetParserContext, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__TargetParserContext, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__TargetParserContext, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__TargetParserContext, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__ParserSchemaValidationContext __pyx_vtable_4lxml_5etree__ParserSchemaValidationContext;

static PyObject *__pyx_tp_new_4lxml_5etree__ParserSchemaValidationContext(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__ParserSchemaValidationContext;
  p->_schema = ((struct __pyx_obj_4lxml_5etree_XMLSchema *)Py_None); Py_INCREF(Py_None);
  if (__pyx_pf_4lxml_5etree_30_ParserSchemaValidationContext___cinit__(o, __pyx_empty_tuple, NULL) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__ParserSchemaValidationContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *p = (struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *)o;
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pf_4lxml_5etree_30_ParserSchemaValidationContext_1__dealloc__(o);
    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_XDECREF(((PyObject *)p->_schema));
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree__ParserSchemaValidationContext(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *p = (struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *)o;
  if (p->_schema) {
    e = (*v)(((PyObject*)p->_schema), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__ParserSchemaValidationContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *p = (struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->_schema);
  p->_schema = ((struct __pyx_obj_4lxml_5etree_XMLSchema *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__ParserSchemaValidationContext[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__ParserSchemaValidationContext = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__ParserSchemaValidationContext = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__ParserSchemaValidationContext = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__ParserSchemaValidationContext = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree__ParserSchemaValidationContext = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._ParserSchemaValidationContext"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ParserSchemaValidationContext, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number__ParserSchemaValidationContext, /*tp_as_number*/
  &__pyx_tp_as_sequence__ParserSchemaValidationContext, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__ParserSchemaValidationContext, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__ParserSchemaValidationContext, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ParserSchemaValidationContext, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ParserSchemaValidationContext, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__ParserSchemaValidationContext, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__ParserSchemaValidationContext, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__Validator __pyx_vtable_4lxml_5etree__Validator;

static PyObject *__pyx_tp_new_4lxml_5etree__Validator(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__Validator *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__Validator *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__Validator;
  p->_error_log = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)Py_None); Py_INCREF(Py_None);
  if (__pyx_pf_4lxml_5etree_10_Validator___cinit__(o, __pyx_empty_tuple, NULL) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__Validator(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__Validator *p = (struct __pyx_obj_4lxml_5etree__Validator *)o;
  Py_XDECREF(((PyObject *)p->_error_log));
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree__Validator(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__Validator *p = (struct __pyx_obj_4lxml_5etree__Validator *)o;
  if (p->_error_log) {
    e = (*v)(((PyObject*)p->_error_log), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__Validator(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__Validator *p = (struct __pyx_obj_4lxml_5etree__Validator *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->_error_log);
  p->_error_log = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_10_Validator_error_log(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_10_Validator_9error_log___get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__Validator[] = {
  {__Pyx_NAMESTR("validate"), (PyCFunction)__pyx_pf_4lxml_5etree_10_Validator_1validate, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_10_Validator_1validate)},
  {__Pyx_NAMESTR("assertValid"), (PyCFunction)__pyx_pf_4lxml_5etree_10_Validator_2assertValid, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_10_Validator_2assertValid)},
  {__Pyx_NAMESTR("assert_"), (PyCFunction)__pyx_pf_4lxml_5etree_10_Validator_3assert_, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_10_Validator_3assert_)},
  {__Pyx_NAMESTR("_append_log_message"), (PyCFunction)__pyx_pf_4lxml_5etree_10_Validator_4_append_log_message, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("_clear_error_log"), (PyCFunction)__pyx_pf_4lxml_5etree_10_Validator_5_clear_error_log, METH_NOARGS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__Validator[] = {
  {(char *)"error_log", __pyx_getprop_4lxml_5etree_10_Validator_error_log, 0, __Pyx_DOCSTR(__pyx_k_449), 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__Validator = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__Validator = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__Validator = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__Validator = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree__Validator = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._Validator"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__Validator), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__Validator, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number__Validator, /*tp_as_number*/
  &__pyx_tp_as_sequence__Validator, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__Validator, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__Validator, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("Base class for XML validators."), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__Validator, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__Validator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__Validator, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__Validator, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__Validator, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_XMLSchema __pyx_vtable_4lxml_5etree_XMLSchema;

static PyObject *__pyx_tp_new_4lxml_5etree_XMLSchema(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_XMLSchema *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__Validator(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_XMLSchema *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__Validator*)__pyx_vtabptr_4lxml_5etree_XMLSchema;
  if (__pyx_pf_4lxml_5etree_9XMLSchema___cinit__(o, __pyx_empty_tuple, NULL) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_XMLSchema(PyObject *o) {
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pf_4lxml_5etree_9XMLSchema_2__dealloc__(o);
    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  __pyx_tp_dealloc_4lxml_5etree__Validator(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree_XMLSchema[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_XMLSchema = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_XMLSchema = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_XMLSchema = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_XMLSchema = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree_XMLSchema = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.XMLSchema"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_XMLSchema), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_XMLSchema, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_XMLSchema, /*tp_as_number*/
  &__pyx_tp_as_sequence_XMLSchema, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_XMLSchema, /*tp_as_mapping*/
  0, /*tp_hash*/
  __pyx_pf_4lxml_5etree_9XMLSchema_3__call__, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_XMLSchema, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("XMLSchema(self, etree=None, file=None)\n    Turn a document into an XML Schema validator.\n\n    Either pass a schema as Element or ElementTree, or pass a file or\n    filename through the ``file`` keyword argument.\n\n    Passing the ``attribute_defaults`` boolean option will make the\n    schema insert default/fixed attributes into validated documents.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__Validator, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__Validator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_XMLSchema, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_4lxml_5etree_9XMLSchema_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_XMLSchema, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext __pyx_vtable_4lxml_5etree__ParserDictionaryContext;

static PyObject *__pyx_tp_new_4lxml_5etree__ParserDictionaryContext(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__ParserDictionaryContext;
  p->_default_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None); Py_INCREF(Py_None);
  p->_implied_parser_contexts = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (__pyx_pf_4lxml_5etree_24_ParserDictionaryContext___cinit__(o, __pyx_empty_tuple, NULL) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__ParserDictionaryContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *p = (struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)o;
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pf_4lxml_5etree_24_ParserDictionaryContext_1__dealloc__(o);
    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_XDECREF(((PyObject *)p->_default_parser));
  Py_XDECREF(((PyObject *)p->_implied_parser_contexts));
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree__ParserDictionaryContext(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *p = (struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)o;
  if (p->_default_parser) {
    e = (*v)(((PyObject*)p->_default_parser), a); if (e) return e;
  }
  if (p->_implied_parser_contexts) {
    e = (*v)(p->_implied_parser_contexts, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__ParserDictionaryContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *p = (struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->_default_parser);
  p->_default_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_implied_parser_contexts);
  p->_implied_parser_contexts = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__ParserDictionaryContext[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__ParserDictionaryContext = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__ParserDictionaryContext = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__ParserDictionaryContext = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__ParserDictionaryContext = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree__ParserDictionaryContext = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._ParserDictionaryContext"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ParserDictionaryContext, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number__ParserDictionaryContext, /*tp_as_number*/
  &__pyx_tp_as_sequence__ParserDictionaryContext, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__ParserDictionaryContext, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__ParserDictionaryContext, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ParserDictionaryContext, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ParserDictionaryContext, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__ParserDictionaryContext, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__ParserDictionaryContext, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__FileReaderContext __pyx_vtable_4lxml_5etree__FileReaderContext;

static PyObject *__pyx_tp_new_4lxml_5etree__FileReaderContext(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__FileReaderContext *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__FileReaderContext *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__FileReaderContext;
  p->_filelike = Py_None; Py_INCREF(Py_None);
  p->_encoding = Py_None; Py_INCREF(Py_None);
  p->_url = Py_None; Py_INCREF(Py_None);
  p->_bytes = Py_None; Py_INCREF(Py_None);
  p->_exc_context = ((struct __pyx_obj_4lxml_5etree__ExceptionContext *)Py_None); Py_INCREF(Py_None);
  if (__pyx_pf_4lxml_5etree_18_FileReaderContext___cinit__(o, a, k) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__FileReaderContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__FileReaderContext *p = (struct __pyx_obj_4lxml_5etree__FileReaderContext *)o;
  Py_XDECREF(p->_filelike);
  Py_XDECREF(p->_encoding);
  Py_XDECREF(p->_url);
  Py_XDECREF(p->_bytes);
  Py_XDECREF(((PyObject *)p->_exc_context));
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree__FileReaderContext(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__FileReaderContext *p = (struct __pyx_obj_4lxml_5etree__FileReaderContext *)o;
  if (p->_filelike) {
    e = (*v)(p->_filelike, a); if (e) return e;
  }
  if (p->_encoding) {
    e = (*v)(p->_encoding, a); if (e) return e;
  }
  if (p->_url) {
    e = (*v)(p->_url, a); if (e) return e;
  }
  if (p->_bytes) {
    e = (*v)(p->_bytes, a); if (e) return e;
  }
  if (p->_exc_context) {
    e = (*v)(((PyObject*)p->_exc_context), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__FileReaderContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__FileReaderContext *p = (struct __pyx_obj_4lxml_5etree__FileReaderContext *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->_filelike);
  p->_filelike = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_encoding);
  p->_encoding = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_url);
  p->_url = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_bytes);
  p->_bytes = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_exc_context);
  p->_exc_context = ((struct __pyx_obj_4lxml_5etree__ExceptionContext *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__FileReaderContext[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__FileReaderContext = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__FileReaderContext = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__FileReaderContext = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__FileReaderContext = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree__FileReaderContext = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._FileReaderContext"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__FileReaderContext), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__FileReaderContext, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number__FileReaderContext, /*tp_as_number*/
  &__pyx_tp_as_sequence__FileReaderContext, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__FileReaderContext, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__FileReaderContext, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__FileReaderContext, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__FileReaderContext, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__FileReaderContext, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__FileReaderContext, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__FeedParser __pyx_vtable_4lxml_5etree__FeedParser;

static PyObject *__pyx_tp_new_4lxml_5etree__FeedParser(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__FeedParser *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__BaseParser(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__FeedParser *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__BaseParser*)__pyx_vtabptr_4lxml_5etree__FeedParser;
  return o;
}

static PyObject *__pyx_getprop_4lxml_5etree_11_FeedParser_feed_error_log(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_11_FeedParser_14feed_error_log___get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__FeedParser[] = {
  {__Pyx_NAMESTR("feed"), (PyCFunction)__pyx_pf_4lxml_5etree_11_FeedParser_feed, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_11_FeedParser_feed)},
  {__Pyx_NAMESTR("close"), (PyCFunction)__pyx_pf_4lxml_5etree_11_FeedParser_1close, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_11_FeedParser_1close)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__FeedParser[] = {
  {(char *)"feed_error_log", __pyx_getprop_4lxml_5etree_11_FeedParser_feed_error_log, 0, __Pyx_DOCSTR(__pyx_k_450), 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__FeedParser = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__FeedParser = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__FeedParser = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__FeedParser = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree__FeedParser = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._FeedParser"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__FeedParser), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__BaseParser, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number__FeedParser, /*tp_as_number*/
  &__pyx_tp_as_sequence__FeedParser, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__FeedParser, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__FeedParser, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__BaseParser, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__BaseParser, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__FeedParser, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__FeedParser, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__FeedParser, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_XMLParser __pyx_vtable_4lxml_5etree_XMLParser;

static PyObject *__pyx_tp_new_4lxml_5etree_XMLParser(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_XMLParser *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__BaseParser(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_XMLParser *)o);
  p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__BaseParser*)__pyx_vtabptr_4lxml_5etree_XMLParser;
  return o;
}

static PyMethodDef __pyx_methods_4lxml_5etree_XMLParser[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_XMLParser = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_XMLParser = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_XMLParser = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_XMLParser = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree_XMLParser = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.XMLParser"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_XMLParser), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__BaseParser, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_XMLParser, /*tp_as_number*/
  &__pyx_tp_as_sequence_XMLParser, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_XMLParser, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_XMLParser, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("XMLParser(self, encoding=None, attribute_defaults=False, dtd_validation=False, load_dtd=False, no_network=True, ns_clean=False, recover=False, XMLSchema schema=None, remove_blank_text=False, resolve_entities=True, remove_comments=False, remove_pis=False, strip_cdata=True, target=None, compact=True)\n\n    The XML parser.\n\n    Parsers can be supplied as additional argument to various parse\n    functions of the lxml API.  A default parser is always available\n    and can be replaced by a call to the global function\n    'set_default_parser'.  New parsers can be created at any time\n    without a major run-time overhead.\n\n    The keyword arguments in the constructor are mainly based on the\n    libxml2 parser configuration.  A DTD will also be loaded if DTD\n    validation or attribute default values are requested (unless you\n    additionally provide an XMLSchema from which the default\n    attributes can be read).\n\n    Available boolean keyword arguments:\n\n    - attribute_defaults - inject default attributes from DTD or XMLSchema\n    - dtd_validation     - validate against a DTD referenced by the document\n    - load_dtd           - use DTD for parsing\n    - no_network         - prevent network access for related files (default: True)\n    - ns_clean           - clean up redundant namespace declarations\n    - recover            - try hard to parse through broken XML\n    - remove_blank_text  - discard blank text nodes\n    - remove_comments    - discard comments\n    - remove_pis         - discard processing instructions\n    - strip_cdata        - replace CDATA sections by normal text content (default: True)\n    - compact            - safe memory for short text content (default: True)\n    - resolve_entities   - replace entities by their text value (default: True)\n    - huge_tree          - disable security restrictions and support very deep trees\n                           and very long text content (only affects libxml2 2.7+)\n\n    Other keyword arguments:\n\n    - encoding - override the document encoding\n    - target   - a parser target object that will receive the parse events\n    - schema   - an XMLSchema to validate against\n\n    Note that you should avoid sharing parsers between threads.  While this is\n    not harmful, it is more efficient to use separate parsers.  This does not\n    apply to the default parser.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__BaseParser, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__BaseParser, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_XMLParser, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_4lxml_5etree_9XMLParser___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_XMLParser, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_ETCompatXMLParser __pyx_vtable_4lxml_5etree_ETCompatXMLParser;

static PyObject *__pyx_tp_new_4lxml_5etree_ETCompatXMLParser(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_ETCompatXMLParser *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__BaseParser(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_ETCompatXMLParser *)o);
  p->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__BaseParser*)__pyx_vtabptr_4lxml_5etree_ETCompatXMLParser;
  return o;
}

static PyMethodDef __pyx_methods_4lxml_5etree_ETCompatXMLParser[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_ETCompatXMLParser = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_ETCompatXMLParser = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_ETCompatXMLParser = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_ETCompatXMLParser = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree_ETCompatXMLParser = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.ETCompatXMLParser"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_ETCompatXMLParser), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__BaseParser, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_ETCompatXMLParser, /*tp_as_number*/
  &__pyx_tp_as_sequence_ETCompatXMLParser, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_ETCompatXMLParser, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_ETCompatXMLParser, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("ETCompatXMLParser(self, encoding=None, attribute_defaults=False,                  dtd_validation=False, load_dtd=False, no_network=True,                  ns_clean=False, recover=False, schema=None,                  huge_tree=False, remove_blank_text=False, resolve_entities=True,                  remove_comments=True, remove_pis=True, strip_cdata=True,                  target=None, compact=True)\n\n    An XML parser with an ElementTree compatible default setup.\n\n    See the XMLParser class for details.\n\n    This parser has ``remove_comments`` and ``remove_pis`` enabled by default\n    and thus ignores comments and processing instructions.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__BaseParser, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__BaseParser, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_ETCompatXMLParser, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_4lxml_5etree_17ETCompatXMLParser___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_ETCompatXMLParser, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_HTMLParser __pyx_vtable_4lxml_5etree_HTMLParser;

static PyObject *__pyx_tp_new_4lxml_5etree_HTMLParser(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_HTMLParser *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__BaseParser(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_HTMLParser *)o);
  p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__BaseParser*)__pyx_vtabptr_4lxml_5etree_HTMLParser;
  return o;
}

static PyMethodDef __pyx_methods_4lxml_5etree_HTMLParser[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_HTMLParser = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_HTMLParser = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_HTMLParser = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_HTMLParser = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree_HTMLParser = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.HTMLParser"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_HTMLParser), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__BaseParser, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_HTMLParser, /*tp_as_number*/
  &__pyx_tp_as_sequence_HTMLParser, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_HTMLParser, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_HTMLParser, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("HTMLParser(self, encoding=None, remove_blank_text=False,                    remove_comments=False, remove_pis=False, strip_cdata=True,                    no_network=True, target=None, XMLSchema schema=None,                    recover=True, compact=True)\n\n    The HTML parser.\n\n    This parser allows reading HTML into a normal XML tree.  By\n    default, it can read broken (non well-formed) HTML, depending on\n    the capabilities of libxml2.  Use the 'recover' option to switch\n    this off.\n\n    Available boolean keyword arguments:\n\n    - recover            - try hard to parse through broken HTML (default: True)\n    - no_network         - prevent network access for related files (default: True)\n    - remove_blank_text  - discard empty text nodes\n    - remove_comments    - discard comments\n    - remove_pis         - discard processing instructions\n    - strip_cdata        - replace CDATA sections by normal text content (default: True)\n    - compact            - safe memory for short text content (default: True)\n\n    Other keyword arguments:\n\n    - encoding - override the document encoding\n    - target   - a parser target object that will receive the parse events\n    - schema   - an XMLSchema to validate against\n\n    Note that you should avoid sharing parsers between threads for performance\n    reasons.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__BaseParser, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__BaseParser, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_HTMLParser, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_4lxml_5etree_10HTMLParser___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_HTMLParser, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget __pyx_vtable_4lxml_5etree__SaxParserTarget;

static PyObject *__pyx_tp_new_4lxml_5etree__SaxParserTarget(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__SaxParserTarget *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__SaxParserTarget *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__SaxParserTarget;
  if (__pyx_pf_4lxml_5etree_16_SaxParserTarget___cinit__(o, __pyx_empty_tuple, NULL) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__SaxParserTarget(PyObject *o) {
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__SaxParserTarget[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__SaxParserTarget = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__SaxParserTarget = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__SaxParserTarget = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__SaxParserTarget = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree__SaxParserTarget = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._SaxParserTarget"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__SaxParserTarget), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__SaxParserTarget, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number__SaxParserTarget, /*tp_as_number*/
  &__pyx_tp_as_sequence__SaxParserTarget, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__SaxParserTarget, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__SaxParserTarget, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__SaxParserTarget, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__SaxParserTarget, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_TreeBuilder __pyx_vtable_4lxml_5etree_TreeBuilder;

static PyObject *__pyx_tp_new_4lxml_5etree_TreeBuilder(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_TreeBuilder *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__SaxParserTarget(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_TreeBuilder *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget*)__pyx_vtabptr_4lxml_5etree_TreeBuilder;
  p->_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None); Py_INCREF(Py_None);
  p->_factory = Py_None; Py_INCREF(Py_None);
  p->_data = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_element_stack = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_element_stack_pop = Py_None; Py_INCREF(Py_None);
  p->_last = ((struct LxmlElement *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_TreeBuilder(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_TreeBuilder *p = (struct __pyx_obj_4lxml_5etree_TreeBuilder *)o;
  Py_XDECREF(((PyObject *)p->_parser));
  Py_XDECREF(p->_factory);
  Py_XDECREF(((PyObject *)p->_data));
  Py_XDECREF(((PyObject *)p->_element_stack));
  Py_XDECREF(p->_element_stack_pop);
  Py_XDECREF(((PyObject *)p->_last));
  __pyx_tp_dealloc_4lxml_5etree__SaxParserTarget(o);
}

static int __pyx_tp_traverse_4lxml_5etree_TreeBuilder(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree_TreeBuilder *p = (struct __pyx_obj_4lxml_5etree_TreeBuilder *)o;
  if (__pyx_ptype_4lxml_5etree__SaxParserTarget->tp_traverse) {
    e = __pyx_ptype_4lxml_5etree__SaxParserTarget->tp_traverse(o, v, a); if (e) return e;
  }
  if (p->_parser) {
    e = (*v)(((PyObject*)p->_parser), a); if (e) return e;
  }
  if (p->_factory) {
    e = (*v)(p->_factory, a); if (e) return e;
  }
  if (p->_data) {
    e = (*v)(p->_data, a); if (e) return e;
  }
  if (p->_element_stack) {
    e = (*v)(p->_element_stack, a); if (e) return e;
  }
  if (p->_element_stack_pop) {
    e = (*v)(p->_element_stack_pop, a); if (e) return e;
  }
  if (p->_last) {
    e = (*v)(((PyObject*)p->_last), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree_TreeBuilder(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_TreeBuilder *p = (struct __pyx_obj_4lxml_5etree_TreeBuilder *)o;
  PyObject* tmp;
  if (__pyx_ptype_4lxml_5etree__SaxParserTarget->tp_clear) {
    __pyx_ptype_4lxml_5etree__SaxParserTarget->tp_clear(o);
  }
  tmp = ((PyObject*)p->_parser);
  p->_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_factory);
  p->_factory = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_data);
  p->_data = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_element_stack);
  p->_element_stack = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_element_stack_pop);
  p->_element_stack_pop = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_last);
  p->_last = ((struct LxmlElement *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree_TreeBuilder[] = {
  {__Pyx_NAMESTR("close"), (PyCFunction)__pyx_pf_4lxml_5etree_11TreeBuilder_1close, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_11TreeBuilder_1close)},
  {__Pyx_NAMESTR("data"), (PyCFunction)__pyx_pf_4lxml_5etree_11TreeBuilder_2data, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_11TreeBuilder_2data)},
  {__Pyx_NAMESTR("start"), (PyCFunction)__pyx_pf_4lxml_5etree_11TreeBuilder_3start, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_11TreeBuilder_3start)},
  {__Pyx_NAMESTR("end"), (PyCFunction)__pyx_pf_4lxml_5etree_11TreeBuilder_4end, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_11TreeBuilder_4end)},
  {__Pyx_NAMESTR("pi"), (PyCFunction)__pyx_pf_4lxml_5etree_11TreeBuilder_5pi, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_11TreeBuilder_5pi)},
  {__Pyx_NAMESTR("comment"), (PyCFunction)__pyx_pf_4lxml_5etree_11TreeBuilder_6comment, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_11TreeBuilder_6comment)},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_TreeBuilder = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_TreeBuilder = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_TreeBuilder = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_TreeBuilder = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree_TreeBuilder = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.TreeBuilder"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_TreeBuilder), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_TreeBuilder, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_TreeBuilder, /*tp_as_number*/
  &__pyx_tp_as_sequence_TreeBuilder, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_TreeBuilder, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_TreeBuilder, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("TreeBuilder(self, element_factory=None, parser=None)\n    Parser target that builds a tree.\n\n    The final tree is returned by the ``close()`` method.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_TreeBuilder, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_TreeBuilder, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_TreeBuilder, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_4lxml_5etree_11TreeBuilder___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_TreeBuilder, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__PythonSaxParserTarget __pyx_vtable_4lxml_5etree__PythonSaxParserTarget;

static PyObject *__pyx_tp_new_4lxml_5etree__PythonSaxParserTarget(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__SaxParserTarget(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget*)__pyx_vtabptr_4lxml_5etree__PythonSaxParserTarget;
  p->_target_start = Py_None; Py_INCREF(Py_None);
  p->_target_end = Py_None; Py_INCREF(Py_None);
  p->_target_data = Py_None; Py_INCREF(Py_None);
  p->_target_doctype = Py_None; Py_INCREF(Py_None);
  p->_target_pi = Py_None; Py_INCREF(Py_None);
  p->_target_comment = Py_None; Py_INCREF(Py_None);
  if (__pyx_pf_4lxml_5etree_22_PythonSaxParserTarget___cinit__(o, a, k) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__PythonSaxParserTarget(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *p = (struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *)o;
  Py_XDECREF(p->_target_start);
  Py_XDECREF(p->_target_end);
  Py_XDECREF(p->_target_data);
  Py_XDECREF(p->_target_doctype);
  Py_XDECREF(p->_target_pi);
  Py_XDECREF(p->_target_comment);
  __pyx_tp_dealloc_4lxml_5etree__SaxParserTarget(o);
}

static int __pyx_tp_traverse_4lxml_5etree__PythonSaxParserTarget(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *p = (struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *)o;
  if (__pyx_ptype_4lxml_5etree__SaxParserTarget->tp_traverse) {
    e = __pyx_ptype_4lxml_5etree__SaxParserTarget->tp_traverse(o, v, a); if (e) return e;
  }
  if (p->_target_start) {
    e = (*v)(p->_target_start, a); if (e) return e;
  }
  if (p->_target_end) {
    e = (*v)(p->_target_end, a); if (e) return e;
  }
  if (p->_target_data) {
    e = (*v)(p->_target_data, a); if (e) return e;
  }
  if (p->_target_doctype) {
    e = (*v)(p->_target_doctype, a); if (e) return e;
  }
  if (p->_target_pi) {
    e = (*v)(p->_target_pi, a); if (e) return e;
  }
  if (p->_target_comment) {
    e = (*v)(p->_target_comment, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__PythonSaxParserTarget(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *p = (struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *)o;
  PyObject* tmp;
  if (__pyx_ptype_4lxml_5etree__SaxParserTarget->tp_clear) {
    __pyx_ptype_4lxml_5etree__SaxParserTarget->tp_clear(o);
  }
  tmp = ((PyObject*)p->_target_start);
  p->_target_start = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_target_end);
  p->_target_end = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_target_data);
  p->_target_data = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_target_doctype);
  p->_target_doctype = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_target_pi);
  p->_target_pi = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_target_comment);
  p->_target_comment = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__PythonSaxParserTarget[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__PythonSaxParserTarget = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__PythonSaxParserTarget = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__PythonSaxParserTarget = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__PythonSaxParserTarget = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree__PythonSaxParserTarget = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._PythonSaxParserTarget"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__PythonSaxParserTarget, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number__PythonSaxParserTarget, /*tp_as_number*/
  &__pyx_tp_as_sequence__PythonSaxParserTarget, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__PythonSaxParserTarget, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__PythonSaxParserTarget, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__PythonSaxParserTarget, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__PythonSaxParserTarget, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__PythonSaxParserTarget, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__PythonSaxParserTarget, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__FilelikeWriter __pyx_vtable_4lxml_5etree__FilelikeWriter;

static PyObject *__pyx_tp_new_4lxml_5etree__FilelikeWriter(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__FilelikeWriter *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__FilelikeWriter;
  p->_filelike = Py_None; Py_INCREF(Py_None);
  p->_close_filelike = Py_None; Py_INCREF(Py_None);
  p->_exc_context = ((struct __pyx_obj_4lxml_5etree__ExceptionContext *)Py_None); Py_INCREF(Py_None);
  p->error_log = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)Py_None); Py_INCREF(Py_None);
  if (__pyx_pf_4lxml_5etree_15_FilelikeWriter___cinit__(o, a, k) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__FilelikeWriter(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__FilelikeWriter *p = (struct __pyx_obj_4lxml_5etree__FilelikeWriter *)o;
  Py_XDECREF(p->_filelike);
  Py_XDECREF(p->_close_filelike);
  Py_XDECREF(((PyObject *)p->_exc_context));
  Py_XDECREF(((PyObject *)p->error_log));
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree__FilelikeWriter(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__FilelikeWriter *p = (struct __pyx_obj_4lxml_5etree__FilelikeWriter *)o;
  if (p->_filelike) {
    e = (*v)(p->_filelike, a); if (e) return e;
  }
  if (p->_close_filelike) {
    e = (*v)(p->_close_filelike, a); if (e) return e;
  }
  if (p->_exc_context) {
    e = (*v)(((PyObject*)p->_exc_context), a); if (e) return e;
  }
  if (p->error_log) {
    e = (*v)(((PyObject*)p->error_log), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__FilelikeWriter(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__FilelikeWriter *p = (struct __pyx_obj_4lxml_5etree__FilelikeWriter *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->_filelike);
  p->_filelike = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_close_filelike);
  p->_close_filelike = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_exc_context);
  p->_exc_context = ((struct __pyx_obj_4lxml_5etree__ExceptionContext *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->error_log);
  p->error_log = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__FilelikeWriter[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__FilelikeWriter = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__FilelikeWriter = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__FilelikeWriter = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__FilelikeWriter = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree__FilelikeWriter = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._FilelikeWriter"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__FilelikeWriter), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__FilelikeWriter, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number__FilelikeWriter, /*tp_as_number*/
  &__pyx_tp_as_sequence__FilelikeWriter, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__FilelikeWriter, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__FilelikeWriter, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__FilelikeWriter, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__FilelikeWriter, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__FilelikeWriter, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__FilelikeWriter, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__IterparseContext __pyx_vtable_4lxml_5etree__IterparseContext;

static PyObject *__pyx_tp_new_4lxml_5etree__IterparseContext(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__IterparseContext *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ParserContext(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__IterparseContext *)o);
  p->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext*)__pyx_vtabptr_4lxml_5etree__IterparseContext;
  p->_root = ((struct LxmlElement *)Py_None); Py_INCREF(Py_None);
  p->_doc = ((struct LxmlDocument *)Py_None); Py_INCREF(Py_None);
  p->_events = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_ns_stack = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_pop_ns = Py_None; Py_INCREF(Py_None);
  p->_node_stack = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_pop_node = Py_None; Py_INCREF(Py_None);
  p->_tag_tuple = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (__pyx_pf_4lxml_5etree_17_IterparseContext___cinit__(o, __pyx_empty_tuple, NULL) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__IterparseContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__IterparseContext *p = (struct __pyx_obj_4lxml_5etree__IterparseContext *)o;
  Py_XDECREF(((PyObject *)p->_root));
  Py_XDECREF(((PyObject *)p->_doc));
  Py_XDECREF(((PyObject *)p->_events));
  Py_XDECREF(((PyObject *)p->_ns_stack));
  Py_XDECREF(p->_pop_ns);
  Py_XDECREF(((PyObject *)p->_node_stack));
  Py_XDECREF(p->_pop_node);
  Py_XDECREF(((PyObject *)p->_tag_tuple));
  __pyx_tp_dealloc_4lxml_5etree__ParserContext(o);
}

static int __pyx_tp_traverse_4lxml_5etree__IterparseContext(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__IterparseContext *p = (struct __pyx_obj_4lxml_5etree__IterparseContext *)o;
  e = __pyx_tp_traverse_4lxml_5etree__ParserContext(o, v, a); if (e) return e;
  if (p->_root) {
    e = (*v)(((PyObject*)p->_root), a); if (e) return e;
  }
  if (p->_doc) {
    e = (*v)(((PyObject*)p->_doc), a); if (e) return e;
  }
  if (p->_events) {
    e = (*v)(p->_events, a); if (e) return e;
  }
  if (p->_ns_stack) {
    e = (*v)(p->_ns_stack, a); if (e) return e;
  }
  if (p->_pop_ns) {
    e = (*v)(p->_pop_ns, a); if (e) return e;
  }
  if (p->_node_stack) {
    e = (*v)(p->_node_stack, a); if (e) return e;
  }
  if (p->_pop_node) {
    e = (*v)(p->_pop_node, a); if (e) return e;
  }
  if (p->_tag_tuple) {
    e = (*v)(p->_tag_tuple, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__IterparseContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__IterparseContext *p = (struct __pyx_obj_4lxml_5etree__IterparseContext *)o;
  PyObject* tmp;
  __pyx_tp_clear_4lxml_5etree__ParserContext(o);
  tmp = ((PyObject*)p->_root);
  p->_root = ((struct LxmlElement *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_doc);
  p->_doc = ((struct LxmlDocument *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_events);
  p->_events = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_ns_stack);
  p->_ns_stack = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_pop_ns);
  p->_pop_ns = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_node_stack);
  p->_node_stack = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_pop_node);
  p->_pop_node = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_tag_tuple);
  p->_tag_tuple = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__IterparseContext[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__IterparseContext = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__IterparseContext = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__IterparseContext = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__IterparseContext = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree__IterparseContext = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._IterparseContext"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__IterparseContext), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__IterparseContext, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number__IterparseContext, /*tp_as_number*/
  &__pyx_tp_as_sequence__IterparseContext, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__IterparseContext, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__IterparseContext, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__IterparseContext, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__IterparseContext, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__IterparseContext, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__IterparseContext, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_iterparse __pyx_vtable_4lxml_5etree_iterparse;

static PyObject *__pyx_tp_new_4lxml_5etree_iterparse(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_iterparse *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__BaseParser(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_iterparse *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__BaseParser*)__pyx_vtabptr_4lxml_5etree_iterparse;
  p->_tag = Py_None; Py_INCREF(Py_None);
  p->_events = Py_None; Py_INCREF(Py_None);
  p->root = Py_None; Py_INCREF(Py_None);
  p->_source = Py_None; Py_INCREF(Py_None);
  p->_buffer = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_iterparse(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_iterparse *p = (struct __pyx_obj_4lxml_5etree_iterparse *)o;
  Py_XDECREF(p->_tag);
  Py_XDECREF(p->_events);
  Py_XDECREF(p->root);
  Py_XDECREF(p->_source);
  Py_XDECREF(p->_buffer);
  __pyx_tp_dealloc_4lxml_5etree__BaseParser(o);
}

static int __pyx_tp_traverse_4lxml_5etree_iterparse(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree_iterparse *p = (struct __pyx_obj_4lxml_5etree_iterparse *)o;
  e = __pyx_tp_traverse_4lxml_5etree__BaseParser(o, v, a); if (e) return e;
  if (p->_tag) {
    e = (*v)(p->_tag, a); if (e) return e;
  }
  if (p->_events) {
    e = (*v)(p->_events, a); if (e) return e;
  }
  if (p->root) {
    e = (*v)(p->root, a); if (e) return e;
  }
  if (p->_source) {
    e = (*v)(p->_source, a); if (e) return e;
  }
  if (p->_buffer) {
    e = (*v)(p->_buffer, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree_iterparse(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_iterparse *p = (struct __pyx_obj_4lxml_5etree_iterparse *)o;
  PyObject* tmp;
  __pyx_tp_clear_4lxml_5etree__BaseParser(o);
  tmp = ((PyObject*)p->_tag);
  p->_tag = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_events);
  p->_events = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->root);
  p->root = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_source);
  p->_source = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_buffer);
  p->_buffer = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_9iterparse_error_log(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_9iterparse_9error_log___get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_9iterparse_root(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_9iterparse_4root___get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree_iterparse[] = {
  {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_pf_4lxml_5etree_9iterparse_1copy, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_4lxml_5etree_9iterparse_3__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree_iterparse[] = {
  {(char *)"error_log", __pyx_getprop_4lxml_5etree_9iterparse_error_log, 0, __Pyx_DOCSTR(__pyx_k_451), 0},
  {(char *)"root", __pyx_getprop_4lxml_5etree_9iterparse_root, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_iterparse = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_iterparse = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_iterparse = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_iterparse = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree_iterparse = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.iterparse"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_iterparse), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_iterparse, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_iterparse, /*tp_as_number*/
  &__pyx_tp_as_sequence_iterparse, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_iterparse, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_iterparse, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("iterparse(self, source, events=(\"end\",), tag=None, attribute_defaults=False, dtd_validation=False, load_dtd=False, no_network=True, remove_blank_text=False, remove_comments=False, remove_pis=False, encoding=None, html=False, huge_tree=False, schema=None)\n\n    Incremental parser.\n\n    Parses XML into a tree and generates tuples (event, element) in a\n    SAX-like fashion. ``event`` is any of 'start', 'end', 'start-ns',\n    'end-ns'.\n\n    For 'start' and 'end', ``element`` is the Element that the parser just\n    found opening or closing.  For 'start-ns', it is a tuple (prefix, URI) of\n    a new namespace declaration.  For 'end-ns', it is simply None.  Note that\n    all start and end events are guaranteed to be properly nested.\n\n    The keyword argument ``events`` specifies a sequence of event type names\n    that should be generated.  By default, only 'end' events will be\n    generated.\n\n    The additional ``tag`` argument restricts the 'start' and 'end' events to\n    those elements that match the given tag.  By default, events are generated\n    for all elements.  Note that the 'start-ns' and 'end-ns' events are not\n    impacted by this restriction.\n\n    The other keyword arguments in the constructor are mainly based on the\n    libxml2 parser configuration.  A DTD will also be loaded if validation or\n    attribute default values are requested.\n\n    Available boolean keyword arguments:\n     - attribute_defaults: read default attributes from DTD\n     - dtd_validation: validate (if DTD is available)\n     - load_dtd: use DTD for parsing\n     - no_network: prevent network access for related files\n     - remove_blank_text: discard blank text nodes\n     - remove_comments: discard comments\n     - remove_pis: discard processing instructions\n     - strip_cdata: replace CDATA sections by normal text content (default: True)\n     - compact: safe memory for short text content (default: True)\n     - resolve_entities: replace entities by their text value (default: True)\n     - huge_tree: disable security restrictions and support very deep trees\n                  and very long text content (only affects libxml2 2.7+)\n\n    Other keyword arguments:\n     - encoding: override the document encoding\n     - schema: an XMLSchema to validate against\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_iterparse, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_iterparse, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pf_4lxml_5etree_9iterparse_2__iter__, /*tp_iter*/
  __pyx_pf_4lxml_5etree_9iterparse_3__next__, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_iterparse, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree_iterparse, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_4lxml_5etree_9iterparse___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_iterparse, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_iterwalk __pyx_vtable_4lxml_5etree_iterwalk;

static PyObject *__pyx_tp_new_4lxml_5etree_iterwalk(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_iterwalk *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_iterwalk *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree_iterwalk;
  p->_node_stack = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_pop_node = Py_None; Py_INCREF(Py_None);
  p->_events = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_pop_event = Py_None; Py_INCREF(Py_None);
  p->_tag_tuple = ((PyObject*)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_iterwalk(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_iterwalk *p = (struct __pyx_obj_4lxml_5etree_iterwalk *)o;
  Py_XDECREF(((PyObject *)p->_node_stack));
  Py_XDECREF(p->_pop_node);
  Py_XDECREF(((PyObject *)p->_events));
  Py_XDECREF(p->_pop_event);
  Py_XDECREF(((PyObject *)p->_tag_tuple));
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree_iterwalk(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree_iterwalk *p = (struct __pyx_obj_4lxml_5etree_iterwalk *)o;
  if (p->_node_stack) {
    e = (*v)(p->_node_stack, a); if (e) return e;
  }
  if (p->_pop_node) {
    e = (*v)(p->_pop_node, a); if (e) return e;
  }
  if (p->_events) {
    e = (*v)(p->_events, a); if (e) return e;
  }
  if (p->_pop_event) {
    e = (*v)(p->_pop_event, a); if (e) return e;
  }
  if (p->_tag_tuple) {
    e = (*v)(p->_tag_tuple, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree_iterwalk(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_iterwalk *p = (struct __pyx_obj_4lxml_5etree_iterwalk *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->_node_stack);
  p->_node_stack = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_pop_node);
  p->_pop_node = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_events);
  p->_events = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_pop_event);
  p->_pop_event = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_tag_tuple);
  p->_tag_tuple = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree_iterwalk[] = {
  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_4lxml_5etree_8iterwalk_2__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_iterwalk = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_iterwalk = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_iterwalk = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_iterwalk = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree_iterwalk = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.iterwalk"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_iterwalk), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_iterwalk, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_iterwalk, /*tp_as_number*/
  &__pyx_tp_as_sequence_iterwalk, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_iterwalk, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_iterwalk, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("iterwalk(self, element_or_tree, events=(\"end\",), tag=None)\n\n    A tree walker that generates events from an existing tree as if it\n    was parsing XML data with ``iterparse()``.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_iterwalk, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_iterwalk, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pf_4lxml_5etree_8iterwalk_1__iter__, /*tp_iter*/
  __pyx_pf_4lxml_5etree_8iterwalk_2__next__, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_iterwalk, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_4lxml_5etree_8iterwalk___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_iterwalk, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__IDDict __pyx_vtable_4lxml_5etree__IDDict;

static PyObject *__pyx_tp_new_4lxml_5etree__IDDict(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__IDDict *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__IDDict *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__IDDict;
  p->_doc = ((struct LxmlDocument *)Py_None); Py_INCREF(Py_None);
  p->_keys = Py_None; Py_INCREF(Py_None);
  p->_items = Py_None; Py_INCREF(Py_None);
  if (__pyx_pf_4lxml_5etree_7_IDDict___cinit__(o, a, k) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__IDDict(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__IDDict *p = (struct __pyx_obj_4lxml_5etree__IDDict *)o;
  Py_XDECREF(((PyObject *)p->_doc));
  Py_XDECREF(p->_keys);
  Py_XDECREF(p->_items);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree__IDDict(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__IDDict *p = (struct __pyx_obj_4lxml_5etree__IDDict *)o;
  if (p->_doc) {
    e = (*v)(((PyObject*)p->_doc), a); if (e) return e;
  }
  if (p->_keys) {
    e = (*v)(p->_keys, a); if (e) return e;
  }
  if (p->_items) {
    e = (*v)(p->_items, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__IDDict(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__IDDict *p = (struct __pyx_obj_4lxml_5etree__IDDict *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->_doc);
  p->_doc = ((struct LxmlDocument *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_keys);
  p->_keys = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_items);
  p->_items = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}
static PyObject *__pyx_sq_item_4lxml_5etree__IDDict(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static PyMethodDef __pyx_methods_4lxml_5etree__IDDict[] = {
  {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_pf_4lxml_5etree_7_IDDict_1copy, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("get"), (PyCFunction)__pyx_pf_4lxml_5etree_7_IDDict_3get, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("has_key"), (PyCFunction)__pyx_pf_4lxml_5etree_7_IDDict_5has_key, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("keys"), (PyCFunction)__pyx_pf_4lxml_5etree_7_IDDict_7keys, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("iterkeys"), (PyCFunction)__pyx_pf_4lxml_5etree_7_IDDict_9iterkeys, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("items"), (PyCFunction)__pyx_pf_4lxml_5etree_7_IDDict_11items, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("iteritems"), (PyCFunction)__pyx_pf_4lxml_5etree_7_IDDict_12iteritems, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("values"), (PyCFunction)__pyx_pf_4lxml_5etree_7_IDDict_13values, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("itervalues"), (PyCFunction)__pyx_pf_4lxml_5etree_7_IDDict_14itervalues, METH_NOARGS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__IDDict = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__IDDict = {
  __pyx_pf_4lxml_5etree_7_IDDict_10__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_4lxml_5etree__IDDict, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  __pyx_pf_4lxml_5etree_7_IDDict_4__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__IDDict = {
  __pyx_pf_4lxml_5etree_7_IDDict_10__len__, /*mp_length*/
  __pyx_pf_4lxml_5etree_7_IDDict_2__getitem__, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__IDDict = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree__IDDict = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._IDDict"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__IDDict), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__IDDict, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pf_4lxml_5etree_7_IDDict_6__repr__, /*tp_repr*/
  &__pyx_tp_as_number__IDDict, /*tp_as_number*/
  &__pyx_tp_as_sequence__IDDict, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__IDDict, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__IDDict, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("IDDict(self, etree)\n    A dictionary-like proxy class that mapps ID attributes to elements.\n\n    The dictionary must be instantiated with the root element of a parsed XML\n    document, otherwise the behaviour is undefined.  Elements and XML trees\n    that were created or modified 'by hand' are not supported.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__IDDict, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__IDDict, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pf_4lxml_5etree_7_IDDict_8__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__IDDict, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__IDDict, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static PyObject *__pyx_tp_new_4lxml_5etree_XInclude(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_XInclude *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_XInclude *)o);
  p->_error_log = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_XInclude(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_XInclude *p = (struct __pyx_obj_4lxml_5etree_XInclude *)o;
  Py_XDECREF(((PyObject *)p->_error_log));
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree_XInclude(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree_XInclude *p = (struct __pyx_obj_4lxml_5etree_XInclude *)o;
  if (p->_error_log) {
    e = (*v)(((PyObject*)p->_error_log), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree_XInclude(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_XInclude *p = (struct __pyx_obj_4lxml_5etree_XInclude *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->_error_log);
  p->_error_log = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_8XInclude_error_log(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_8XInclude_9error_log___get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree_XInclude[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree_XInclude[] = {
  {(char *)"error_log", __pyx_getprop_4lxml_5etree_8XInclude_error_log, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_XInclude = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_XInclude = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_XInclude = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_XInclude = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree_XInclude = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.XInclude"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_XInclude), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_XInclude, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_XInclude, /*tp_as_number*/
  &__pyx_tp_as_sequence_XInclude, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_XInclude, /*tp_as_mapping*/
  0, /*tp_hash*/
  __pyx_pf_4lxml_5etree_8XInclude_1__call__, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_XInclude, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("XInclude(self)\n    XInclude processor.\n\n    Create an instance and call it on an Element to run XInclude\n    processing.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_XInclude, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_XInclude, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_XInclude, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree_XInclude, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_4lxml_5etree_8XInclude___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_XInclude, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__ExsltRegExp __pyx_vtable_4lxml_5etree__ExsltRegExp;

static PyObject *__pyx_tp_new_4lxml_5etree__ExsltRegExp(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ExsltRegExp *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ExsltRegExp *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__ExsltRegExp;
  p->_compile_map = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (__pyx_pf_4lxml_5etree_12_ExsltRegExp___cinit__(o, __pyx_empty_tuple, NULL) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__ExsltRegExp(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ExsltRegExp *p = (struct __pyx_obj_4lxml_5etree__ExsltRegExp *)o;
  Py_XDECREF(((PyObject *)p->_compile_map));
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree__ExsltRegExp(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__ExsltRegExp *p = (struct __pyx_obj_4lxml_5etree__ExsltRegExp *)o;
  if (p->_compile_map) {
    e = (*v)(p->_compile_map, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__ExsltRegExp(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ExsltRegExp *p = (struct __pyx_obj_4lxml_5etree__ExsltRegExp *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->_compile_map);
  p->_compile_map = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__ExsltRegExp[] = {
  {__Pyx_NAMESTR("test"), (PyCFunction)__pyx_pf_4lxml_5etree_12_ExsltRegExp_1test, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("match"), (PyCFunction)__pyx_pf_4lxml_5etree_12_ExsltRegExp_2match, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("replace"), (PyCFunction)__pyx_pf_4lxml_5etree_12_ExsltRegExp_3replace, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__ExsltRegExp = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__ExsltRegExp = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__ExsltRegExp = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__ExsltRegExp = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree__ExsltRegExp = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._ExsltRegExp"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ExsltRegExp), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ExsltRegExp, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number__ExsltRegExp, /*tp_as_number*/
  &__pyx_tp_as_sequence__ExsltRegExp, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__ExsltRegExp, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__ExsltRegExp, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ExsltRegExp, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ExsltRegExp, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__ExsltRegExp, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__ExsltRegExp, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__BaseContext __pyx_vtable_4lxml_5etree__BaseContext;

static PyObject *__pyx_tp_new_4lxml_5etree__BaseContext(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__BaseContext *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__BaseContext *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__BaseContext;
  p->_doc = ((struct LxmlDocument *)Py_None); Py_INCREF(Py_None);
  p->_extensions = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_namespaces = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_global_namespaces = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_utf_refs = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_function_cache = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_eval_context_dict = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_temp_refs = ((struct __pyx_obj_4lxml_5etree__TempStore *)Py_None); Py_INCREF(Py_None);
  p->_temp_documents = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_exc = ((struct __pyx_obj_4lxml_5etree__ExceptionContext *)Py_None); Py_INCREF(Py_None);
  if (__pyx_pf_4lxml_5etree_12_BaseContext___cinit__(o, __pyx_empty_tuple, NULL) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__BaseContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__BaseContext *p = (struct __pyx_obj_4lxml_5etree__BaseContext *)o;
  Py_XDECREF(((PyObject *)p->_doc));
  Py_XDECREF(((PyObject *)p->_extensions));
  Py_XDECREF(((PyObject *)p->_namespaces));
  Py_XDECREF(((PyObject *)p->_global_namespaces));
  Py_XDECREF(((PyObject *)p->_utf_refs));
  Py_XDECREF(((PyObject *)p->_function_cache));
  Py_XDECREF(((PyObject *)p->_eval_context_dict));
  Py_XDECREF(((PyObject *)p->_temp_refs));
  Py_XDECREF(((PyObject *)p->_temp_documents));
  Py_XDECREF(((PyObject *)p->_exc));
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree__BaseContext(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__BaseContext *p = (struct __pyx_obj_4lxml_5etree__BaseContext *)o;
  if (p->_doc) {
    e = (*v)(((PyObject*)p->_doc), a); if (e) return e;
  }
  if (p->_extensions) {
    e = (*v)(p->_extensions, a); if (e) return e;
  }
  if (p->_namespaces) {
    e = (*v)(p->_namespaces, a); if (e) return e;
  }
  if (p->_global_namespaces) {
    e = (*v)(p->_global_namespaces, a); if (e) return e;
  }
  if (p->_utf_refs) {
    e = (*v)(p->_utf_refs, a); if (e) return e;
  }
  if (p->_function_cache) {
    e = (*v)(p->_function_cache, a); if (e) return e;
  }
  if (p->_eval_context_dict) {
    e = (*v)(p->_eval_context_dict, a); if (e) return e;
  }
  if (p->_temp_refs) {
    e = (*v)(((PyObject*)p->_temp_refs), a); if (e) return e;
  }
  if (p->_temp_documents) {
    e = (*v)(p->_temp_documents, a); if (e) return e;
  }
  if (p->_exc) {
    e = (*v)(((PyObject*)p->_exc), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__BaseContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__BaseContext *p = (struct __pyx_obj_4lxml_5etree__BaseContext *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->_doc);
  p->_doc = ((struct LxmlDocument *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_extensions);
  p->_extensions = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_namespaces);
  p->_namespaces = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_global_namespaces);
  p->_global_namespaces = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_utf_refs);
  p->_utf_refs = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_function_cache);
  p->_function_cache = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_eval_context_dict);
  p->_eval_context_dict = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_temp_refs);
  p->_temp_refs = ((struct __pyx_obj_4lxml_5etree__TempStore *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_temp_documents);
  p->_temp_documents = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_exc);
  p->_exc = ((struct __pyx_obj_4lxml_5etree__ExceptionContext *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_12_BaseContext_context_node(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_12_BaseContext_12context_node___get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_12_BaseContext_eval_context(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_12_BaseContext_12eval_context___get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__BaseContext[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__BaseContext[] = {
  {(char *)"context_node", __pyx_getprop_4lxml_5etree_12_BaseContext_context_node, 0, 0, 0},
  {(char *)"eval_context", __pyx_getprop_4lxml_5etree_12_BaseContext_eval_context, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__BaseContext = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__BaseContext = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__BaseContext = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__BaseContext = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree__BaseContext = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._BaseContext"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__BaseContext), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__BaseContext, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number__BaseContext, /*tp_as_number*/
  &__pyx_tp_as_sequence__BaseContext, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__BaseContext, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__BaseContext, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__BaseContext, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__BaseContext, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__BaseContext, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__BaseContext, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_4lxml_5etree_12_BaseContext_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__BaseContext, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static PyObject *__pyx_tp_new_4lxml_5etree__ElementUnicodeResult(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *p;
  PyObject *o = (&PyUnicode_Type)->tp_new(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *)o);
  p->_parent = ((struct LxmlElement *)Py_None); Py_INCREF(Py_None);
  p->is_tail = Py_None; Py_INCREF(Py_None);
  p->is_text = Py_None; Py_INCREF(Py_None);
  p->is_attribute = Py_None; Py_INCREF(Py_None);
  p->attrname = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__ElementUnicodeResult(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *p = (struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *)o;
  Py_XDECREF(((PyObject *)p->_parent));
  Py_XDECREF(p->is_tail);
  Py_XDECREF(p->is_text);
  Py_XDECREF(p->is_attribute);
  Py_XDECREF(p->attrname);
  (&PyUnicode_Type)->tp_dealloc(o);
}

static int __pyx_tp_traverse_4lxml_5etree__ElementUnicodeResult(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *p = (struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *)o;
  if ((&PyUnicode_Type)->tp_traverse) {
    e = (&PyUnicode_Type)->tp_traverse(o, v, a); if (e) return e;
  }
  if (p->_parent) {
    e = (*v)(((PyObject*)p->_parent), a); if (e) return e;
  }
  if (p->is_tail) {
    e = (*v)(p->is_tail, a); if (e) return e;
  }
  if (p->is_text) {
    e = (*v)(p->is_text, a); if (e) return e;
  }
  if (p->is_attribute) {
    e = (*v)(p->is_attribute, a); if (e) return e;
  }
  if (p->attrname) {
    e = (*v)(p->attrname, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__ElementUnicodeResult(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *p = (struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *)o;
  PyObject* tmp;
  if ((&PyUnicode_Type)->tp_clear) {
    (&PyUnicode_Type)->tp_clear(o);
  }
  tmp = ((PyObject*)p->_parent);
  p->_parent = ((struct LxmlElement *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->is_tail);
  p->is_tail = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->is_text);
  p->is_text = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->is_attribute);
  p->is_attribute = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->attrname);
  p->attrname = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_21_ElementUnicodeResult_is_tail(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_21_ElementUnicodeResult_7is_tail___get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_21_ElementUnicodeResult_is_text(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_21_ElementUnicodeResult_7is_text___get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_21_ElementUnicodeResult_is_attribute(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_21_ElementUnicodeResult_12is_attribute___get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_21_ElementUnicodeResult_attrname(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_21_ElementUnicodeResult_8attrname___get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__ElementUnicodeResult[] = {
  {__Pyx_NAMESTR("getparent"), (PyCFunction)__pyx_pf_4lxml_5etree_21_ElementUnicodeResult_getparent, METH_NOARGS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__ElementUnicodeResult[] = {
  {(char *)"is_tail", __pyx_getprop_4lxml_5etree_21_ElementUnicodeResult_is_tail, 0, 0, 0},
  {(char *)"is_text", __pyx_getprop_4lxml_5etree_21_ElementUnicodeResult_is_text, 0, 0, 0},
  {(char *)"is_attribute", __pyx_getprop_4lxml_5etree_21_ElementUnicodeResult_is_attribute, 0, 0, 0},
  {(char *)"attrname", __pyx_getprop_4lxml_5etree_21_ElementUnicodeResult_attrname, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__ElementUnicodeResult = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__ElementUnicodeResult = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__ElementUnicodeResult = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__ElementUnicodeResult = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree__ElementUnicodeResult = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._ElementUnicodeResult"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ElementUnicodeResult), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ElementUnicodeResult, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number__ElementUnicodeResult, /*tp_as_number*/
  &__pyx_tp_as_sequence__ElementUnicodeResult, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__ElementUnicodeResult, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__ElementUnicodeResult, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ElementUnicodeResult, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ElementUnicodeResult, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__ElementUnicodeResult, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__ElementUnicodeResult, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__ElementUnicodeResult, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__XPathContext __pyx_vtable_4lxml_5etree__XPathContext;

static PyObject *__pyx_tp_new_4lxml_5etree__XPathContext(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__XPathContext *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__BaseContext(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__XPathContext *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__BaseContext*)__pyx_vtabptr_4lxml_5etree__XPathContext;
  p->_variables = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__XPathContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__XPathContext *p = (struct __pyx_obj_4lxml_5etree__XPathContext *)o;
  Py_XDECREF(p->_variables);
  __pyx_tp_dealloc_4lxml_5etree__BaseContext(o);
}

static int __pyx_tp_traverse_4lxml_5etree__XPathContext(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__XPathContext *p = (struct __pyx_obj_4lxml_5etree__XPathContext *)o;
  e = __pyx_tp_traverse_4lxml_5etree__BaseContext(o, v, a); if (e) return e;
  if (p->_variables) {
    e = (*v)(p->_variables, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__XPathContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__XPathContext *p = (struct __pyx_obj_4lxml_5etree__XPathContext *)o;
  PyObject* tmp;
  __pyx_tp_clear_4lxml_5etree__BaseContext(o);
  tmp = ((PyObject*)p->_variables);
  p->_variables = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__XPathContext[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__XPathContext = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__XPathContext = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__XPathContext = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__XPathContext = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree__XPathContext = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._XPathContext"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__XPathContext), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__XPathContext, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number__XPathContext, /*tp_as_number*/
  &__pyx_tp_as_sequence__XPathContext, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__XPathContext, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__XPathContext, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__XPathContext, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__XPathContext, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__XPathContext, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_4lxml_5etree_13_XPathContext___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__XPathContext, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__XPathEvaluatorBase __pyx_vtable_4lxml_5etree__XPathEvaluatorBase;

static PyObject *__pyx_tp_new_4lxml_5etree__XPathEvaluatorBase(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__XPathEvaluatorBase;
  p->_context = ((struct __pyx_obj_4lxml_5etree__XPathContext *)Py_None); Py_INCREF(Py_None);
  p->_error_log = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)Py_None); Py_INCREF(Py_None);
  if (__pyx_pf_4lxml_5etree_19_XPathEvaluatorBase___cinit__(o, __pyx_empty_tuple, NULL) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__XPathEvaluatorBase(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *p = (struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)o;
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pf_4lxml_5etree_19_XPathEvaluatorBase_2__dealloc__(o);
    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_XDECREF(((PyObject *)p->_context));
  Py_XDECREF(((PyObject *)p->_error_log));
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree__XPathEvaluatorBase(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *p = (struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)o;
  if (p->_context) {
    e = (*v)(((PyObject*)p->_context), a); if (e) return e;
  }
  if (p->_error_log) {
    e = (*v)(((PyObject*)p->_error_log), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__XPathEvaluatorBase(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *p = (struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->_context);
  p->_context = ((struct __pyx_obj_4lxml_5etree__XPathContext *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_error_log);
  p->_error_log = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_19_XPathEvaluatorBase_error_log(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_19_XPathEvaluatorBase_9error_log___get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__XPathEvaluatorBase[] = {
  {__Pyx_NAMESTR("evaluate"), (PyCFunction)__pyx_pf_4lxml_5etree_19_XPathEvaluatorBase_3evaluate, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_19_XPathEvaluatorBase_3evaluate)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__XPathEvaluatorBase[] = {
  {(char *)"error_log", __pyx_getprop_4lxml_5etree_19_XPathEvaluatorBase_error_log, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__XPathEvaluatorBase = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__XPathEvaluatorBase = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__XPathEvaluatorBase = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__XPathEvaluatorBase = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree__XPathEvaluatorBase = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._XPathEvaluatorBase"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__XPathEvaluatorBase, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number__XPathEvaluatorBase, /*tp_as_number*/
  &__pyx_tp_as_sequence__XPathEvaluatorBase, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__XPathEvaluatorBase, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__XPathEvaluatorBase, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__XPathEvaluatorBase, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__XPathEvaluatorBase, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__XPathEvaluatorBase, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__XPathEvaluatorBase, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_4lxml_5etree_19_XPathEvaluatorBase_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__XPathEvaluatorBase, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_XPathElementEvaluator __pyx_vtable_4lxml_5etree_XPathElementEvaluator;

static PyObject *__pyx_tp_new_4lxml_5etree_XPathElementEvaluator(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__XPathEvaluatorBase(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__XPathEvaluatorBase*)__pyx_vtabptr_4lxml_5etree_XPathElementEvaluator;
  p->_element = ((struct LxmlElement *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_XPathElementEvaluator(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *p = (struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *)o;
  Py_XDECREF(((PyObject *)p->_element));
  __pyx_tp_dealloc_4lxml_5etree__XPathEvaluatorBase(o);
}

static int __pyx_tp_traverse_4lxml_5etree_XPathElementEvaluator(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *p = (struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *)o;
  e = __pyx_tp_traverse_4lxml_5etree__XPathEvaluatorBase(o, v, a); if (e) return e;
  if (p->_element) {
    e = (*v)(((PyObject*)p->_element), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree_XPathElementEvaluator(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *p = (struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *)o;
  PyObject* tmp;
  __pyx_tp_clear_4lxml_5etree__XPathEvaluatorBase(o);
  tmp = ((PyObject*)p->_element);
  p->_element = ((struct LxmlElement *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree_XPathElementEvaluator[] = {
  {__Pyx_NAMESTR("register_namespace"), (PyCFunction)__pyx_pf_4lxml_5etree_21XPathElementEvaluator_1register_namespace, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_21XPathElementEvaluator_1register_namespace)},
  {__Pyx_NAMESTR("register_namespaces"), (PyCFunction)__pyx_pf_4lxml_5etree_21XPathElementEvaluator_2register_namespaces, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_21XPathElementEvaluator_2register_namespaces)},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_XPathElementEvaluator = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_XPathElementEvaluator = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_XPathElementEvaluator = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_XPathElementEvaluator = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree_XPathElementEvaluator = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.XPathElementEvaluator"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_XPathElementEvaluator), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_XPathElementEvaluator, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_XPathElementEvaluator, /*tp_as_number*/
  &__pyx_tp_as_sequence_XPathElementEvaluator, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_XPathElementEvaluator, /*tp_as_mapping*/
  0, /*tp_hash*/
  __pyx_pf_4lxml_5etree_21XPathElementEvaluator_3__call__, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_XPathElementEvaluator, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("XPathElementEvaluator(self, element, namespaces=None, extensions=None, regexp=True, smart_strings=True)\n    Create an XPath evaluator for an element.\n\n    Absolute XPath expressions (starting with '/') will be evaluated against\n    the ElementTree as returned by getroottree().\n\n    Additional namespace declarations can be passed with the\n    'namespace' keyword argument.  EXSLT regular expression support\n    can be disabled with the 'regexp' boolean keyword (defaults to\n    True).  Smart strings will be returned for string results unless\n    you pass ``smart_strings=False``.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_XPathElementEvaluator, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_XPathElementEvaluator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_XPathElementEvaluator, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_4lxml_5etree_21XPathElementEvaluator___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_XPathElementEvaluator, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_XPathDocumentEvaluator __pyx_vtable_4lxml_5etree_XPathDocumentEvaluator;

static PyObject *__pyx_tp_new_4lxml_5etree_XPathDocumentEvaluator(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_XPathDocumentEvaluator *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree_XPathElementEvaluator(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_XPathDocumentEvaluator *)o);
  p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__XPathEvaluatorBase*)__pyx_vtabptr_4lxml_5etree_XPathDocumentEvaluator;
  return o;
}

static PyMethodDef __pyx_methods_4lxml_5etree_XPathDocumentEvaluator[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_XPathDocumentEvaluator = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_XPathDocumentEvaluator = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_XPathDocumentEvaluator = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_XPathDocumentEvaluator = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree_XPathDocumentEvaluator = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.XPathDocumentEvaluator"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_XPathDocumentEvaluator), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_XPathElementEvaluator, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_XPathDocumentEvaluator, /*tp_as_number*/
  &__pyx_tp_as_sequence_XPathDocumentEvaluator, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_XPathDocumentEvaluator, /*tp_as_mapping*/
  0, /*tp_hash*/
  __pyx_pf_4lxml_5etree_22XPathDocumentEvaluator_1__call__, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_XPathDocumentEvaluator, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("XPathDocumentEvaluator(self, etree, namespaces=None, extensions=None, regexp=True, smart_strings=True)\n    Create an XPath evaluator for an ElementTree.\n\n    Additional namespace declarations can be passed with the\n    'namespace' keyword argument.  EXSLT regular expression support\n    can be disabled with the 'regexp' boolean keyword (defaults to\n    True).  Smart strings will be returned for string results unless\n    you pass ``smart_strings=False``.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_XPathElementEvaluator, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_XPathElementEvaluator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_XPathDocumentEvaluator, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_4lxml_5etree_22XPathDocumentEvaluator___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_XPathDocumentEvaluator, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_XPath __pyx_vtable_4lxml_5etree_XPath;

static PyObject *__pyx_tp_new_4lxml_5etree_XPath(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_XPath *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__XPathEvaluatorBase(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_XPath *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__XPathEvaluatorBase*)__pyx_vtabptr_4lxml_5etree_XPath;
  p->_path = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (__pyx_pf_4lxml_5etree_5XPath___cinit__(o, __pyx_empty_tuple, NULL) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_XPath(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_XPath *p = (struct __pyx_obj_4lxml_5etree_XPath *)o;
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pf_4lxml_5etree_5XPath_3__dealloc__(o);
    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_XDECREF(((PyObject *)p->_path));
  __pyx_tp_dealloc_4lxml_5etree__XPathEvaluatorBase(o);
}

static int __pyx_tp_traverse_4lxml_5etree_XPath(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree_XPath *p = (struct __pyx_obj_4lxml_5etree_XPath *)o;
  e = __pyx_tp_traverse_4lxml_5etree__XPathEvaluatorBase(o, v, a); if (e) return e;
  if (p->_path) {
    e = (*v)(p->_path, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree_XPath(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_XPath *p = (struct __pyx_obj_4lxml_5etree_XPath *)o;
  PyObject* tmp;
  __pyx_tp_clear_4lxml_5etree__XPathEvaluatorBase(o);
  tmp = ((PyObject*)p->_path);
  p->_path = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_5XPath_path(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_5XPath_4path___get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree_XPath[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree_XPath[] = {
  {(char *)"path", __pyx_getprop_4lxml_5etree_5XPath_path, 0, __Pyx_DOCSTR(__pyx_k_452), 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_XPath = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_XPath = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_XPath = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_XPath = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree_XPath = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.XPath"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_XPath), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_XPath, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pf_4lxml_5etree_5XPath_4__repr__, /*tp_repr*/
  &__pyx_tp_as_number_XPath, /*tp_as_number*/
  &__pyx_tp_as_sequence_XPath, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_XPath, /*tp_as_mapping*/
  0, /*tp_hash*/
  __pyx_pf_4lxml_5etree_5XPath_2__call__, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_XPath, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("XPath(self, path, namespaces=None, extensions=None, regexp=True, smart_strings=True)\n    A compiled XPath expression that can be called on Elements and ElementTrees.\n\n    Besides the XPath expression, you can pass prefix-namespace\n    mappings and extension functions to the constructor through the\n    keyword arguments ``namespaces`` and ``extensions``.  EXSLT\n    regular expression support can be disabled with the 'regexp'\n    boolean keyword (defaults to True).  Smart strings will be\n    returned for string results unless you pass\n    ``smart_strings=False``.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_XPath, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_XPath, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_XPath, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree_XPath, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_4lxml_5etree_5XPath_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_XPath, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_ETXPath __pyx_vtable_4lxml_5etree_ETXPath;

static PyObject *__pyx_tp_new_4lxml_5etree_ETXPath(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_ETXPath *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree_XPath(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_ETXPath *)o);
  p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__XPathEvaluatorBase*)__pyx_vtabptr_4lxml_5etree_ETXPath;
  return o;
}

static PyMethodDef __pyx_methods_4lxml_5etree_ETXPath[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_ETXPath = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_ETXPath = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_ETXPath = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_ETXPath = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree_ETXPath = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.ETXPath"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_ETXPath), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_XPath, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_ETXPath, /*tp_as_number*/
  &__pyx_tp_as_sequence_ETXPath, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_ETXPath, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_ETXPath, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("ETXPath(self, path, extensions=None, regexp=True, smart_strings=True)\n    Special XPath class that supports the ElementTree {uri} notation for namespaces.\n\n    Note that this class does not accept the ``namespace`` keyword\n    argument. All namespaces must be passed as part of the path\n    string.  Smart strings will be returned for string results unless\n    you pass ``smart_strings=False``.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_XPath, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_XPath, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_ETXPath, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_4lxml_5etree_7ETXPath___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_ETXPath, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__XSLTResolverContext __pyx_vtable_4lxml_5etree__XSLTResolverContext;

static PyObject *__pyx_tp_new_4lxml_5etree__XSLTResolverContext(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__XSLTResolverContext *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ResolverContext(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__XSLTResolverContext *)o);
  p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext*)__pyx_vtabptr_4lxml_5etree__XSLTResolverContext;
  p->_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__XSLTResolverContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__XSLTResolverContext *p = (struct __pyx_obj_4lxml_5etree__XSLTResolverContext *)o;
  Py_XDECREF(((PyObject *)p->_parser));
  __pyx_tp_dealloc_4lxml_5etree__ResolverContext(o);
}

static int __pyx_tp_traverse_4lxml_5etree__XSLTResolverContext(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__XSLTResolverContext *p = (struct __pyx_obj_4lxml_5etree__XSLTResolverContext *)o;
  e = __pyx_tp_traverse_4lxml_5etree__ResolverContext(o, v, a); if (e) return e;
  if (p->_parser) {
    e = (*v)(((PyObject*)p->_parser), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__XSLTResolverContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__XSLTResolverContext *p = (struct __pyx_obj_4lxml_5etree__XSLTResolverContext *)o;
  PyObject* tmp;
  __pyx_tp_clear_4lxml_5etree__ResolverContext(o);
  tmp = ((PyObject*)p->_parser);
  p->_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__XSLTResolverContext[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__XSLTResolverContext = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__XSLTResolverContext = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__XSLTResolverContext = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__XSLTResolverContext = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree__XSLTResolverContext = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._XSLTResolverContext"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__XSLTResolverContext), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__XSLTResolverContext, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number__XSLTResolverContext, /*tp_as_number*/
  &__pyx_tp_as_sequence__XSLTResolverContext, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__XSLTResolverContext, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__XSLTResolverContext, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__XSLTResolverContext, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__XSLTResolverContext, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__XSLTResolverContext, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__XSLTResolverContext, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_XSLTAccessControl __pyx_vtable_4lxml_5etree_XSLTAccessControl;

static PyObject *__pyx_tp_new_4lxml_5etree_XSLTAccessControl(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_XSLTAccessControl *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_XSLTAccessControl *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree_XSLTAccessControl;
  if (__pyx_pf_4lxml_5etree_17XSLTAccessControl___cinit__(o, a, k) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_XSLTAccessControl(PyObject *o) {
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pf_4lxml_5etree_17XSLTAccessControl_1__dealloc__(o);
    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  (*Py_TYPE(o)->tp_free)(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_17XSLTAccessControl_options(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_17XSLTAccessControl_7options___get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree_XSLTAccessControl[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree_XSLTAccessControl[] = {
  {(char *)"options", __pyx_getprop_4lxml_5etree_17XSLTAccessControl_options, 0, __Pyx_DOCSTR(__pyx_k_453), 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_XSLTAccessControl = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_XSLTAccessControl = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_XSLTAccessControl = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_XSLTAccessControl = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree_XSLTAccessControl = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.XSLTAccessControl"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_XSLTAccessControl), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_XSLTAccessControl, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pf_4lxml_5etree_17XSLTAccessControl_2__repr__, /*tp_repr*/
  &__pyx_tp_as_number_XSLTAccessControl, /*tp_as_number*/
  &__pyx_tp_as_sequence_XSLTAccessControl, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_XSLTAccessControl, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_XSLTAccessControl, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  __Pyx_DOCSTR("XSLTAccessControl(self, read_file=True, write_file=True, create_dir=True, read_network=True, write_network=True)\n\n    Access control for XSLT: reading/writing files, directories and\n    network I/O.  Access to a type of resource is granted or denied by\n    passing any of the following boolean keyword arguments.  All of\n    them default to True to allow access.\n\n    - read_file\n    - write_file\n    - create_dir\n    - read_network\n    - write_network\n\n    For convenience, there is also a class member `DENY_ALL` that\n    provides an XSLTAccessControl instance that is readily configured\n    to deny everything, and a `DENY_WRITE` member that denies all\n    write access but allows read access.\n\n    See `XSLT`.\n    "), /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_XSLTAccessControl, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree_XSLTAccessControl, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_XSLTAccessControl, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__XSLTContext __pyx_vtable_4lxml_5etree__XSLTContext;

static PyObject *__pyx_tp_new_4lxml_5etree__XSLTContext(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__XSLTContext *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__BaseContext(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__XSLTContext *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__BaseContext*)__pyx_vtabptr_4lxml_5etree__XSLTContext;
  p->_extension_element_proxy = ((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)Py_None); Py_INCREF(Py_None);
  p->_extension_elements = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (__pyx_pf_4lxml_5etree_12_XSLTContext___cinit__(o, __pyx_empty_tuple, NULL) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__XSLTContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__XSLTContext *p = (struct __pyx_obj_4lxml_5etree__XSLTContext *)o;
  Py_XDECREF(((PyObject *)p->_extension_element_proxy));
  Py_XDECREF(((PyObject *)p->_extension_elements));
  __pyx_tp_dealloc_4lxml_5etree__BaseContext(o);
}

static int __pyx_tp_traverse_4lxml_5etree__XSLTContext(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__XSLTContext *p = (struct __pyx_obj_4lxml_5etree__XSLTContext *)o;
  e = __pyx_tp_traverse_4lxml_5etree__BaseContext(o, v, a); if (e) return e;
  if (p->_extension_element_proxy) {
    e = (*v)(((PyObject*)p->_extension_element_proxy), a); if (e) return e;
  }
  if (p->_extension_elements) {
    e = (*v)(p->_extension_elements, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__XSLTContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__XSLTContext *p = (struct __pyx_obj_4lxml_5etree__XSLTContext *)o;
  PyObject* tmp;
  __pyx_tp_clear_4lxml_5etree__BaseContext(o);
  tmp = ((PyObject*)p->_extension_element_proxy);
  p->_extension_element_proxy = ((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_extension_elements);
  p->_extension_elements = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__XSLTContext[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__XSLTContext = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__XSLTContext = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__XSLTContext = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__XSLTContext = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree__XSLTContext = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._XSLTContext"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__XSLTContext), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__XSLTContext, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number__XSLTContext, /*tp_as_number*/
  &__pyx_tp_as_sequence__XSLTContext, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__XSLTContext, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__XSLTContext, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__XSLTContext, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__XSLTContext, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__XSLTContext, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_4lxml_5etree_12_XSLTContext_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__XSLTContext, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static PyObject *__pyx_tp_new_4lxml_5etree__XSLTQuotedStringParam(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__XSLTQuotedStringParam *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__XSLTQuotedStringParam *)o);
  p->strval = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (__pyx_pf_4lxml_5etree_22_XSLTQuotedStringParam___cinit__(o, a, k) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__XSLTQuotedStringParam(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__XSLTQuotedStringParam *p = (struct __pyx_obj_4lxml_5etree__XSLTQuotedStringParam *)o;
  Py_XDECREF(((PyObject *)p->strval));
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree__XSLTQuotedStringParam(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__XSLTQuotedStringParam *p = (struct __pyx_obj_4lxml_5etree__XSLTQuotedStringParam *)o;
  if (p->strval) {
    e = (*v)(p->strval, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__XSLTQuotedStringParam(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__XSLTQuotedStringParam *p = (struct __pyx_obj_4lxml_5etree__XSLTQuotedStringParam *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->strval);
  p->strval = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__XSLTQuotedStringParam[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__XSLTQuotedStringParam = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__XSLTQuotedStringParam = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__XSLTQuotedStringParam = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__XSLTQuotedStringParam = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree__XSLTQuotedStringParam = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._XSLTQuotedStringParam"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__XSLTQuotedStringParam), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__XSLTQuotedStringParam, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number__XSLTQuotedStringParam, /*tp_as_number*/
  &__pyx_tp_as_sequence__XSLTQuotedStringParam, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__XSLTQuotedStringParam, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__XSLTQuotedStringParam, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("A wrapper class for literal XSLT string parameters that require\n    quote escaping.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__XSLTQuotedStringParam, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__XSLTQuotedStringParam, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__XSLTQuotedStringParam, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__XSLTQuotedStringParam, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_XSLT __pyx_vtable_4lxml_5etree_XSLT;

static PyObject *__pyx_tp_new_4lxml_5etree_XSLT(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_XSLT *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_XSLT *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree_XSLT;
  p->_context = ((struct __pyx_obj_4lxml_5etree__XSLTContext *)Py_None); Py_INCREF(Py_None);
  p->_xslt_resolver_context = ((struct __pyx_obj_4lxml_5etree__XSLTResolverContext *)Py_None); Py_INCREF(Py_None);
  p->_access_control = ((struct __pyx_obj_4lxml_5etree_XSLTAccessControl *)Py_None); Py_INCREF(Py_None);
  p->_error_log = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)Py_None); Py_INCREF(Py_None);
  if (__pyx_pf_4lxml_5etree_4XSLT___cinit__(o, __pyx_empty_tuple, NULL) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_XSLT(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_XSLT *p = (struct __pyx_obj_4lxml_5etree_XSLT *)o;
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pf_4lxml_5etree_4XSLT_2__dealloc__(o);
    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_XDECREF(((PyObject *)p->_context));
  Py_XDECREF(((PyObject *)p->_xslt_resolver_context));
  Py_XDECREF(((PyObject *)p->_access_control));
  Py_XDECREF(((PyObject *)p->_error_log));
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree_XSLT(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree_XSLT *p = (struct __pyx_obj_4lxml_5etree_XSLT *)o;
  if (p->_context) {
    e = (*v)(((PyObject*)p->_context), a); if (e) return e;
  }
  if (p->_xslt_resolver_context) {
    e = (*v)(((PyObject*)p->_xslt_resolver_context), a); if (e) return e;
  }
  if (p->_access_control) {
    e = (*v)(((PyObject*)p->_access_control), a); if (e) return e;
  }
  if (p->_error_log) {
    e = (*v)(((PyObject*)p->_error_log), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree_XSLT(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_XSLT *p = (struct __pyx_obj_4lxml_5etree_XSLT *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->_context);
  p->_context = ((struct __pyx_obj_4lxml_5etree__XSLTContext *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_xslt_resolver_context);
  p->_xslt_resolver_context = ((struct __pyx_obj_4lxml_5etree__XSLTResolverContext *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_access_control);
  p->_access_control = ((struct __pyx_obj_4lxml_5etree_XSLTAccessControl *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_error_log);
  p->_error_log = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_4XSLT_error_log(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_4XSLT_9error_log___get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree_XSLT[] = {
  {__Pyx_NAMESTR("strparam"), (PyCFunction)__pyx_pf_4lxml_5etree_4XSLT_3strparam, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_4XSLT_3strparam)},
  {__Pyx_NAMESTR("apply"), (PyCFunction)__pyx_pf_4lxml_5etree_4XSLT_4apply, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_4XSLT_4apply)},
  {__Pyx_NAMESTR("tostring"), (PyCFunction)__pyx_pf_4lxml_5etree_4XSLT_5tostring, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_4XSLT_5tostring)},
  {__Pyx_NAMESTR("__deepcopy__"), (PyCFunction)__pyx_pf_4lxml_5etree_4XSLT_6__deepcopy__, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("__copy__"), (PyCFunction)__pyx_pf_4lxml_5etree_4XSLT_7__copy__, METH_NOARGS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree_XSLT[] = {
  {(char *)"error_log", __pyx_getprop_4lxml_5etree_4XSLT_error_log, 0, __Pyx_DOCSTR(__pyx_k_454), 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_XSLT = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_XSLT = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_XSLT = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_XSLT = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree_XSLT = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.XSLT"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_XSLT), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_XSLT, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_XSLT, /*tp_as_number*/
  &__pyx_tp_as_sequence_XSLT, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_XSLT, /*tp_as_mapping*/
  0, /*tp_hash*/
  __pyx_pf_4lxml_5etree_4XSLT_8__call__, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_XSLT, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("XSLT(self, xslt_input, extensions=None, regexp=True, access_control=None)\n\n    Turn an XSL document into an XSLT object.\n\n    Calling this object on a tree or Element will execute the XSLT::\n\n      >>> transform = etree.XSLT(xsl_tree)\n      >>> result = transform(xml_tree)\n\n    Keyword arguments of the constructor:\n\n    - extensions: a dict mapping ``(namespace, name)`` pairs to\n      extension functions or extension elements\n    - regexp: enable exslt regular expression support in XPath\n      (default: True)\n    - access_control: access restrictions for network or file\n      system (see `XSLTAccessControl`)\n\n    Keyword arguments of the XSLT call:\n\n    - profile_run: enable XSLT profiling (default: False)\n\n    Other keyword arguments of the call are passed to the stylesheet\n    as parameters.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_XSLT, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_XSLT, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_XSLT, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree_XSLT, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_4lxml_5etree_4XSLT_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_XSLT, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__XSLTResultTree __pyx_vtable_4lxml_5etree__XSLTResultTree;

static PyObject *__pyx_tp_new_4lxml_5etree__XSLTResultTree(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__XSLTResultTree *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ElementTree(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__ElementTree*)__pyx_vtabptr_4lxml_5etree__XSLTResultTree;
  p->_xslt = ((struct __pyx_obj_4lxml_5etree_XSLT *)Py_None); Py_INCREF(Py_None);
  p->_profile = ((struct LxmlDocument *)Py_None); Py_INCREF(Py_None);
  if (__pyx_pf_4lxml_5etree_15_XSLTResultTree___cinit__(o, __pyx_empty_tuple, NULL) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__XSLTResultTree(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__XSLTResultTree *p = (struct __pyx_obj_4lxml_5etree__XSLTResultTree *)o;
  Py_XDECREF(((PyObject *)p->_xslt));
  Py_XDECREF(((PyObject *)p->_profile));
  __pyx_tp_dealloc_4lxml_5etree__ElementTree(o);
}

static int __pyx_tp_traverse_4lxml_5etree__XSLTResultTree(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__XSLTResultTree *p = (struct __pyx_obj_4lxml_5etree__XSLTResultTree *)o;
  e = __pyx_tp_traverse_4lxml_5etree__ElementTree(o, v, a); if (e) return e;
  if (p->_xslt) {
    e = (*v)(((PyObject*)p->_xslt), a); if (e) return e;
  }
  if (p->_profile) {
    e = (*v)(((PyObject*)p->_profile), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__XSLTResultTree(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__XSLTResultTree *p = (struct __pyx_obj_4lxml_5etree__XSLTResultTree *)o;
  PyObject* tmp;
  __pyx_tp_clear_4lxml_5etree__ElementTree(o);
  tmp = ((PyObject*)p->_xslt);
  p->_xslt = ((struct __pyx_obj_4lxml_5etree_XSLT *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_profile);
  p->_profile = ((struct LxmlDocument *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_15_XSLTResultTree_xslt_profile(PyObject *o, void *x) {
  return __pyx_pf_4lxml_5etree_15_XSLTResultTree_12xslt_profile___get__(o);
}

static int __pyx_setprop_4lxml_5etree_15_XSLTResultTree_xslt_profile(PyObject *o, PyObject *v, void *x) {
  if (v) {
    PyErr_SetString(PyExc_NotImplementedError, "__set__");
    return -1;
  }
  else {
    return __pyx_pf_4lxml_5etree_15_XSLTResultTree_12xslt_profile_1__del__(o);
  }
}

static PyMethodDef __pyx_methods_4lxml_5etree__XSLTResultTree[] = {
  {__Pyx_NAMESTR("__unicode__"), (PyCFunction)__pyx_pf_4lxml_5etree_15_XSLTResultTree_2__unicode__, METH_NOARGS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__XSLTResultTree[] = {
  {(char *)"xslt_profile", __pyx_getprop_4lxml_5etree_15_XSLTResultTree_xslt_profile, __pyx_setprop_4lxml_5etree_15_XSLTResultTree_xslt_profile, __Pyx_DOCSTR(__pyx_k_455), 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__XSLTResultTree = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__XSLTResultTree = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__XSLTResultTree = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__XSLTResultTree = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  __pyx_pf_4lxml_5etree_15_XSLTResultTree_3__getbuffer__, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  __pyx_pf_4lxml_5etree_15_XSLTResultTree_4__releasebuffer__, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree__XSLTResultTree = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._XSLTResultTree"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__XSLTResultTree), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__XSLTResultTree, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number__XSLTResultTree, /*tp_as_number*/
  &__pyx_tp_as_sequence__XSLTResultTree, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__XSLTResultTree, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  __pyx_pf_4lxml_5etree_15_XSLTResultTree_1__str__, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__XSLTResultTree, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__XSLTResultTree, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__XSLTResultTree, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__XSLTResultTree, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__XSLTResultTree, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__XSLTResultTree, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__XSLTProcessingInstruction __pyx_vtable_4lxml_5etree__XSLTProcessingInstruction;

static PyObject *__pyx_tp_new_4lxml_5etree__XSLTProcessingInstruction(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__XSLTProcessingInstruction *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__Element(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__XSLTProcessingInstruction *)o);
  p->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree___ContentOnlyElement*)__pyx_vtabptr_4lxml_5etree__XSLTProcessingInstruction;
  return o;
}

static PyMethodDef __pyx_methods_4lxml_5etree__XSLTProcessingInstruction[] = {
  {__Pyx_NAMESTR("parseXSL"), (PyCFunction)__pyx_pf_4lxml_5etree_26_XSLTProcessingInstruction_parseXSL, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_26_XSLTProcessingInstruction_parseXSL)},
  {__Pyx_NAMESTR("set"), (PyCFunction)__pyx_pf_4lxml_5etree_26_XSLTProcessingInstruction_1set, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_26_XSLTProcessingInstruction_1set)},
  {__Pyx_NAMESTR("get"), (PyCFunction)__pyx_pf_4lxml_5etree_26_XSLTProcessingInstruction_2get, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_26_XSLTProcessingInstruction_2get)},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__XSLTProcessingInstruction = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__XSLTProcessingInstruction = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__XSLTProcessingInstruction = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__XSLTProcessingInstruction = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree__XSLTProcessingInstruction = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._XSLTProcessingInstruction"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__XSLTProcessingInstruction), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__Element, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number__XSLTProcessingInstruction, /*tp_as_number*/
  &__pyx_tp_as_sequence__XSLTProcessingInstruction, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__XSLTProcessingInstruction, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__XSLTProcessingInstruction, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__Element, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__Element, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__XSLTProcessingInstruction, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__XSLTProcessingInstruction, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_XSLTExtension __pyx_vtable_4lxml_5etree_XSLTExtension;

static PyObject *__pyx_tp_new_4lxml_5etree_XSLTExtension(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_XSLTExtension *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_XSLTExtension *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree_XSLTExtension;
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_XSLTExtension(PyObject *o) {
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree_XSLTExtension[] = {
  {__Pyx_NAMESTR("execute"), (PyCFunction)__pyx_pf_4lxml_5etree_13XSLTExtension_execute, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_13XSLTExtension_execute)},
  {__Pyx_NAMESTR("apply_templates"), (PyCFunction)__pyx_pf_4lxml_5etree_13XSLTExtension_1apply_templates, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_13XSLTExtension_1apply_templates)},
  {__Pyx_NAMESTR("process_children"), (PyCFunction)__pyx_pf_4lxml_5etree_13XSLTExtension_2process_children, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_13XSLTExtension_2process_children)},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_XSLTExtension = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_XSLTExtension = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_XSLTExtension = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_XSLTExtension = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree_XSLTExtension = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.XSLTExtension"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_XSLTExtension), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_XSLTExtension, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_XSLTExtension, /*tp_as_number*/
  &__pyx_tp_as_sequence_XSLTExtension, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_XSLTExtension, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_XSLTExtension, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  __Pyx_DOCSTR("Base class of an XSLT extension element.\n    "), /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_XSLTExtension, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_XSLTExtension, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_DTD __pyx_vtable_4lxml_5etree_DTD;

static PyObject *__pyx_tp_new_4lxml_5etree_DTD(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_DTD *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__Validator(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_DTD *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__Validator*)__pyx_vtabptr_4lxml_5etree_DTD;
  if (__pyx_pf_4lxml_5etree_3DTD___cinit__(o, __pyx_empty_tuple, NULL) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_DTD(PyObject *o) {
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pf_4lxml_5etree_3DTD_2__dealloc__(o);
    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  __pyx_tp_dealloc_4lxml_5etree__Validator(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree_DTD[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_DTD = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_DTD = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_DTD = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_DTD = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree_DTD = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.DTD"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_DTD), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_DTD, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_DTD, /*tp_as_number*/
  &__pyx_tp_as_sequence_DTD, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_DTD, /*tp_as_mapping*/
  0, /*tp_hash*/
  __pyx_pf_4lxml_5etree_3DTD_3__call__, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_DTD, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("DTD(self, file=None, external_id=None)\n    A DTD validator.\n\n    Can load from filesystem directly given a filename or file-like object.\n    Alternatively, pass the keyword parameter ``external_id`` to load from a\n    catalog.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__Validator, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__Validator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_DTD, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_4lxml_5etree_3DTD_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_DTD, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_RelaxNG __pyx_vtable_4lxml_5etree_RelaxNG;

static PyObject *__pyx_tp_new_4lxml_5etree_RelaxNG(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_RelaxNG *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__Validator(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_RelaxNG *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__Validator*)__pyx_vtabptr_4lxml_5etree_RelaxNG;
  if (__pyx_pf_4lxml_5etree_7RelaxNG___cinit__(o, __pyx_empty_tuple, NULL) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_RelaxNG(PyObject *o) {
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pf_4lxml_5etree_7RelaxNG_2__dealloc__(o);
    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  __pyx_tp_dealloc_4lxml_5etree__Validator(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree_RelaxNG[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_RelaxNG = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_RelaxNG = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_RelaxNG = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_RelaxNG = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree_RelaxNG = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.RelaxNG"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_RelaxNG), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_RelaxNG, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_RelaxNG, /*tp_as_number*/
  &__pyx_tp_as_sequence_RelaxNG, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_RelaxNG, /*tp_as_mapping*/
  0, /*tp_hash*/
  __pyx_pf_4lxml_5etree_7RelaxNG_3__call__, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_RelaxNG, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("RelaxNG(self, etree=None, file=None)\n    Turn a document into a Relax NG validator.\n\n    Either pass a schema as Element or ElementTree, or pass a file or\n    filename through the ``file`` keyword argument.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__Validator, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__Validator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_RelaxNG, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_4lxml_5etree_7RelaxNG_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_RelaxNG, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_Schematron __pyx_vtable_4lxml_5etree_Schematron;

static PyObject *__pyx_tp_new_4lxml_5etree_Schematron(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_Schematron *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__Validator(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_Schematron *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__Validator*)__pyx_vtabptr_4lxml_5etree_Schematron;
  if (__pyx_pf_4lxml_5etree_10Schematron___cinit__(o, __pyx_empty_tuple, NULL) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_Schematron(PyObject *o) {
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pf_4lxml_5etree_10Schematron_2__dealloc__(o);
    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  __pyx_tp_dealloc_4lxml_5etree__Validator(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree_Schematron[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_Schematron = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_Schematron = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_Schematron = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_Schematron = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree_Schematron = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.Schematron"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_Schematron), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_Schematron, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_Schematron, /*tp_as_number*/
  &__pyx_tp_as_sequence_Schematron, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_Schematron, /*tp_as_mapping*/
  0, /*tp_hash*/
  __pyx_pf_4lxml_5etree_10Schematron_3__call__, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_Schematron, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("Schematron(self, etree=None, file=None)\n    A Schematron validator.\n\n    Pass a root Element or an ElementTree to turn it into a validator.\n    Alternatively, pass a filename as keyword argument 'file' to parse from\n    the file system.\n\n    Schematron is a less well known, but very powerful schema language.  The main\n    idea is to use the capabilities of XPath to put restrictions on the structure\n    and the content of XML documents.  Here is a simple example::\n\n      >>> schematron = etree.Schematron(etree.XML('''\n      ... <schema xmlns=\"http://www.ascc.net/xml/schematron\" >\n      ...   <pattern name=\"id is the only permited attribute name\">\n      ...     <rule context=\"*\">\n      ...       <report test=\"@*[not(name()='id')]\">Attribute\n      ...         <name path=\"@*[not(name()='id')]\"/> is forbidden<name/>\n      ...       </report>\n      ...     </rule>\n      ...   </pattern>\n      ... </schema>\n      ... '''))\n\n      >>> xml = etree.XML('''\n      ... <AAA name=\"aaa\">\n      ...   <BBB id=\"bbb\"/>\n      ...   <CCC color=\"ccc\"/>\n      ... </AAA>\n      ... ''')\n\n      >>> schematron.validate(xml)\n      0\n\n      >>> xml = etree.XML('''\n      ... <AAA id=\"aaa\">\n      ...   <BBB id=\"bbb\"/>\n      ...   <CCC/>\n      ... </AAA>\n      ... ''')\n\n      >>> schematron.validate(xml)\n      1\n\n    Schematron was added to libxml2 in version 2.6.21.  Before version 2.6.32,\n    however, Schematron lacked support for error reporting other than to stderr.\n    This version is therefore required to retrieve validation warnings and\n    errors in lxml.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__Validator, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__Validator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_Schematron, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_4lxml_5etree_10Schematron_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_Schematron, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static PyMethodDef __pyx_methods[] = {
  {0, 0, 0, 0}
};

#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef __pyx_moduledef = {
    PyModuleDef_HEAD_INIT,
    __Pyx_NAMESTR("etree"),
    __Pyx_DOCSTR(__pyx_k_456), /* m_doc */
    -1, /* m_size */
    __pyx_methods /* m_methods */,
    NULL, /* m_reload */
    NULL, /* m_traverse */
    NULL, /* m_clear */
    NULL /* m_free */
};
#endif

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0},
  {&__pyx_kp_u_100, __pyx_k_100, sizeof(__pyx_k_100), 0, 1, 0, 0},
  {&__pyx_kp_u_101, __pyx_k_101, sizeof(__pyx_k_101), 0, 1, 0, 0},
  {&__pyx_kp_b_102, __pyx_k_102, sizeof(__pyx_k_102), 0, 0, 0, 0},
  {&__pyx_kp_u_102, __pyx_k_102, sizeof(__pyx_k_102), 0, 1, 0, 0},
  {&__pyx_kp_u_106, __pyx_k_106, sizeof(__pyx_k_106), 0, 1, 0, 0},
  {&__pyx_kp_u_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 1, 0, 0},
  {&__pyx_kp_u_113, __pyx_k_113, sizeof(__pyx_k_113), 0, 1, 0, 0},
  {&__pyx_kp_u_114, __pyx_k_114, sizeof(__pyx_k_114), 0, 1, 0, 0},
  {&__pyx_kp_u_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 1, 0, 0},
  {&__pyx_kp_u_124, __pyx_k_124, sizeof(__pyx_k_124), 0, 1, 0, 0},
  {&__pyx_kp_u_125, __pyx_k_125, sizeof(__pyx_k_125), 0, 1, 0, 0},
  {&__pyx_kp_u_128, __pyx_k_128, sizeof(__pyx_k_128), 0, 1, 0, 0},
  {&__pyx_kp_s_129, __pyx_k_129, sizeof(__pyx_k_129), 0, 0, 1, 0},
  {&__pyx_kp_u_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 1, 0, 0},
  {&__pyx_n_s_130, __pyx_k_130, sizeof(__pyx_k_130), 0, 0, 1, 1},
  {&__pyx_kp_b_132, __pyx_k_132, sizeof(__pyx_k_132), 0, 0, 0, 0},
  {&__pyx_kp_s_132, __pyx_k_132, sizeof(__pyx_k_132), 0, 0, 1, 0},
  {&__pyx_kp_u_132, __pyx_k_132, sizeof(__pyx_k_132), 0, 1, 0, 0},
  {&__pyx_kp_s_133, __pyx_k_133, sizeof(__pyx_k_133), 0, 0, 1, 0},
  {&__pyx_kp_u_134, __pyx_k_134, sizeof(__pyx_k_134), 0, 1, 0, 0},
  {&__pyx_kp_u_135, __pyx_k_135, sizeof(__pyx_k_135), 0, 1, 0, 0},
  {&__pyx_kp_u_136, __pyx_k_136, sizeof(__pyx_k_136), 0, 1, 0, 0},
  {&__pyx_kp_u_137, __pyx_k_137, sizeof(__pyx_k_137), 0, 1, 0, 0},
  {&__pyx_kp_u_138, __pyx_k_138, sizeof(__pyx_k_138), 0, 1, 0, 0},
  {&__pyx_kp_u_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 1, 0, 0},
  {&__pyx_kp_s_140, __pyx_k_140, sizeof(__pyx_k_140), 0, 0, 1, 0},
  {&__pyx_kp_u_141, __pyx_k_141, sizeof(__pyx_k_141), 0, 1, 0, 0},
  {&__pyx_kp_u_142, __pyx_k_142, sizeof(__pyx_k_142), 0, 1, 0, 0},
  {&__pyx_kp_u_143, __pyx_k_143, sizeof(__pyx_k_143), 0, 1, 0, 0},
  {&__pyx_kp_u_144, __pyx_k_144, sizeof(__pyx_k_144), 0, 1, 0, 0},
  {&__pyx_kp_u_148, __pyx_k_148, sizeof(__pyx_k_148), 0, 1, 0, 0},
  {&__pyx_kp_u_149, __pyx_k_149, sizeof(__pyx_k_149), 0, 1, 0, 0},
  {&__pyx_kp_u_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 1, 0, 0},
  {&__pyx_n_s_150, __pyx_k_150, sizeof(__pyx_k_150), 0, 0, 1, 1},
  {&__pyx_kp_u_151, __pyx_k_151, sizeof(__pyx_k_151), 0, 1, 0, 0},
  {&__pyx_kp_u_152, __pyx_k_152, sizeof(__pyx_k_152), 0, 1, 0, 0},
  {&__pyx_n_s_153, __pyx_k_153, sizeof(__pyx_k_153), 0, 0, 1, 1},
  {&__pyx_kp_u_154, __pyx_k_154, sizeof(__pyx_k_154), 0, 1, 0, 0},
  {&__pyx_kp_u_155, __pyx_k_155, sizeof(__pyx_k_155), 0, 1, 0, 0},
  {&__pyx_kp_u_156, __pyx_k_156, sizeof(__pyx_k_156), 0, 1, 0, 0},
  {&__pyx_kp_s_157, __pyx_k_157, sizeof(__pyx_k_157), 0, 0, 1, 0},
  {&__pyx_kp_u_158, __pyx_k_158, sizeof(__pyx_k_158), 0, 1, 0, 0},
  {&__pyx_n_s_159, __pyx_k_159, sizeof(__pyx_k_159), 0, 0, 1, 1},
  {&__pyx_kp_u_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 1, 0, 0},
  {&__pyx_n_u_160, __pyx_k_160, sizeof(__pyx_k_160), 0, 1, 0, 1},
  {&__pyx_n_s_161, __pyx_k_161, sizeof(__pyx_k_161), 0, 0, 1, 1},
  {&__pyx_n_s_167, __pyx_k_167, sizeof(__pyx_k_167), 0, 0, 1, 1},
  {&__pyx_kp_u_168, __pyx_k_168, sizeof(__pyx_k_168), 0, 1, 0, 0},
  {&__pyx_kp_u_169, __pyx_k_169, sizeof(__pyx_k_169), 0, 1, 0, 0},
  {&__pyx_kp_u_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 1, 0, 0},
  {&__pyx_kp_u_170, __pyx_k_170, sizeof(__pyx_k_170), 0, 1, 0, 0},
  {&__pyx_kp_u_171, __pyx_k_171, sizeof(__pyx_k_171), 0, 1, 0, 0},
  {&__pyx_n_s_172, __pyx_k_172, sizeof(__pyx_k_172), 0, 0, 1, 1},
  {&__pyx_kp_u_173, __pyx_k_173, sizeof(__pyx_k_173), 0, 1, 0, 0},
  {&__pyx_kp_u_174, __pyx_k_174, sizeof(__pyx_k_174), 0, 1, 0, 0},
  {&__pyx_n_s_175, __pyx_k_175, sizeof(__pyx_k_175), 0, 0, 1, 1},
  {&__pyx_n_s_176, __pyx_k_176, sizeof(__pyx_k_176), 0, 0, 1, 1},
  {&__pyx_n_s_177, __pyx_k_177, sizeof(__pyx_k_177), 0, 0, 1, 1},
  {&__pyx_n_s_178, __pyx_k_178, sizeof(__pyx_k_178), 0, 0, 1, 1},
  {&__pyx_kp_u_179, __pyx_k_179, sizeof(__pyx_k_179), 0, 1, 0, 0},
  {&__pyx_kp_u_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 1, 0, 0},
  {&__pyx_kp_u_180, __pyx_k_180, sizeof(__pyx_k_180), 0, 1, 0, 0},
  {&__pyx_n_s_181, __pyx_k_181, sizeof(__pyx_k_181), 0, 0, 1, 1},
  {&__pyx_n_s_182, __pyx_k_182, sizeof(__pyx_k_182), 0, 0, 1, 1},
  {&__pyx_kp_u_183, __pyx_k_183, sizeof(__pyx_k_183), 0, 1, 0, 0},
  {&__pyx_n_s_184, __pyx_k_184, sizeof(__pyx_k_184), 0, 0, 1, 1},
  {&__pyx_n_s_185, __pyx_k_185, sizeof(__pyx_k_185), 0, 0, 1, 1},
  {&__pyx_kp_u_186, __pyx_k_186, sizeof(__pyx_k_186), 0, 1, 0, 0},
  {&__pyx_n_s_187, __pyx_k_187, sizeof(__pyx_k_187), 0, 0, 1, 1},
  {&__pyx_kp_u_188, __pyx_k_188, sizeof(__pyx_k_188), 0, 1, 0, 0},
  {&__pyx_kp_u_189, __pyx_k_189, sizeof(__pyx_k_189), 0, 1, 0, 0},
  {&__pyx_kp_u_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 1, 0, 0},
  {&__pyx_n_s_190, __pyx_k_190, sizeof(__pyx_k_190), 0, 0, 1, 1},
  {&__pyx_kp_u_191, __pyx_k_191, sizeof(__pyx_k_191), 0, 1, 0, 0},
  {&__pyx_kp_u_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 1, 0, 0},
  {&__pyx_kp_s_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 1, 0},
  {&__pyx_kp_s_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 0, 1, 0},
  {&__pyx_n_s_225, __pyx_k_225, sizeof(__pyx_k_225), 0, 0, 1, 1},
  {&__pyx_kp_u_226, __pyx_k_226, sizeof(__pyx_k_226), 0, 1, 0, 0},
  {&__pyx_kp_u_227, __pyx_k_227, sizeof(__pyx_k_227), 0, 1, 0, 0},
  {&__pyx_kp_u_228, __pyx_k_228, sizeof(__pyx_k_228), 0, 1, 0, 0},
  {&__pyx_n_s_229, __pyx_k_229, sizeof(__pyx_k_229), 0, 0, 1, 1},
  {&__pyx_kp_u_230, __pyx_k_230, sizeof(__pyx_k_230), 0, 1, 0, 0},
  {&__pyx_kp_u_231, __pyx_k_231, sizeof(__pyx_k_231), 0, 1, 0, 0},
  {&__pyx_kp_u_232, __pyx_k_232, sizeof(__pyx_k_232), 0, 1, 0, 0},
  {&__pyx_kp_u_233, __pyx_k_233, sizeof(__pyx_k_233), 0, 1, 0, 0},
  {&__pyx_kp_u_234, __pyx_k_234, sizeof(__pyx_k_234), 0, 1, 0, 0},
  {&__pyx_n_s_235, __pyx_k_235, sizeof(__pyx_k_235), 0, 0, 1, 1},
  {&__pyx_kp_u_236, __pyx_k_236, sizeof(__pyx_k_236), 0, 1, 0, 0},
  {&__pyx_kp_u_237, __pyx_k_237, sizeof(__pyx_k_237), 0, 1, 0, 0},
  {&__pyx_kp_u_239, __pyx_k_239, sizeof(__pyx_k_239), 0, 1, 0, 0},
  {&__pyx_kp_s_24, __pyx_k_24, sizeof(__pyx_k_24), 0, 0, 1, 0},
  {&__pyx_kp_u_240, __pyx_k_240, sizeof(__pyx_k_240), 0, 1, 0, 0},
  {&__pyx_kp_b_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 0, 0},
  {&__pyx_kp_s_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 1, 0},
  {&__pyx_kp_u_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 1, 0, 0},
  {&__pyx_kp_u_251, __pyx_k_251, sizeof(__pyx_k_251), 0, 1, 0, 0},
  {&__pyx_kp_u_255, __pyx_k_255, sizeof(__pyx_k_255), 0, 1, 0, 0},
  {&__pyx_kp_u_256, __pyx_k_256, sizeof(__pyx_k_256), 0, 1, 0, 0},
  {&__pyx_kp_u_258, __pyx_k_258, sizeof(__pyx_k_258), 0, 1, 0, 0},
  {&__pyx_kp_u_259, __pyx_k_259, sizeof(__pyx_k_259), 0, 1, 0, 0},
  {&__pyx_kp_u_260, __pyx_k_260, sizeof(__pyx_k_260), 0, 1, 0, 0},
  {&__pyx_kp_u_261, __pyx_k_261, sizeof(__pyx_k_261), 0, 1, 0, 0},
  {&__pyx_kp_u_262, __pyx_k_262, sizeof(__pyx_k_262), 0, 1, 0, 0},
  {&__pyx_kp_u_27, __pyx_k_27, sizeof(__pyx_k_27), 0, 1, 0, 0},
  {&__pyx_kp_u_278, __pyx_k_278, sizeof(__pyx_k_278), 0, 1, 0, 0},
  {&__pyx_kp_u_28, __pyx_k_28, sizeof(__pyx_k_28), 0, 1, 0, 0},
  {&__pyx_kp_u_280, __pyx_k_280, sizeof(__pyx_k_280), 0, 1, 0, 0},
  {&__pyx_kp_u_286, __pyx_k_286, sizeof(__pyx_k_286), 0, 1, 0, 0},
  {&__pyx_kp_u_289, __pyx_k_289, sizeof(__pyx_k_289), 0, 1, 0, 0},
  {&__pyx_kp_u_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 1, 0, 0},
  {&__pyx_kp_u_290, __pyx_k_290, sizeof(__pyx_k_290), 0, 1, 0, 0},
  {&__pyx_kp_u_291, __pyx_k_291, sizeof(__pyx_k_291), 0, 1, 0, 0},
  {&__pyx_kp_s_292, __pyx_k_292, sizeof(__pyx_k_292), 0, 0, 1, 0},
  {&__pyx_kp_s_293, __pyx_k_293, sizeof(__pyx_k_293), 0, 0, 1, 0},
  {&__pyx_n_s_294, __pyx_k_294, sizeof(__pyx_k_294), 0, 0, 1, 1},
  {&__pyx_n_s_295, __pyx_k_295, sizeof(__pyx_k_295), 0, 0, 1, 1},
  {&__pyx_kp_u_296, __pyx_k_296, sizeof(__pyx_k_296), 0, 1, 0, 0},
  {&__pyx_kp_u_297, __pyx_k_297, sizeof(__pyx_k_297), 0, 1, 0, 0},
  {&__pyx_kp_u_298, __pyx_k_298, sizeof(__pyx_k_298), 0, 1, 0, 0},
  {&__pyx_n_s_299, __pyx_k_299, sizeof(__pyx_k_299), 0, 0, 1, 1},
  {&__pyx_kp_u_30, __pyx_k_30, sizeof(__pyx_k_30), 0, 1, 0, 0},
  {&__pyx_n_s_300, __pyx_k_300, sizeof(__pyx_k_300), 0, 0, 1, 1},
  {&__pyx_kp_u_301, __pyx_k_301, sizeof(__pyx_k_301), 0, 1, 0, 0},
  {&__pyx_kp_u_302, __pyx_k_302, sizeof(__pyx_k_302), 0, 1, 0, 0},
  {&__pyx_kp_u_303, __pyx_k_303, sizeof(__pyx_k_303), 0, 1, 0, 0},
  {&__pyx_kp_u_304, __pyx_k_304, sizeof(__pyx_k_304), 0, 1, 0, 0},
  {&__pyx_kp_u_305, __pyx_k_305, sizeof(__pyx_k_305), 0, 1, 0, 0},
  {&__pyx_kp_b_309, __pyx_k_309, sizeof(__pyx_k_309), 0, 0, 0, 0},
  {&__pyx_kp_u_31, __pyx_k_31, sizeof(__pyx_k_31), 0, 1, 0, 0},
  {&__pyx_n_s_310, __pyx_k_310, sizeof(__pyx_k_310), 0, 0, 1, 1},
  {&__pyx_kp_u_311, __pyx_k_311, sizeof(__pyx_k_311), 0, 1, 0, 0},
  {&__pyx_kp_s_312, __pyx_k_312, sizeof(__pyx_k_312), 0, 0, 1, 0},
  {&__pyx_kp_u_313, __pyx_k_313, sizeof(__pyx_k_313), 0, 1, 0, 0},
  {&__pyx_kp_u_314, __pyx_k_314, sizeof(__pyx_k_314), 0, 1, 0, 0},
  {&__pyx_kp_u_315, __pyx_k_315, sizeof(__pyx_k_315), 0, 1, 0, 0},
  {&__pyx_kp_u_316, __pyx_k_316, sizeof(__pyx_k_316), 0, 1, 0, 0},
  {&__pyx_kp_u_317, __pyx_k_317, sizeof(__pyx_k_317), 0, 1, 0, 0},
  {&__pyx_n_s_318, __pyx_k_318, sizeof(__pyx_k_318), 0, 0, 1, 1},
  {&__pyx_n_s_319, __pyx_k_319, sizeof(__pyx_k_319), 0, 0, 1, 1},
  {&__pyx_kp_u_32, __pyx_k_32, sizeof(__pyx_k_32), 0, 1, 0, 0},
  {&__pyx_n_s_320, __pyx_k_320, sizeof(__pyx_k_320), 0, 0, 1, 1},
  {&__pyx_kp_u_321, __pyx_k_321, sizeof(__pyx_k_321), 0, 1, 0, 0},
  {&__pyx_n_s_322, __pyx_k_322, sizeof(__pyx_k_322), 0, 0, 1, 1},
  {&__pyx_n_s_323, __pyx_k_323, sizeof(__pyx_k_323), 0, 0, 1, 1},
  {&__pyx_n_s_324, __pyx_k_324, sizeof(__pyx_k_324), 0, 0, 1, 1},
  {&__pyx_n_s_325, __pyx_k_325, sizeof(__pyx_k_325), 0, 0, 1, 1},
  {&__pyx_n_s_326, __pyx_k_326, sizeof(__pyx_k_326), 0, 0, 1, 1},
  {&__pyx_n_s_327, __pyx_k_327, sizeof(__pyx_k_327), 0, 0, 1, 1},
  {&__pyx_n_s_328, __pyx_k_328, sizeof(__pyx_k_328), 0, 0, 1, 1},
  {&__pyx_kp_u_329, __pyx_k_329, sizeof(__pyx_k_329), 0, 1, 0, 0},
  {&__pyx_kp_u_33, __pyx_k_33, sizeof(__pyx_k_33), 0, 1, 0, 0},
  {&__pyx_kp_u_331, __pyx_k_331, sizeof(__pyx_k_331), 0, 1, 0, 0},
  {&__pyx_kp_u_332, __pyx_k_332, sizeof(__pyx_k_332), 0, 1, 0, 0},
  {&__pyx_kp_s_335, __pyx_k_335, sizeof(__pyx_k_335), 0, 0, 1, 0},
  {&__pyx_kp_u_34, __pyx_k_34, sizeof(__pyx_k_34), 0, 1, 0, 0},
  {&__pyx_kp_b_346, __pyx_k_346, sizeof(__pyx_k_346), 0, 0, 0, 0},
  {&__pyx_kp_u_348, __pyx_k_348, sizeof(__pyx_k_348), 0, 1, 0, 0},
  {&__pyx_kp_u_35, __pyx_k_35, sizeof(__pyx_k_35), 0, 1, 0, 0},
  {&__pyx_kp_u_354, __pyx_k_354, sizeof(__pyx_k_354), 0, 1, 0, 0},
  {&__pyx_kp_u_356, __pyx_k_356, sizeof(__pyx_k_356), 0, 1, 0, 0},
  {&__pyx_kp_u_357, __pyx_k_357, sizeof(__pyx_k_357), 0, 1, 0, 0},
  {&__pyx_kp_u_358, __pyx_k_358, sizeof(__pyx_k_358), 0, 1, 0, 0},
  {&__pyx_kp_u_36, __pyx_k_36, sizeof(__pyx_k_36), 0, 1, 0, 0},
  {&__pyx_kp_u_360, __pyx_k_360, sizeof(__pyx_k_360), 0, 1, 0, 0},
  {&__pyx_n_s_361, __pyx_k_361, sizeof(__pyx_k_361), 0, 0, 1, 1},
  {&__pyx_kp_u_362, __pyx_k_362, sizeof(__pyx_k_362), 0, 1, 0, 0},
  {&__pyx_kp_s_365, __pyx_k_365, sizeof(__pyx_k_365), 0, 0, 1, 0},
  {&__pyx_kp_u_366, __pyx_k_366, sizeof(__pyx_k_366), 0, 1, 0, 0},
  {&__pyx_kp_u_367, __pyx_k_367, sizeof(__pyx_k_367), 0, 1, 0, 0},
  {&__pyx_n_s_368, __pyx_k_368, sizeof(__pyx_k_368), 0, 0, 1, 1},
  {&__pyx_kp_u_369, __pyx_k_369, sizeof(__pyx_k_369), 0, 1, 0, 0},
  {&__pyx_kp_u_37, __pyx_k_37, sizeof(__pyx_k_37), 0, 1, 0, 0},
  {&__pyx_kp_b_371, __pyx_k_371, sizeof(__pyx_k_371), 0, 0, 0, 0},
  {&__pyx_kp_u_371, __pyx_k_371, sizeof(__pyx_k_371), 0, 1, 0, 0},
  {&__pyx_kp_u_372, __pyx_k_372, sizeof(__pyx_k_372), 0, 1, 0, 0},
  {&__pyx_kp_u_373, __pyx_k_373, sizeof(__pyx_k_373), 0, 1, 0, 0},
  {&__pyx_kp_u_374, __pyx_k_374, sizeof(__pyx_k_374), 0, 1, 0, 0},
  {&__pyx_kp_u_375, __pyx_k_375, sizeof(__pyx_k_375), 0, 1, 0, 0},
  {&__pyx_kp_u_376, __pyx_k_376, sizeof(__pyx_k_376), 0, 1, 0, 0},
  {&__pyx_kp_u_377, __pyx_k_377, sizeof(__pyx_k_377), 0, 1, 0, 0},
  {&__pyx_kp_u_378, __pyx_k_378, sizeof(__pyx_k_378), 0, 1, 0, 0},
  {&__pyx_kp_u_379, __pyx_k_379, sizeof(__pyx_k_379), 0, 1, 0, 0},
  {&__pyx_kp_u_38, __pyx_k_38, sizeof(__pyx_k_38), 0, 1, 0, 0},
  {&__pyx_kp_s_380, __pyx_k_380, sizeof(__pyx_k_380), 0, 0, 1, 0},
  {&__pyx_n_s_382, __pyx_k_382, sizeof(__pyx_k_382), 0, 0, 1, 1},
  {&__pyx_n_s_383, __pyx_k_383, sizeof(__pyx_k_383), 0, 0, 1, 1},
  {&__pyx_kp_u_384, __pyx_k_384, sizeof(__pyx_k_384), 0, 1, 0, 0},
  {&__pyx_kp_u_385, __pyx_k_385, sizeof(__pyx_k_385), 0, 1, 0, 0},
  {&__pyx_kp_u_39, __pyx_k_39, sizeof(__pyx_k_39), 0, 1, 0, 0},
  {&__pyx_kp_u_390, __pyx_k_390, sizeof(__pyx_k_390), 0, 1, 0, 0},
  {&__pyx_kp_u_391, __pyx_k_391, sizeof(__pyx_k_391), 0, 1, 0, 0},
  {&__pyx_kp_u_392, __pyx_k_392, sizeof(__pyx_k_392), 0, 1, 0, 0},
  {&__pyx_kp_u_393, __pyx_k_393, sizeof(__pyx_k_393), 0, 1, 0, 0},
  {&__pyx_kp_s_394, __pyx_k_394, sizeof(__pyx_k_394), 0, 0, 1, 0},
  {&__pyx_kp_u_395, __pyx_k_395, sizeof(__pyx_k_395), 0, 1, 0, 0},
  {&__pyx_kp_u_396, __pyx_k_396, sizeof(__pyx_k_396), 0, 1, 0, 0},
  {&__pyx_kp_u_398, __pyx_k_398, sizeof(__pyx_k_398), 0, 1, 0, 0},
  {&__pyx_kp_u_399, __pyx_k_399, sizeof(__pyx_k_399), 0, 1, 0, 0},
  {&__pyx_kp_u_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 1, 0, 0},
  {&__pyx_kp_u_40, __pyx_k_40, sizeof(__pyx_k_40), 0, 1, 0, 0},
  {&__pyx_kp_u_400, __pyx_k_400, sizeof(__pyx_k_400), 0, 1, 0, 0},
  {&__pyx_kp_u_401, __pyx_k_401, sizeof(__pyx_k_401), 0, 1, 0, 0},
  {&__pyx_kp_s_402, __pyx_k_402, sizeof(__pyx_k_402), 0, 0, 1, 0},
  {&__pyx_n_s_403, __pyx_k_403, sizeof(__pyx_k_403), 0, 0, 1, 1},
  {&__pyx_kp_u_404, __pyx_k_404, sizeof(__pyx_k_404), 0, 1, 0, 0},
  {&__pyx_n_s_405, __pyx_k_405, sizeof(__pyx_k_405), 0, 0, 1, 1},
  {&__pyx_n_s_406, __pyx_k_406, sizeof(__pyx_k_406), 0, 0, 1, 1},
  {&__pyx_kp_b_408, __pyx_k_408, sizeof(__pyx_k_408), 0, 0, 0, 0},
  {&__pyx_kp_u_408, __pyx_k_408, sizeof(__pyx_k_408), 0, 1, 0, 0},
  {&__pyx_kp_u_409, __pyx_k_409, sizeof(__pyx_k_409), 0, 1, 0, 0},
  {&__pyx_n_s_41, __pyx_k_41, sizeof(__pyx_k_41), 0, 0, 1, 1},
  {&__pyx_kp_u_410, __pyx_k_410, sizeof(__pyx_k_410), 0, 1, 0, 0},
  {&__pyx_kp_s_411, __pyx_k_411, sizeof(__pyx_k_411), 0, 0, 1, 0},
  {&__pyx_n_s_412, __pyx_k_412, sizeof(__pyx_k_412), 0, 0, 1, 1},
  {&__pyx_kp_u_413, __pyx_k_413, sizeof(__pyx_k_413), 0, 1, 0, 0},
  {&__pyx_kp_s_414, __pyx_k_414, sizeof(__pyx_k_414), 0, 0, 1, 0},
  {&__pyx_kp_u_415, __pyx_k_415, sizeof(__pyx_k_415), 0, 1, 0, 0},
  {&__pyx_n_s_416, __pyx_k_416, sizeof(__pyx_k_416), 0, 0, 1, 1},
  {&__pyx_kp_u_417, __pyx_k_417, sizeof(__pyx_k_417), 0, 1, 0, 0},
  {&__pyx_kp_s_418, __pyx_k_418, sizeof(__pyx_k_418), 0, 0, 1, 0},
  {&__pyx_n_s_419, __pyx_k_419, sizeof(__pyx_k_419), 0, 0, 1, 1},
  {&__pyx_kp_u_42, __pyx_k_42, sizeof(__pyx_k_42), 0, 1, 0, 0},
  {&__pyx_kp_u_420, __pyx_k_420, sizeof(__pyx_k_420), 0, 1, 0, 0},
  {&__pyx_kp_u_43, __pyx_k_43, sizeof(__pyx_k_43), 0, 1, 0, 0},
  {&__pyx_kp_u_44, __pyx_k_44, sizeof(__pyx_k_44), 0, 1, 0, 0},
  {&__pyx_kp_u_45, __pyx_k_45, sizeof(__pyx_k_45), 0, 1, 0, 0},
  {&__pyx_kp_u_457, __pyx_k_457, sizeof(__pyx_k_457), 0, 1, 0, 0},
  {&__pyx_n_s_458, __pyx_k_458, sizeof(__pyx_k_458), 0, 0, 1, 1},
  {&__pyx_n_s_459, __pyx_k_459, sizeof(__pyx_k_459), 0, 0, 1, 1},
  {&__pyx_kp_u_46, __pyx_k_46, sizeof(__pyx_k_46), 0, 1, 0, 0},
  {&__pyx_n_s_460, __pyx_k_460, sizeof(__pyx_k_460), 0, 0, 1, 1},
  {&__pyx_n_s_461, __pyx_k_461, sizeof(__pyx_k_461), 0, 0, 1, 1},
  {&__pyx_n_s_462, __pyx_k_462, sizeof(__pyx_k_462), 0, 0, 1, 1},
  {&__pyx_n_s_463, __pyx_k_463, sizeof(__pyx_k_463), 0, 0, 1, 1},
  {&__pyx_n_s_464, __pyx_k_464, sizeof(__pyx_k_464), 0, 0, 1, 1},
  {&__pyx_n_s_465, __pyx_k_465, sizeof(__pyx_k_465), 0, 0, 1, 1},
  {&__pyx_n_s_466, __pyx_k_466, sizeof(__pyx_k_466), 0, 0, 1, 1},
  {&__pyx_n_s_467, __pyx_k_467, sizeof(__pyx_k_467), 0, 0, 1, 1},
  {&__pyx_n_s_468, __pyx_k_468, sizeof(__pyx_k_468), 0, 0, 1, 1},
  {&__pyx_n_s_469, __pyx_k_469, sizeof(__pyx_k_469), 0, 0, 1, 1},
  {&__pyx_kp_u_47, __pyx_k_47, sizeof(__pyx_k_47), 0, 1, 0, 0},
  {&__pyx_n_s_470, __pyx_k_470, sizeof(__pyx_k_470), 0, 0, 1, 1},
  {&__pyx_kp_b_472, __pyx_k_472, sizeof(__pyx_k_472), 0, 0, 0, 0},
  {&__pyx_kp_b_473, __pyx_k_473, sizeof(__pyx_k_473), 0, 0, 0, 0},
  {&__pyx_kp_b_474, __pyx_k_474, sizeof(__pyx_k_474), 0, 0, 0, 0},
  {&__pyx_kp_b_475, __pyx_k_475, sizeof(__pyx_k_475), 0, 0, 0, 0},
  {&__pyx_kp_b_476, __pyx_k_476, sizeof(__pyx_k_476), 0, 0, 0, 0},
  {&__pyx_kp_b_477, __pyx_k_477, sizeof(__pyx_k_477), 0, 0, 0, 0},
  {&__pyx_kp_b_478, __pyx_k_478, sizeof(__pyx_k_478), 0, 0, 0, 0},
  {&__pyx_kp_b_479, __pyx_k_479, sizeof(__pyx_k_479), 0, 0, 0, 0},
  {&__pyx_n_s_481, __pyx_k_481, sizeof(__pyx_k_481), 0, 0, 1, 1},
  {&__pyx_kp_s_482, __pyx_k_482, sizeof(__pyx_k_482), 0, 0, 1, 0},
  {&__pyx_kp_s_483, __pyx_k_483, sizeof(__pyx_k_483), 0, 0, 1, 0},
  {&__pyx_kp_s_484, __pyx_k_484, sizeof(__pyx_k_484), 0, 0, 1, 0},
  {&__pyx_kp_u_485, __pyx_k_485, sizeof(__pyx_k_485), 0, 1, 0, 0},
  {&__pyx_kp_u_487, __pyx_k_487, sizeof(__pyx_k_487), 0, 1, 0, 0},
  {&__pyx_kp_u_488, __pyx_k_488, sizeof(__pyx_k_488), 0, 1, 0, 0},
  {&__pyx_kp_s_490, __pyx_k_490, sizeof(__pyx_k_490), 0, 0, 1, 0},
  {&__pyx_kp_s_491, __pyx_k_491, sizeof(__pyx_k_491), 0, 0, 1, 0},
  {&__pyx_kp_s_492, __pyx_k_492, sizeof(__pyx_k_492), 0, 0, 1, 0},
  {&__pyx_kp_s_493, __pyx_k_493, sizeof(__pyx_k_493), 0, 0, 1, 0},
  {&__pyx_kp_u_494, __pyx_k_494, sizeof(__pyx_k_494), 0, 1, 0, 0},
  {&__pyx_kp_u_496, __pyx_k_496, sizeof(__pyx_k_496), 0, 1, 0, 0},
  {&__pyx_kp_u_498, __pyx_k_498, sizeof(__pyx_k_498), 0, 1, 0, 0},
  {&__pyx_kp_u_499, __pyx_k_499, sizeof(__pyx_k_499), 0, 1, 0, 0},
  {&__pyx_kp_b_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 0, 0},
  {&__pyx_kp_u_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 1, 0, 0},
  {&__pyx_kp_u_500, __pyx_k_500, sizeof(__pyx_k_500), 0, 1, 0, 0},
  {&__pyx_kp_u_501, __pyx_k_501, sizeof(__pyx_k_501), 0, 1, 0, 0},
  {&__pyx_kp_u_502, __pyx_k_502, sizeof(__pyx_k_502), 0, 1, 0, 0},
  {&__pyx_kp_u_503, __pyx_k_503, sizeof(__pyx_k_503), 0, 1, 0, 0},
  {&__pyx_kp_u_504, __pyx_k_504, sizeof(__pyx_k_504), 0, 1, 0, 0},
  {&__pyx_kp_u_505, __pyx_k_505, sizeof(__pyx_k_505), 0, 1, 0, 0},
  {&__pyx_kp_u_506, __pyx_k_506, sizeof(__pyx_k_506), 0, 1, 0, 0},
  {&__pyx_kp_u_507, __pyx_k_507, sizeof(__pyx_k_507), 0, 1, 0, 0},
  {&__pyx_kp_u_508, __pyx_k_508, sizeof(__pyx_k_508), 0, 1, 0, 0},
  {&__pyx_kp_u_510, __pyx_k_510, sizeof(__pyx_k_510), 0, 1, 0, 0},
  {&__pyx_kp_s_512, __pyx_k_512, sizeof(__pyx_k_512), 0, 0, 1, 0},
  {&__pyx_kp_s_513, __pyx_k_513, sizeof(__pyx_k_513), 0, 0, 1, 0},
  {&__pyx_kp_s_514, __pyx_k_514, sizeof(__pyx_k_514), 0, 0, 1, 0},
  {&__pyx_kp_s_515, __pyx_k_515, sizeof(__pyx_k_515), 0, 0, 1, 0},
  {&__pyx_kp_s_516, __pyx_k_516, sizeof(__pyx_k_516), 0, 0, 1, 0},
  {&__pyx_n_s_517, __pyx_k_517, sizeof(__pyx_k_517), 0, 0, 1, 1},
  {&__pyx_kp_s_518, __pyx_k_518, sizeof(__pyx_k_518), 0, 0, 1, 0},
  {&__pyx_kp_s_519, __pyx_k_519, sizeof(__pyx_k_519), 0, 0, 1, 0},
  {&__pyx_kp_s_520, __pyx_k_520, sizeof(__pyx_k_520), 0, 0, 1, 0},
  {&__pyx_kp_s_521, __pyx_k_521, sizeof(__pyx_k_521), 0, 0, 1, 0},
  {&__pyx_kp_s_522, __pyx_k_522, sizeof(__pyx_k_522), 0, 0, 1, 0},
  {&__pyx_kp_s_523, __pyx_k_523, sizeof(__pyx_k_523), 0, 0, 1, 0},
  {&__pyx_kp_b_524, __pyx_k_524, sizeof(__pyx_k_524), 0, 0, 0, 0},
  {&__pyx_kp_b_526, __pyx_k_526, sizeof(__pyx_k_526), 0, 0, 0, 0},
  {&__pyx_kp_s_528, __pyx_k_528, sizeof(__pyx_k_528), 0, 0, 1, 0},
  {&__pyx_kp_s_529, __pyx_k_529, sizeof(__pyx_k_529), 0, 0, 1, 0},
  {&__pyx_kp_s_530, __pyx_k_530, sizeof(__pyx_k_530), 0, 0, 1, 0},
  {&__pyx_kp_s_531, __pyx_k_531, sizeof(__pyx_k_531), 0, 0, 1, 0},
  {&__pyx_kp_s_532, __pyx_k_532, sizeof(__pyx_k_532), 0, 0, 1, 0},
  {&__pyx_kp_u_533, __pyx_k_533, sizeof(__pyx_k_533), 0, 1, 0, 0},
  {&__pyx_kp_u_534, __pyx_k_534, sizeof(__pyx_k_534), 0, 1, 0, 0},
  {&__pyx_kp_s_536, __pyx_k_536, sizeof(__pyx_k_536), 0, 0, 1, 0},
  {&__pyx_kp_s_537, __pyx_k_537, sizeof(__pyx_k_537), 0, 0, 1, 0},
  {&__pyx_kp_s_538, __pyx_k_538, sizeof(__pyx_k_538), 0, 0, 1, 0},
  {&__pyx_kp_s_539, __pyx_k_539, sizeof(__pyx_k_539), 0, 0, 1, 0},
  {&__pyx_kp_s_540, __pyx_k_540, sizeof(__pyx_k_540), 0, 0, 1, 0},
  {&__pyx_kp_s_541, __pyx_k_541, sizeof(__pyx_k_541), 0, 0, 1, 0},
  {&__pyx_kp_s_542, __pyx_k_542, sizeof(__pyx_k_542), 0, 0, 1, 0},
  {&__pyx_kp_s_543, __pyx_k_543, sizeof(__pyx_k_543), 0, 0, 1, 0},
  {&__pyx_kp_s_544, __pyx_k_544, sizeof(__pyx_k_544), 0, 0, 1, 0},
  {&__pyx_kp_s_545, __pyx_k_545, sizeof(__pyx_k_545), 0, 0, 1, 0},
  {&__pyx_kp_u_546, __pyx_k_546, sizeof(__pyx_k_546), 0, 1, 0, 0},
  {&__pyx_kp_s_548, __pyx_k_548, sizeof(__pyx_k_548), 0, 0, 1, 0},
  {&__pyx_kp_s_549, __pyx_k_549, sizeof(__pyx_k_549), 0, 0, 1, 0},
  {&__pyx_kp_u_55, __pyx_k_55, sizeof(__pyx_k_55), 0, 1, 0, 0},
  {&__pyx_kp_s_550, __pyx_k_550, sizeof(__pyx_k_550), 0, 0, 1, 0},
  {&__pyx_kp_u_551, __pyx_k_551, sizeof(__pyx_k_551), 0, 1, 0, 0},
  {&__pyx_kp_u_552, __pyx_k_552, sizeof(__pyx_k_552), 0, 1, 0, 0},
  {&__pyx_kp_u_58, __pyx_k_58, sizeof(__pyx_k_58), 0, 1, 0, 0},
  {&__pyx_kp_u_59, __pyx_k_59, sizeof(__pyx_k_59), 0, 1, 0, 0},
  {&__pyx_kp_u_60, __pyx_k_60, sizeof(__pyx_k_60), 0, 1, 0, 0},
  {&__pyx_kp_u_61, __pyx_k_61, sizeof(__pyx_k_61), 0, 1, 0, 0},
  {&__pyx_kp_u_62, __pyx_k_62, sizeof(__pyx_k_62), 0, 1, 0, 0},
  {&__pyx_kp_u_63, __pyx_k_63, sizeof(__pyx_k_63), 0, 1, 0, 0},
  {&__pyx_kp_u_64, __pyx_k_64, sizeof(__pyx_k_64), 0, 1, 0, 0},
  {&__pyx_kp_u_65, __pyx_k_65, sizeof(__pyx_k_65), 0, 1, 0, 0},
  {&__pyx_kp_u_66, __pyx_k_66, sizeof(__pyx_k_66), 0, 1, 0, 0},
  {&__pyx_kp_u_67, __pyx_k_67, sizeof(__pyx_k_67), 0, 1, 0, 0},
  {&__pyx_kp_u_68, __pyx_k_68, sizeof(__pyx_k_68), 0, 1, 0, 0},
  {&__pyx_kp_u_69, __pyx_k_69, sizeof(__pyx_k_69), 0, 1, 0, 0},
  {&__pyx_kp_u_70, __pyx_k_70, sizeof(__pyx_k_70), 0, 1, 0, 0},
  {&__pyx_kp_u_71, __pyx_k_71, sizeof(__pyx_k_71), 0, 1, 0, 0},
  {&__pyx_kp_u_72, __pyx_k_72, sizeof(__pyx_k_72), 0, 1, 0, 0},
  {&__pyx_kp_u_77, __pyx_k_77, sizeof(__pyx_k_77), 0, 1, 0, 0},
  {&__pyx_kp_u_78, __pyx_k_78, sizeof(__pyx_k_78), 0, 1, 0, 0},
  {&__pyx_n_s_79, __pyx_k_79, sizeof(__pyx_k_79), 0, 0, 1, 1},
  {&__pyx_kp_u_80, __pyx_k_80, sizeof(__pyx_k_80), 0, 1, 0, 0},
  {&__pyx_kp_u_81, __pyx_k_81, sizeof(__pyx_k_81), 0, 1, 0, 0},
  {&__pyx_kp_u_82, __pyx_k_82, sizeof(__pyx_k_82), 0, 1, 0, 0},
  {&__pyx_kp_u_83, __pyx_k_83, sizeof(__pyx_k_83), 0, 1, 0, 0},
  {&__pyx_kp_u_84, __pyx_k_84, sizeof(__pyx_k_84), 0, 1, 0, 0},
  {&__pyx_kp_u_85, __pyx_k_85, sizeof(__pyx_k_85), 0, 1, 0, 0},
  {&__pyx_n_s_86, __pyx_k_86, sizeof(__pyx_k_86), 0, 0, 1, 1},
  {&__pyx_kp_u_87, __pyx_k_87, sizeof(__pyx_k_87), 0, 1, 0, 0},
  {&__pyx_kp_u_88, __pyx_k_88, sizeof(__pyx_k_88), 0, 1, 0, 0},
  {&__pyx_kp_u_89, __pyx_k_89, sizeof(__pyx_k_89), 0, 1, 0, 0},
  {&__pyx_kp_s_94, __pyx_k_94, sizeof(__pyx_k_94), 0, 0, 1, 0},
  {&__pyx_kp_s_96, __pyx_k_96, sizeof(__pyx_k_96), 0, 0, 1, 0},
  {&__pyx_kp_s_98, __pyx_k_98, sizeof(__pyx_k_98), 0, 0, 1, 0},
  {&__pyx_n_b__A, __pyx_k__A, sizeof(__pyx_k__A), 0, 0, 0, 1},
  {&__pyx_n_u__ASCII, __pyx_k__ASCII, sizeof(__pyx_k__ASCII), 0, 1, 0, 1},
  {&__pyx_n_s__AssertionError, __pyx_k__AssertionError, sizeof(__pyx_k__AssertionError), 0, 0, 1, 1},
  {&__pyx_n_s__AttributeError, __pyx_k__AttributeError, sizeof(__pyx_k__AttributeError), 0, 0, 1, 1},
  {&__pyx_n_s__BytesIO, __pyx_k__BytesIO, sizeof(__pyx_k__BytesIO), 0, 0, 1, 1},
  {&__pyx_n_s__C14NError, __pyx_k__C14NError, sizeof(__pyx_k__C14NError), 0, 0, 1, 1},
  {&__pyx_n_s__CDATA, __pyx_k__CDATA, sizeof(__pyx_k__CDATA), 0, 0, 1, 1},
  {&__pyx_n_s__CRITICAL, __pyx_k__CRITICAL, sizeof(__pyx_k__CRITICAL), 0, 0, 1, 1},
  {&__pyx_n_s__Comment, __pyx_k__Comment, sizeof(__pyx_k__Comment), 0, 0, 1, 1},
  {&__pyx_n_s__CommentBase, __pyx_k__CommentBase, sizeof(__pyx_k__CommentBase), 0, 0, 1, 1},
  {&__pyx_n_s__DEBUG, __pyx_k__DEBUG, sizeof(__pyx_k__DEBUG), 0, 0, 1, 1},
  {&__pyx_n_s__DENY_ALL, __pyx_k__DENY_ALL, sizeof(__pyx_k__DENY_ALL), 0, 0, 1, 1},
  {&__pyx_n_s__DENY_WRITE, __pyx_k__DENY_WRITE, sizeof(__pyx_k__DENY_WRITE), 0, 0, 1, 1},
  {&__pyx_n_s__DTD, __pyx_k__DTD, sizeof(__pyx_k__DTD), 0, 0, 1, 1},
  {&__pyx_n_s__DTDError, __pyx_k__DTDError, sizeof(__pyx_k__DTDError), 0, 0, 1, 1},
  {&__pyx_n_s__DTDParseError, __pyx_k__DTDParseError, sizeof(__pyx_k__DTDParseError), 0, 0, 1, 1},
  {&__pyx_n_s__DTDValidateError, __pyx_k__DTDValidateError, sizeof(__pyx_k__DTDValidateError), 0, 0, 1, 1},
  {&__pyx_n_s__DocumentInvalid, __pyx_k__DocumentInvalid, sizeof(__pyx_k__DocumentInvalid), 0, 0, 1, 1},
  {&__pyx_n_s__ERROR, __pyx_k__ERROR, sizeof(__pyx_k__ERROR), 0, 0, 1, 1},
  {&__pyx_n_s__ETCompatXMLParser, __pyx_k__ETCompatXMLParser, sizeof(__pyx_k__ETCompatXMLParser), 0, 0, 1, 1},
  {&__pyx_n_s__ETXPath, __pyx_k__ETXPath, sizeof(__pyx_k__ETXPath), 0, 0, 1, 1},
  {&__pyx_n_s__Element, __pyx_k__Element, sizeof(__pyx_k__Element), 0, 0, 1, 1},
  {&__pyx_n_s__ElementBase, __pyx_k__ElementBase, sizeof(__pyx_k__ElementBase), 0, 0, 1, 1},
  {&__pyx_n_s__ElementClassLookup, __pyx_k__ElementClassLookup, sizeof(__pyx_k__ElementClassLookup), 0, 0, 1, 1},
  {&__pyx_n_s__ElementTree, __pyx_k__ElementTree, sizeof(__pyx_k__ElementTree), 0, 0, 1, 1},
  {&__pyx_n_s__Entity, __pyx_k__Entity, sizeof(__pyx_k__Entity), 0, 0, 1, 1},
  {&__pyx_n_s__EntityBase, __pyx_k__EntityBase, sizeof(__pyx_k__EntityBase), 0, 0, 1, 1},
  {&__pyx_n_s__Error, __pyx_k__Error, sizeof(__pyx_k__Error), 0, 0, 1, 1},
  {&__pyx_n_s__ErrorDomains, __pyx_k__ErrorDomains, sizeof(__pyx_k__ErrorDomains), 0, 0, 1, 1},
  {&__pyx_n_s__ErrorLevels, __pyx_k__ErrorLevels, sizeof(__pyx_k__ErrorLevels), 0, 0, 1, 1},
  {&__pyx_n_s__ErrorTypes, __pyx_k__ErrorTypes, sizeof(__pyx_k__ErrorTypes), 0, 0, 1, 1},
  {&__pyx_n_s__Exception, __pyx_k__Exception, sizeof(__pyx_k__Exception), 0, 0, 1, 1},
  {&__pyx_n_s__Extension, __pyx_k__Extension, sizeof(__pyx_k__Extension), 0, 0, 1, 1},
  {&__pyx_n_s__ExternalID, __pyx_k__ExternalID, sizeof(__pyx_k__ExternalID), 0, 0, 1, 1},
  {&__pyx_n_s__FATAL, __pyx_k__FATAL, sizeof(__pyx_k__FATAL), 0, 0, 1, 1},
  {&__pyx_n_s__FunctionNamespace, __pyx_k__FunctionNamespace, sizeof(__pyx_k__FunctionNamespace), 0, 0, 1, 1},
  {&__pyx_n_s__FutureWarning, __pyx_k__FutureWarning, sizeof(__pyx_k__FutureWarning), 0, 0, 1, 1},
  {&__pyx_n_s__GzipFile, __pyx_k__GzipFile, sizeof(__pyx_k__GzipFile), 0, 0, 1, 1},
  {&__pyx_n_s__HTML, __pyx_k__HTML, sizeof(__pyx_k__HTML), 0, 0, 1, 1},
  {&__pyx_n_s__HTMLParser, __pyx_k__HTMLParser, sizeof(__pyx_k__HTMLParser), 0, 0, 1, 1},
  {&__pyx_n_s__IGNORECASE, __pyx_k__IGNORECASE, sizeof(__pyx_k__IGNORECASE), 0, 0, 1, 1},
  {&__pyx_n_s__IOError, __pyx_k__IOError, sizeof(__pyx_k__IOError), 0, 0, 1, 1},
  {&__pyx_n_s__ImportError, __pyx_k__ImportError, sizeof(__pyx_k__ImportError), 0, 0, 1, 1},
  {&__pyx_n_s__IndexError, __pyx_k__IndexError, sizeof(__pyx_k__IndexError), 0, 0, 1, 1},
  {&__pyx_n_s__KeyError, __pyx_k__KeyError, sizeof(__pyx_k__KeyError), 0, 0, 1, 1},
  {&__pyx_n_s__LIBXML_VERSION, __pyx_k__LIBXML_VERSION, sizeof(__pyx_k__LIBXML_VERSION), 0, 0, 1, 1},
  {&__pyx_n_s__LIBXSLT_VERSION, __pyx_k__LIBXSLT_VERSION, sizeof(__pyx_k__LIBXSLT_VERSION), 0, 0, 1, 1},
  {&__pyx_n_s__LXML_VERSION, __pyx_k__LXML_VERSION, sizeof(__pyx_k__LXML_VERSION), 0, 0, 1, 1},
  {&__pyx_n_s__LookupError, __pyx_k__LookupError, sizeof(__pyx_k__LookupError), 0, 0, 1, 1},
  {&__pyx_n_s__LxmlError, __pyx_k__LxmlError, sizeof(__pyx_k__LxmlError), 0, 0, 1, 1},
  {&__pyx_n_s__LxmlRegistryError, __pyx_k__LxmlRegistryError, sizeof(__pyx_k__LxmlRegistryError), 0, 0, 1, 1},
  {&__pyx_n_s__LxmlSyntaxError, __pyx_k__LxmlSyntaxError, sizeof(__pyx_k__LxmlSyntaxError), 0, 0, 1, 1},
  {&__pyx_n_s__NAMESPACE, __pyx_k__NAMESPACE, sizeof(__pyx_k__NAMESPACE), 0, 0, 1, 1},
  {&__pyx_n_s__NotImplementedError, __pyx_k__NotImplementedError, sizeof(__pyx_k__NotImplementedError), 0, 0, 1, 1},
  {&__pyx_n_s__PARSER, __pyx_k__PARSER, sizeof(__pyx_k__PARSER), 0, 0, 1, 1},
  {&__pyx_n_s__PI, __pyx_k__PI, sizeof(__pyx_k__PI), 0, 0, 1, 1},
  {&__pyx_n_u__PI, __pyx_k__PI, sizeof(__pyx_k__PI), 0, 1, 0, 1},
  {&__pyx_n_s__PIBase, __pyx_k__PIBase, sizeof(__pyx_k__PIBase), 0, 0, 1, 1},
  {&__pyx_n_s__ParseError, __pyx_k__ParseError, sizeof(__pyx_k__ParseError), 0, 0, 1, 1},
  {&__pyx_n_s__ParserError, __pyx_k__ParserError, sizeof(__pyx_k__ParserError), 0, 0, 1, 1},
  {&__pyx_n_s__PyErrorLog, __pyx_k__PyErrorLog, sizeof(__pyx_k__PyErrorLog), 0, 0, 1, 1},
  {&__pyx_n_s__QName, __pyx_k__QName, sizeof(__pyx_k__QName), 0, 0, 1, 1},
  {&__pyx_n_s__RELAXNGV, __pyx_k__RELAXNGV, sizeof(__pyx_k__RELAXNGV), 0, 0, 1, 1},
  {&__pyx_n_s__RelaxNG, __pyx_k__RelaxNG, sizeof(__pyx_k__RelaxNG), 0, 0, 1, 1},
  {&__pyx_n_s__RelaxNGError, __pyx_k__RelaxNGError, sizeof(__pyx_k__RelaxNGError), 0, 0, 1, 1},
  {&__pyx_n_s__RelaxNGErrorTypes, __pyx_k__RelaxNGErrorTypes, sizeof(__pyx_k__RelaxNGErrorTypes), 0, 0, 1, 1},
  {&__pyx_n_s__RelaxNGParseError, __pyx_k__RelaxNGParseError, sizeof(__pyx_k__RelaxNGParseError), 0, 0, 1, 1},
  {&__pyx_n_s__Resolver, __pyx_k__Resolver, sizeof(__pyx_k__Resolver), 0, 0, 1, 1},
  {&__pyx_n_s__Schematron, __pyx_k__Schematron, sizeof(__pyx_k__Schematron), 0, 0, 1, 1},
  {&__pyx_n_s__SchematronError, __pyx_k__SchematronError, sizeof(__pyx_k__SchematronError), 0, 0, 1, 1},
  {&__pyx_n_s__SerialisationError, __pyx_k__SerialisationError, sizeof(__pyx_k__SerialisationError), 0, 0, 1, 1},
  {&__pyx_n_s__StopIteration, __pyx_k__StopIteration, sizeof(__pyx_k__StopIteration), 0, 0, 1, 1},
  {&__pyx_n_s__StringIO, __pyx_k__StringIO, sizeof(__pyx_k__StringIO), 0, 0, 1, 1},
  {&__pyx_n_s__SubElement, __pyx_k__SubElement, sizeof(__pyx_k__SubElement), 0, 0, 1, 1},
  {&__pyx_n_s__SyntaxError, __pyx_k__SyntaxError, sizeof(__pyx_k__SyntaxError), 0, 0, 1, 1},
  {&__pyx_n_s__SystemID, __pyx_k__SystemID, sizeof(__pyx_k__SystemID), 0, 0, 1, 1},
  {&__pyx_n_s__TAG, __pyx_k__TAG, sizeof(__pyx_k__TAG), 0, 0, 1, 1},
  {&__pyx_n_s__TreeBuilder, __pyx_k__TreeBuilder, sizeof(__pyx_k__TreeBuilder), 0, 0, 1, 1},
  {&__pyx_n_s__TypeError, __pyx_k__TypeError, sizeof(__pyx_k__TypeError), 0, 0, 1, 1},
  {&__pyx_n_s__U, __pyx_k__U, sizeof(__pyx_k__U), 0, 0, 1, 1},
  {&__pyx_n_s__UNICODE, __pyx_k__UNICODE, sizeof(__pyx_k__UNICODE), 0, 0, 1, 1},
  {&__pyx_n_s__URL, __pyx_k__URL, sizeof(__pyx_k__URL), 0, 0, 1, 1},
  {&__pyx_n_u__UTF8, __pyx_k__UTF8, sizeof(__pyx_k__UTF8), 0, 1, 0, 1},
  {&__pyx_n_s__UnicodeDecodeError, __pyx_k__UnicodeDecodeError, sizeof(__pyx_k__UnicodeDecodeError), 0, 0, 1, 1},
  {&__pyx_n_s__UnicodeEncodeError, __pyx_k__UnicodeEncodeError, sizeof(__pyx_k__UnicodeEncodeError), 0, 0, 1, 1},
  {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1},
  {&__pyx_n_s__WARNING, __pyx_k__WARNING, sizeof(__pyx_k__WARNING), 0, 0, 1, 1},
  {&__pyx_n_s__XInclude, __pyx_k__XInclude, sizeof(__pyx_k__XInclude), 0, 0, 1, 1},
  {&__pyx_n_s__XIncludeError, __pyx_k__XIncludeError, sizeof(__pyx_k__XIncludeError), 0, 0, 1, 1},
  {&__pyx_n_s__XML, __pyx_k__XML, sizeof(__pyx_k__XML), 0, 0, 1, 1},
  {&__pyx_n_s__XMLDTDID, __pyx_k__XMLDTDID, sizeof(__pyx_k__XMLDTDID), 0, 0, 1, 1},
  {&__pyx_n_s__XMLID, __pyx_k__XMLID, sizeof(__pyx_k__XMLID), 0, 0, 1, 1},
  {&__pyx_n_s__XMLParser, __pyx_k__XMLParser, sizeof(__pyx_k__XMLParser), 0, 0, 1, 1},
  {&__pyx_n_s__XMLSchema, __pyx_k__XMLSchema, sizeof(__pyx_k__XMLSchema), 0, 0, 1, 1},
  {&__pyx_n_s__XMLSchemaError, __pyx_k__XMLSchemaError, sizeof(__pyx_k__XMLSchemaError), 0, 0, 1, 1},
  {&__pyx_n_s__XMLSchemaParseError, __pyx_k__XMLSchemaParseError, sizeof(__pyx_k__XMLSchemaParseError), 0, 0, 1, 1},
  {&__pyx_n_s__XMLSyntaxError, __pyx_k__XMLSyntaxError, sizeof(__pyx_k__XMLSyntaxError), 0, 0, 1, 1},
  {&__pyx_n_s__XMLTreeBuilder, __pyx_k__XMLTreeBuilder, sizeof(__pyx_k__XMLTreeBuilder), 0, 0, 1, 1},
  {&__pyx_n_u__XPATH_LOCATIONSET, __pyx_k__XPATH_LOCATIONSET, sizeof(__pyx_k__XPATH_LOCATIONSET), 0, 1, 0, 1},
  {&__pyx_n_u__XPATH_POINT, __pyx_k__XPATH_POINT, sizeof(__pyx_k__XPATH_POINT), 0, 1, 0, 1},
  {&__pyx_n_u__XPATH_RANGE, __pyx_k__XPATH_RANGE, sizeof(__pyx_k__XPATH_RANGE), 0, 1, 0, 1},
  {&__pyx_n_u__XPATH_USERS, __pyx_k__XPATH_USERS, sizeof(__pyx_k__XPATH_USERS), 0, 1, 0, 1},
  {&__pyx_n_s__XPath, __pyx_k__XPath, sizeof(__pyx_k__XPath), 0, 0, 1, 1},
  {&__pyx_n_s__XPathError, __pyx_k__XPathError, sizeof(__pyx_k__XPathError), 0, 0, 1, 1},
  {&__pyx_n_s__XPathEvalError, __pyx_k__XPathEvalError, sizeof(__pyx_k__XPathEvalError), 0, 0, 1, 1},
  {&__pyx_n_s__XPathEvaluator, __pyx_k__XPathEvaluator, sizeof(__pyx_k__XPathEvaluator), 0, 0, 1, 1},
  {&__pyx_n_s__XPathFunctionError, __pyx_k__XPathFunctionError, sizeof(__pyx_k__XPathFunctionError), 0, 0, 1, 1},
  {&__pyx_n_s__XPathResultError, __pyx_k__XPathResultError, sizeof(__pyx_k__XPathResultError), 0, 0, 1, 1},
  {&__pyx_n_s__XPathSyntaxError, __pyx_k__XPathSyntaxError, sizeof(__pyx_k__XPathSyntaxError), 0, 0, 1, 1},
  {&__pyx_n_s__XSLT, __pyx_k__XSLT, sizeof(__pyx_k__XSLT), 0, 0, 1, 1},
  {&__pyx_n_s__XSLTAccessControl, __pyx_k__XSLTAccessControl, sizeof(__pyx_k__XSLTAccessControl), 0, 0, 1, 1},
  {&__pyx_n_s__XSLTApplyError, __pyx_k__XSLTApplyError, sizeof(__pyx_k__XSLTApplyError), 0, 0, 1, 1},
  {&__pyx_n_s__XSLTError, __pyx_k__XSLTError, sizeof(__pyx_k__XSLTError), 0, 0, 1, 1},
  {&__pyx_n_s__XSLTExtension, __pyx_k__XSLTExtension, sizeof(__pyx_k__XSLTExtension), 0, 0, 1, 1},
  {&__pyx_n_s__XSLTExtensionError, __pyx_k__XSLTExtensionError, sizeof(__pyx_k__XSLTExtensionError), 0, 0, 1, 1},
  {&__pyx_n_s__XSLTParseError, __pyx_k__XSLTParseError, sizeof(__pyx_k__XSLTParseError), 0, 0, 1, 1},
  {&__pyx_n_s__XSLTSaveError, __pyx_k__XSLTSaveError, sizeof(__pyx_k__XSLTSaveError), 0, 0, 1, 1},
  {&__pyx_n_u___, __pyx_k___, sizeof(__pyx_k___), 0, 1, 0, 1},
  {&__pyx_n_u___GlobalErrorLog, __pyx_k___GlobalErrorLog, sizeof(__pyx_k___GlobalErrorLog), 0, 1, 0, 1},
  {&__pyx_n_s___TargetParserResult, __pyx_k___TargetParserResult, sizeof(__pyx_k___TargetParserResult), 0, 0, 1, 1},
  {&__pyx_n_s____all__, __pyx_k____all__, sizeof(__pyx_k____all__), 0, 0, 1, 1},
  {&__pyx_n_s____builtin__, __pyx_k____builtin__, sizeof(__pyx_k____builtin__), 0, 0, 1, 1},
  {&__pyx_n_s____class__, __pyx_k____class__, sizeof(__pyx_k____class__), 0, 0, 1, 1},
  {&__pyx_n_s____copy__, __pyx_k____copy__, sizeof(__pyx_k____copy__), 0, 0, 1, 1},
  {&__pyx_n_u____dict__, __pyx_k____dict__, sizeof(__pyx_k____dict__), 0, 1, 0, 1},
  {&__pyx_n_s____docformat__, __pyx_k____docformat__, sizeof(__pyx_k____docformat__), 0, 0, 1, 1},
  {&__pyx_n_s____getattribute__, __pyx_k____getattribute__, sizeof(__pyx_k____getattribute__), 0, 0, 1, 1},
  {&__pyx_n_s____hash__, __pyx_k____hash__, sizeof(__pyx_k____hash__), 0, 0, 1, 1},
  {&__pyx_n_s____init__, __pyx_k____init__, sizeof(__pyx_k____init__), 0, 0, 1, 1},
  {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
  {&__pyx_n_s____name__, __pyx_k____name__, sizeof(__pyx_k____name__), 0, 0, 1, 1},
  {&__pyx_n_s____next__, __pyx_k____next__, sizeof(__pyx_k____next__), 0, 0, 1, 1},
  {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
  {&__pyx_n_s____unicode__, __pyx_k____unicode__, sizeof(__pyx_k____unicode__), 0, 0, 1, 1},
  {&__pyx_n_s____version__, __pyx_k____version__, sizeof(__pyx_k____version__), 0, 0, 1, 1},
  {&__pyx_n_s___accepted_domains, __pyx_k___accepted_domains, sizeof(__pyx_k___accepted_domains), 0, 0, 1, 1},
  {&__pyx_n_s___access_control, __pyx_k___access_control, sizeof(__pyx_k___access_control), 0, 0, 1, 1},
  {&__pyx_n_s___append_log_message, __pyx_k___append_log_message, sizeof(__pyx_k___append_log_message), 0, 0, 1, 1},
  {&__pyx_n_s___assertHasRoot, __pyx_k___assertHasRoot, sizeof(__pyx_k___assertHasRoot), 0, 0, 1, 1},
  {&__pyx_n_s___assertNode, __pyx_k___assertNode, sizeof(__pyx_k___assertNode), 0, 0, 1, 1},
  {&__pyx_n_s___assureDocGetsFreed, __pyx_k___assureDocGetsFreed, sizeof(__pyx_k___assureDocGetsFreed), 0, 0, 1, 1},
  {&__pyx_n_s___buffer, __pyx_k___buffer, sizeof(__pyx_k___buffer), 0, 0, 1, 1},
  {&__pyx_n_s___buffer_len, __pyx_k___buffer_len, sizeof(__pyx_k___buffer_len), 0, 0, 1, 1},
  {&__pyx_n_s___buffer_refcnt, __pyx_k___buffer_refcnt, sizeof(__pyx_k___buffer_refcnt), 0, 0, 1, 1},
  {&__pyx_n_s___build_items, __pyx_k___build_items, sizeof(__pyx_k___build_items), 0, 0, 1, 1},
  {&__pyx_n_s___build_keys, __pyx_k___build_keys, sizeof(__pyx_k___build_keys), 0, 0, 1, 1},
  {&__pyx_n_s___bytes, __pyx_k___bytes, sizeof(__pyx_k___bytes), 0, 0, 1, 1},
  {&__pyx_n_s___bytes_read, __pyx_k___bytes_read, sizeof(__pyx_k___bytes_read), 0, 0, 1, 1},
  {&__pyx_n_s___c_attr, __pyx_k___c_attr, sizeof(__pyx_k___c_attr), 0, 0, 1, 1},
  {&__pyx_n_s___c_ctxt, __pyx_k___c_ctxt, sizeof(__pyx_k___c_ctxt), 0, 0, 1, 1},
  {&__pyx_n_s___c_dict, __pyx_k___c_dict, sizeof(__pyx_k___c_dict), 0, 0, 1, 1},
  {&__pyx_n_s___c_doc, __pyx_k___c_doc, sizeof(__pyx_k___c_doc), 0, 0, 1, 1},
  {&__pyx_n_s___c_dtd, __pyx_k___c_dtd, sizeof(__pyx_k___c_dtd), 0, 0, 1, 1},
  {&__pyx_n_s___c_name, __pyx_k___c_name, sizeof(__pyx_k___c_name), 0, 0, 1, 1},
  {&__pyx_n_s___c_node, __pyx_k___c_node, sizeof(__pyx_k___c_node), 0, 0, 1, 1},
  {&__pyx_n_s___c_ns, __pyx_k___c_ns, sizeof(__pyx_k___c_ns), 0, 0, 1, 1},
  {&__pyx_n_s___c_ns_uri_utf, __pyx_k___c_ns_uri_utf, sizeof(__pyx_k___c_ns_uri_utf), 0, 0, 1, 1},
  {&__pyx_n_s___c_schema, __pyx_k___c_schema, sizeof(__pyx_k___c_schema), 0, 0, 1, 1},
  {&__pyx_n_s___c_schema_doc, __pyx_k___c_schema_doc, sizeof(__pyx_k___c_schema_doc), 0, 0, 1, 1},
  {&__pyx_n_s___c_style, __pyx_k___c_style, sizeof(__pyx_k___c_style), 0, 0, 1, 1},
  {&__pyx_n_s___c_style_doc, __pyx_k___c_style_doc, sizeof(__pyx_k___c_style_doc), 0, 0, 1, 1},
  {&__pyx_n_s___c_url, __pyx_k___c_url, sizeof(__pyx_k___c_url), 0, 0, 1, 1},
  {&__pyx_n_s___class_lookup, __pyx_k___class_lookup, sizeof(__pyx_k___class_lookup), 0, 0, 1, 1},
  {&__pyx_n_s___class_mapping, __pyx_k___class_mapping, sizeof(__pyx_k___class_mapping), 0, 0, 1, 1},
  {&__pyx_n_s___cleanup_context, __pyx_k___cleanup_context, sizeof(__pyx_k___cleanup_context), 0, 0, 1, 1},
  {&__pyx_n_s___clear_error_log, __pyx_k___clear_error_log, sizeof(__pyx_k___clear_error_log), 0, 0, 1, 1},
  {&__pyx_n_s___close_file, __pyx_k___close_file, sizeof(__pyx_k___close_file), 0, 0, 1, 1},
  {&__pyx_n_s___close_filelike, __pyx_k___close_filelike, sizeof(__pyx_k___close_filelike), 0, 0, 1, 1},
  {&__pyx_n_s___close_source, __pyx_k___close_source, sizeof(__pyx_k___close_source), 0, 0, 1, 1},
  {&__pyx_n_s___compile, __pyx_k___compile, sizeof(__pyx_k___compile), 0, 0, 1, 1},
  {&__pyx_n_s___compile_map, __pyx_k___compile_map, sizeof(__pyx_k___compile_map), 0, 0, 1, 1},
  {&__pyx_n_s___context, __pyx_k___context, sizeof(__pyx_k___context), 0, 0, 1, 1},
  {&__pyx_n_s___context_node, __pyx_k___context_node, sizeof(__pyx_k___context_node), 0, 0, 1, 1},
  {&__pyx_n_s___copy, __pyx_k___copy, sizeof(__pyx_k___copy), 0, 0, 1, 1},
  {&__pyx_n_s___createContext, __pyx_k___createContext, sizeof(__pyx_k___createContext), 0, 0, 1, 1},
  {&__pyx_n_s___createOutputBuffer, __pyx_k___createOutputBuffer, sizeof(__pyx_k___createOutputBuffer), 0, 0, 1, 1},
  {&__pyx_n_s___createParserInput, __pyx_k___createParserInput, sizeof(__pyx_k___createParserInput), 0, 0, 1, 1},
  {&__pyx_n_s___data, __pyx_k___data, sizeof(__pyx_k___data), 0, 0, 1, 1},
  {&__pyx_n_s___data_bytes, __pyx_k___data_bytes, sizeof(__pyx_k___data_bytes), 0, 0, 1, 1},
  {&__pyx_n_s___default_encoding, __pyx_k___default_encoding, sizeof(__pyx_k___default_encoding), 0, 0, 1, 1},
  {&__pyx_n_s___default_parser, __pyx_k___default_parser, sizeof(__pyx_k___default_parser), 0, 0, 1, 1},
  {&__pyx_n_s___default_resolver, __pyx_k___default_resolver, sizeof(__pyx_k___default_resolver), 0, 0, 1, 1},
  {&__pyx_n_s___dependent_proxies, __pyx_k___dependent_proxies, sizeof(__pyx_k___dependent_proxies), 0, 0, 1, 1},
  {&__pyx_n_s___doc, __pyx_k___doc, sizeof(__pyx_k___doc), 0, 0, 1, 1},
  {&__pyx_n_s___element, __pyx_k___element, sizeof(__pyx_k___element), 0, 0, 1, 1},
  {&__pyx_n_s___element_stack, __pyx_k___element_stack, sizeof(__pyx_k___element_stack), 0, 0, 1, 1},
  {&__pyx_n_s___element_stack_pop, __pyx_k___element_stack_pop, sizeof(__pyx_k___element_stack_pop), 0, 0, 1, 1},
  {&__pyx_n_s___elementpath, __pyx_k___elementpath, sizeof(__pyx_k___elementpath), 0, 0, 1, 1},
  {&__pyx_n_s___encoding, __pyx_k___encoding, sizeof(__pyx_k___encoding), 0, 0, 1, 1},
  {&__pyx_n_s___end_node, __pyx_k___end_node, sizeof(__pyx_k___end_node), 0, 0, 1, 1},
  {&__pyx_n_s___entries, __pyx_k___entries, sizeof(__pyx_k___entries), 0, 0, 1, 1},
  {&__pyx_n_s___error_log, __pyx_k___error_log, sizeof(__pyx_k___error_log), 0, 0, 1, 1},
  {&__pyx_n_s___etree_or_element, __pyx_k___etree_or_element, sizeof(__pyx_k___etree_or_element), 0, 0, 1, 1},
  {&__pyx_n_s___eval_arg, __pyx_k___eval_arg, sizeof(__pyx_k___eval_arg), 0, 0, 1, 1},
  {&__pyx_n_s___eval_context_dict, __pyx_k___eval_context_dict, sizeof(__pyx_k___eval_context_dict), 0, 0, 1, 1},
  {&__pyx_n_s___eval_lock, __pyx_k___eval_lock, sizeof(__pyx_k___eval_lock), 0, 0, 1, 1},
  {&__pyx_n_s___event_filter, __pyx_k___event_filter, sizeof(__pyx_k___event_filter), 0, 0, 1, 1},
  {&__pyx_n_s___event_index, __pyx_k___event_index, sizeof(__pyx_k___event_index), 0, 0, 1, 1},
  {&__pyx_n_s___events, __pyx_k___events, sizeof(__pyx_k___events), 0, 0, 1, 1},
  {&__pyx_n_s___exc, __pyx_k___exc, sizeof(__pyx_k___exc), 0, 0, 1, 1},
  {&__pyx_n_s___exc_context, __pyx_k___exc_context, sizeof(__pyx_k___exc_context), 0, 0, 1, 1},
  {&__pyx_n_s___exc_info, __pyx_k___exc_info, sizeof(__pyx_k___exc_info), 0, 0, 1, 1},
  {&__pyx_n_s___extension_elements, __pyx_k___extension_elements, sizeof(__pyx_k___extension_elements), 0, 0, 1, 1},
  {&__pyx_n_s___extensions, __pyx_k___extensions, sizeof(__pyx_k___extensions), 0, 0, 1, 1},
  {&__pyx_n_s___factory, __pyx_k___factory, sizeof(__pyx_k___factory), 0, 0, 1, 1},
  {&__pyx_n_s___fallback_function, __pyx_k___fallback_function, sizeof(__pyx_k___fallback_function), 0, 0, 1, 1},
  {&__pyx_n_s___file, __pyx_k___file, sizeof(__pyx_k___file), 0, 0, 1, 1},
  {&__pyx_n_s___filelike, __pyx_k___filelike, sizeof(__pyx_k___filelike), 0, 0, 1, 1},
  {&__pyx_n_s___filename, __pyx_k___filename, sizeof(__pyx_k___filename), 0, 0, 1, 1},
  {&__pyx_n_s___findOrBuildNodeNs, __pyx_k___findOrBuildNodeNs, sizeof(__pyx_k___findOrBuildNodeNs), 0, 0, 1, 1},
  {&__pyx_n_s___first_error, __pyx_k___first_error, sizeof(__pyx_k___first_error), 0, 0, 1, 1},
  {&__pyx_n_s___flush, __pyx_k___flush, sizeof(__pyx_k___flush), 0, 0, 1, 1},
  {&__pyx_n_s___for_html, __pyx_k___for_html, sizeof(__pyx_k___for_html), 0, 0, 1, 1},
  {&__pyx_n_s___free_after_use, __pyx_k___free_after_use, sizeof(__pyx_k___free_after_use), 0, 0, 1, 1},
  {&__pyx_n_s___function_cache, __pyx_k___function_cache, sizeof(__pyx_k___function_cache), 0, 0, 1, 1},
  {&__pyx_n_s___gc_doc, __pyx_k___gc_doc, sizeof(__pyx_k___gc_doc), 0, 0, 1, 1},
  {&__pyx_n_s___get, __pyx_k___get, sizeof(__pyx_k___get), 0, 0, 1, 1},
  {&__pyx_n_s___getName, __pyx_k___getName, sizeof(__pyx_k___getName), 0, 0, 1, 1},
  {&__pyx_n_s___getParserContext, __pyx_k___getParserContext, sizeof(__pyx_k___getParserContext), 0, 0, 1, 1},
  {&__pyx_n_s___getThreadDict, __pyx_k___getThreadDict, sizeof(__pyx_k___getThreadDict), 0, 0, 1, 1},
  {&__pyx_n_s___global_namespaces, __pyx_k___global_namespaces, sizeof(__pyx_k___global_namespaces), 0, 0, 1, 1},
  {&__pyx_n_s___handleParseResult, __pyx_k___handleParseResult, sizeof(__pyx_k___handleParseResult), 0, 0, 1, 1},
  {&__pyx_n_s___handleSaxComment, __pyx_k___handleSaxComment, sizeof(__pyx_k___handleSaxComment), 0, 0, 1, 1},
  {&__pyx_n_s___handleSaxData, __pyx_k___handleSaxData, sizeof(__pyx_k___handleSaxData), 0, 0, 1, 1},
  {&__pyx_n_s___handleSaxDoctype, __pyx_k___handleSaxDoctype, sizeof(__pyx_k___handleSaxDoctype), 0, 0, 1, 1},
  {&__pyx_n_s___handleSaxEnd, __pyx_k___handleSaxEnd, sizeof(__pyx_k___handleSaxEnd), 0, 0, 1, 1},
  {&__pyx_n_s___handleSaxException, __pyx_k___handleSaxException, sizeof(__pyx_k___handleSaxException), 0, 0, 1, 1},
  {&__pyx_n_s___handleSaxPi, __pyx_k___handleSaxPi, sizeof(__pyx_k___handleSaxPi), 0, 0, 1, 1},
  {&__pyx_n_s___handleSaxStart, __pyx_k___handleSaxStart, sizeof(__pyx_k___handleSaxStart), 0, 0, 1, 1},
  {&__pyx_n_s___handle_result, __pyx_k___handle_result, sizeof(__pyx_k___handle_result), 0, 0, 1, 1},
  {&__pyx_n_s___has_raised, __pyx_k___has_raised, sizeof(__pyx_k___has_raised), 0, 0, 1, 1},
  {&__pyx_n_s___hold, __pyx_k___hold, sizeof(__pyx_k___hold), 0, 0, 1, 1},
  {&__pyx_n_s___href, __pyx_k___href, sizeof(__pyx_k___href), 0, 0, 1, 1},
  {&__pyx_n_s___in_tail, __pyx_k___in_tail, sizeof(__pyx_k___in_tail), 0, 0, 1, 1},
  {&__pyx_n_s___index, __pyx_k___index, sizeof(__pyx_k___index), 0, 0, 1, 1},
  {&__pyx_n_s___init, __pyx_k___init, sizeof(__pyx_k___init), 0, 0, 1, 1},
  {&__pyx_n_s___initParserContext, __pyx_k___initParserContext, sizeof(__pyx_k___initParserContext), 0, 0, 1, 1},
  {&__pyx_n_s___initTagMatch, __pyx_k___initTagMatch, sizeof(__pyx_k___initTagMatch), 0, 0, 1, 1},
  {&__pyx_n_s___input, __pyx_k___input, sizeof(__pyx_k___input), 0, 0, 1, 1},
  {&__pyx_n_s___items, __pyx_k___items, sizeof(__pyx_k___items), 0, 0, 1, 1},
  {&__pyx_n_s___keys, __pyx_k___keys, sizeof(__pyx_k___keys), 0, 0, 1, 1},
  {&__pyx_n_s___keysvalues, __pyx_k___keysvalues, sizeof(__pyx_k___keysvalues), 0, 0, 1, 1},
  {&__pyx_n_s___last, __pyx_k___last, sizeof(__pyx_k___last), 0, 0, 1, 1},
  {&__pyx_n_s___lock, __pyx_k___lock, sizeof(__pyx_k___lock), 0, 0, 1, 1},
  {&__pyx_n_s___log, __pyx_k___log, sizeof(__pyx_k___log), 0, 0, 1, 1},
  {&__pyx_n_s___lookup_function, __pyx_k___lookup_function, sizeof(__pyx_k___lookup_function), 0, 0, 1, 1},
  {&__pyx_n_s___make_string, __pyx_k___make_string, sizeof(__pyx_k___make_string), 0, 0, 1, 1},
  {&__pyx_n_s___map_level, __pyx_k___map_level, sizeof(__pyx_k___map_level), 0, 0, 1, 1},
  {&__pyx_n_s___max_len, __pyx_k___max_len, sizeof(__pyx_k___max_len), 0, 0, 1, 1},
  {&__pyx_n_s___name, __pyx_k___name, sizeof(__pyx_k___name), 0, 0, 1, 1},
  {&__pyx_n_s___names, __pyx_k___names, sizeof(__pyx_k___names), 0, 0, 1, 1},
  {&__pyx_n_s___namespaces, __pyx_k___namespaces, sizeof(__pyx_k___namespaces), 0, 0, 1, 1},
  {&__pyx_n_s___newParserCtxt, __pyx_k___newParserCtxt, sizeof(__pyx_k___newParserCtxt), 0, 0, 1, 1},
  {&__pyx_n_s___newPushParserCtxt, __pyx_k___newPushParserCtxt, sizeof(__pyx_k___newPushParserCtxt), 0, 0, 1, 1},
  {&__pyx_n_s___newSaxValidator, __pyx_k___newSaxValidator, sizeof(__pyx_k___newSaxValidator), 0, 0, 1, 1},
  {&__pyx_n_s___nextEvent, __pyx_k___nextEvent, sizeof(__pyx_k___nextEvent), 0, 0, 1, 1},
  {&__pyx_n_s___nextNodeAnyTag, __pyx_k___nextNodeAnyTag, sizeof(__pyx_k___nextNodeAnyTag), 0, 0, 1, 1},
  {&__pyx_n_s___nextNodeMatchTag, __pyx_k___nextNodeMatchTag, sizeof(__pyx_k___nextNodeMatchTag), 0, 0, 1, 1},
  {&__pyx_n_s___next_element, __pyx_k___next_element, sizeof(__pyx_k___next_element), 0, 0, 1, 1},
  {&__pyx_n_s___next_node, __pyx_k___next_node, sizeof(__pyx_k___next_node), 0, 0, 1, 1},
  {&__pyx_n_s___node, __pyx_k___node, sizeof(__pyx_k___node), 0, 0, 1, 1},
  {&__pyx_n_s___node_stack, __pyx_k___node_stack, sizeof(__pyx_k___node_stack), 0, 0, 1, 1},
  {&__pyx_n_s___node_type, __pyx_k___node_type, sizeof(__pyx_k___node_type), 0, 0, 1, 1},
  {&__pyx_n_s___ns_counter, __pyx_k___ns_counter, sizeof(__pyx_k___ns_counter), 0, 0, 1, 1},
  {&__pyx_n_s___ns_stack, __pyx_k___ns_stack, sizeof(__pyx_k___ns_stack), 0, 0, 1, 1},
  {&__pyx_n_s___ns_uri, __pyx_k___ns_uri, sizeof(__pyx_k___ns_uri), 0, 0, 1, 1},
  {&__pyx_n_s___ns_uri_utf, __pyx_k___ns_uri_utf, sizeof(__pyx_k___ns_uri_utf), 0, 0, 1, 1},
  {&__pyx_n_s___nsextract_path, __pyx_k___nsextract_path, sizeof(__pyx_k___nsextract_path), 0, 0, 1, 1},
  {&__pyx_n_s___optval, __pyx_k___optval, sizeof(__pyx_k___optval), 0, 0, 1, 1},
  {&__pyx_n_s___origSaxCData, __pyx_k___origSaxCData, sizeof(__pyx_k___origSaxCData), 0, 0, 1, 1},
  {&__pyx_n_s___origSaxComment, __pyx_k___origSaxComment, sizeof(__pyx_k___origSaxComment), 0, 0, 1, 1},
  {&__pyx_n_s___origSaxData, __pyx_k___origSaxData, sizeof(__pyx_k___origSaxData), 0, 0, 1, 1},
  {&__pyx_n_s___origSaxDoctype, __pyx_k___origSaxDoctype, sizeof(__pyx_k___origSaxDoctype), 0, 0, 1, 1},
  {&__pyx_n_s___origSaxEnd, __pyx_k___origSaxEnd, sizeof(__pyx_k___origSaxEnd), 0, 0, 1, 1},
  {&__pyx_n_s___origSaxEndNoNs, __pyx_k___origSaxEndNoNs, sizeof(__pyx_k___origSaxEndNoNs), 0, 0, 1, 1},
  {&__pyx_n_s___origSaxPI, __pyx_k___origSaxPI, sizeof(__pyx_k___origSaxPI), 0, 0, 1, 1},
  {&__pyx_n_s___origSaxPi, __pyx_k___origSaxPi, sizeof(__pyx_k___origSaxPi), 0, 0, 1, 1},
  {&__pyx_n_s___origSaxStart, __pyx_k___origSaxStart, sizeof(__pyx_k___origSaxStart), 0, 0, 1, 1},
  {&__pyx_n_s___origSaxStartNoNs, __pyx_k___origSaxStartNoNs, sizeof(__pyx_k___origSaxStartNoNs), 0, 0, 1, 1},
  {&__pyx_n_s___parent, __pyx_k___parent, sizeof(__pyx_k___parent), 0, 0, 1, 1},
  {&__pyx_n_s___parseDoc, __pyx_k___parseDoc, sizeof(__pyx_k___parseDoc), 0, 0, 1, 1},
  {&__pyx_n_s___parseDocFromFile, __pyx_k___parseDocFromFile, sizeof(__pyx_k___parseDocFromFile), 0, 0, 1, 1},
  {&__pyx_n_s___parseUnicodeDoc, __pyx_k___parseUnicodeDoc, sizeof(__pyx_k___parseUnicodeDoc), 0, 0, 1, 1},
  {&__pyx_n_s___parse_chunk, __pyx_k___parse_chunk, sizeof(__pyx_k___parse_chunk), 0, 0, 1, 1},
  {&__pyx_n_s___parse_options, __pyx_k___parse_options, sizeof(__pyx_k___parse_options), 0, 0, 1, 1},
  {&__pyx_n_s___parser, __pyx_k___parser, sizeof(__pyx_k___parser), 0, 0, 1, 1},
  {&__pyx_n_s___parser_context, __pyx_k___parser_context, sizeof(__pyx_k___parser_context), 0, 0, 1, 1},
  {&__pyx_n_s___path, __pyx_k___path, sizeof(__pyx_k___path), 0, 0, 1, 1},
  {&__pyx_n_s___pop_event, __pyx_k___pop_event, sizeof(__pyx_k___pop_event), 0, 0, 1, 1},
  {&__pyx_n_s___pop_node, __pyx_k___pop_node, sizeof(__pyx_k___pop_node), 0, 0, 1, 1},
  {&__pyx_n_s___pop_ns, __pyx_k___pop_ns, sizeof(__pyx_k___pop_ns), 0, 0, 1, 1},
  {&__pyx_n_s___prefix, __pyx_k___prefix, sizeof(__pyx_k___prefix), 0, 0, 1, 1},
  {&__pyx_n_s___prefix_tail, __pyx_k___prefix_tail, sizeof(__pyx_k___prefix_tail), 0, 0, 1, 1},
  {&__pyx_n_s___prefix_utf, __pyx_k___prefix_utf, sizeof(__pyx_k___prefix_utf), 0, 0, 1, 1},
  {&__pyx_n_s___prefs, __pyx_k___prefs, sizeof(__pyx_k___prefs), 0, 0, 1, 1},
  {&__pyx_n_s___private, __pyx_k___private, sizeof(__pyx_k___private), 0, 0, 1, 1},
  {&__pyx_n_s___profile, __pyx_k___profile, sizeof(__pyx_k___profile), 0, 0, 1, 1},
  {&__pyx_n_s___pystrings, __pyx_k___pystrings, sizeof(__pyx_k___pystrings), 0, 0, 1, 1},
  {&__pyx_n_s___pytag, __pyx_k___pytag, sizeof(__pyx_k___pytag), 0, 0, 1, 1},
  {&__pyx_n_s___python_target, __pyx_k___python_target, sizeof(__pyx_k___python_target), 0, 0, 1, 1},
  {&__pyx_n_s___raiseImmutable, __pyx_k___raiseImmutable, sizeof(__pyx_k___raiseImmutable), 0, 0, 1, 1},
  {&__pyx_n_s___raise_eval_error, __pyx_k___raise_eval_error, sizeof(__pyx_k___raise_eval_error), 0, 0, 1, 1},
  {&__pyx_n_s___raise_if_stored, __pyx_k___raise_if_stored, sizeof(__pyx_k___raise_if_stored), 0, 0, 1, 1},
  {&__pyx_n_s___raise_parse_error, __pyx_k___raise_parse_error, sizeof(__pyx_k___raise_parse_error), 0, 0, 1, 1},
  {&__pyx_n_s___readDoc, __pyx_k___readDoc, sizeof(__pyx_k___readDoc), 0, 0, 1, 1},
  {&__pyx_n_s___readDtd, __pyx_k___readDtd, sizeof(__pyx_k___readDtd), 0, 0, 1, 1},
  {&__pyx_n_s___read_more_events, __pyx_k___read_more_events, sizeof(__pyx_k___read_more_events), 0, 0, 1, 1},
  {&__pyx_n_s___receive, __pyx_k___receive, sizeof(__pyx_k___receive), 0, 0, 1, 1},
  {&__pyx_n_s___receiveGeneric, __pyx_k___receiveGeneric, sizeof(__pyx_k___receiveGeneric), 0, 0, 1, 1},
  {&__pyx_n_s___register_context, __pyx_k___register_context, sizeof(__pyx_k___register_context), 0, 0, 1, 1},
  {&__pyx_n_s___release_context, __pyx_k___release_context, sizeof(__pyx_k___release_context), 0, 0, 1, 1},
  {&__pyx_n_s___release_temp_refs, __pyx_k___release_temp_refs, sizeof(__pyx_k___release_temp_refs), 0, 0, 1, 1},
  {&__pyx_n_s___remove_comments, __pyx_k___remove_comments, sizeof(__pyx_k___remove_comments), 0, 0, 1, 1},
  {&__pyx_n_s___remove_pis, __pyx_k___remove_pis, sizeof(__pyx_k___remove_pis), 0, 0, 1, 1},
  {&__pyx_n_s___resetParserContext, __pyx_k___resetParserContext, sizeof(__pyx_k___resetParserContext), 0, 0, 1, 1},
  {&__pyx_n_s___resolvers, __pyx_k___resolvers, sizeof(__pyx_k___resolvers), 0, 0, 1, 1},
  {&__pyx_n_s___root, __pyx_k___root, sizeof(__pyx_k___root), 0, 0, 1, 1},
  {&__pyx_n_s___run_transform, __pyx_k___run_transform, sizeof(__pyx_k___run_transform), 0, 0, 1, 1},
  {&__pyx_n_s___sax_event_filter, __pyx_k___sax_event_filter, sizeof(__pyx_k___sax_event_filter), 0, 0, 1, 1},
  {&__pyx_n_s___sax_plug, __pyx_k___sax_plug, sizeof(__pyx_k___sax_plug), 0, 0, 1, 1},
  {&__pyx_n_s___schema, __pyx_k___schema, sizeof(__pyx_k___schema), 0, 0, 1, 1},
  {&__pyx_n_s___setAccess, __pyx_k___setAccess, sizeof(__pyx_k___setAccess), 0, 0, 1, 1},
  {&__pyx_n_s___setError, __pyx_k___setError, sizeof(__pyx_k___setError), 0, 0, 1, 1},
  {&__pyx_n_s___setEventFilter, __pyx_k___setEventFilter, sizeof(__pyx_k___setEventFilter), 0, 0, 1, 1},
  {&__pyx_n_s___setFallback, __pyx_k___setFallback, sizeof(__pyx_k___setFallback), 0, 0, 1, 1},
  {&__pyx_n_s___setGeneric, __pyx_k___setGeneric, sizeof(__pyx_k___setGeneric), 0, 0, 1, 1},
  {&__pyx_n_s___setNodeNs, __pyx_k___setNodeNs, sizeof(__pyx_k___setNodeNs), 0, 0, 1, 1},
  {&__pyx_n_s___setSaxParserTarget, __pyx_k___setSaxParserTarget, sizeof(__pyx_k___setSaxParserTarget), 0, 0, 1, 1},
  {&__pyx_n_s___setTagFilter, __pyx_k___setTagFilter, sizeof(__pyx_k___setTagFilter), 0, 0, 1, 1},
  {&__pyx_n_s___setTarget, __pyx_k___setTarget, sizeof(__pyx_k___setTarget), 0, 0, 1, 1},
  {&__pyx_n_s___set_xpath_context, __pyx_k___set_xpath_context, sizeof(__pyx_k___set_xpath_context), 0, 0, 1, 1},
  {&__pyx_n_s___setupDict, __pyx_k___setupDict, sizeof(__pyx_k___setupDict), 0, 0, 1, 1},
  {&__pyx_n_s___source, __pyx_k___source, sizeof(__pyx_k___source), 0, 0, 1, 1},
  {&__pyx_n_s___source_proxy, __pyx_k___source_proxy, sizeof(__pyx_k___source_proxy), 0, 0, 1, 1},
  {&__pyx_n_s___start_element, __pyx_k___start_element, sizeof(__pyx_k___start_element), 0, 0, 1, 1},
  {&__pyx_n_s___start_node, __pyx_k___start_node, sizeof(__pyx_k___start_node), 0, 0, 1, 1},
  {&__pyx_n_s___start_takes_nsmap, __pyx_k___start_takes_nsmap, sizeof(__pyx_k___start_takes_nsmap), 0, 0, 1, 1},
  {&__pyx_n_s___storage, __pyx_k___storage, sizeof(__pyx_k___storage), 0, 0, 1, 1},
  {&__pyx_n_s___storeNext, __pyx_k___storeNext, sizeof(__pyx_k___storeNext), 0, 0, 1, 1},
  {&__pyx_n_s___store_exception, __pyx_k___store_exception, sizeof(__pyx_k___store_exception), 0, 0, 1, 1},
  {&__pyx_n_s___store_raised, __pyx_k___store_raised, sizeof(__pyx_k___store_raised), 0, 0, 1, 1},
  {&__pyx_n_s___strip_cdata, __pyx_k___strip_cdata, sizeof(__pyx_k___strip_cdata), 0, 0, 1, 1},
  {&__pyx_n_s___tag, __pyx_k___tag, sizeof(__pyx_k___tag), 0, 0, 1, 1},
  {&__pyx_n_s___tag_href, __pyx_k___tag_href, sizeof(__pyx_k___tag_href), 0, 0, 1, 1},
  {&__pyx_n_s___tag_name, __pyx_k___tag_name, sizeof(__pyx_k___tag_name), 0, 0, 1, 1},
  {&__pyx_n_s___tag_tuple, __pyx_k___tag_tuple, sizeof(__pyx_k___tag_tuple), 0, 0, 1, 1},
  {&__pyx_n_s___target, __pyx_k___target, sizeof(__pyx_k___target), 0, 0, 1, 1},
  {&__pyx_n_s___target_comment, __pyx_k___target_comment, sizeof(__pyx_k___target_comment), 0, 0, 1, 1},
  {&__pyx_n_s___target_data, __pyx_k___target_data, sizeof(__pyx_k___target_data), 0, 0, 1, 1},
  {&__pyx_n_s___target_doctype, __pyx_k___target_doctype, sizeof(__pyx_k___target_doctype), 0, 0, 1, 1},
  {&__pyx_n_s___target_end, __pyx_k___target_end, sizeof(__pyx_k___target_end), 0, 0, 1, 1},
  {&__pyx_n_s___target_pi, __pyx_k___target_pi, sizeof(__pyx_k___target_pi), 0, 0, 1, 1},
  {&__pyx_n_s___target_start, __pyx_k___target_start, sizeof(__pyx_k___target_start), 0, 0, 1, 1},
  {&__pyx_n_s___temp_documents, __pyx_k___temp_documents, sizeof(__pyx_k___temp_documents), 0, 0, 1, 1},
  {&__pyx_n_s___temp_refs, __pyx_k___temp_refs, sizeof(__pyx_k___temp_refs), 0, 0, 1, 1},
  {&__pyx_n_s___to_utf, __pyx_k___to_utf, sizeof(__pyx_k___to_utf), 0, 0, 1, 1},
  {&__pyx_n_s___top_node, __pyx_k___top_node, sizeof(__pyx_k___top_node), 0, 0, 1, 1},
  {&__pyx_n_s___type, __pyx_k___type, sizeof(__pyx_k___type), 0, 0, 1, 1},
  {&__pyx_n_s___unlock, __pyx_k___unlock, sizeof(__pyx_k___unlock), 0, 0, 1, 1},
  {&__pyx_n_s___url, __pyx_k___url, sizeof(__pyx_k___url), 0, 0, 1, 1},
  {&__pyx_n_s___utf8_data, __pyx_k___utf8_data, sizeof(__pyx_k___utf8_data), 0, 0, 1, 1},
  {&__pyx_n_s___utf_refs, __pyx_k___utf_refs, sizeof(__pyx_k___utf_refs), 0, 0, 1, 1},
  {&__pyx_n_s___valid_ctxt, __pyx_k___valid_ctxt, sizeof(__pyx_k___valid_ctxt), 0, 0, 1, 1},
  {&__pyx_n_s___validator, __pyx_k___validator, sizeof(__pyx_k___validator), 0, 0, 1, 1},
  {&__pyx_n_s___variables, __pyx_k___variables, sizeof(__pyx_k___variables), 0, 0, 1, 1},
  {&__pyx_n_s___xpath, __pyx_k___xpath, sizeof(__pyx_k___xpath), 0, 0, 1, 1},
  {&__pyx_n_s___xpathCtxt, __pyx_k___xpathCtxt, sizeof(__pyx_k___xpathCtxt), 0, 0, 1, 1},
  {&__pyx_n_s___xslt, __pyx_k___xslt, sizeof(__pyx_k___xslt), 0, 0, 1, 1},
  {&__pyx_n_s___xsltCtxt, __pyx_k___xsltCtxt, sizeof(__pyx_k___xsltCtxt), 0, 0, 1, 1},
  {&__pyx_n_s__abspath, __pyx_k__abspath, sizeof(__pyx_k__abspath), 0, 0, 1, 1},
  {&__pyx_n_s__access_control, __pyx_k__access_control, sizeof(__pyx_k__access_control), 0, 0, 1, 1},
  {&__pyx_n_s__add, __pyx_k__add, sizeof(__pyx_k__add), 0, 0, 1, 1},
  {&__pyx_n_s__addNamespace, __pyx_k__addNamespace, sizeof(__pyx_k__addNamespace), 0, 0, 1, 1},
  {&__pyx_n_u__alpha, __pyx_k__alpha, sizeof(__pyx_k__alpha), 0, 1, 0, 1},
  {&__pyx_n_s__append, __pyx_k__append, sizeof(__pyx_k__append), 0, 0, 1, 1},
  {&__pyx_n_b__ascii, __pyx_k__ascii, sizeof(__pyx_k__ascii), 0, 0, 0, 1},
  {&__pyx_n_s__attr, __pyx_k__attr, sizeof(__pyx_k__attr), 0, 0, 1, 1},
  {&__pyx_n_s__attrib, __pyx_k__attrib, sizeof(__pyx_k__attrib), 0, 0, 1, 1},
  {&__pyx_n_s__attribute_defaults, __pyx_k__attribute_defaults, sizeof(__pyx_k__attribute_defaults), 0, 0, 1, 1},
  {&__pyx_n_s__attribute_name, __pyx_k__attribute_name, sizeof(__pyx_k__attribute_name), 0, 0, 1, 1},
  {&__pyx_n_s__attributes, __pyx_k__attributes, sizeof(__pyx_k__attributes), 0, 0, 1, 1},
  {&__pyx_n_s__attrname, __pyx_k__attrname, sizeof(__pyx_k__attrname), 0, 0, 1, 1},
  {&__pyx_n_s__attrs, __pyx_k__attrs, sizeof(__pyx_k__attrs), 0, 0, 1, 1},
  {&__pyx_n_s__backslashreplace, __pyx_k__backslashreplace, sizeof(__pyx_k__backslashreplace), 0, 0, 1, 1},
  {&__pyx_n_s__base, __pyx_k__base, sizeof(__pyx_k__base), 0, 0, 1, 1},
  {&__pyx_n_s__base_url, __pyx_k__base_url, sizeof(__pyx_k__base_url), 0, 0, 1, 1},
  {&__pyx_n_u__beta, __pyx_k__beta, sizeof(__pyx_k__beta), 0, 1, 0, 1},
  {&__pyx_n_s__boolval, __pyx_k__boolval, sizeof(__pyx_k__boolval), 0, 0, 1, 1},
  {&__pyx_n_s__buf, __pyx_k__buf, sizeof(__pyx_k__buf), 0, 0, 1, 1},
  {&__pyx_n_s__buffer, __pyx_k__buffer, sizeof(__pyx_k__buffer), 0, 0, 1, 1},
  {&__pyx_n_s__buildNewPrefix, __pyx_k__buildNewPrefix, sizeof(__pyx_k__buildNewPrefix), 0, 0, 1, 1},
  {&__pyx_n_s__build_smart_strings, __pyx_k__build_smart_strings, sizeof(__pyx_k__build_smart_strings), 0, 0, 1, 1},
  {&__pyx_n_s__builtins, __pyx_k__builtins, sizeof(__pyx_k__builtins), 0, 0, 1, 1},
  {&__pyx_n_s__c14n, __pyx_k__c14n, sizeof(__pyx_k__c14n), 0, 0, 1, 1},
  {&__pyx_n_s__cdataBlock, __pyx_k__cdataBlock, sizeof(__pyx_k__cdataBlock), 0, 0, 1, 1},
  {&__pyx_n_s__characters, __pyx_k__characters, sizeof(__pyx_k__characters), 0, 0, 1, 1},
  {&__pyx_n_s__child, __pyx_k__child, sizeof(__pyx_k__child), 0, 0, 1, 1},
  {&__pyx_n_s__children, __pyx_k__children, sizeof(__pyx_k__children), 0, 0, 1, 1},
  {&__pyx_n_s__class_mapping, __pyx_k__class_mapping, sizeof(__pyx_k__class_mapping), 0, 0, 1, 1},
  {&__pyx_n_s__cleanup, __pyx_k__cleanup, sizeof(__pyx_k__cleanup), 0, 0, 1, 1},
  {&__pyx_n_s__cleanup_namespaces, __pyx_k__cleanup_namespaces, sizeof(__pyx_k__cleanup_namespaces), 0, 0, 1, 1},
  {&__pyx_n_s__clear, __pyx_k__clear, sizeof(__pyx_k__clear), 0, 0, 1, 1},
  {&__pyx_n_s__clear_error_log, __pyx_k__clear_error_log, sizeof(__pyx_k__clear_error_log), 0, 0, 1, 1},
  {&__pyx_n_s__close, __pyx_k__close, sizeof(__pyx_k__close), 0, 0, 1, 1},
  {&__pyx_n_s__code, __pyx_k__code, sizeof(__pyx_k__code), 0, 0, 1, 1},
  {&__pyx_n_s__column, __pyx_k__column, sizeof(__pyx_k__column), 0, 0, 1, 1},
  {&__pyx_n_s__comment, __pyx_k__comment, sizeof(__pyx_k__comment), 0, 0, 1, 1},
  {&__pyx_n_u__comment, __pyx_k__comment, sizeof(__pyx_k__comment), 0, 1, 0, 1},
  {&__pyx_n_s__comment_class, __pyx_k__comment_class, sizeof(__pyx_k__comment_class), 0, 0, 1, 1},
  {&__pyx_n_s__compact, __pyx_k__compact, sizeof(__pyx_k__compact), 0, 0, 1, 1},
  {&__pyx_n_s__compile, __pyx_k__compile, sizeof(__pyx_k__compile), 0, 0, 1, 1},
  {&__pyx_n_s__compression, __pyx_k__compression, sizeof(__pyx_k__compression), 0, 0, 1, 1},
  {&__pyx_n_s__compresslevel, __pyx_k__compresslevel, sizeof(__pyx_k__compresslevel), 0, 0, 1, 1},
  {&__pyx_n_s__connect, __pyx_k__connect, sizeof(__pyx_k__connect), 0, 0, 1, 1},
  {&__pyx_n_s__content, __pyx_k__content, sizeof(__pyx_k__content), 0, 0, 1, 1},
  {&__pyx_n_s__context, __pyx_k__context, sizeof(__pyx_k__context), 0, 0, 1, 1},
  {&__pyx_n_s__conv, __pyx_k__conv, sizeof(__pyx_k__conv), 0, 0, 1, 1},
  {&__pyx_n_s__copy, __pyx_k__copy, sizeof(__pyx_k__copy), 0, 0, 1, 1},
  {&__pyx_n_s__copyToBuffer, __pyx_k__copyToBuffer, sizeof(__pyx_k__copyToBuffer), 0, 0, 1, 1},
  {&__pyx_n_s__create_dir, __pyx_k__create_dir, sizeof(__pyx_k__create_dir), 0, 0, 1, 1},
  {&__pyx_n_u__create_dir, __pyx_k__create_dir, sizeof(__pyx_k__create_dir), 0, 1, 0, 1},
  {&__pyx_n_s__ctxt, __pyx_k__ctxt, sizeof(__pyx_k__ctxt), 0, 0, 1, 1},
  {&__pyx_n_s__cur, __pyx_k__cur, sizeof(__pyx_k__cur), 0, 0, 1, 1},
  {&__pyx_n_s__data, __pyx_k__data, sizeof(__pyx_k__data), 0, 0, 1, 1},
  {&__pyx_n_b__dc, __pyx_k__dc, sizeof(__pyx_k__dc), 0, 0, 0, 1},
  {&__pyx_n_s__decode, __pyx_k__decode, sizeof(__pyx_k__decode), 0, 0, 1, 1},
  {&__pyx_n_s__default, __pyx_k__default, sizeof(__pyx_k__default), 0, 0, 1, 1},
  {&__pyx_n_s__default_resolver, __pyx_k__default_resolver, sizeof(__pyx_k__default_resolver), 0, 0, 1, 1},
  {&__pyx_n_u__dev, __pyx_k__dev, sizeof(__pyx_k__dev), 0, 1, 0, 1},
  {&__pyx_n_s__dict, __pyx_k__dict, sizeof(__pyx_k__dict), 0, 0, 1, 1},
  {&__pyx_n_s__disableSAX, __pyx_k__disableSAX, sizeof(__pyx_k__disableSAX), 0, 0, 1, 1},
  {&__pyx_n_s__discard, __pyx_k__discard, sizeof(__pyx_k__discard), 0, 0, 1, 1},
  {&__pyx_n_s__disconnect, __pyx_k__disconnect, sizeof(__pyx_k__disconnect), 0, 0, 1, 1},
  {&__pyx_n_s__doc, __pyx_k__doc, sizeof(__pyx_k__doc), 0, 0, 1, 1},
  {&__pyx_n_s__docstring, __pyx_k__docstring, sizeof(__pyx_k__docstring), 0, 0, 1, 1},
  {&__pyx_n_s__doctype, __pyx_k__doctype, sizeof(__pyx_k__doctype), 0, 0, 1, 1},
  {&__pyx_n_s__domain, __pyx_k__domain, sizeof(__pyx_k__domain), 0, 0, 1, 1},
  {&__pyx_n_s__domain_name, __pyx_k__domain_name, sizeof(__pyx_k__domain_name), 0, 0, 1, 1},
  {&__pyx_n_s__domains, __pyx_k__domains, sizeof(__pyx_k__domains), 0, 0, 1, 1},
  {&__pyx_n_s__dtd_validation, __pyx_k__dtd_validation, sizeof(__pyx_k__dtd_validation), 0, 0, 1, 1},
  {&__pyx_n_s__dump, __pyx_k__dump, sizeof(__pyx_k__dump), 0, 0, 1, 1},
  {&__pyx_n_s__elem, __pyx_k__elem, sizeof(__pyx_k__elem), 0, 0, 1, 1},
  {&__pyx_n_s__element, __pyx_k__element, sizeof(__pyx_k__element), 0, 0, 1, 1},
  {&__pyx_n_u__element, __pyx_k__element, sizeof(__pyx_k__element), 0, 1, 0, 1},
  {&__pyx_n_s__element_class, __pyx_k__element_class, sizeof(__pyx_k__element_class), 0, 0, 1, 1},
  {&__pyx_n_s__element_factory, __pyx_k__element_factory, sizeof(__pyx_k__element_factory), 0, 0, 1, 1},
  {&__pyx_n_s__element_or_tree, __pyx_k__element_or_tree, sizeof(__pyx_k__element_or_tree), 0, 0, 1, 1},
  {&__pyx_n_s__elements, __pyx_k__elements, sizeof(__pyx_k__elements), 0, 0, 1, 1},
  {&__pyx_n_s__enable_regexp, __pyx_k__enable_regexp, sizeof(__pyx_k__enable_regexp), 0, 0, 1, 1},
  {&__pyx_n_s__encode, __pyx_k__encode, sizeof(__pyx_k__encode), 0, 0, 1, 1},
  {&__pyx_n_s__encoding, __pyx_k__encoding, sizeof(__pyx_k__encoding), 0, 0, 1, 1},
  {&__pyx_n_s__end, __pyx_k__end, sizeof(__pyx_k__end), 0, 0, 1, 1},
  {&__pyx_n_u__end, __pyx_k__end, sizeof(__pyx_k__end), 0, 1, 0, 1},
  {&__pyx_n_s__endElement, __pyx_k__endElement, sizeof(__pyx_k__endElement), 0, 0, 1, 1},
  {&__pyx_n_s__endElementNs, __pyx_k__endElementNs, sizeof(__pyx_k__endElementNs), 0, 0, 1, 1},
  {&__pyx_n_s__endNode, __pyx_k__endNode, sizeof(__pyx_k__endNode), 0, 0, 1, 1},
  {&__pyx_n_s__entities, __pyx_k__entities, sizeof(__pyx_k__entities), 0, 0, 1, 1},
  {&__pyx_n_s__entity, __pyx_k__entity, sizeof(__pyx_k__entity), 0, 0, 1, 1},
  {&__pyx_n_u__entity, __pyx_k__entity, sizeof(__pyx_k__entity), 0, 1, 0, 1},
  {&__pyx_n_s__entity_class, __pyx_k__entity_class, sizeof(__pyx_k__entity_class), 0, 0, 1, 1},
  {&__pyx_n_s__entries, __pyx_k__entries, sizeof(__pyx_k__entries), 0, 0, 1, 1},
  {&__pyx_n_s__enumerate, __pyx_k__enumerate, sizeof(__pyx_k__enumerate), 0, 0, 1, 1},
  {&__pyx_n_s__errNo, __pyx_k__errNo, sizeof(__pyx_k__errNo), 0, 0, 1, 1},
  {&__pyx_n_s__error, __pyx_k__error, sizeof(__pyx_k__error), 0, 0, 1, 1},
  {&__pyx_n_s__error_log, __pyx_k__error_log, sizeof(__pyx_k__error_log), 0, 0, 1, 1},
  {&__pyx_n_s__etree, __pyx_k__etree, sizeof(__pyx_k__etree), 0, 0, 1, 1},
  {&__pyx_n_s__etree_or_element, __pyx_k__etree_or_element, sizeof(__pyx_k__etree_or_element), 0, 0, 1, 1},
  {&__pyx_n_s__events, __pyx_k__events, sizeof(__pyx_k__events), 0, 0, 1, 1},
  {&__pyx_n_s__exc_context, __pyx_k__exc_context, sizeof(__pyx_k__exc_context), 0, 0, 1, 1},
  {&__pyx_n_s__exc_info, __pyx_k__exc_info, sizeof(__pyx_k__exc_info), 0, 0, 1, 1},
  {&__pyx_n_s__exclusive, __pyx_k__exclusive, sizeof(__pyx_k__exclusive), 0, 0, 1, 1},
  {&__pyx_n_s__execute, __pyx_k__execute, sizeof(__pyx_k__execute), 0, 0, 1, 1},
  {&__pyx_n_s__extSubset, __pyx_k__extSubset, sizeof(__pyx_k__extSubset), 0, 0, 1, 1},
  {&__pyx_n_s__extend, __pyx_k__extend, sizeof(__pyx_k__extend), 0, 0, 1, 1},
  {&__pyx_n_s__extensions, __pyx_k__extensions, sizeof(__pyx_k__extensions), 0, 0, 1, 1},
  {&__pyx_n_s__external_id, __pyx_k__external_id, sizeof(__pyx_k__external_id), 0, 0, 1, 1},
  {&__pyx_n_s__f, __pyx_k__f, sizeof(__pyx_k__f), 0, 0, 1, 1},
  {&__pyx_n_s__fallback, __pyx_k__fallback, sizeof(__pyx_k__fallback), 0, 0, 1, 1},
  {&__pyx_n_s__feed, __pyx_k__feed, sizeof(__pyx_k__feed), 0, 0, 1, 1},
  {&__pyx_n_s__file, __pyx_k__file, sizeof(__pyx_k__file), 0, 0, 1, 1},
  {&__pyx_n_s__filelike, __pyx_k__filelike, sizeof(__pyx_k__filelike), 0, 0, 1, 1},
  {&__pyx_n_s__filename, __pyx_k__filename, sizeof(__pyx_k__filename), 0, 0, 1, 1},
  {&__pyx_n_s__fileobj, __pyx_k__fileobj, sizeof(__pyx_k__fileobj), 0, 0, 1, 1},
  {&__pyx_n_s__filter_from_errors, __pyx_k__filter_from_errors, sizeof(__pyx_k__filter_from_errors), 0, 0, 1, 1},
  {&__pyx_n_s__filter_from_level, __pyx_k__filter_from_level, sizeof(__pyx_k__filter_from_level), 0, 0, 1, 1},
  {&__pyx_n_s__filter_types, __pyx_k__filter_types, sizeof(__pyx_k__filter_types), 0, 0, 1, 1},
  {&__pyx_n_s__find, __pyx_k__find, sizeof(__pyx_k__find), 0, 0, 1, 1},
  {&__pyx_n_s__findImpliedContext, __pyx_k__findImpliedContext, sizeof(__pyx_k__findImpliedContext), 0, 0, 1, 1},
  {&__pyx_n_s__findall, __pyx_k__findall, sizeof(__pyx_k__findall), 0, 0, 1, 1},
  {&__pyx_n_s__findtext, __pyx_k__findtext, sizeof(__pyx_k__findtext), 0, 0, 1, 1},
  {&__pyx_n_s__first_error, __pyx_k__first_error, sizeof(__pyx_k__first_error), 0, 0, 1, 1},
  {&__pyx_n_s__flags, __pyx_k__flags, sizeof(__pyx_k__flags), 0, 0, 1, 1},
  {&__pyx_n_s__floatval, __pyx_k__floatval, sizeof(__pyx_k__floatval), 0, 0, 1, 1},
  {&__pyx_n_s__for_html, __pyx_k__for_html, sizeof(__pyx_k__for_html), 0, 0, 1, 1},
  {&__pyx_n_s__format, __pyx_k__format, sizeof(__pyx_k__format), 0, 0, 1, 1},
  {&__pyx_n_s__free_after_use, __pyx_k__free_after_use, sizeof(__pyx_k__free_after_use), 0, 0, 1, 1},
  {&__pyx_n_s__free_context, __pyx_k__free_context, sizeof(__pyx_k__free_context), 0, 0, 1, 1},
  {&__pyx_n_s__fromstring, __pyx_k__fromstring, sizeof(__pyx_k__fromstring), 0, 0, 1, 1},
  {&__pyx_n_s__fromstringlist, __pyx_k__fromstringlist, sizeof(__pyx_k__fromstringlist), 0, 0, 1, 1},
  {&__pyx_n_s__function, __pyx_k__function, sizeof(__pyx_k__function), 0, 0, 1, 1},
  {&__pyx_n_s__functionURI, __pyx_k__functionURI, sizeof(__pyx_k__functionURI), 0, 0, 1, 1},
  {&__pyx_n_s__function_mapping, __pyx_k__function_mapping, sizeof(__pyx_k__function_mapping), 0, 0, 1, 1},
  {&__pyx_n_u__g, __pyx_k__g, sizeof(__pyx_k__g), 0, 1, 0, 1},
  {&__pyx_n_s__get, __pyx_k__get, sizeof(__pyx_k__get), 0, 0, 1, 1},
  {&__pyx_n_s__getDefaultParser, __pyx_k__getDefaultParser, sizeof(__pyx_k__getDefaultParser), 0, 0, 1, 1},
  {&__pyx_n_s__getLogger, __pyx_k__getLogger, sizeof(__pyx_k__getLogger), 0, 0, 1, 1},
  {&__pyx_n_s__get_default_parser, __pyx_k__get_default_parser, sizeof(__pyx_k__get_default_parser), 0, 0, 1, 1},
  {&__pyx_n_s__getargspec, __pyx_k__getargspec, sizeof(__pyx_k__getargspec), 0, 0, 1, 1},
  {&__pyx_n_s__getchildren, __pyx_k__getchildren, sizeof(__pyx_k__getchildren), 0, 0, 1, 1},
  {&__pyx_n_s__getdefaultencoding, __pyx_k__getdefaultencoding, sizeof(__pyx_k__getdefaultencoding), 0, 0, 1, 1},
  {&__pyx_n_s__getdoctype, __pyx_k__getdoctype, sizeof(__pyx_k__getdoctype), 0, 0, 1, 1},
  {&__pyx_n_s__getiterator, __pyx_k__getiterator, sizeof(__pyx_k__getiterator), 0, 0, 1, 1},
  {&__pyx_n_s__getnext, __pyx_k__getnext, sizeof(__pyx_k__getnext), 0, 0, 1, 1},
  {&__pyx_n_s__getparent, __pyx_k__getparent, sizeof(__pyx_k__getparent), 0, 0, 1, 1},
  {&__pyx_n_s__getroot, __pyx_k__getroot, sizeof(__pyx_k__getroot), 0, 0, 1, 1},
  {&__pyx_n_s__geturl, __pyx_k__geturl, sizeof(__pyx_k__geturl), 0, 0, 1, 1},
  {&__pyx_n_s__getvalue, __pyx_k__getvalue, sizeof(__pyx_k__getvalue), 0, 0, 1, 1},
  {&__pyx_n_u__getvalue, __pyx_k__getvalue, sizeof(__pyx_k__getvalue), 0, 1, 0, 1},
  {&__pyx_n_s__getxmlinfo, __pyx_k__getxmlinfo, sizeof(__pyx_k__getxmlinfo), 0, 0, 1, 1},
  {&__pyx_n_s__group, __pyx_k__group, sizeof(__pyx_k__group), 0, 0, 1, 1},
  {&__pyx_n_s__groups, __pyx_k__groups, sizeof(__pyx_k__groups), 0, 0, 1, 1},
  {&__pyx_n_s__gzip, __pyx_k__gzip, sizeof(__pyx_k__gzip), 0, 0, 1, 1},
  {&__pyx_n_s__hasdoctype, __pyx_k__hasdoctype, sizeof(__pyx_k__hasdoctype), 0, 0, 1, 1},
  {&__pyx_n_s__href, __pyx_k__href, sizeof(__pyx_k__href), 0, 0, 1, 1},
  {&__pyx_n_u__href, __pyx_k__href, sizeof(__pyx_k__href), 0, 1, 0, 1},
  {&__pyx_n_b__html, __pyx_k__html, sizeof(__pyx_k__html), 0, 0, 0, 1},
  {&__pyx_n_s__html, __pyx_k__html, sizeof(__pyx_k__html), 0, 0, 1, 1},
  {&__pyx_n_u__html, __pyx_k__html, sizeof(__pyx_k__html), 0, 1, 0, 1},
  {&__pyx_n_s__huge_tree, __pyx_k__huge_tree, sizeof(__pyx_k__huge_tree), 0, 0, 1, 1},
  {&__pyx_n_u__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 1, 0, 1},
  {&__pyx_n_s__id, __pyx_k__id, sizeof(__pyx_k__id), 0, 0, 1, 1},
  {&__pyx_n_u__id, __pyx_k__id, sizeof(__pyx_k__id), 0, 1, 0, 1},
  {&__pyx_n_s__ids, __pyx_k__ids, sizeof(__pyx_k__ids), 0, 0, 1, 1},
  {&__pyx_n_s__inSubset, __pyx_k__inSubset, sizeof(__pyx_k__inSubset), 0, 0, 1, 1},
  {&__pyx_n_s__inclusive, __pyx_k__inclusive, sizeof(__pyx_k__inclusive), 0, 0, 1, 1},
  {&__pyx_n_s__index, __pyx_k__index, sizeof(__pyx_k__index), 0, 0, 1, 1},
  {&__pyx_n_s__initDocDict, __pyx_k__initDocDict, sizeof(__pyx_k__initDocDict), 0, 0, 1, 1},
  {&__pyx_n_s__initParserDict, __pyx_k__initParserDict, sizeof(__pyx_k__initParserDict), 0, 0, 1, 1},
  {&__pyx_n_s__initThreadDictRef, __pyx_k__initThreadDictRef, sizeof(__pyx_k__initThreadDictRef), 0, 0, 1, 1},
  {&__pyx_n_s__initXPathParserDict, __pyx_k__initXPathParserDict, sizeof(__pyx_k__initXPathParserDict), 0, 0, 1, 1},
  {&__pyx_n_s__initialized, __pyx_k__initialized, sizeof(__pyx_k__initialized), 0, 0, 1, 1},
  {&__pyx_n_s__input, __pyx_k__input, sizeof(__pyx_k__input), 0, 0, 1, 1},
  {&__pyx_n_s__input_node, __pyx_k__input_node, sizeof(__pyx_k__input_node), 0, 0, 1, 1},
  {&__pyx_n_s__insert, __pyx_k__insert, sizeof(__pyx_k__insert), 0, 0, 1, 1},
  {&__pyx_n_s__inspect, __pyx_k__inspect, sizeof(__pyx_k__inspect), 0, 0, 1, 1},
  {&__pyx_n_s__inst, __pyx_k__inst, sizeof(__pyx_k__inst), 0, 0, 1, 1},
  {&__pyx_n_s__int2, __pyx_k__int2, sizeof(__pyx_k__int2), 0, 0, 1, 1},
  {&__pyx_n_s__intSubset, __pyx_k__intSubset, sizeof(__pyx_k__intSubset), 0, 0, 1, 1},
  {&__pyx_n_s__internal, __pyx_k__internal, sizeof(__pyx_k__internal), 0, 0, 1, 1},
  {&__pyx_n_s__internalSubset, __pyx_k__internalSubset, sizeof(__pyx_k__internalSubset), 0, 0, 1, 1},
  {&__pyx_n_s__io, __pyx_k__io, sizeof(__pyx_k__io), 0, 0, 1, 1},
  {&__pyx_n_s__is_attribute, __pyx_k__is_attribute, sizeof(__pyx_k__is_attribute), 0, 0, 1, 1},
  {&__pyx_n_s__is_tail, __pyx_k__is_tail, sizeof(__pyx_k__is_tail), 0, 0, 1, 1},
  {&__pyx_n_s__is_text, __pyx_k__is_text, sizeof(__pyx_k__is_text), 0, 0, 1, 1},
  {&__pyx_n_s__iselement, __pyx_k__iselement, sizeof(__pyx_k__iselement), 0, 0, 1, 1},
  {&__pyx_n_s__isstandalone, __pyx_k__isstandalone, sizeof(__pyx_k__isstandalone), 0, 0, 1, 1},
  {&__pyx_n_s__isvalid, __pyx_k__isvalid, sizeof(__pyx_k__isvalid), 0, 0, 1, 1},
  {&__pyx_n_s__items, __pyx_k__items, sizeof(__pyx_k__items), 0, 0, 1, 1},
  {&__pyx_n_u__items, __pyx_k__items, sizeof(__pyx_k__items), 0, 1, 0, 1},
  {&__pyx_n_s__itemsize, __pyx_k__itemsize, sizeof(__pyx_k__itemsize), 0, 0, 1, 1},
  {&__pyx_n_s__iter, __pyx_k__iter, sizeof(__pyx_k__iter), 0, 0, 1, 1},
  {&__pyx_n_s__iterfind, __pyx_k__iterfind, sizeof(__pyx_k__iterfind), 0, 0, 1, 1},
  {&__pyx_n_s__iteritems, __pyx_k__iteritems, sizeof(__pyx_k__iteritems), 0, 0, 1, 1},
  {&__pyx_n_s__iterparse, __pyx_k__iterparse, sizeof(__pyx_k__iterparse), 0, 0, 1, 1},
  {&__pyx_n_s__iterwalk, __pyx_k__iterwalk, sizeof(__pyx_k__iterwalk), 0, 0, 1, 1},
  {&__pyx_n_s__join, __pyx_k__join, sizeof(__pyx_k__join), 0, 0, 1, 1},
  {&__pyx_n_s__key, __pyx_k__key, sizeof(__pyx_k__key), 0, 0, 1, 1},
  {&__pyx_n_s__last, __pyx_k__last, sizeof(__pyx_k__last), 0, 0, 1, 1},
  {&__pyx_n_s__lastError, __pyx_k__lastError, sizeof(__pyx_k__lastError), 0, 0, 1, 1},
  {&__pyx_n_s__last_error, __pyx_k__last_error, sizeof(__pyx_k__last_error), 0, 0, 1, 1},
  {&__pyx_n_s__len, __pyx_k__len, sizeof(__pyx_k__len), 0, 0, 1, 1},
  {&__pyx_n_s__length, __pyx_k__length, sizeof(__pyx_k__length), 0, 0, 1, 1},
  {&__pyx_n_s__level, __pyx_k__level, sizeof(__pyx_k__level), 0, 0, 1, 1},
  {&__pyx_n_s__level_map, __pyx_k__level_map, sizeof(__pyx_k__level_map), 0, 0, 1, 1},
  {&__pyx_n_s__level_name, __pyx_k__level_name, sizeof(__pyx_k__level_name), 0, 0, 1, 1},
  {&__pyx_n_s__line, __pyx_k__line, sizeof(__pyx_k__line), 0, 0, 1, 1},
  {&__pyx_n_s__load_dtd, __pyx_k__load_dtd, sizeof(__pyx_k__load_dtd), 0, 0, 1, 1},
  {&__pyx_n_s__loadsubset, __pyx_k__loadsubset, sizeof(__pyx_k__loadsubset), 0, 0, 1, 1},
  {&__pyx_n_s__localname, __pyx_k__localname, sizeof(__pyx_k__localname), 0, 0, 1, 1},
  {&__pyx_n_s__log, __pyx_k__log, sizeof(__pyx_k__log), 0, 0, 1, 1},
  {&__pyx_n_s__log_entry, __pyx_k__log_entry, sizeof(__pyx_k__log_entry), 0, 0, 1, 1},
  {&__pyx_n_s__logger, __pyx_k__logger, sizeof(__pyx_k__logger), 0, 0, 1, 1},
  {&__pyx_n_s__logger_name, __pyx_k__logger_name, sizeof(__pyx_k__logger_name), 0, 0, 1, 1},
  {&__pyx_n_s__logging, __pyx_k__logging, sizeof(__pyx_k__logging), 0, 0, 1, 1},
  {&__pyx_n_s__lookup, __pyx_k__lookup, sizeof(__pyx_k__lookup), 0, 0, 1, 1},
  {&__pyx_n_s__lower, __pyx_k__lower, sizeof(__pyx_k__lower), 0, 0, 1, 1},
  {&__pyx_n_b__match, __pyx_k__match, sizeof(__pyx_k__match), 0, 0, 0, 1},
  {&__pyx_n_s__match, __pyx_k__match, sizeof(__pyx_k__match), 0, 0, 1, 1},
  {&__pyx_n_u__match, __pyx_k__match, sizeof(__pyx_k__match), 0, 1, 0, 1},
  {&__pyx_n_u__matches, __pyx_k__matches, sizeof(__pyx_k__matches), 0, 1, 0, 1},
  {&__pyx_n_s__max_len, __pyx_k__max_len, sizeof(__pyx_k__max_len), 0, 0, 1, 1},
  {&__pyx_n_s__message, __pyx_k__message, sizeof(__pyx_k__message), 0, 0, 1, 1},
  {&__pyx_n_s__method, __pyx_k__method, sizeof(__pyx_k__method), 0, 0, 1, 1},
  {&__pyx_n_s__mode, __pyx_k__mode, sizeof(__pyx_k__mode), 0, 0, 1, 1},
  {&__pyx_n_s__module, __pyx_k__module, sizeof(__pyx_k__module), 0, 0, 1, 1},
  {&__pyx_n_s__myDoc, __pyx_k__myDoc, sizeof(__pyx_k__myDoc), 0, 0, 1, 1},
  {&__pyx_n_s__name, __pyx_k__name, sizeof(__pyx_k__name), 0, 0, 1, 1},
  {&__pyx_n_s__namespace, __pyx_k__namespace, sizeof(__pyx_k__namespace), 0, 0, 1, 1},
  {&__pyx_n_s__namespaces, __pyx_k__namespaces, sizeof(__pyx_k__namespaces), 0, 0, 1, 1},
  {&__pyx_n_s__ndim, __pyx_k__ndim, sizeof(__pyx_k__ndim), 0, 0, 1, 1},
  {&__pyx_n_s__new, __pyx_k__new, sizeof(__pyx_k__new), 0, 0, 1, 1},
  {&__pyx_n_s__new_element, __pyx_k__new_element, sizeof(__pyx_k__new_element), 0, 0, 1, 1},
  {&__pyx_n_s__next, __pyx_k__next, sizeof(__pyx_k__next), 0, 0, 1, 1},
  {&__pyx_n_s__no_network, __pyx_k__no_network, sizeof(__pyx_k__no_network), 0, 0, 1, 1},
  {&__pyx_n_s__node, __pyx_k__node, sizeof(__pyx_k__node), 0, 0, 1, 1},
  {&__pyx_n_s__nodeNr, __pyx_k__nodeNr, sizeof(__pyx_k__nodeNr), 0, 0, 1, 1},
  {&__pyx_n_s__nodeTab, __pyx_k__nodeTab, sizeof(__pyx_k__nodeTab), 0, 0, 1, 1},
  {&__pyx_n_s__nodesetval, __pyx_k__nodesetval, sizeof(__pyx_k__nodesetval), 0, 0, 1, 1},
  {&__pyx_n_s__notations, __pyx_k__notations, sizeof(__pyx_k__notations), 0, 0, 1, 1},
  {&__pyx_n_s__ns, __pyx_k__ns, sizeof(__pyx_k__ns), 0, 0, 1, 1},
  {&__pyx_n_s__nsDef, __pyx_k__nsDef, sizeof(__pyx_k__nsDef), 0, 0, 1, 1},
  {&__pyx_n_s__nsHash, __pyx_k__nsHash, sizeof(__pyx_k__nsHash), 0, 0, 1, 1},
  {&__pyx_n_s__ns_clean, __pyx_k__ns_clean, sizeof(__pyx_k__ns_clean), 0, 0, 1, 1},
  {&__pyx_n_s__ns_uri, __pyx_k__ns_uri, sizeof(__pyx_k__ns_uri), 0, 0, 1, 1},
  {&__pyx_n_s__nsmap, __pyx_k__nsmap, sizeof(__pyx_k__nsmap), 0, 0, 1, 1},
  {&__pyx_n_s__object, __pyx_k__object, sizeof(__pyx_k__object), 0, 0, 1, 1},
  {&__pyx_n_s__old, __pyx_k__old, sizeof(__pyx_k__old), 0, 0, 1, 1},
  {&__pyx_n_s__old_element, __pyx_k__old_element, sizeof(__pyx_k__old_element), 0, 0, 1, 1},
  {&__pyx_n_s__open, __pyx_k__open, sizeof(__pyx_k__open), 0, 0, 1, 1},
  {&__pyx_n_s__options, __pyx_k__options, sizeof(__pyx_k__options), 0, 0, 1, 1},
  {&__pyx_n_s__output, __pyx_k__output, sizeof(__pyx_k__output), 0, 0, 1, 1},
  {&__pyx_n_s__output_parent, __pyx_k__output_parent, sizeof(__pyx_k__output_parent), 0, 0, 1, 1},
  {&__pyx_n_s__parent, __pyx_k__parent, sizeof(__pyx_k__parent), 0, 0, 1, 1},
  {&__pyx_n_s__parse, __pyx_k__parse, sizeof(__pyx_k__parse), 0, 0, 1, 1},
  {&__pyx_n_s__parse_options, __pyx_k__parse_options, sizeof(__pyx_k__parse_options), 0, 0, 1, 1},
  {&__pyx_n_s__parseid, __pyx_k__parseid, sizeof(__pyx_k__parseid), 0, 0, 1, 1},
  {&__pyx_n_s__parser, __pyx_k__parser, sizeof(__pyx_k__parser), 0, 0, 1, 1},
  {&__pyx_n_s__path, __pyx_k__path, sizeof(__pyx_k__path), 0, 0, 1, 1},
  {&__pyx_n_s__pentities, __pyx_k__pentities, sizeof(__pyx_k__pentities), 0, 0, 1, 1},
  {&__pyx_n_s__pi, __pyx_k__pi, sizeof(__pyx_k__pi), 0, 0, 1, 1},
  {&__pyx_n_u__pi, __pyx_k__pi, sizeof(__pyx_k__pi), 0, 1, 0, 1},
  {&__pyx_n_s__pi_class, __pyx_k__pi_class, sizeof(__pyx_k__pi_class), 0, 0, 1, 1},
  {&__pyx_n_s__pop, __pyx_k__pop, sizeof(__pyx_k__pop), 0, 0, 1, 1},
  {&__pyx_n_s__popImpliedContext, __pyx_k__popImpliedContext, sizeof(__pyx_k__popImpliedContext), 0, 0, 1, 1},
  {&__pyx_n_s__position, __pyx_k__position, sizeof(__pyx_k__position), 0, 0, 1, 1},
  {&__pyx_n_s__preceding, __pyx_k__preceding, sizeof(__pyx_k__preceding), 0, 0, 1, 1},
  {&__pyx_n_s__prefix, __pyx_k__prefix, sizeof(__pyx_k__prefix), 0, 0, 1, 1},
  {&__pyx_n_s__prepare, __pyx_k__prepare, sizeof(__pyx_k__prepare), 0, 0, 1, 1},
  {&__pyx_n_s__pretty_print, __pyx_k__pretty_print, sizeof(__pyx_k__pretty_print), 0, 0, 1, 1},
  {&__pyx_n_s__prev, __pyx_k__prev, sizeof(__pyx_k__prev), 0, 0, 1, 1},
  {&__pyx_n_s__profile, __pyx_k__profile, sizeof(__pyx_k__profile), 0, 0, 1, 1},
  {&__pyx_n_s__profile_run, __pyx_k__profile_run, sizeof(__pyx_k__profile_run), 0, 0, 1, 1},
  {&__pyx_n_s__progressive, __pyx_k__progressive, sizeof(__pyx_k__progressive), 0, 0, 1, 1},
  {&__pyx_n_s__properties, __pyx_k__properties, sizeof(__pyx_k__properties), 0, 0, 1, 1},
  {&__pyx_n_s__public_id, __pyx_k__public_id, sizeof(__pyx_k__public_id), 0, 0, 1, 1},
  {&__pyx_n_s__pushEvent, __pyx_k__pushEvent, sizeof(__pyx_k__pushEvent), 0, 0, 1, 1},
  {&__pyx_n_s__pushImpliedContext, __pyx_k__pushImpliedContext, sizeof(__pyx_k__pushImpliedContext), 0, 0, 1, 1},
  {&__pyx_n_b__py, __pyx_k__py, sizeof(__pyx_k__py), 0, 0, 0, 1},
  {&__pyx_n_s__python, __pyx_k__python, sizeof(__pyx_k__python), 0, 0, 1, 1},
  {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1},
  {&__pyx_n_u__rb, __pyx_k__rb, sizeof(__pyx_k__rb), 0, 1, 0, 1},
  {&__pyx_n_b__rdf, __pyx_k__rdf, sizeof(__pyx_k__rdf), 0, 0, 0, 1},
  {&__pyx_n_s__re, __pyx_k__re, sizeof(__pyx_k__re), 0, 0, 1, 1},
  {&__pyx_n_s__read, __pyx_k__read, sizeof(__pyx_k__read), 0, 0, 1, 1},
  {&__pyx_n_u__read, __pyx_k__read, sizeof(__pyx_k__read), 0, 1, 0, 1},
  {&__pyx_n_s__read_file, __pyx_k__read_file, sizeof(__pyx_k__read_file), 0, 0, 1, 1},
  {&__pyx_n_u__read_file, __pyx_k__read_file, sizeof(__pyx_k__read_file), 0, 1, 0, 1},
  {&__pyx_n_s__read_network, __pyx_k__read_network, sizeof(__pyx_k__read_network), 0, 0, 1, 1},
  {&__pyx_n_u__read_network, __pyx_k__read_network, sizeof(__pyx_k__read_network), 0, 1, 0, 1},
  {&__pyx_n_s__readcallback, __pyx_k__readcallback, sizeof(__pyx_k__readcallback), 0, 0, 1, 1},
  {&__pyx_n_s__readonly, __pyx_k__readonly, sizeof(__pyx_k__readonly), 0, 0, 1, 1},
  {&__pyx_n_s__receive, __pyx_k__receive, sizeof(__pyx_k__receive), 0, 0, 1, 1},
  {&__pyx_n_s__recover, __pyx_k__recover, sizeof(__pyx_k__recover), 0, 0, 1, 1},
  {&__pyx_n_s__reference, __pyx_k__reference, sizeof(__pyx_k__reference), 0, 0, 1, 1},
  {&__pyx_n_s__regexp, __pyx_k__regexp, sizeof(__pyx_k__regexp), 0, 0, 1, 1},
  {&__pyx_n_s__registerVariables, __pyx_k__registerVariables, sizeof(__pyx_k__registerVariables), 0, 0, 1, 1},
  {&__pyx_n_s__register_context, __pyx_k__register_context, sizeof(__pyx_k__register_context), 0, 0, 1, 1},
  {&__pyx_n_s__register_namespace, __pyx_k__register_namespace, sizeof(__pyx_k__register_namespace), 0, 0, 1, 1},
  {&__pyx_n_s__remove, __pyx_k__remove, sizeof(__pyx_k__remove), 0, 0, 1, 1},
  {&__pyx_n_s__remove_blank_text, __pyx_k__remove_blank_text, sizeof(__pyx_k__remove_blank_text), 0, 0, 1, 1},
  {&__pyx_n_s__remove_comments, __pyx_k__remove_comments, sizeof(__pyx_k__remove_comments), 0, 0, 1, 1},
  {&__pyx_n_s__remove_pis, __pyx_k__remove_pis, sizeof(__pyx_k__remove_pis), 0, 0, 1, 1},
  {&__pyx_n_b__replace, __pyx_k__replace, sizeof(__pyx_k__replace), 0, 0, 0, 1},
  {&__pyx_n_s__replace, __pyx_k__replace, sizeof(__pyx_k__replace), 0, 0, 1, 1},
  {&__pyx_n_s__replaceEntities, __pyx_k__replaceEntities, sizeof(__pyx_k__replaceEntities), 0, 0, 1, 1},
  {&__pyx_n_s__replacement, __pyx_k__replacement, sizeof(__pyx_k__replacement), 0, 0, 1, 1},
  {&__pyx_n_s__resolve, __pyx_k__resolve, sizeof(__pyx_k__resolve), 0, 0, 1, 1},
  {&__pyx_n_s__resolve_entities, __pyx_k__resolve_entities, sizeof(__pyx_k__resolve_entities), 0, 0, 1, 1},
  {&__pyx_n_s__resolvers, __pyx_k__resolvers, sizeof(__pyx_k__resolvers), 0, 0, 1, 1},
  {&__pyx_n_s__result, __pyx_k__result, sizeof(__pyx_k__result), 0, 0, 1, 1},
  {&__pyx_n_s__reverse, __pyx_k__reverse, sizeof(__pyx_k__reverse), 0, 0, 1, 1},
  {&__pyx_n_s__reversed, __pyx_k__reversed, sizeof(__pyx_k__reversed), 0, 0, 1, 1},
  {&__pyx_n_s__rexp, __pyx_k__rexp, sizeof(__pyx_k__rexp), 0, 0, 1, 1},
  {&__pyx_n_s__root, __pyx_k__root, sizeof(__pyx_k__root), 0, 0, 1, 1},
  {&__pyx_n_s__s, __pyx_k__s, sizeof(__pyx_k__s), 0, 0, 1, 1},
  {&__pyx_n_s__sax, __pyx_k__sax, sizeof(__pyx_k__sax), 0, 0, 1, 1},
  {&__pyx_n_s__schema, __pyx_k__schema, sizeof(__pyx_k__schema), 0, 0, 1, 1},
  {&__pyx_n_s__search, __pyx_k__search, sizeof(__pyx_k__search), 0, 0, 1, 1},
  {&__pyx_n_s__self, __pyx_k__self, sizeof(__pyx_k__self), 0, 0, 1, 1},
  {&__pyx_n_s__self_node, __pyx_k__self_node, sizeof(__pyx_k__self_node), 0, 0, 1, 1},
  {&__pyx_n_s__setDefaultParser, __pyx_k__setDefaultParser, sizeof(__pyx_k__setDefaultParser), 0, 0, 1, 1},
  {&__pyx_n_s__set_context, __pyx_k__set_context, sizeof(__pyx_k__set_context), 0, 0, 1, 1},
  {&__pyx_n_s__set_default_parser, __pyx_k__set_default_parser, sizeof(__pyx_k__set_default_parser), 0, 0, 1, 1},
  {&__pyx_n_s__shape, __pyx_k__shape, sizeof(__pyx_k__shape), 0, 0, 1, 1},
  {&__pyx_n_s__size, __pyx_k__size, sizeof(__pyx_k__size), 0, 0, 1, 1},
  {&__pyx_n_s__smart_strings, __pyx_k__smart_strings, sizeof(__pyx_k__smart_strings), 0, 0, 1, 1},
  {&__pyx_n_s__sort, __pyx_k__sort, sizeof(__pyx_k__sort), 0, 0, 1, 1},
  {&__pyx_n_s__source, __pyx_k__source, sizeof(__pyx_k__source), 0, 0, 1, 1},
  {&__pyx_n_s__spaceMax, __pyx_k__spaceMax, sizeof(__pyx_k__spaceMax), 0, 0, 1, 1},
  {&__pyx_n_s__spaceTab, __pyx_k__spaceTab, sizeof(__pyx_k__spaceTab), 0, 0, 1, 1},
  {&__pyx_n_s__split, __pyx_k__split, sizeof(__pyx_k__split), 0, 0, 1, 1},
  {&__pyx_n_s__standalone, __pyx_k__standalone, sizeof(__pyx_k__standalone), 0, 0, 1, 1},
  {&__pyx_n_s__start, __pyx_k__start, sizeof(__pyx_k__start), 0, 0, 1, 1},
  {&__pyx_n_u__start, __pyx_k__start, sizeof(__pyx_k__start), 0, 1, 0, 1},
  {&__pyx_n_s__startElement, __pyx_k__startElement, sizeof(__pyx_k__startElement), 0, 0, 1, 1},
  {&__pyx_n_s__startElementNs, __pyx_k__startElementNs, sizeof(__pyx_k__startElementNs), 0, 0, 1, 1},
  {&__pyx_n_s__startNode, __pyx_k__startNode, sizeof(__pyx_k__startNode), 0, 0, 1, 1},
  {&__pyx_n_s__startswith, __pyx_k__startswith, sizeof(__pyx_k__startswith), 0, 0, 1, 1},
  {&__pyx_n_s__state, __pyx_k__state, sizeof(__pyx_k__state), 0, 0, 1, 1},
  {&__pyx_n_s__stdout, __pyx_k__stdout, sizeof(__pyx_k__stdout), 0, 0, 1, 1},
  {&__pyx_n_s__step, __pyx_k__step, sizeof(__pyx_k__step), 0, 0, 1, 1},
  {&__pyx_n_s__stop, __pyx_k__stop, sizeof(__pyx_k__stop), 0, 0, 1, 1},
  {&__pyx_n_s__str, __pyx_k__str, sizeof(__pyx_k__str), 0, 0, 1, 1},
  {&__pyx_n_s__strides, __pyx_k__strides, sizeof(__pyx_k__strides), 0, 0, 1, 1},
  {&__pyx_n_s__string, __pyx_k__string, sizeof(__pyx_k__string), 0, 0, 1, 1},
  {&__pyx_n_s__strings, __pyx_k__strings, sizeof(__pyx_k__strings), 0, 0, 1, 1},
  {&__pyx_n_s__stringval, __pyx_k__stringval, sizeof(__pyx_k__stringval), 0, 0, 1, 1},
  {&__pyx_n_s__strip, __pyx_k__strip, sizeof(__pyx_k__strip), 0, 0, 1, 1},
  {&__pyx_n_s__strip_attributes, __pyx_k__strip_attributes, sizeof(__pyx_k__strip_attributes), 0, 0, 1, 1},
  {&__pyx_n_s__strip_cdata, __pyx_k__strip_cdata, sizeof(__pyx_k__strip_cdata), 0, 0, 1, 1},
  {&__pyx_n_s__strip_elements, __pyx_k__strip_elements, sizeof(__pyx_k__strip_elements), 0, 0, 1, 1},
  {&__pyx_n_s__strip_tags, __pyx_k__strip_tags, sizeof(__pyx_k__strip_tags), 0, 0, 1, 1},
  {&__pyx_n_s__strparam, __pyx_k__strparam, sizeof(__pyx_k__strparam), 0, 0, 1, 1},
  {&__pyx_n_s__strval, __pyx_k__strval, sizeof(__pyx_k__strval), 0, 0, 1, 1},
  {&__pyx_n_s__sub, __pyx_k__sub, sizeof(__pyx_k__sub), 0, 0, 1, 1},
  {&__pyx_n_s__suboffsets, __pyx_k__suboffsets, sizeof(__pyx_k__suboffsets), 0, 0, 1, 1},
  {&__pyx_n_s__super, __pyx_k__super, sizeof(__pyx_k__super), 0, 0, 1, 1},
  {&__pyx_n_s__sys, __pyx_k__sys, sizeof(__pyx_k__sys), 0, 0, 1, 1},
  {&__pyx_n_s__system_url, __pyx_k__system_url, sizeof(__pyx_k__system_url), 0, 0, 1, 1},
  {&__pyx_n_s__tag, __pyx_k__tag, sizeof(__pyx_k__tag), 0, 0, 1, 1},
  {&__pyx_n_s__tail, __pyx_k__tail, sizeof(__pyx_k__tail), 0, 0, 1, 1},
  {&__pyx_n_s__target, __pyx_k__target, sizeof(__pyx_k__target), 0, 0, 1, 1},
  {&__pyx_n_s__tell, __pyx_k__tell, sizeof(__pyx_k__tell), 0, 0, 1, 1},
  {&__pyx_n_u__tell, __pyx_k__tell, sizeof(__pyx_k__tell), 0, 1, 0, 1},
  {&__pyx_n_b__test, __pyx_k__test, sizeof(__pyx_k__test), 0, 0, 0, 1},
  {&__pyx_n_s__test, __pyx_k__test, sizeof(__pyx_k__test), 0, 0, 1, 1},
  {&__pyx_n_s__text, __pyx_k__text, sizeof(__pyx_k__text), 0, 0, 1, 1},
  {&__pyx_n_u__text, __pyx_k__text, sizeof(__pyx_k__text), 0, 1, 0, 1},
  {&__pyx_n_s__tostring, __pyx_k__tostring, sizeof(__pyx_k__tostring), 0, 0, 1, 1},
  {&__pyx_n_s__tostringlist, __pyx_k__tostringlist, sizeof(__pyx_k__tostringlist), 0, 0, 1, 1},
  {&__pyx_n_s__tounicode, __pyx_k__tounicode, sizeof(__pyx_k__tounicode), 0, 0, 1, 1},
  {&__pyx_n_s__tree, __pyx_k__tree, sizeof(__pyx_k__tree), 0, 0, 1, 1},
  {&__pyx_n_s__tree_or_element, __pyx_k__tree_or_element, sizeof(__pyx_k__tree_or_element), 0, 0, 1, 1},
  {&__pyx_n_s__type, __pyx_k__type, sizeof(__pyx_k__type), 0, 0, 1, 1},
  {&__pyx_n_s__type_name, __pyx_k__type_name, sizeof(__pyx_k__type_name), 0, 0, 1, 1},
  {&__pyx_n_s__unicode, __pyx_k__unicode, sizeof(__pyx_k__unicode), 0, 0, 1, 1},
  {&__pyx_n_u__unknown, __pyx_k__unknown, sizeof(__pyx_k__unknown), 0, 1, 0, 1},
  {&__pyx_n_s__unregister_context, __pyx_k__unregister_context, sizeof(__pyx_k__unregister_context), 0, 0, 1, 1},
  {&__pyx_n_s__update, __pyx_k__update, sizeof(__pyx_k__update), 0, 0, 1, 1},
  {&__pyx_n_s__upper, __pyx_k__upper, sizeof(__pyx_k__upper), 0, 0, 1, 1},
  {&__pyx_n_s__uri, __pyx_k__uri, sizeof(__pyx_k__uri), 0, 0, 1, 1},
  {&__pyx_n_s__url, __pyx_k__url, sizeof(__pyx_k__url), 0, 0, 1, 1},
  {&__pyx_n_s__userData, __pyx_k__userData, sizeof(__pyx_k__userData), 0, 0, 1, 1},
  {&__pyx_n_s__validate, __pyx_k__validate, sizeof(__pyx_k__validate), 0, 0, 1, 1},
  {&__pyx_n_s__value, __pyx_k__value, sizeof(__pyx_k__value), 0, 0, 1, 1},
  {&__pyx_n_s__values, __pyx_k__values, sizeof(__pyx_k__values), 0, 0, 1, 1},
  {&__pyx_n_s__variables, __pyx_k__variables, sizeof(__pyx_k__variables), 0, 0, 1, 1},
  {&__pyx_n_s__version, __pyx_k__version, sizeof(__pyx_k__version), 0, 0, 1, 1},
  {&__pyx_n_s__warn, __pyx_k__warn, sizeof(__pyx_k__warn), 0, 0, 1, 1},
  {&__pyx_n_s__warnings, __pyx_k__warnings, sizeof(__pyx_k__warnings), 0, 0, 1, 1},
  {&__pyx_n_u__wb, __pyx_k__wb, sizeof(__pyx_k__wb), 0, 1, 0, 1},
  {&__pyx_n_s__wellFormed, __pyx_k__wellFormed, sizeof(__pyx_k__wellFormed), 0, 0, 1, 1},
  {&__pyx_n_s__with_comments, __pyx_k__with_comments, sizeof(__pyx_k__with_comments), 0, 0, 1, 1},
  {&__pyx_n_s__with_tail, __pyx_k__with_tail, sizeof(__pyx_k__with_tail), 0, 0, 1, 1},
  {&__pyx_n_s__write, __pyx_k__write, sizeof(__pyx_k__write), 0, 0, 1, 1},
  {&__pyx_n_u__write, __pyx_k__write, sizeof(__pyx_k__write), 0, 1, 0, 1},
  {&__pyx_n_s__write_file, __pyx_k__write_file, sizeof(__pyx_k__write_file), 0, 0, 1, 1},
  {&__pyx_n_u__write_file, __pyx_k__write_file, sizeof(__pyx_k__write_file), 0, 1, 0, 1},
  {&__pyx_n_s__write_network, __pyx_k__write_network, sizeof(__pyx_k__write_network), 0, 0, 1, 1},
  {&__pyx_n_u__write_network, __pyx_k__write_network, sizeof(__pyx_k__write_network), 0, 1, 0, 1},
  {&__pyx_n_b__wsdl, __pyx_k__wsdl, sizeof(__pyx_k__wsdl), 0, 0, 0, 1},
  {&__pyx_n_b__xml, __pyx_k__xml, sizeof(__pyx_k__xml), 0, 0, 0, 1},
  {&__pyx_n_u__xml, __pyx_k__xml, sizeof(__pyx_k__xml), 0, 1, 0, 1},
  {&__pyx_n_s__xml_declaration, __pyx_k__xml_declaration, sizeof(__pyx_k__xml_declaration), 0, 0, 1, 1},
  {&__pyx_n_s__xpathCtxt, __pyx_k__xpathCtxt, sizeof(__pyx_k__xpathCtxt), 0, 0, 1, 1},
  {&__pyx_n_b__xs, __pyx_k__xs, sizeof(__pyx_k__xs), 0, 0, 0, 1},
  {&__pyx_n_u__xs, __pyx_k__xs, sizeof(__pyx_k__xs), 0, 1, 0, 1},
  {&__pyx_n_b__xsi, __pyx_k__xsi, sizeof(__pyx_k__xsi), 0, 0, 0, 1},
  {&__pyx_n_b__xsl, __pyx_k__xsl, sizeof(__pyx_k__xsl), 0, 0, 0, 1},
  {&__pyx_n_u__xsl, __pyx_k__xsl, sizeof(__pyx_k__xsl), 0, 1, 0, 1},
  {&__pyx_n_s__xslt_input, __pyx_k__xslt_input, sizeof(__pyx_k__xslt_input), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_ImportError = __Pyx_GetName(__pyx_b, __pyx_n_s__ImportError); if (!__pyx_builtin_ImportError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_AttributeError = __Pyx_GetName(__pyx_b, __pyx_n_s__AttributeError); if (!__pyx_builtin_AttributeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_Exception = __Pyx_GetName(__pyx_b, __pyx_n_s__Exception); if (!__pyx_builtin_Exception) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_SyntaxError = __Pyx_GetName(__pyx_b, __pyx_n_s__SyntaxError); if (!__pyx_builtin_SyntaxError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_object = __Pyx_GetName(__pyx_b, __pyx_n_s__object); if (!__pyx_builtin_object) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_super = __Pyx_GetName(__pyx_b, __pyx_n_s__super); if (!__pyx_builtin_super) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_id = __Pyx_GetName(__pyx_b, __pyx_n_s__id); if (!__pyx_builtin_id) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_KeyError = __Pyx_GetName(__pyx_b, __pyx_n_s__KeyError); if (!__pyx_builtin_KeyError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_UnicodeEncodeError = __Pyx_GetName(__pyx_b, __pyx_n_s__UnicodeEncodeError); if (!__pyx_builtin_UnicodeEncodeError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_UnicodeDecodeError = __Pyx_GetName(__pyx_b, __pyx_n_s__UnicodeDecodeError); if (!__pyx_builtin_UnicodeDecodeError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_IndexError = __Pyx_GetName(__pyx_b, __pyx_n_s__IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_FutureWarning = __Pyx_GetName(__pyx_b, __pyx_n_s__FutureWarning); if (!__pyx_builtin_FutureWarning) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_StopIteration = __Pyx_GetName(__pyx_b, __pyx_n_s__StopIteration); if (!__pyx_builtin_StopIteration) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_IOError = __Pyx_GetName(__pyx_b, __pyx_n_s__IOError); if (!__pyx_builtin_IOError) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_LookupError = __Pyx_GetName(__pyx_b, __pyx_n_s__LookupError); if (!__pyx_builtin_LookupError) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_open = __Pyx_GetName(__pyx_b, __pyx_n_s__open); if (!__pyx_builtin_open) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_enumerate = __Pyx_GetName(__pyx_b, __pyx_n_s__enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_NotImplementedError = __Pyx_GetName(__pyx_b, __pyx_n_s__NotImplementedError); if (!__pyx_builtin_NotImplementedError) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_AssertionError = __Pyx_GetName(__pyx_b, __pyx_n_s__AssertionError); if (!__pyx_builtin_AssertionError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  return 0;
  __pyx_L1_error:;
  return -1;
}

static int __Pyx_InitCachedConstants(void) {
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants");

  /* "src/lxml/lxml.etree.pyx":154
 *     prefix_utf, uri_utf = _utf8(prefix), _utf8(uri)
 *     if _check_internal_prefix(prefix_utf):
 *         raise ValueError("Prefix format reserved for internal use")             # <<<<<<<<<<<<<<
 *     _tagValidOrRaise(prefix_utf)
 *     _uriValidOrRaise(uri_utf)
 */
  __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_2));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_1));
  PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_kp_s_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2));

  /* "src/lxml/lxml.etree.pyx":201
 * cdef __unpackDottedVersion(version):
 *     cdef list version_list = []
 *     l = (version.decode(u"ASCII").replace(u'-', u'.').split(u'.') + [0]*4)[:4]             # <<<<<<<<<<<<<<
 *     for item in l:
 *         try:
 */
  __pyx_k_tuple_3 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_3));
  __Pyx_INCREF(((PyObject *)__pyx_n_u__ASCII));
  PyTuple_SET_ITEM(__pyx_k_tuple_3, 0, ((PyObject *)__pyx_n_u__ASCII));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_u__ASCII));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_3));
  __pyx_k_tuple_6 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_6));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_4));
  PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, ((PyObject *)__pyx_kp_u_4));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_4));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_5));
  PyTuple_SET_ITEM(__pyx_k_tuple_6, 1, ((PyObject *)__pyx_kp_u_5));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6));
  __pyx_k_tuple_7 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_7));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_5));
  PyTuple_SET_ITEM(__pyx_k_tuple_7, 0, ((PyObject *)__pyx_kp_u_5));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_7));

  /* "src/lxml/lxml.etree.pyx":206
 *             item = int(item)
 *         except ValueError:
 *             if item.startswith(u'dev'):             # <<<<<<<<<<<<<<
 *                 count = item[3:]
 *                 item = -300
 */
  __pyx_k_tuple_8 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_8));
  __Pyx_INCREF(((PyObject *)__pyx_n_u__dev));
  PyTuple_SET_ITEM(__pyx_k_tuple_8, 0, ((PyObject *)__pyx_n_u__dev));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_u__dev));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8));

  /* "src/lxml/lxml.etree.pyx":209
 *                 count = item[3:]
 *                 item = -300
 *             elif item.startswith(u'alpha'):             # <<<<<<<<<<<<<<
 *                 count = item[5:]
 *                 item = -200
 */
  __pyx_k_tuple_9 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_9));
  __Pyx_INCREF(((PyObject *)__pyx_n_u__alpha));
  PyTuple_SET_ITEM(__pyx_k_tuple_9, 0, ((PyObject *)__pyx_n_u__alpha));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_u__alpha));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_9));

  /* "src/lxml/lxml.etree.pyx":212
 *                 count = item[5:]
 *                 item = -200
 *             elif item.startswith(u'beta'):             # <<<<<<<<<<<<<<
 *                 count = item[4:]
 *                 item = -100
 */
  __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_10));
  __Pyx_INCREF(((PyObject *)__pyx_n_u__beta));
  PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, ((PyObject *)__pyx_n_u__beta));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_u__beta));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":647
 *     xml_string = xml_string.strip()
 *     if xml_string[:5] == '<?xml':
 *         i = xml_string.find('?>')             # <<<<<<<<<<<<<<
 *         if i != -1:
 *             i = i + 2
 */
  __pyx_k_tuple_23 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_23)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_23));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_22));
  PyTuple_SET_ITEM(__pyx_k_tuple_23, 0, ((PyObject *)__pyx_kp_s_22));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_22));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_23));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":466
 *     except KeyError:
 *         log = (<object>thread_dict)[u"_GlobalErrorLog"] = \
 *               _RotatingErrorLog(__MAX_LOG_SIZE)             # <<<<<<<<<<<<<<
 *         return log
 * 
 */
  __pyx_k_tuple_48 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_48)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_48));
  __Pyx_INCREF(__pyx_int_100);
  PyTuple_SET_ITEM(__pyx_k_tuple_48, 0, __pyx_int_100);
  __Pyx_GIVEREF(__pyx_int_100);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_48));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":591
 *     u"Called at setup time to parse the constants and build the classes below."
 *     cdef dict reverse_dict
 *     find_constants = re.compile(ur"\s*([a-zA-Z0-9_]+)\s*=\s*([0-9]+)").findall             # <<<<<<<<<<<<<<
 *     const_defs = ((ErrorLevels,          __ERROR_LEVELS),
 *                   (ErrorDomains,         __ERROR_DOMAINS),
 */
  __pyx_k_tuple_56 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_56)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_56));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_55));
  PyTuple_SET_ITEM(__pyx_k_tuple_56, 0, ((PyObject *)__pyx_kp_u_55));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_55));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_56));

  /* "src/lxml/lxml.etree.pyx":1825
 *         if method == 'c14n':
 *             if encoding is not None:
 *                 raise ValueError("Cannot specify encoding with C14N")             # <<<<<<<<<<<<<<
 *             if xml_declaration:
 *                 raise ValueError("Cannot enable XML declaration in C14N")
 */
  __pyx_k_tuple_95 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_95)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_95));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_94));
  PyTuple_SET_ITEM(__pyx_k_tuple_95, 0, ((PyObject *)__pyx_kp_s_94));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_94));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_95));

  /* "src/lxml/lxml.etree.pyx":1827
 *                 raise ValueError("Cannot specify encoding with C14N")
 *             if xml_declaration:
 *                 raise ValueError("Cannot enable XML declaration in C14N")             # <<<<<<<<<<<<<<
 *             _tofilelikeC14N(file, self._context_node, exclusive, with_comments,
 *                             compression)
 */
  __pyx_k_tuple_97 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_97)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_97));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_96));
  PyTuple_SET_ITEM(__pyx_k_tuple_97, 0, ((PyObject *)__pyx_kp_s_96));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_96));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_97));

  /* "src/lxml/lxml.etree.pyx":1832
 *             return
 *         if not with_comments:
 *             raise ValueError("Can only discard comments in C14N serialisation")             # <<<<<<<<<<<<<<
 *         # suppress decl. in default case (purely for ElementTree compatibility)
 *         if xml_declaration is not None:
 */
  __pyx_k_tuple_99 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_99)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_99));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_98));
  PyTuple_SET_ITEM(__pyx_k_tuple_99, 0, ((PyObject *)__pyx_kp_s_98));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_98));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_99));

  /* "src/lxml/lxml.etree.pyx":2506
 *         _assertValidNode(element)
 *         if with_tail:
 *             events = (u"start", u"end")             # <<<<<<<<<<<<<<
 *         else:
 *             events = (u"start",)
 */
  __pyx_k_tuple_111 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_111)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_111));
  __Pyx_INCREF(((PyObject *)__pyx_n_u__start));
  PyTuple_SET_ITEM(__pyx_k_tuple_111, 0, ((PyObject *)__pyx_n_u__start));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_u__start));
  __Pyx_INCREF(((PyObject *)__pyx_n_u__end));
  PyTuple_SET_ITEM(__pyx_k_tuple_111, 1, ((PyObject *)__pyx_n_u__end));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_u__end));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_111));

  /* "src/lxml/lxml.etree.pyx":2508
 *             events = (u"start", u"end")
 *         else:
 *             events = (u"start",)             # <<<<<<<<<<<<<<
 *         self._start_element = element
 *         self._nextEvent = iterwalk(element, events=events, tag=tag).__next__
 */
  __pyx_k_tuple_112 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_112)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_112));
  __Pyx_INCREF(((PyObject *)__pyx_n_u__start));
  PyTuple_SET_ITEM(__pyx_k_tuple_112, 0, ((PyObject *)__pyx_n_u__start));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_u__start));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_112));

  /* "src/lxml/lxml.etree.pyx":2830
 *     if method == 'c14n':
 *         if encoding is not None:
 *             raise ValueError("Cannot specify encoding with C14N")             # <<<<<<<<<<<<<<
 *         if xml_declaration:
 *             raise ValueError("Cannot enable XML declaration in C14N")
 */
  __pyx_k_tuple_121 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_121)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_121));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_94));
  PyTuple_SET_ITEM(__pyx_k_tuple_121, 0, ((PyObject *)__pyx_kp_s_94));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_94));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_121));

  /* "src/lxml/lxml.etree.pyx":2832
 *             raise ValueError("Cannot specify encoding with C14N")
 *         if xml_declaration:
 *             raise ValueError("Cannot enable XML declaration in C14N")             # <<<<<<<<<<<<<<
 *         return _tostringC14N(element_or_tree, exclusive, with_comments)
 *     if not with_comments:
 */
  __pyx_k_tuple_122 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_122)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_122));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_96));
  PyTuple_SET_ITEM(__pyx_k_tuple_122, 0, ((PyObject *)__pyx_kp_s_96));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_96));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_122));

  /* "src/lxml/lxml.etree.pyx":2835
 *         return _tostringC14N(element_or_tree, exclusive, with_comments)
 *     if not with_comments:
 *         raise ValueError("Can only discard comments in C14N serialisation")             # <<<<<<<<<<<<<<
 *     if encoding is _unicode or (encoding is not None and encoding.upper() == 'UNICODE'):
 *         if xml_declaration:
 */
  __pyx_k_tuple_123 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_123)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_123));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_98));
  PyTuple_SET_ITEM(__pyx_k_tuple_123, 0, ((PyObject *)__pyx_kp_s_98));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_98));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_123));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":61
 *             tag = _utf8(_getattr(_getattr(self, '__class__'), '__name__'))
 *             if b'.' in tag:
 *                 tag = tag.split(b'.')[-1]             # <<<<<<<<<<<<<<
 *         try:
 *             parser = _getattr(self, 'PARSER')
 */
  __pyx_k_tuple_139 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_139)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_139));
  __Pyx_INCREF(((PyObject *)__pyx_kp_b_5));
  PyTuple_SET_ITEM(__pyx_k_tuple_139, 0, ((PyObject *)__pyx_kp_b_5));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_b_5));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_139));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":111
 *     if enchandler is NULL and c_enc is not NULL:
 *         if encoding is not None:
 *             encoding = encoding.decode(u'UTF-8')             # <<<<<<<<<<<<<<
 *         raise LookupError, u"unknown encoding: '%s'" % encoding
 *     c_buffer = tree.xmlAllocOutputBuffer(enchandler)
 */
  __pyx_k_tuple_238 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_238)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_238));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_31));
  PyTuple_SET_ITEM(__pyx_k_tuple_238, 0, ((PyObject *)__pyx_kp_u_31));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_31));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_238));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":447
 *     if enchandler is NULL:
 *         if encoding is not None:
 *             encoding = encoding.decode(u'UTF-8')             # <<<<<<<<<<<<<<
 *         raise LookupError, u"unknown encoding: '%s'" % encoding
 * 
 */
  __pyx_k_tuple_257 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_257)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_257));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_31));
  PyTuple_SET_ITEM(__pyx_k_tuple_257, 0, ((PyObject *)__pyx_kp_u_31));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_31));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_257));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":184
 *             ns_count = self._pop_ns()
 *             if ns_count > 0:
 *                 event = (u"end-ns", None)             # <<<<<<<<<<<<<<
 *                 for i from 0 <= i < ns_count:
 *                     self._events.append(event)
 */
  __pyx_k_tuple_263 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_263)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_263));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_261));
  PyTuple_SET_ITEM(__pyx_k_tuple_263, 0, ((PyObject *)__pyx_kp_u_261));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_261));
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_k_tuple_263, 1, Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_263));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":364
 *                              char* chunk, int size, int terminate) nogil
 * 
 *     def __init__(self, source, events=(u"end",), *, tag=None,             # <<<<<<<<<<<<<<
 *                  attribute_defaults=False, dtd_validation=False,
 *                  load_dtd=False, no_network=True, remove_blank_text=False,
 */
  __pyx_k_tuple_264 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_264)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_264));
  __Pyx_INCREF(((PyObject *)__pyx_n_u__end));
  PyTuple_SET_ITEM(__pyx_k_tuple_264, 0, ((PyObject *)__pyx_n_u__end));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_u__end));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_264));
  __pyx_k_tuple_277 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_277)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_277));
  __Pyx_INCREF(((PyObject *)__pyx_n_u__end));
  PyTuple_SET_ITEM(__pyx_k_tuple_277, 0, ((PyObject *)__pyx_n_u__end));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_u__end));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_277));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":496
 *         while python.PyList_GET_SIZE(context._events) == 0:
 *             if c_stream is NULL:
 *                 data = self._source.read(__ITERPARSE_CHUNK_SIZE)             # <<<<<<<<<<<<<<
 *                 if not python.PyBytes_Check(data):
 *                     self._close_source()
 */
  __pyx_k_tuple_279 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_279)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_279));
  __Pyx_INCREF(__pyx_int_32768);
  PyTuple_SET_ITEM(__pyx_k_tuple_279, 0, __pyx_int_32768);
  __Pyx_GIVEREF(__pyx_int_32768);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_279));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":553
 *     cdef char*  _tag_name
 * 
 *     def __init__(self, element_or_tree, events=(u"end",), tag=None):             # <<<<<<<<<<<<<<
 *         cdef _Element root
 *         cdef int ns_count
 */
  __pyx_k_tuple_281 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_281)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_281));
  __Pyx_INCREF(((PyObject *)__pyx_n_u__end));
  PyTuple_SET_ITEM(__pyx_k_tuple_281, 0, ((PyObject *)__pyx_n_u__end));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_u__end));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_281));
  __pyx_k_tuple_282 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_282)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_282));
  __Pyx_INCREF(((PyObject *)__pyx_n_u__end));
  PyTuple_SET_ITEM(__pyx_k_tuple_282, 0, ((PyObject *)__pyx_n_u__end));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_u__end));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_282));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":598
 *         cdef int ns_count
 *         if self._events:
 *             return self._pop_event(0)             # <<<<<<<<<<<<<<
 *         ns_count = 0
 *         # find next node
 */
  __pyx_k_tuple_283 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_283)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_283));
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_k_tuple_283, 0, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_283));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":627
 *                 self._index += 1
 *             if self._events:
 *                 return self._pop_event(0)             # <<<<<<<<<<<<<<
 *         raise StopIteration
 * 
 */
  __pyx_k_tuple_284 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_284)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_284));
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_k_tuple_284, 0, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_284));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":653
 *                 self._events.append( (u"end", node) )
 *         if self._event_filter & ITERPARSE_FILTER_END_NS:
 *             event = (u"end-ns", None)             # <<<<<<<<<<<<<<
 *             for i from 0 <= i < ns_count:
 *                 self._events.append(event)
 */
  __pyx_k_tuple_285 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_285)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_285));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_261));
  PyTuple_SET_ITEM(__pyx_k_tuple_285, 0, ((PyObject *)__pyx_kp_u_261));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_261));
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_k_tuple_285, 1, Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_285));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":15
 *     global _find_id_attributes
 *     if _find_id_attributes is None:
 *         _find_id_attributes = XPath(u'//[inserted by cython to avoid comment start]*[string(@id)]')             # <<<<<<<<<<<<<<
 * 
 *     # ElementTree compatible implementation: parse and look for 'id' attributes
 */
  __pyx_k_tuple_287 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_287)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_287));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_286));
  PyTuple_SET_ITEM(__pyx_k_tuple_287, 0, ((PyObject *)__pyx_kp_u_286));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_286));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_287));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":21
 *     dic = {}
 *     for elem in _find_id_attributes(root):
 *         dic[elem.get(u'id')] = elem             # <<<<<<<<<<<<<<
 *     return (root, dic)
 * 
 */
  __pyx_k_tuple_288 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_288)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_288));
  __Pyx_INCREF(((PyObject *)__pyx_n_u__id));
  PyTuple_SET_ITEM(__pyx_k_tuple_288, 0, ((PyObject *)__pyx_n_u__id));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_u__id));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_288));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":369
 *         if function_mapping is None:
 *             function_mapping = [ name for name in dir(module)
 *                                  if not name.startswith(u'_') ]             # <<<<<<<<<<<<<<
 *         for function_name in function_mapping:
 *             functions[(ns, function_name)] = getattr(module, function_name)
 */
  __pyx_k_tuple_306 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_306)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_306));
  __Pyx_INCREF(((PyObject *)__pyx_n_u___));
  PyTuple_SET_ITEM(__pyx_k_tuple_306, 0, ((PyObject *)__pyx_n_u___));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_u___));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_306));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":444
 *                 return ()
 *             results = [ result.group() ]
 *             results.extend( result.groups(u'') )             # <<<<<<<<<<<<<<
 *         result_list = []
 *         root = Element(u'matches')
 */
  __pyx_k_tuple_307 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_307)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_307));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_25));
  PyTuple_SET_ITEM(__pyx_k_tuple_307, 0, ((PyObject *)__pyx_kp_u_25));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_25));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_307));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":446
 *             results.extend( result.groups(u'') )
 *         result_list = []
 *         root = Element(u'matches')             # <<<<<<<<<<<<<<
 *         join_groups = u''.join
 *         for s_match in results:
 */
  __pyx_k_tuple_308 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_308)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_308));
  __Pyx_INCREF(((PyObject *)__pyx_n_u__matches));
  PyTuple_SET_ITEM(__pyx_k_tuple_308, 0, ((PyObject *)__pyx_n_u__matches));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_u__matches));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_308));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":147
 *             _XPATH_VERSION_WARNING_REQUIRED = 0
 *             import warnings
 *             warnings.warn(u"This version of libxml2 has a known XPath bug. "             # <<<<<<<<<<<<<<
 *                           u"Use it at your own risk.")
 *         self._context = _XPathContext(namespaces, extensions,
 */
  __pyx_k_tuple_330 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_330)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_330));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_329));
  PyTuple_SET_ITEM(__pyx_k_tuple_330, 0, ((PyObject *)__pyx_kp_u_329));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_329));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_330));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":480
 *         """
 *         def __get__(self):
 *             return self._path.decode(u'UTF-8')             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __pyx_k_tuple_342 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_342)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_342));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_31));
  PyTuple_SET_ITEM(__pyx_k_tuple_342, 0, ((PyObject *)__pyx_kp_u_31));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_31));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_342));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":247
 *         items.sort()
 *         return u"%s(%s)" % (
 *             funicode(python._fqtypename(self)).split(u'.')[-1],             # <<<<<<<<<<<<<<
 *             u', '.join([u"%s=%r" % item for item in items]))
 * 
 */
  __pyx_k_tuple_355 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_355)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_355));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_5));
  PyTuple_SET_ITEM(__pyx_k_tuple_355, 0, ((PyObject *)__pyx_kp_u_5));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_355));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":824
 *     global __findStylesheetByID
 *     if __findStylesheetByID is None:
 *         __findStylesheetByID = XPath(             # <<<<<<<<<<<<<<
 *             u"//xsl:stylesheet[@xml:id = $id]",
 *             namespaces={u"xsl" : u"http://www.w3.org/1999/XSL/Transform"})
 */
  __pyx_k_tuple_370 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_370)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_370));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_369));
  PyTuple_SET_ITEM(__pyx_k_tuple_370, 0, ((PyObject *)__pyx_kp_u_369));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_369));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_370));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xsltext.pxi":204
 *                 e = unicode(e).encode(u"UTF-8")
 *             except:
 *                 e = repr(e).encode(u"UTF-8")             # <<<<<<<<<<<<<<
 *             message = python.PyBytes_FromFormat(
 *                 "Error executing extension element '%s': %s",
 */
  __pyx_k_tuple_386 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_386)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_386));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_31));
  PyTuple_SET_ITEM(__pyx_k_tuple_386, 0, ((PyObject *)__pyx_kp_u_31));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_31));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_386));

  /* "src/lxml/lxml.etree.pyx":123
 *     _FILENAME_ENCODING = b'ascii'
 * else:
 *     _FILENAME_ENCODING = _FILENAME_ENCODING.encode(u"UTF-8")             # <<<<<<<<<<<<<<
 * cdef char* _C_FILENAME_ENCODING
 * _C_FILENAME_ENCODING = _cstr(_FILENAME_ENCODING)
 */
  __pyx_k_tuple_471 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_471)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_471));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_31));
  PyTuple_SET_ITEM(__pyx_k_tuple_471, 0, ((PyObject *)__pyx_kp_u_31));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_31));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_471));

  /* "src/lxml/lxml.etree.pyx":144
 * }
 * 
 * cdef object _check_internal_prefix = re.compile(b"ns\d+$").match             # <<<<<<<<<<<<<<
 * 
 * def register_namespace(prefix, uri):
 */
  __pyx_k_tuple_480 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_480)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_480));
  __Pyx_INCREF(((PyObject *)__pyx_kp_b_479));
  PyTuple_SET_ITEM(__pyx_k_tuple_480, 0, ((PyObject *)__pyx_kp_b_479));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_b_479));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_480));

  /* "src/lxml/lxml.etree.pyx":232
 * try:
 *     _LIBXML_VERSION_INT = int(
 *         re.match(u'[0-9]+', (tree.xmlParserVersion).decode(u"ASCII")).group(0))             # <<<<<<<<<<<<<<
 * except Exception:
 *     print u"Unknown libxml2 version: %s" % (tree.xmlParserVersion).decode(u"ASCII")
 */
  __pyx_k_tuple_486 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_486)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_486));
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_k_tuple_486, 0, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_486));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":454
 * 
 * cdef _BaseErrorLog __GLOBAL_ERROR_LOG
 * __GLOBAL_ERROR_LOG = _RotatingErrorLog(__MAX_LOG_SIZE)             # <<<<<<<<<<<<<<
 * 
 * cdef _BaseErrorLog _getGlobalErrorLog():
 */
  __pyx_k_tuple_489 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_489)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_489));
  __Pyx_INCREF(__pyx_int_100);
  PyTuple_SET_ITEM(__pyx_k_tuple_489, 0, __pyx_int_100);
  __Pyx_GIVEREF(__pyx_int_100);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_489));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":631
 * 
 * cdef object __ERROR_LEVELS
 * __ERROR_LEVELS = (u"""\             # <<<<<<<<<<<<<<
 * NONE=0
 * WARNING=1
 */
  __pyx_k_tuple_495 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_495)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_495));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_494));
  PyTuple_SET_ITEM(__pyx_k_tuple_495, 0, ((PyObject *)__pyx_kp_u_494));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_494));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_495));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":639
 * 
 * cdef object __ERROR_DOMAINS
 * __ERROR_DOMAINS = (u"""\             # <<<<<<<<<<<<<<
 * NONE=0
 * PARSER=1
 */
  __pyx_k_tuple_497 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_497)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_497));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_496));
  PyTuple_SET_ITEM(__pyx_k_tuple_497, 0, ((PyObject *)__pyx_kp_u_496));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_496));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_497));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":672
 * 
 * cdef object __PARSER_ERROR_TYPES
 * __PARSER_ERROR_TYPES = (u"""\             # <<<<<<<<<<<<<<
 * ERR_OK=0
 * ERR_INTERNAL_ERROR=1
 */
  __pyx_k_tuple_509 = PyTuple_New(11); if (unlikely(!__pyx_k_tuple_509)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_509));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_498));
  PyTuple_SET_ITEM(__pyx_k_tuple_509, 0, ((PyObject *)__pyx_kp_u_498));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_498));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_499));
  PyTuple_SET_ITEM(__pyx_k_tuple_509, 1, ((PyObject *)__pyx_kp_u_499));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_499));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_500));
  PyTuple_SET_ITEM(__pyx_k_tuple_509, 2, ((PyObject *)__pyx_kp_u_500));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_500));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_501));
  PyTuple_SET_ITEM(__pyx_k_tuple_509, 3, ((PyObject *)__pyx_kp_u_501));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_501));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_502));
  PyTuple_SET_ITEM(__pyx_k_tuple_509, 4, ((PyObject *)__pyx_kp_u_502));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_502));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_503));
  PyTuple_SET_ITEM(__pyx_k_tuple_509, 5, ((PyObject *)__pyx_kp_u_503));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_503));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_504));
  PyTuple_SET_ITEM(__pyx_k_tuple_509, 6, ((PyObject *)__pyx_kp_u_504));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_504));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_505));
  PyTuple_SET_ITEM(__pyx_k_tuple_509, 7, ((PyObject *)__pyx_kp_u_505));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_505));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_506));
  PyTuple_SET_ITEM(__pyx_k_tuple_509, 8, ((PyObject *)__pyx_kp_u_506));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_506));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_507));
  PyTuple_SET_ITEM(__pyx_k_tuple_509, 9, ((PyObject *)__pyx_kp_u_507));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_507));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_508));
  PyTuple_SET_ITEM(__pyx_k_tuple_509, 10, ((PyObject *)__pyx_kp_u_508));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_508));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_509));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":1429
 * 
 * cdef object __RELAXNG_ERROR_TYPES
 * __RELAXNG_ERROR_TYPES = (u"""\             # <<<<<<<<<<<<<<
 * RELAXNG_OK=0
 * RELAXNG_ERR_MEMORY=1
 */
  __pyx_k_tuple_511 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_511)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_511));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_510));
  PyTuple_SET_ITEM(__pyx_k_tuple_511, 0, ((PyObject *)__pyx_kp_u_510));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_510));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_511));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":492
 * cdef object _replace_strings
 * cdef object _find_namespaces
 * _replace_strings = re.compile(b'("[^"]*")|(\'[^\']*\')').sub             # <<<<<<<<<<<<<<
 * _find_namespaces = re.compile(b'({[^}]+})').findall
 * 
 */
  __pyx_k_tuple_525 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_525)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_525));
  __Pyx_INCREF(((PyObject *)__pyx_kp_b_524));
  PyTuple_SET_ITEM(__pyx_k_tuple_525, 0, ((PyObject *)__pyx_kp_b_524));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_b_524));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_525));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":493
 * cdef object _find_namespaces
 * _replace_strings = re.compile(b'("[^"]*")|(\'[^\']*\')').sub
 * _find_namespaces = re.compile(b'({[^}]+})').findall             # <<<<<<<<<<<<<<
 * 
 * cdef class ETXPath(XPath):
 */
  __pyx_k_tuple_527 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_527)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_527));
  __Pyx_INCREF(((PyObject *)__pyx_kp_b_526));
  PyTuple_SET_ITEM(__pyx_k_tuple_527, 0, ((PyObject *)__pyx_kp_b_526));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_b_526));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_527));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":810
 * 
 * cdef object _RE_PI_HREF
 * _RE_PI_HREF = re.compile(ur'\s+href\s*=\s*["\']([^"\']+)["\']')             # <<<<<<<<<<<<<<
 * 
 * cdef object _FIND_PI_HREF
 */
  __pyx_k_tuple_535 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_535)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_535));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_534));
  PyTuple_SET_ITEM(__pyx_k_tuple_535, 0, ((PyObject *)__pyx_kp_u_534));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_534));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_535));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":22
 * # XMLSchema
 * 
 * cdef XPath _check_for_default_attributes = XPath(             # <<<<<<<<<<<<<<
 *     u"boolean(//xs:attribute[@default or @fixed][1])",
 *     namespaces={u'xs': u'http://www.w3.org/2001/XMLSchema'})
 */
  __pyx_k_tuple_547 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_547)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_547));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_546));
  PyTuple_SET_ITEM(__pyx_k_tuple_547, 0, ((PyObject *)__pyx_kp_u_546));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_546));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_547));
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_InitGlobals(void) {
  #if PY_VERSION_HEX < 0x02040000
  if (unlikely(__Pyx_Py23SetsImport() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_100 = PyInt_FromLong(100); if (unlikely(!__pyx_int_100)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_neg_100 = PyInt_FromLong(-100); if (unlikely(!__pyx_int_neg_100)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_neg_200 = PyInt_FromLong(-200); if (unlikely(!__pyx_int_neg_200)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_neg_300 = PyInt_FromLong(-300); if (unlikely(!__pyx_int_neg_300)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_32768 = PyInt_FromLong(32768); if (unlikely(!__pyx_int_32768)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  return 0;
  __pyx_L1_error:;
  return -1;
}

#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC initetree(void); /*proto*/
PyMODINIT_FUNC initetree(void)
#else
PyMODINIT_FUNC PyInit_etree(void); /*proto*/
PyMODINIT_FUNC PyInit_etree(void)
#endif
{
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  #if CYTHON_REFNANNY
  void* __pyx_refnanny = NULL;
  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  if (!__Pyx_RefNanny) {
      PyErr_Clear();
      __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
      if (!__Pyx_RefNanny)
          Py_FatalError("failed to import 'refnanny' module");
  }
  __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit_etree(void)", __LINE__, __FILE__);
  #endif
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #ifdef __pyx_binding_PyCFunctionType_USED
  if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  /*--- Library function declarations ---*/
  /*--- Threads initialization code ---*/
  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  #ifdef WITH_THREAD /* Python build with threading support? */
  PyEval_InitThreads();
  #endif
  #endif
  /*--- Module creation code ---*/
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4(__Pyx_NAMESTR("etree"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_456), 0, PYTHON_API_VERSION);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  #if PY_MAJOR_VERSION < 3
  Py_INCREF(__pyx_m);
  #endif
  __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME));
  if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  /*--- Initialize various global constants etc. ---*/
  if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_module_is_main_lxml__etree) {
    if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  }
  /*--- Builtin init code ---*/
  if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Constants init code ---*/
  if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Global init code ---*/
  __pyx_v_4lxml_5etree__unicode = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_os_path_abspath = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_BytesIO = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_StringIO = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__elementpath = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_sys = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_re = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_gzip = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_ITER_EMPTY = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_EMPTY_READ_ONLY_DICT = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__FILENAME_ENCODING = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__check_internal_prefix = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__Error = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_error_super_init = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree___RE_XML_ENCODING = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree___REPLACE_XML_ENCODING = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree___HAS_XML_ENCODING = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree___GLOBAL_ERROR_LOG = ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)Py_None); Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree___ERROR_LEVELS = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree___ERROR_DOMAINS = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree___PARSER_ERROR_TYPES = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree___RELAXNG_ERROR_TYPES = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__PREFIX_CACHE = ((PyObject*)Py_None); Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_ELEMENT_CLASS_LOOKUP_STATE = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_DEFAULT_ELEMENT_CLASS_LOOKUP = ((struct __pyx_obj_4lxml_5etree_ParserBasedElementClassLookup *)Py_None); Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree___FUNCTION_NAMESPACE_REGISTRIES = ((PyObject*)Py_None); Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__LxmlSyntaxError = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__ParseError = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT = ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)Py_None); Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree___DEFAULT_XML_PARSER = ((struct __pyx_obj_4lxml_5etree_XMLParser *)Py_None); Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree___DEFAULT_HTML_PARSER = ((struct __pyx_obj_4lxml_5etree_HTMLParser *)Py_None); Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_inspect_getargspec = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__find_id_attributes = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__XPATH_SYNTAX_ERRORS = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__XPATH_EVAL_ERRORS = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__replace_strings = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__find_namespaces = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_EMPTY_DICT = ((PyObject*)Py_None); Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__FIND_PI_ATTRIBUTES = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__RE_PI_HREF = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__FIND_PI_HREF = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__REPLACE_PI_HREF = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree___findStylesheetByID = ((struct __pyx_obj_4lxml_5etree_XPath *)Py_None); Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__check_for_default_attributes = ((struct __pyx_obj_4lxml_5etree_XPath *)Py_None); Py_INCREF(Py_None);
  /*--- Function export code ---*/
  if (__Pyx_ExportFunction("deepcopyNodeToDocument", (void (*)(void))deepcopyNodeToDocument, "struct LxmlElement *(struct LxmlDocument *, xmlNode *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("elementTreeFactory", (void (*)(void))elementTreeFactory, "struct LxmlElementTree *(struct LxmlElement *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("newElementTree", (void (*)(void))newElementTree, "struct LxmlElementTree *(struct LxmlElement *, PyObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("elementFactory", (void (*)(void))elementFactory, "struct LxmlElement *(struct LxmlDocument *, xmlNode *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("makeElement", (void (*)(void))makeElement, "struct LxmlElement *(PyObject *, struct LxmlDocument *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("makeSubElement", (void (*)(void))makeSubElement, "struct LxmlElement *(struct LxmlElement *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("setElementClassLookupFunction", (void (*)(void))setElementClassLookupFunction, "void (_element_class_lookup_function, PyObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("lookupDefaultElementClass", (void (*)(void))lookupDefaultElementClass, "PyObject *(PyObject *, PyObject *, xmlNode *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("lookupNamespaceElementClass", (void (*)(void))lookupNamespaceElementClass, "PyObject *(PyObject *, PyObject *, xmlNode *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("callLookupFallback", (void (*)(void))callLookupFallback, "PyObject *(struct LxmlFallbackElementClassLookup *, struct LxmlDocument *, xmlNode *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("tagMatches", (void (*)(void))tagMatches, "int (xmlNode *, char *, char *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("documentOrRaise", (void (*)(void))documentOrRaise, "struct LxmlDocument *(PyObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("rootNodeOrRaise", (void (*)(void))rootNodeOrRaise, "struct LxmlElement *(PyObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("hasText", (void (*)(void))hasText, "int (xmlNode *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("hasTail", (void (*)(void))hasTail, "int (xmlNode *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("textOf", (void (*)(void))textOf, "PyObject *(xmlNode *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("tailOf", (void (*)(void))tailOf, "PyObject *(xmlNode *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("setNodeText", (void (*)(void))setNodeText, "int (xmlNode *, PyObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("setTailText", (void (*)(void))setTailText, "int (xmlNode *, PyObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("attributeValue", (void (*)(void))attributeValue, "PyObject *(xmlNode *, xmlAttr *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("attributeValueFromNsName", (void (*)(void))attributeValueFromNsName, "PyObject *(xmlNode *, char *, char *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("getAttributeValue", (void (*)(void))getAttributeValue, "PyObject *(struct LxmlElement *, PyObject *, PyObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("iterattributes", (void (*)(void))iterattributes, "PyObject *(struct LxmlElement *, int)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("collectAttributes", (void (*)(void))collectAttributes, "PyObject *(xmlNode *, int)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("setAttributeValue", (void (*)(void))setAttributeValue, "int (struct LxmlElement *, PyObject *, PyObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("delAttribute", (void (*)(void))delAttribute, "int (struct LxmlElement *, PyObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("delAttributeFromNsName", (void (*)(void))delAttributeFromNsName, "int (xmlNode *, char *, char *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("hasChild", (void (*)(void))hasChild, "int (xmlNode *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("findChild", (void (*)(void))findChild, "xmlNode *(xmlNode *, Py_ssize_t)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("findChildForwards", (void (*)(void))findChildForwards, "xmlNode *(xmlNode *, Py_ssize_t)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("findChildBackwards", (void (*)(void))findChildBackwards, "xmlNode *(xmlNode *, Py_ssize_t)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("nextElement", (void (*)(void))nextElement, "xmlNode *(xmlNode *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("previousElement", (void (*)(void))previousElement, "xmlNode *(xmlNode *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("appendChild", (void (*)(void))appendChild, "void (struct LxmlElement *, struct LxmlElement *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("pyunicode", (void (*)(void))pyunicode, "PyObject *(char *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("utf8", (void (*)(void))utf8, "PyObject *(PyObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("getNsTag", (void (*)(void))getNsTag, "PyObject *(PyObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("getNsTagWithEmptyNs", (void (*)(void))getNsTagWithEmptyNs, "PyObject *(PyObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("namespacedName", (void (*)(void))namespacedName, "PyObject *(xmlNode *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("namespacedNameFromNsName", (void (*)(void))namespacedNameFromNsName, "PyObject *(char *, char *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("iteratorStoreNext", (void (*)(void))iteratorStoreNext, "void (struct LxmlElementIterator *, struct LxmlElement *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("initTagMatch", (void (*)(void))initTagMatch, "void (struct LxmlElementTagMatcher *, PyObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("findOrBuildNodeNsPrefix", (void (*)(void))findOrBuildNodeNsPrefix, "xmlNs *(struct LxmlDocument *, xmlNode *, char *, char *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Type init code ---*/
  __pyx_vtabptr_4lxml_5etree__TempStore = &__pyx_vtable_4lxml_5etree__TempStore;
  __pyx_vtable_4lxml_5etree__TempStore.add = (int (*)(struct __pyx_obj_4lxml_5etree__TempStore *, PyObject *))__pyx_f_4lxml_5etree_10_TempStore_add;
  __pyx_vtable_4lxml_5etree__TempStore.clear = (int (*)(struct __pyx_obj_4lxml_5etree__TempStore *))__pyx_f_4lxml_5etree_10_TempStore_clear;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__TempStore) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__TempStore.tp_dict, __pyx_vtabptr_4lxml_5etree__TempStore) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_TempStore", (PyObject *)&__pyx_type_4lxml_5etree__TempStore) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__TempStore = &__pyx_type_4lxml_5etree__TempStore;
  __pyx_vtabptr_4lxml_5etree__ExceptionContext = &__pyx_vtable_4lxml_5etree__ExceptionContext;
  __pyx_vtable_4lxml_5etree__ExceptionContext.clear = (void (*)(struct __pyx_obj_4lxml_5etree__ExceptionContext *))__pyx_f_4lxml_5etree_17_ExceptionContext_clear;
  __pyx_vtable_4lxml_5etree__ExceptionContext._store_raised = (void (*)(struct __pyx_obj_4lxml_5etree__ExceptionContext *))__pyx_f_4lxml_5etree_17_ExceptionContext__store_raised;
  __pyx_vtable_4lxml_5etree__ExceptionContext._store_exception = (void (*)(struct __pyx_obj_4lxml_5etree__ExceptionContext *, PyObject *))__pyx_f_4lxml_5etree_17_ExceptionContext__store_exception;
  __pyx_vtable_4lxml_5etree__ExceptionContext._has_raised = (int (*)(struct __pyx_obj_4lxml_5etree__ExceptionContext *))__pyx_f_4lxml_5etree_17_ExceptionContext__has_raised;
  __pyx_vtable_4lxml_5etree__ExceptionContext._raise_if_stored = (int (*)(struct __pyx_obj_4lxml_5etree__ExceptionContext *))__pyx_f_4lxml_5etree_17_ExceptionContext__raise_if_stored;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__ExceptionContext) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__ExceptionContext.tp_dict, __pyx_vtabptr_4lxml_5etree__ExceptionContext) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_ExceptionContext", (PyObject *)&__pyx_type_4lxml_5etree__ExceptionContext) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__ExceptionContext = &__pyx_type_4lxml_5etree__ExceptionContext;
  __pyx_vtabptr_4lxml_5etree__Document = &__pyx_vtable_4lxml_5etree__Document;
  __pyx_vtable_4lxml_5etree__Document.getroot = (PyObject *(*)(struct LxmlDocument *))__pyx_f_4lxml_5etree_9_Document_getroot;
  __pyx_vtable_4lxml_5etree__Document.hasdoctype = (int (*)(struct LxmlDocument *))__pyx_f_4lxml_5etree_9_Document_hasdoctype;
  __pyx_vtable_4lxml_5etree__Document.getdoctype = (PyObject *(*)(struct LxmlDocument *))__pyx_f_4lxml_5etree_9_Document_getdoctype;
  __pyx_vtable_4lxml_5etree__Document.getxmlinfo = (PyObject *(*)(struct LxmlDocument *))__pyx_f_4lxml_5etree_9_Document_getxmlinfo;
  __pyx_vtable_4lxml_5etree__Document.isstandalone = (PyObject *(*)(struct LxmlDocument *))__pyx_f_4lxml_5etree_9_Document_isstandalone;
  __pyx_vtable_4lxml_5etree__Document.buildNewPrefix = (PyObject *(*)(struct LxmlDocument *))__pyx_f_4lxml_5etree_9_Document_buildNewPrefix;
  __pyx_vtable_4lxml_5etree__Document._findOrBuildNodeNs = (xmlNs *(*)(struct LxmlDocument *, xmlNode *, char *, char *, int))__pyx_f_4lxml_5etree_9_Document__findOrBuildNodeNs;
  __pyx_vtable_4lxml_5etree__Document._setNodeNs = (int (*)(struct LxmlDocument *, xmlNode *, char *))__pyx_f_4lxml_5etree_9_Document__setNodeNs;
  if (PyType_Ready(&LxmlDocumentType) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(LxmlDocumentType.tp_dict, __pyx_vtabptr_4lxml_5etree__Document) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_Document", (PyObject *)&LxmlDocumentType) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__Document = &LxmlDocumentType;
  if (PyType_Ready(&LxmlElementType) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  {
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&LxmlElementType, "__setitem__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_4lxml_5etree_8_Element_2__setitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_8_Element_2__setitem__.doc = __pyx_doc_4lxml_5etree_8_Element_2__setitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_8_Element_2__setitem__;
    }
  }
  {
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&LxmlElementType, "__delitem__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_4lxml_5etree_8_Element_3__delitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_8_Element_3__delitem__.doc = __pyx_doc_4lxml_5etree_8_Element_3__delitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_8_Element_3__delitem__;
    }
  }
  {
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&LxmlElementType, "__repr__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_4lxml_5etree_8_Element_15__repr__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_8_Element_15__repr__.doc = __pyx_doc_4lxml_5etree_8_Element_15__repr__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_8_Element_15__repr__;
    }
  }
  {
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&LxmlElementType, "__getitem__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_4lxml_5etree_8_Element_16__getitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_8_Element_16__getitem__.doc = __pyx_doc_4lxml_5etree_8_Element_16__getitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_8_Element_16__getitem__;
    }
  }
  {
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&LxmlElementType, "__len__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_4lxml_5etree_8_Element_17__len__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_8_Element_17__len__.doc = __pyx_doc_4lxml_5etree_8_Element_17__len__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_8_Element_17__len__;
    }
  }
  {
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&LxmlElementType, "__contains__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_4lxml_5etree_8_Element_19__contains__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_8_Element_19__contains__.doc = __pyx_doc_4lxml_5etree_8_Element_19__contains__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_8_Element_19__contains__;
    }
  }
  {
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&LxmlElementType, "__iter__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_4lxml_5etree_8_Element_20__iter__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_8_Element_20__iter__.doc = __pyx_doc_4lxml_5etree_8_Element_20__iter__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_8_Element_20__iter__;
    }
  }
  if (__Pyx_SetAttrString(__pyx_m, "_Element", (PyObject *)&LxmlElementType) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__Element = &LxmlElementType;
  __pyx_vtabptr_4lxml_5etree__BaseParser = &__pyx_vtable_4lxml_5etree__BaseParser;
  __pyx_vtable_4lxml_5etree__BaseParser._getParserContext = (struct __pyx_obj_4lxml_5etree__ParserContext *(*)(struct __pyx_obj_4lxml_5etree__BaseParser *))__pyx_f_4lxml_5etree_11_BaseParser__getParserContext;
  __pyx_vtable_4lxml_5etree__BaseParser._getPushParserContext = (struct __pyx_obj_4lxml_5etree__ParserContext *(*)(struct __pyx_obj_4lxml_5etree__BaseParser *))__pyx_f_4lxml_5etree_11_BaseParser__getPushParserContext;
  __pyx_vtable_4lxml_5etree__BaseParser._createContext = (struct __pyx_obj_4lxml_5etree__ParserContext *(*)(struct __pyx_obj_4lxml_5etree__BaseParser *, PyObject *))__pyx_f_4lxml_5etree_11_BaseParser__createContext;
  __pyx_vtable_4lxml_5etree__BaseParser._newParserCtxt = (xmlParserCtxt *(*)(struct __pyx_obj_4lxml_5etree__BaseParser *))__pyx_f_4lxml_5etree_11_BaseParser__newParserCtxt;
  __pyx_vtable_4lxml_5etree__BaseParser._newPushParserCtxt = (xmlParserCtxt *(*)(struct __pyx_obj_4lxml_5etree__BaseParser *))__pyx_f_4lxml_5etree_11_BaseParser__newPushParserCtxt;
  __pyx_vtable_4lxml_5etree__BaseParser._copy = (struct __pyx_obj_4lxml_5etree__BaseParser *(*)(struct __pyx_obj_4lxml_5etree__BaseParser *))__pyx_f_4lxml_5etree_11_BaseParser__copy;
  __pyx_vtable_4lxml_5etree__BaseParser._parseUnicodeDoc = (xmlDoc *(*)(struct __pyx_obj_4lxml_5etree__BaseParser *, PyObject *, char *))__pyx_f_4lxml_5etree_11_BaseParser__parseUnicodeDoc;
  __pyx_vtable_4lxml_5etree__BaseParser._parseDoc = (xmlDoc *(*)(struct __pyx_obj_4lxml_5etree__BaseParser *, char *, Py_ssize_t, char *))__pyx_f_4lxml_5etree_11_BaseParser__parseDoc;
  __pyx_vtable_4lxml_5etree__BaseParser._parseDocFromFile = (xmlDoc *(*)(struct __pyx_obj_4lxml_5etree__BaseParser *, char *))__pyx_f_4lxml_5etree_11_BaseParser__parseDocFromFile;
  __pyx_vtable_4lxml_5etree__BaseParser._parseDocFromFilelike = (xmlDoc *(*)(struct __pyx_obj_4lxml_5etree__BaseParser *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_11_BaseParser__parseDocFromFilelike;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__BaseParser) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__BaseParser.tp_dict, __pyx_vtabptr_4lxml_5etree__BaseParser) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_BaseParser", (PyObject *)&__pyx_type_4lxml_5etree__BaseParser) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__BaseParser = &__pyx_type_4lxml_5etree__BaseParser;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_QName) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "QName", (PyObject *)&__pyx_type_4lxml_5etree_QName) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_QName = &__pyx_type_4lxml_5etree_QName;
  __pyx_vtabptr_4lxml_5etree__LogEntry = &__pyx_vtable_4lxml_5etree__LogEntry;
  __pyx_vtable_4lxml_5etree__LogEntry._setError = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__LogEntry *, xmlError *))__pyx_f_4lxml_5etree_9_LogEntry__setError;
  __pyx_vtable_4lxml_5etree__LogEntry._setGeneric = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__LogEntry *, int, int, int, int, PyObject *, PyObject *))__pyx_f_4lxml_5etree_9_LogEntry__setGeneric;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__LogEntry) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__LogEntry.tp_dict, __pyx_vtabptr_4lxml_5etree__LogEntry) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_LogEntry", (PyObject *)&__pyx_type_4lxml_5etree__LogEntry) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__LogEntry = &__pyx_type_4lxml_5etree__LogEntry;
  __pyx_vtabptr_4lxml_5etree__BaseErrorLog = &__pyx_vtable_4lxml_5etree__BaseErrorLog;
  __pyx_vtable_4lxml_5etree__BaseErrorLog._receive = (void (*)(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, xmlError *))__pyx_f_4lxml_5etree_13_BaseErrorLog__receive;
  __pyx_vtable_4lxml_5etree__BaseErrorLog._receiveGeneric = (void (*)(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, int, int, int, int, PyObject *, PyObject *))__pyx_f_4lxml_5etree_13_BaseErrorLog__receiveGeneric;
  __pyx_vtable_4lxml_5etree__BaseErrorLog._buildParseException = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_13_BaseErrorLog__buildParseException;
  __pyx_vtable_4lxml_5etree__BaseErrorLog._buildExceptionMessage = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, PyObject *))__pyx_f_4lxml_5etree_13_BaseErrorLog__buildExceptionMessage;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__BaseErrorLog) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__BaseErrorLog.tp_dict, __pyx_vtabptr_4lxml_5etree__BaseErrorLog) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_BaseErrorLog", (PyObject *)&__pyx_type_4lxml_5etree__BaseErrorLog) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__BaseErrorLog = &__pyx_type_4lxml_5etree__BaseErrorLog;
  __pyx_vtabptr_4lxml_5etree__ListErrorLog = &__pyx_vtable_4lxml_5etree__ListErrorLog;
  __pyx_vtable_4lxml_5etree__ListErrorLog.__pyx_base = *__pyx_vtabptr_4lxml_5etree__BaseErrorLog;
  __pyx_type_4lxml_5etree__ListErrorLog.tp_base = __pyx_ptype_4lxml_5etree__BaseErrorLog;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__ListErrorLog) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__ListErrorLog.tp_dict, __pyx_vtabptr_4lxml_5etree__ListErrorLog) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_ListErrorLog", (PyObject *)&__pyx_type_4lxml_5etree__ListErrorLog) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__ListErrorLog = &__pyx_type_4lxml_5etree__ListErrorLog;
  __pyx_vtabptr_4lxml_5etree__ErrorLog = &__pyx_vtable_4lxml_5etree__ErrorLog;
  __pyx_vtable_4lxml_5etree__ErrorLog.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ListErrorLog;
  __pyx_vtable_4lxml_5etree__ErrorLog.connect = (void (*)(struct __pyx_obj_4lxml_5etree__ErrorLog *))__pyx_f_4lxml_5etree_9_ErrorLog_connect;
  __pyx_vtable_4lxml_5etree__ErrorLog.disconnect = (void (*)(struct __pyx_obj_4lxml_5etree__ErrorLog *))__pyx_f_4lxml_5etree_9_ErrorLog_disconnect;
  __pyx_type_4lxml_5etree__ErrorLog.tp_base = __pyx_ptype_4lxml_5etree__ListErrorLog;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__ErrorLog) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__ErrorLog.tp_dict, __pyx_vtabptr_4lxml_5etree__ErrorLog) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_ErrorLog", (PyObject *)&__pyx_type_4lxml_5etree__ErrorLog) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__ErrorLog = &__pyx_type_4lxml_5etree__ErrorLog;
  __pyx_vtabptr_4lxml_5etree__DomainErrorLog = &__pyx_vtable_4lxml_5etree__DomainErrorLog;
  __pyx_vtable_4lxml_5etree__DomainErrorLog.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ErrorLog;
  __pyx_type_4lxml_5etree__DomainErrorLog.tp_base = __pyx_ptype_4lxml_5etree__ErrorLog;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__DomainErrorLog) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__DomainErrorLog.tp_dict, __pyx_vtabptr_4lxml_5etree__DomainErrorLog) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_DomainErrorLog", (PyObject *)&__pyx_type_4lxml_5etree__DomainErrorLog) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__DomainErrorLog = &__pyx_type_4lxml_5etree__DomainErrorLog;
  __pyx_vtabptr_4lxml_5etree__RotatingErrorLog = &__pyx_vtable_4lxml_5etree__RotatingErrorLog;
  __pyx_vtable_4lxml_5etree__RotatingErrorLog.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ErrorLog;
  __pyx_type_4lxml_5etree__RotatingErrorLog.tp_base = __pyx_ptype_4lxml_5etree__ErrorLog;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__RotatingErrorLog) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__RotatingErrorLog.tp_dict, __pyx_vtabptr_4lxml_5etree__RotatingErrorLog) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_RotatingErrorLog", (PyObject *)&__pyx_type_4lxml_5etree__RotatingErrorLog) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__RotatingErrorLog = &__pyx_type_4lxml_5etree__RotatingErrorLog;
  __pyx_vtabptr_4lxml_5etree_PyErrorLog = &__pyx_vtable_4lxml_5etree_PyErrorLog;
  __pyx_vtable_4lxml_5etree_PyErrorLog.__pyx_base = *__pyx_vtabptr_4lxml_5etree__BaseErrorLog;
  __pyx_type_4lxml_5etree_PyErrorLog.tp_base = __pyx_ptype_4lxml_5etree__BaseErrorLog;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_PyErrorLog) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_PyErrorLog.tp_dict, __pyx_vtabptr_4lxml_5etree_PyErrorLog) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "PyErrorLog", (PyObject *)&__pyx_type_4lxml_5etree_PyErrorLog) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_PyErrorLog = &__pyx_type_4lxml_5etree_PyErrorLog;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_DocInfo) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "DocInfo", (PyObject *)&__pyx_type_4lxml_5etree_DocInfo) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_DocInfo = &__pyx_type_4lxml_5etree_DocInfo;
  __pyx_vtabptr_4lxml_5etree___ContentOnlyElement = &__pyx_vtable_4lxml_5etree___ContentOnlyElement;
  __pyx_vtable_4lxml_5etree___ContentOnlyElement._raiseImmutable = (int (*)(struct __pyx_obj_4lxml_5etree___ContentOnlyElement *))__pyx_f_4lxml_5etree_20__ContentOnlyElement__raiseImmutable;
  __pyx_type_4lxml_5etree___ContentOnlyElement.tp_base = __pyx_ptype_4lxml_5etree__Element;
  if (PyType_Ready(&__pyx_type_4lxml_5etree___ContentOnlyElement) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  {
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_4lxml_5etree___ContentOnlyElement, "__setitem__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_4lxml_5etree_20__ContentOnlyElement_3__setitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_20__ContentOnlyElement_3__setitem__.doc = __pyx_doc_4lxml_5etree_20__ContentOnlyElement_3__setitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_20__ContentOnlyElement_3__setitem__;
    }
  }
  {
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_4lxml_5etree___ContentOnlyElement, "__getitem__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_4lxml_5etree_20__ContentOnlyElement_4__getitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_20__ContentOnlyElement_4__getitem__.doc = __pyx_doc_4lxml_5etree_20__ContentOnlyElement_4__getitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_20__ContentOnlyElement_4__getitem__;
    }
  }
  {
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_4lxml_5etree___ContentOnlyElement, "__len__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_4lxml_5etree_20__ContentOnlyElement_5__len__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_20__ContentOnlyElement_5__len__.doc = __pyx_doc_4lxml_5etree_20__ContentOnlyElement_5__len__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_20__ContentOnlyElement_5__len__;
    }
  }
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree___ContentOnlyElement.tp_dict, __pyx_vtabptr_4lxml_5etree___ContentOnlyElement) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "__ContentOnlyElement", (PyObject *)&__pyx_type_4lxml_5etree___ContentOnlyElement) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree___ContentOnlyElement = &__pyx_type_4lxml_5etree___ContentOnlyElement;
  __pyx_vtabptr_4lxml_5etree__Comment = &__pyx_vtable_4lxml_5etree__Comment;
  __pyx_vtable_4lxml_5etree__Comment.__pyx_base = *__pyx_vtabptr_4lxml_5etree___ContentOnlyElement;
  __pyx_type_4lxml_5etree__Comment.tp_base = __pyx_ptype_4lxml_5etree___ContentOnlyElement;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__Comment) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__Comment.tp_dict, __pyx_vtabptr_4lxml_5etree__Comment) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_Comment", (PyObject *)&__pyx_type_4lxml_5etree__Comment) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__Comment = &__pyx_type_4lxml_5etree__Comment;
  __pyx_vtabptr_4lxml_5etree__ProcessingInstruction = &__pyx_vtable_4lxml_5etree__ProcessingInstruction;
  __pyx_vtable_4lxml_5etree__ProcessingInstruction.__pyx_base = *__pyx_vtabptr_4lxml_5etree___ContentOnlyElement;
  __pyx_type_4lxml_5etree__ProcessingInstruction.tp_base = __pyx_ptype_4lxml_5etree___ContentOnlyElement;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__ProcessingInstruction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__ProcessingInstruction.tp_dict, __pyx_vtabptr_4lxml_5etree__ProcessingInstruction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_ProcessingInstruction", (PyObject *)&__pyx_type_4lxml_5etree__ProcessingInstruction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__ProcessingInstruction = &__pyx_type_4lxml_5etree__ProcessingInstruction;
  __pyx_vtabptr_4lxml_5etree__Entity = &__pyx_vtable_4lxml_5etree__Entity;
  __pyx_vtable_4lxml_5etree__Entity.__pyx_base = *__pyx_vtabptr_4lxml_5etree___ContentOnlyElement;
  __pyx_type_4lxml_5etree__Entity.tp_base = __pyx_ptype_4lxml_5etree___ContentOnlyElement;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__Entity) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__Entity.tp_dict, __pyx_vtabptr_4lxml_5etree__Entity) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_Entity", (PyObject *)&__pyx_type_4lxml_5etree__Entity) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__Entity = &__pyx_type_4lxml_5etree__Entity;
  __pyx_vtabptr_4lxml_5etree__ElementTree = &__pyx_vtable_4lxml_5etree__ElementTree;
  __pyx_vtable_4lxml_5etree__ElementTree._assertHasRoot = (PyObject *(*)(struct LxmlElementTree *))__pyx_f_4lxml_5etree_12_ElementTree__assertHasRoot;
  if (PyType_Ready(&LxmlElementTreeType) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1683; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(LxmlElementTreeType.tp_dict, __pyx_vtabptr_4lxml_5etree__ElementTree) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1683; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_ElementTree", (PyObject *)&LxmlElementTreeType) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1683; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__ElementTree = &LxmlElementTreeType;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__Attrib) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_Attrib", (PyObject *)&__pyx_type_4lxml_5etree__Attrib) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__Attrib = &__pyx_type_4lxml_5etree__Attrib;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__AttribIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_AttribIterator", (PyObject *)&__pyx_type_4lxml_5etree__AttribIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__AttribIterator = &__pyx_type_4lxml_5etree__AttribIterator;
  __pyx_vtabptr_4lxml_5etree__ElementTagMatcher = &__pyx_vtable_4lxml_5etree__ElementTagMatcher;
  __pyx_vtable_4lxml_5etree__ElementTagMatcher._initTagMatch = (PyObject *(*)(struct LxmlElementTagMatcher *, PyObject *))__pyx_f_4lxml_5etree_18_ElementTagMatcher__initTagMatch;
  if (PyType_Ready(&LxmlElementTagMatcherType) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(LxmlElementTagMatcherType.tp_dict, __pyx_vtabptr_4lxml_5etree__ElementTagMatcher) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_ElementTagMatcher", (PyObject *)&LxmlElementTagMatcherType) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__ElementTagMatcher = &LxmlElementTagMatcherType;
  __pyx_vtabptr_4lxml_5etree__ElementIterator = &__pyx_vtable_4lxml_5etree__ElementIterator;
  __pyx_vtable_4lxml_5etree__ElementIterator.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ElementTagMatcher;
  __pyx_vtable_4lxml_5etree__ElementIterator._storeNext = (void (*)(struct LxmlElementIterator *, struct LxmlElement *))__pyx_f_4lxml_5etree_16_ElementIterator__storeNext;
  LxmlElementIteratorType.tp_base = __pyx_ptype_4lxml_5etree__ElementTagMatcher;
  if (PyType_Ready(&LxmlElementIteratorType) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(LxmlElementIteratorType.tp_dict, __pyx_vtabptr_4lxml_5etree__ElementIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_ElementIterator", (PyObject *)&LxmlElementIteratorType) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__ElementIterator = &LxmlElementIteratorType;
  __pyx_vtabptr_4lxml_5etree_ElementChildIterator = &__pyx_vtable_4lxml_5etree_ElementChildIterator;
  __pyx_vtable_4lxml_5etree_ElementChildIterator.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ElementIterator;
  __pyx_type_4lxml_5etree_ElementChildIterator.tp_base = __pyx_ptype_4lxml_5etree__ElementIterator;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_ElementChildIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_ElementChildIterator.tp_dict, __pyx_vtabptr_4lxml_5etree_ElementChildIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "ElementChildIterator", (PyObject *)&__pyx_type_4lxml_5etree_ElementChildIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_ElementChildIterator = &__pyx_type_4lxml_5etree_ElementChildIterator;
  __pyx_vtabptr_4lxml_5etree_SiblingsIterator = &__pyx_vtable_4lxml_5etree_SiblingsIterator;
  __pyx_vtable_4lxml_5etree_SiblingsIterator.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ElementIterator;
  __pyx_type_4lxml_5etree_SiblingsIterator.tp_base = __pyx_ptype_4lxml_5etree__ElementIterator;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_SiblingsIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_SiblingsIterator.tp_dict, __pyx_vtabptr_4lxml_5etree_SiblingsIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "SiblingsIterator", (PyObject *)&__pyx_type_4lxml_5etree_SiblingsIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_SiblingsIterator = &__pyx_type_4lxml_5etree_SiblingsIterator;
  __pyx_vtabptr_4lxml_5etree_AncestorsIterator = &__pyx_vtable_4lxml_5etree_AncestorsIterator;
  __pyx_vtable_4lxml_5etree_AncestorsIterator.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ElementIterator;
  __pyx_type_4lxml_5etree_AncestorsIterator.tp_base = __pyx_ptype_4lxml_5etree__ElementIterator;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_AncestorsIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_AncestorsIterator.tp_dict, __pyx_vtabptr_4lxml_5etree_AncestorsIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "AncestorsIterator", (PyObject *)&__pyx_type_4lxml_5etree_AncestorsIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_AncestorsIterator = &__pyx_type_4lxml_5etree_AncestorsIterator;
  __pyx_vtabptr_4lxml_5etree_ElementDepthFirstIterator = &__pyx_vtable_4lxml_5etree_ElementDepthFirstIterator;
  __pyx_vtable_4lxml_5etree_ElementDepthFirstIterator.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ElementTagMatcher;
  __pyx_vtable_4lxml_5etree_ElementDepthFirstIterator._nextNodeAnyTag = (xmlNode *(*)(struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *, xmlNode *))__pyx_f_4lxml_5etree_25ElementDepthFirstIterator__nextNodeAnyTag;
  __pyx_vtable_4lxml_5etree_ElementDepthFirstIterator._nextNodeMatchTag = (xmlNode *(*)(struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *, xmlNode *))__pyx_f_4lxml_5etree_25ElementDepthFirstIterator__nextNodeMatchTag;
  __pyx_type_4lxml_5etree_ElementDepthFirstIterator.tp_base = __pyx_ptype_4lxml_5etree__ElementTagMatcher;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_ElementDepthFirstIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_ElementDepthFirstIterator.tp_dict, __pyx_vtabptr_4lxml_5etree_ElementDepthFirstIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "ElementDepthFirstIterator", (PyObject *)&__pyx_type_4lxml_5etree_ElementDepthFirstIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_ElementDepthFirstIterator = &__pyx_type_4lxml_5etree_ElementDepthFirstIterator;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_ElementTextIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "ElementTextIterator", (PyObject *)&__pyx_type_4lxml_5etree_ElementTextIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_ElementTextIterator = &__pyx_type_4lxml_5etree_ElementTextIterator;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_CDATA) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "CDATA", (PyObject *)&__pyx_type_4lxml_5etree_CDATA) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_CDATA = &__pyx_type_4lxml_5etree_CDATA;
  __pyx_vtabptr_4lxml_5etree__ReadOnlyProxy = &__pyx_vtable_4lxml_5etree__ReadOnlyProxy;
  __pyx_vtable_4lxml_5etree__ReadOnlyProxy._assertNode = (int (*)(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *))__pyx_f_4lxml_5etree_14_ReadOnlyProxy__assertNode;
  __pyx_vtable_4lxml_5etree__ReadOnlyProxy._raise_unsupported_type = (int (*)(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *))__pyx_f_4lxml_5etree_14_ReadOnlyProxy__raise_unsupported_type;
  __pyx_vtable_4lxml_5etree__ReadOnlyProxy.free_after_use = (void (*)(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *))__pyx_f_4lxml_5etree_14_ReadOnlyProxy_free_after_use;
  __pyx_vtable_4lxml_5etree__ReadOnlyProxy.__copy__ = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *, int __pyx_skip_dispatch))__pyx_f_4lxml_5etree_14_ReadOnlyProxy___copy__;
  __pyx_vtable_4lxml_5etree__ReadOnlyProxy.getchildren = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *, int __pyx_skip_dispatch))__pyx_f_4lxml_5etree_14_ReadOnlyProxy_getchildren;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__ReadOnlyProxy) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  {
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_4lxml_5etree__ReadOnlyProxy, "__getitem__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_4lxml_5etree_14_ReadOnlyProxy_2__getitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_14_ReadOnlyProxy_2__getitem__.doc = __pyx_doc_4lxml_5etree_14_ReadOnlyProxy_2__getitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_14_ReadOnlyProxy_2__getitem__;
    }
  }
  {
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_4lxml_5etree__ReadOnlyProxy, "__len__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_4lxml_5etree_14_ReadOnlyProxy_3__len__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_14_ReadOnlyProxy_3__len__.doc = __pyx_doc_4lxml_5etree_14_ReadOnlyProxy_3__len__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_14_ReadOnlyProxy_3__len__;
    }
  }
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__ReadOnlyProxy.tp_dict, __pyx_vtabptr_4lxml_5etree__ReadOnlyProxy) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_ReadOnlyProxy", (PyObject *)&__pyx_type_4lxml_5etree__ReadOnlyProxy) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__ReadOnlyProxy = &__pyx_type_4lxml_5etree__ReadOnlyProxy;
  __pyx_vtabptr_4lxml_5etree__ReadOnlyPIProxy = &__pyx_vtable_4lxml_5etree__ReadOnlyPIProxy;
  __pyx_vtable_4lxml_5etree__ReadOnlyPIProxy.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ReadOnlyProxy;
  __pyx_type_4lxml_5etree__ReadOnlyPIProxy.tp_base = __pyx_ptype_4lxml_5etree__ReadOnlyProxy;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__ReadOnlyPIProxy) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__ReadOnlyPIProxy.tp_dict, __pyx_vtabptr_4lxml_5etree__ReadOnlyPIProxy) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_ReadOnlyPIProxy", (PyObject *)&__pyx_type_4lxml_5etree__ReadOnlyPIProxy) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__ReadOnlyPIProxy = &__pyx_type_4lxml_5etree__ReadOnlyPIProxy;
  __pyx_vtabptr_4lxml_5etree__ReadOnlyEntityProxy = &__pyx_vtable_4lxml_5etree__ReadOnlyEntityProxy;
  __pyx_vtable_4lxml_5etree__ReadOnlyEntityProxy.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ReadOnlyProxy;
  __pyx_type_4lxml_5etree__ReadOnlyEntityProxy.tp_base = __pyx_ptype_4lxml_5etree__ReadOnlyProxy;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__ReadOnlyEntityProxy) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__ReadOnlyEntityProxy.tp_dict, __pyx_vtabptr_4lxml_5etree__ReadOnlyEntityProxy) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_ReadOnlyEntityProxy", (PyObject *)&__pyx_type_4lxml_5etree__ReadOnlyEntityProxy) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__ReadOnlyEntityProxy = &__pyx_type_4lxml_5etree__ReadOnlyEntityProxy;
  __pyx_vtabptr_4lxml_5etree__ReadOnlyElementProxy = &__pyx_vtable_4lxml_5etree__ReadOnlyElementProxy;
  __pyx_vtable_4lxml_5etree__ReadOnlyElementProxy.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ReadOnlyProxy;
  __pyx_type_4lxml_5etree__ReadOnlyElementProxy.tp_base = __pyx_ptype_4lxml_5etree__ReadOnlyProxy;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__ReadOnlyElementProxy) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__ReadOnlyElementProxy.tp_dict, __pyx_vtabptr_4lxml_5etree__ReadOnlyElementProxy) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_ReadOnlyElementProxy", (PyObject *)&__pyx_type_4lxml_5etree__ReadOnlyElementProxy) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__ReadOnlyElementProxy = &__pyx_type_4lxml_5etree__ReadOnlyElementProxy;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__OpaqueNodeWrapper) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_OpaqueNodeWrapper", (PyObject *)&__pyx_type_4lxml_5etree__OpaqueNodeWrapper) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__OpaqueNodeWrapper = &__pyx_type_4lxml_5etree__OpaqueNodeWrapper;
  __pyx_vtabptr_4lxml_5etree__OpaqueDocumentWrapper = &__pyx_vtable_4lxml_5etree__OpaqueDocumentWrapper;
  __pyx_vtable_4lxml_5etree__OpaqueDocumentWrapper._assertNode = (int (*)(struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper *))__pyx_f_4lxml_5etree_22_OpaqueDocumentWrapper__assertNode;
  __pyx_vtable_4lxml_5etree__OpaqueDocumentWrapper.append = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper *, PyObject *, int __pyx_skip_dispatch))__pyx_f_4lxml_5etree_22_OpaqueDocumentWrapper_append;
  __pyx_type_4lxml_5etree__OpaqueDocumentWrapper.tp_base = __pyx_ptype_4lxml_5etree__OpaqueNodeWrapper;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__OpaqueDocumentWrapper) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__OpaqueDocumentWrapper.tp_dict, __pyx_vtabptr_4lxml_5etree__OpaqueDocumentWrapper) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_OpaqueDocumentWrapper", (PyObject *)&__pyx_type_4lxml_5etree__OpaqueDocumentWrapper) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__OpaqueDocumentWrapper = &__pyx_type_4lxml_5etree__OpaqueDocumentWrapper;
  __pyx_vtabptr_4lxml_5etree__ModifyContentOnlyProxy = &__pyx_vtable_4lxml_5etree__ModifyContentOnlyProxy;
  __pyx_vtable_4lxml_5etree__ModifyContentOnlyProxy.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ReadOnlyProxy;
  __pyx_type_4lxml_5etree__ModifyContentOnlyProxy.tp_base = __pyx_ptype_4lxml_5etree__ReadOnlyProxy;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__ModifyContentOnlyProxy) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__ModifyContentOnlyProxy.tp_dict, __pyx_vtabptr_4lxml_5etree__ModifyContentOnlyProxy) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_ModifyContentOnlyProxy", (PyObject *)&__pyx_type_4lxml_5etree__ModifyContentOnlyProxy) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__ModifyContentOnlyProxy = &__pyx_type_4lxml_5etree__ModifyContentOnlyProxy;
  __pyx_vtabptr_4lxml_5etree__ModifyContentOnlyPIProxy = &__pyx_vtable_4lxml_5etree__ModifyContentOnlyPIProxy;
  __pyx_vtable_4lxml_5etree__ModifyContentOnlyPIProxy.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ModifyContentOnlyProxy;
  __pyx_type_4lxml_5etree__ModifyContentOnlyPIProxy.tp_base = __pyx_ptype_4lxml_5etree__ModifyContentOnlyProxy;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__ModifyContentOnlyPIProxy) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__ModifyContentOnlyPIProxy.tp_dict, __pyx_vtabptr_4lxml_5etree__ModifyContentOnlyPIProxy) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_ModifyContentOnlyPIProxy", (PyObject *)&__pyx_type_4lxml_5etree__ModifyContentOnlyPIProxy) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__ModifyContentOnlyPIProxy = &__pyx_type_4lxml_5etree__ModifyContentOnlyPIProxy;
  __pyx_vtabptr_4lxml_5etree__ModifyContentOnlyEntityProxy = &__pyx_vtable_4lxml_5etree__ModifyContentOnlyEntityProxy;
  __pyx_vtable_4lxml_5etree__ModifyContentOnlyEntityProxy.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ModifyContentOnlyProxy;
  __pyx_type_4lxml_5etree__ModifyContentOnlyEntityProxy.tp_base = __pyx_ptype_4lxml_5etree__ModifyContentOnlyProxy;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__ModifyContentOnlyEntityProxy) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__ModifyContentOnlyEntityProxy.tp_dict, __pyx_vtabptr_4lxml_5etree__ModifyContentOnlyEntityProxy) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_ModifyContentOnlyEntityProxy", (PyObject *)&__pyx_type_4lxml_5etree__ModifyContentOnlyEntityProxy) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__ModifyContentOnlyEntityProxy = &__pyx_type_4lxml_5etree__ModifyContentOnlyEntityProxy;
  __pyx_vtabptr_4lxml_5etree__AppendOnlyElementProxy = &__pyx_vtable_4lxml_5etree__AppendOnlyElementProxy;
  __pyx_vtable_4lxml_5etree__AppendOnlyElementProxy.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ReadOnlyElementProxy;
  __pyx_vtable_4lxml_5etree__AppendOnlyElementProxy.append = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *, PyObject *, int __pyx_skip_dispatch))__pyx_f_4lxml_5etree_23_AppendOnlyElementProxy_append;
  __pyx_type_4lxml_5etree__AppendOnlyElementProxy.tp_base = __pyx_ptype_4lxml_5etree__ReadOnlyElementProxy;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__AppendOnlyElementProxy) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__AppendOnlyElementProxy.tp_dict, __pyx_vtabptr_4lxml_5etree__AppendOnlyElementProxy) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_AppendOnlyElementProxy", (PyObject *)&__pyx_type_4lxml_5etree__AppendOnlyElementProxy) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__AppendOnlyElementProxy = &__pyx_type_4lxml_5etree__AppendOnlyElementProxy;
  LxmlElementBaseType.tp_base = __pyx_ptype_4lxml_5etree__Element;
  if (PyType_Ready(&LxmlElementBaseType) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  {
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&LxmlElementBaseType, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_4lxml_5etree_11ElementBase___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_11ElementBase___init__.doc = __pyx_doc_4lxml_5etree_11ElementBase___init__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_11ElementBase___init__;
    }
  }
  if (__Pyx_SetAttrString(__pyx_m, "ElementBase", (PyObject *)&LxmlElementBaseType) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_ElementBase = &LxmlElementBaseType;
  __pyx_vtabptr_4lxml_5etree_CommentBase = &__pyx_vtable_4lxml_5etree_CommentBase;
  __pyx_vtable_4lxml_5etree_CommentBase.__pyx_base = *__pyx_vtabptr_4lxml_5etree__Comment;
  __pyx_type_4lxml_5etree_CommentBase.tp_base = __pyx_ptype_4lxml_5etree__Comment;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_CommentBase) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_CommentBase.tp_dict, __pyx_vtabptr_4lxml_5etree_CommentBase) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "CommentBase", (PyObject *)&__pyx_type_4lxml_5etree_CommentBase) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_CommentBase = &__pyx_type_4lxml_5etree_CommentBase;
  __pyx_vtabptr_4lxml_5etree_PIBase = &__pyx_vtable_4lxml_5etree_PIBase;
  __pyx_vtable_4lxml_5etree_PIBase.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ProcessingInstruction;
  __pyx_type_4lxml_5etree_PIBase.tp_base = __pyx_ptype_4lxml_5etree__ProcessingInstruction;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_PIBase) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_PIBase.tp_dict, __pyx_vtabptr_4lxml_5etree_PIBase) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "PIBase", (PyObject *)&__pyx_type_4lxml_5etree_PIBase) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_PIBase = &__pyx_type_4lxml_5etree_PIBase;
  __pyx_vtabptr_4lxml_5etree_EntityBase = &__pyx_vtable_4lxml_5etree_EntityBase;
  __pyx_vtable_4lxml_5etree_EntityBase.__pyx_base = *__pyx_vtabptr_4lxml_5etree__Entity;
  __pyx_type_4lxml_5etree_EntityBase.tp_base = __pyx_ptype_4lxml_5etree__Entity;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_EntityBase) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_EntityBase.tp_dict, __pyx_vtabptr_4lxml_5etree_EntityBase) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "EntityBase", (PyObject *)&__pyx_type_4lxml_5etree_EntityBase) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_EntityBase = &__pyx_type_4lxml_5etree_EntityBase;
  if (PyType_Ready(&LxmlElementClassLookupType) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "ElementClassLookup", (PyObject *)&LxmlElementClassLookupType) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_ElementClassLookup = &LxmlElementClassLookupType;
  __pyx_vtabptr_4lxml_5etree_FallbackElementClassLookup = &__pyx_vtable_4lxml_5etree_FallbackElementClassLookup;
  __pyx_vtable_4lxml_5etree_FallbackElementClassLookup._setFallback = (void (*)(struct LxmlFallbackElementClassLookup *, struct LxmlElementClassLookup *))__pyx_f_4lxml_5etree_26FallbackElementClassLookup__setFallback;
  LxmlFallbackElementClassLookupType.tp_base = __pyx_ptype_4lxml_5etree_ElementClassLookup;
  if (PyType_Ready(&LxmlFallbackElementClassLookupType) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(LxmlFallbackElementClassLookupType.tp_dict, __pyx_vtabptr_4lxml_5etree_FallbackElementClassLookup) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "FallbackElementClassLookup", (PyObject *)&LxmlFallbackElementClassLookupType) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_FallbackElementClassLookup = &LxmlFallbackElementClassLookupType;
  __pyx_type_4lxml_5etree_ElementDefaultClassLookup.tp_base = __pyx_ptype_4lxml_5etree_ElementClassLookup;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_ElementDefaultClassLookup) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "ElementDefaultClassLookup", (PyObject *)&__pyx_type_4lxml_5etree_ElementDefaultClassLookup) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_ElementDefaultClassLookup = &__pyx_type_4lxml_5etree_ElementDefaultClassLookup;
  __pyx_vtabptr_4lxml_5etree_AttributeBasedElementClassLookup = &__pyx_vtable_4lxml_5etree_AttributeBasedElementClassLookup;
  __pyx_vtable_4lxml_5etree_AttributeBasedElementClassLookup.__pyx_base = *__pyx_vtabptr_4lxml_5etree_FallbackElementClassLookup;
  __pyx_type_4lxml_5etree_AttributeBasedElementClassLookup.tp_base = __pyx_ptype_4lxml_5etree_FallbackElementClassLookup;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_AttributeBasedElementClassLookup) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_AttributeBasedElementClassLookup.tp_dict, __pyx_vtabptr_4lxml_5etree_AttributeBasedElementClassLookup) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "AttributeBasedElementClassLookup", (PyObject *)&__pyx_type_4lxml_5etree_AttributeBasedElementClassLookup) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_AttributeBasedElementClassLookup = &__pyx_type_4lxml_5etree_AttributeBasedElementClassLookup;
  __pyx_vtabptr_4lxml_5etree_ParserBasedElementClassLookup = &__pyx_vtable_4lxml_5etree_ParserBasedElementClassLookup;
  __pyx_vtable_4lxml_5etree_ParserBasedElementClassLookup.__pyx_base = *__pyx_vtabptr_4lxml_5etree_FallbackElementClassLookup;
  __pyx_type_4lxml_5etree_ParserBasedElementClassLookup.tp_base = __pyx_ptype_4lxml_5etree_FallbackElementClassLookup;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_ParserBasedElementClassLookup) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_ParserBasedElementClassLookup.tp_dict, __pyx_vtabptr_4lxml_5etree_ParserBasedElementClassLookup) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "ParserBasedElementClassLookup", (PyObject *)&__pyx_type_4lxml_5etree_ParserBasedElementClassLookup) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_ParserBasedElementClassLookup = &__pyx_type_4lxml_5etree_ParserBasedElementClassLookup;
  __pyx_vtabptr_4lxml_5etree_CustomElementClassLookup = &__pyx_vtable_4lxml_5etree_CustomElementClassLookup;
  __pyx_vtable_4lxml_5etree_CustomElementClassLookup.__pyx_base = *__pyx_vtabptr_4lxml_5etree_FallbackElementClassLookup;
  __pyx_type_4lxml_5etree_CustomElementClassLookup.tp_base = __pyx_ptype_4lxml_5etree_FallbackElementClassLookup;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_CustomElementClassLookup) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_CustomElementClassLookup.tp_dict, __pyx_vtabptr_4lxml_5etree_CustomElementClassLookup) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "CustomElementClassLookup", (PyObject *)&__pyx_type_4lxml_5etree_CustomElementClassLookup) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_CustomElementClassLookup = &__pyx_type_4lxml_5etree_CustomElementClassLookup;
  __pyx_vtabptr_4lxml_5etree_PythonElementClassLookup = &__pyx_vtable_4lxml_5etree_PythonElementClassLookup;
  __pyx_vtable_4lxml_5etree_PythonElementClassLookup.__pyx_base = *__pyx_vtabptr_4lxml_5etree_FallbackElementClassLookup;
  __pyx_type_4lxml_5etree_PythonElementClassLookup.tp_base = __pyx_ptype_4lxml_5etree_FallbackElementClassLookup;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_PythonElementClassLookup) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_PythonElementClassLookup.tp_dict, __pyx_vtabptr_4lxml_5etree_PythonElementClassLookup) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "PythonElementClassLookup", (PyObject *)&__pyx_type_4lxml_5etree_PythonElementClassLookup) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_PythonElementClassLookup = &__pyx_type_4lxml_5etree_PythonElementClassLookup;
  __pyx_vtabptr_4lxml_5etree__NamespaceRegistry = &__pyx_vtable_4lxml_5etree__NamespaceRegistry;
  __pyx_vtable_4lxml_5etree__NamespaceRegistry._get = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *, PyObject *))__pyx_f_4lxml_5etree_18_NamespaceRegistry__get;
  __pyx_vtable_4lxml_5etree__NamespaceRegistry._getForString = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *, char *))__pyx_f_4lxml_5etree_18_NamespaceRegistry__getForString;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__NamespaceRegistry) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__NamespaceRegistry.tp_dict, __pyx_vtabptr_4lxml_5etree__NamespaceRegistry) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_NamespaceRegistry", (PyObject *)&__pyx_type_4lxml_5etree__NamespaceRegistry) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__NamespaceRegistry = &__pyx_type_4lxml_5etree__NamespaceRegistry;
  __pyx_vtabptr_4lxml_5etree__ClassNamespaceRegistry = &__pyx_vtable_4lxml_5etree__ClassNamespaceRegistry;
  __pyx_vtable_4lxml_5etree__ClassNamespaceRegistry.__pyx_base = *__pyx_vtabptr_4lxml_5etree__NamespaceRegistry;
  __pyx_type_4lxml_5etree__ClassNamespaceRegistry.tp_base = __pyx_ptype_4lxml_5etree__NamespaceRegistry;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__ClassNamespaceRegistry) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__ClassNamespaceRegistry.tp_dict, __pyx_vtabptr_4lxml_5etree__ClassNamespaceRegistry) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_ClassNamespaceRegistry", (PyObject *)&__pyx_type_4lxml_5etree__ClassNamespaceRegistry) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__ClassNamespaceRegistry = &__pyx_type_4lxml_5etree__ClassNamespaceRegistry;
  __pyx_vtabptr_4lxml_5etree_ElementNamespaceClassLookup = &__pyx_vtable_4lxml_5etree_ElementNamespaceClassLookup;
  __pyx_vtable_4lxml_5etree_ElementNamespaceClassLookup.__pyx_base = *__pyx_vtabptr_4lxml_5etree_FallbackElementClassLookup;
  __pyx_type_4lxml_5etree_ElementNamespaceClassLookup.tp_base = __pyx_ptype_4lxml_5etree_FallbackElementClassLookup;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_ElementNamespaceClassLookup) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_ElementNamespaceClassLookup.tp_dict, __pyx_vtabptr_4lxml_5etree_ElementNamespaceClassLookup) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "ElementNamespaceClassLookup", (PyObject *)&__pyx_type_4lxml_5etree_ElementNamespaceClassLookup) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_ElementNamespaceClassLookup = &__pyx_type_4lxml_5etree_ElementNamespaceClassLookup;
  __pyx_vtabptr_4lxml_5etree__FunctionNamespaceRegistry = &__pyx_vtable_4lxml_5etree__FunctionNamespaceRegistry;
  __pyx_vtable_4lxml_5etree__FunctionNamespaceRegistry.__pyx_base = *__pyx_vtabptr_4lxml_5etree__NamespaceRegistry;
  __pyx_type_4lxml_5etree__FunctionNamespaceRegistry.tp_base = __pyx_ptype_4lxml_5etree__NamespaceRegistry;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__FunctionNamespaceRegistry) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__FunctionNamespaceRegistry.tp_dict, __pyx_vtabptr_4lxml_5etree__FunctionNamespaceRegistry) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_FunctionNamespaceRegistry", (PyObject *)&__pyx_type_4lxml_5etree__FunctionNamespaceRegistry) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__FunctionNamespaceRegistry = &__pyx_type_4lxml_5etree__FunctionNamespaceRegistry;
  __pyx_vtabptr_4lxml_5etree__XPathFunctionNamespaceRegistry = &__pyx_vtable_4lxml_5etree__XPathFunctionNamespaceRegistry;
  __pyx_vtable_4lxml_5etree__XPathFunctionNamespaceRegistry.__pyx_base = *__pyx_vtabptr_4lxml_5etree__FunctionNamespaceRegistry;
  __pyx_type_4lxml_5etree__XPathFunctionNamespaceRegistry.tp_base = __pyx_ptype_4lxml_5etree__FunctionNamespaceRegistry;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__XPathFunctionNamespaceRegistry) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__XPathFunctionNamespaceRegistry.tp_dict, __pyx_vtabptr_4lxml_5etree__XPathFunctionNamespaceRegistry) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_XPathFunctionNamespaceRegistry", (PyObject *)&__pyx_type_4lxml_5etree__XPathFunctionNamespaceRegistry) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__XPathFunctionNamespaceRegistry = &__pyx_type_4lxml_5etree__XPathFunctionNamespaceRegistry;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__InputDocument) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_InputDocument", (PyObject *)&__pyx_type_4lxml_5etree__InputDocument) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__InputDocument = &__pyx_type_4lxml_5etree__InputDocument;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_Resolver) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "Resolver", (PyObject *)&__pyx_type_4lxml_5etree_Resolver) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_Resolver = &__pyx_type_4lxml_5etree_Resolver;
  __pyx_vtabptr_4lxml_5etree__ResolverRegistry = &__pyx_vtable_4lxml_5etree__ResolverRegistry;
  __pyx_vtable_4lxml_5etree__ResolverRegistry._copy = (struct __pyx_obj_4lxml_5etree__ResolverRegistry *(*)(struct __pyx_obj_4lxml_5etree__ResolverRegistry *))__pyx_f_4lxml_5etree_17_ResolverRegistry__copy;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__ResolverRegistry) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__ResolverRegistry.tp_dict, __pyx_vtabptr_4lxml_5etree__ResolverRegistry) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_ResolverRegistry", (PyObject *)&__pyx_type_4lxml_5etree__ResolverRegistry) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__ResolverRegistry = &__pyx_type_4lxml_5etree__ResolverRegistry;
  __pyx_vtabptr_4lxml_5etree__ResolverContext = &__pyx_vtable_4lxml_5etree__ResolverContext;
  __pyx_vtable_4lxml_5etree__ResolverContext.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ExceptionContext;
  __pyx_vtable_4lxml_5etree__ResolverContext.__pyx_base.clear = (void (*)(struct __pyx_obj_4lxml_5etree__ExceptionContext *))__pyx_f_4lxml_5etree_16_ResolverContext_clear;
  __pyx_type_4lxml_5etree__ResolverContext.tp_base = __pyx_ptype_4lxml_5etree__ExceptionContext;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__ResolverContext) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__ResolverContext.tp_dict, __pyx_vtabptr_4lxml_5etree__ResolverContext) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_ResolverContext", (PyObject *)&__pyx_type_4lxml_5etree__ResolverContext) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__ResolverContext = &__pyx_type_4lxml_5etree__ResolverContext;
  __pyx_vtabptr_4lxml_5etree__ParserContext = &__pyx_vtable_4lxml_5etree__ParserContext;
  __pyx_vtable_4lxml_5etree__ParserContext.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ResolverContext;
  __pyx_vtable_4lxml_5etree__ParserContext._copy = (struct __pyx_obj_4lxml_5etree__ParserContext *(*)(struct __pyx_obj_4lxml_5etree__ParserContext *))__pyx_f_4lxml_5etree_14_ParserContext__copy;
  __pyx_vtable_4lxml_5etree__ParserContext._initParserContext = (void (*)(struct __pyx_obj_4lxml_5etree__ParserContext *, xmlParserCtxt *))__pyx_f_4lxml_5etree_14_ParserContext__initParserContext;
  __pyx_vtable_4lxml_5etree__ParserContext._resetParserContext = (void (*)(struct __pyx_obj_4lxml_5etree__ParserContext *))__pyx_f_4lxml_5etree_14_ParserContext__resetParserContext;
  __pyx_vtable_4lxml_5etree__ParserContext.prepare = (int (*)(struct __pyx_obj_4lxml_5etree__ParserContext *))__pyx_f_4lxml_5etree_14_ParserContext_prepare;
  __pyx_vtable_4lxml_5etree__ParserContext.cleanup = (int (*)(struct __pyx_obj_4lxml_5etree__ParserContext *))__pyx_f_4lxml_5etree_14_ParserContext_cleanup;
  __pyx_vtable_4lxml_5etree__ParserContext._handleParseResult = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__ParserContext *, struct __pyx_obj_4lxml_5etree__BaseParser *, xmlDoc *, PyObject *))__pyx_f_4lxml_5etree_14_ParserContext__handleParseResult;
  __pyx_vtable_4lxml_5etree__ParserContext._handleParseResultDoc = (xmlDoc *(*)(struct __pyx_obj_4lxml_5etree__ParserContext *, struct __pyx_obj_4lxml_5etree__BaseParser *, xmlDoc *, PyObject *))__pyx_f_4lxml_5etree_14_ParserContext__handleParseResultDoc;
  __pyx_type_4lxml_5etree__ParserContext.tp_base = __pyx_ptype_4lxml_5etree__ResolverContext;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__ParserContext) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__ParserContext.tp_dict, __pyx_vtabptr_4lxml_5etree__ParserContext) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_ParserContext", (PyObject *)&__pyx_type_4lxml_5etree__ParserContext) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__ParserContext = &__pyx_type_4lxml_5etree__ParserContext;
  __pyx_vtabptr_4lxml_5etree__SaxParserContext = &__pyx_vtable_4lxml_5etree__SaxParserContext;
  __pyx_vtable_4lxml_5etree__SaxParserContext.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ParserContext;
  __pyx_vtable_4lxml_5etree__SaxParserContext.__pyx_base._initParserContext = (void (*)(struct __pyx_obj_4lxml_5etree__ParserContext *, xmlParserCtxt *))__pyx_f_4lxml_5etree_17_SaxParserContext__initParserContext;
  __pyx_vtable_4lxml_5etree__SaxParserContext._setSaxParserTarget = (void (*)(struct __pyx_obj_4lxml_5etree__SaxParserContext *, struct __pyx_obj_4lxml_5etree__SaxParserTarget *))__pyx_f_4lxml_5etree_17_SaxParserContext__setSaxParserTarget;
  __pyx_vtable_4lxml_5etree__SaxParserContext._handleSaxException = (void (*)(struct __pyx_obj_4lxml_5etree__SaxParserContext *, xmlParserCtxt *))__pyx_f_4lxml_5etree_17_SaxParserContext__handleSaxException;
  __pyx_type_4lxml_5etree__SaxParserContext.tp_base = __pyx_ptype_4lxml_5etree__ParserContext;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__SaxParserContext) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__SaxParserContext.tp_dict, __pyx_vtabptr_4lxml_5etree__SaxParserContext) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_SaxParserContext", (PyObject *)&__pyx_type_4lxml_5etree__SaxParserContext) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__SaxParserContext = &__pyx_type_4lxml_5etree__SaxParserContext;
  __pyx_vtabptr_4lxml_5etree__TargetParserContext = &__pyx_vtable_4lxml_5etree__TargetParserContext;
  __pyx_vtable_4lxml_5etree__TargetParserContext.__pyx_base = *__pyx_vtabptr_4lxml_5etree__SaxParserContext;
  __pyx_vtable_4lxml_5etree__TargetParserContext.__pyx_base.__pyx_base._copy = (struct __pyx_obj_4lxml_5etree__ParserContext *(*)(struct __pyx_obj_4lxml_5etree__ParserContext *))__pyx_f_4lxml_5etree_20_TargetParserContext__copy;
  __pyx_vtable_4lxml_5etree__TargetParserContext.__pyx_base.__pyx_base._handleParseResult = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__ParserContext *, struct __pyx_obj_4lxml_5etree__BaseParser *, xmlDoc *, PyObject *))__pyx_f_4lxml_5etree_20_TargetParserContext__handleParseResult;
  __pyx_vtable_4lxml_5etree__TargetParserContext.__pyx_base.__pyx_base._handleParseResultDoc = (xmlDoc *(*)(struct __pyx_obj_4lxml_5etree__ParserContext *, struct __pyx_obj_4lxml_5etree__BaseParser *, xmlDoc *, PyObject *))__pyx_f_4lxml_5etree_20_TargetParserContext__handleParseResultDoc;
  __pyx_vtable_4lxml_5etree__TargetParserContext._setTarget = (int (*)(struct __pyx_obj_4lxml_5etree__TargetParserContext *, PyObject *))__pyx_f_4lxml_5etree_20_TargetParserContext__setTarget;
  __pyx_vtable_4lxml_5etree__TargetParserContext._cleanupTargetParserContext = (void (*)(struct __pyx_obj_4lxml_5etree__TargetParserContext *, xmlDoc *))__pyx_f_4lxml_5etree_20_TargetParserContext__cleanupTargetParserContext;
  __pyx_type_4lxml_5etree__TargetParserContext.tp_base = __pyx_ptype_4lxml_5etree__SaxParserContext;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__TargetParserContext) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__TargetParserContext.tp_dict, __pyx_vtabptr_4lxml_5etree__TargetParserContext) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_TargetParserContext", (PyObject *)&__pyx_type_4lxml_5etree__TargetParserContext) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__TargetParserContext = &__pyx_type_4lxml_5etree__TargetParserContext;
  __pyx_vtabptr_4lxml_5etree__ParserSchemaValidationContext = &__pyx_vtable_4lxml_5etree__ParserSchemaValidationContext;
  __pyx_vtable_4lxml_5etree__ParserSchemaValidationContext.copy = (struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *(*)(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *))__pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_copy;
  __pyx_vtable_4lxml_5etree__ParserSchemaValidationContext.inject_default_attributes = (void (*)(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *, xmlDoc *))__pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_inject_default_attributes;
  __pyx_vtable_4lxml_5etree__ParserSchemaValidationContext.connect = (int (*)(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *, xmlParserCtxt *))__pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_connect;
  __pyx_vtable_4lxml_5etree__ParserSchemaValidationContext.disconnect = (void (*)(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *))__pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_disconnect;
  __pyx_vtable_4lxml_5etree__ParserSchemaValidationContext.isvalid = (int (*)(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *))__pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_isvalid;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__ParserSchemaValidationContext) < 0) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__ParserSchemaValidationContext.tp_dict, __pyx_vtabptr_4lxml_5etree__ParserSchemaValidationContext) < 0) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_ParserSchemaValidationContext", (PyObject *)&__pyx_type_4lxml_5etree__ParserSchemaValidationContext) < 0) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__ParserSchemaValidationContext = &__pyx_type_4lxml_5etree__ParserSchemaValidationContext;
  __pyx_vtabptr_4lxml_5etree__Validator = &__pyx_vtable_4lxml_5etree__Validator;
  __pyx_vtable_4lxml_5etree__Validator._append_log_message = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__Validator *, int, int, int, int, PyObject *, PyObject *, int __pyx_skip_dispatch))__pyx_f_4lxml_5etree_10_Validator__append_log_message;
  __pyx_vtable_4lxml_5etree__Validator._clear_error_log = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__Validator *, int __pyx_skip_dispatch))__pyx_f_4lxml_5etree_10_Validator__clear_error_log;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__Validator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2985; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__Validator.tp_dict, __pyx_vtabptr_4lxml_5etree__Validator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2985; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_Validator", (PyObject *)&__pyx_type_4lxml_5etree__Validator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2985; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__Validator = &__pyx_type_4lxml_5etree__Validator;
  __pyx_vtabptr_4lxml_5etree_XMLSchema = &__pyx_vtable_4lxml_5etree_XMLSchema;
  __pyx_vtable_4lxml_5etree_XMLSchema.__pyx_base = *__pyx_vtabptr_4lxml_5etree__Validator;
  __pyx_vtable_4lxml_5etree_XMLSchema._newSaxValidator = (struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *(*)(struct __pyx_obj_4lxml_5etree_XMLSchema *, int))__pyx_f_4lxml_5etree_9XMLSchema__newSaxValidator;
  __pyx_type_4lxml_5etree_XMLSchema.tp_base = __pyx_ptype_4lxml_5etree__Validator;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_XMLSchema) < 0) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  {
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_4lxml_5etree_XMLSchema, "__call__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_4lxml_5etree_9XMLSchema_3__call__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_9XMLSchema_3__call__.doc = __pyx_doc_4lxml_5etree_9XMLSchema_3__call__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_9XMLSchema_3__call__;
    }
  }
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_XMLSchema.tp_dict, __pyx_vtabptr_4lxml_5etree_XMLSchema) < 0) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "XMLSchema", (PyObject *)&__pyx_type_4lxml_5etree_XMLSchema) < 0) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_XMLSchema = &__pyx_type_4lxml_5etree_XMLSchema;
  __pyx_vtabptr_4lxml_5etree__ParserDictionaryContext = &__pyx_vtable_4lxml_5etree__ParserDictionaryContext;
  __pyx_vtable_4lxml_5etree__ParserDictionaryContext.initMainParserContext = (void (*)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *))__pyx_f_4lxml_5etree_24_ParserDictionaryContext_initMainParserContext;
  __pyx_vtable_4lxml_5etree__ParserDictionaryContext._findThreadParserContext = (struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *(*)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *))__pyx_f_4lxml_5etree_24_ParserDictionaryContext__findThreadParserContext;
  __pyx_vtable_4lxml_5etree__ParserDictionaryContext.setDefaultParser = (void (*)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, struct __pyx_obj_4lxml_5etree__BaseParser *))__pyx_f_4lxml_5etree_24_ParserDictionaryContext_setDefaultParser;
  __pyx_vtable_4lxml_5etree__ParserDictionaryContext.getDefaultParser = (struct __pyx_obj_4lxml_5etree__BaseParser *(*)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *))__pyx_f_4lxml_5etree_24_ParserDictionaryContext_getDefaultParser;
  __pyx_vtable_4lxml_5etree__ParserDictionaryContext._getThreadDict = (xmlDict *(*)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, xmlDict *))__pyx_f_4lxml_5etree_24_ParserDictionaryContext__getThreadDict;
  __pyx_vtable_4lxml_5etree__ParserDictionaryContext.initThreadDictRef = (void (*)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, xmlDict **))__pyx_f_4lxml_5etree_24_ParserDictionaryContext_initThreadDictRef;
  __pyx_vtable_4lxml_5etree__ParserDictionaryContext.initParserDict = (void (*)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, xmlParserCtxt *))__pyx_f_4lxml_5etree_24_ParserDictionaryContext_initParserDict;
  __pyx_vtable_4lxml_5etree__ParserDictionaryContext.initXPathParserDict = (void (*)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, xmlXPathContext *))__pyx_f_4lxml_5etree_24_ParserDictionaryContext_initXPathParserDict;
  __pyx_vtable_4lxml_5etree__ParserDictionaryContext.initDocDict = (void (*)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, xmlDoc *))__pyx_f_4lxml_5etree_24_ParserDictionaryContext_initDocDict;
  __pyx_vtable_4lxml_5etree__ParserDictionaryContext.findImpliedContext = (struct __pyx_obj_4lxml_5etree__ParserContext *(*)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *))__pyx_f_4lxml_5etree_24_ParserDictionaryContext_findImpliedContext;
  __pyx_vtable_4lxml_5etree__ParserDictionaryContext.pushImpliedContextFromParser = (void (*)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, struct __pyx_obj_4lxml_5etree__BaseParser *))__pyx_f_4lxml_5etree_24_ParserDictionaryContext_pushImpliedContextFromParser;
  __pyx_vtable_4lxml_5etree__ParserDictionaryContext.pushImpliedContext = (void (*)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, struct __pyx_obj_4lxml_5etree__ParserContext *))__pyx_f_4lxml_5etree_24_ParserDictionaryContext_pushImpliedContext;
  __pyx_vtable_4lxml_5etree__ParserDictionaryContext.popImpliedContext = (void (*)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *))__pyx_f_4lxml_5etree_24_ParserDictionaryContext_popImpliedContext;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__ParserDictionaryContext) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__ParserDictionaryContext.tp_dict, __pyx_vtabptr_4lxml_5etree__ParserDictionaryContext) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_ParserDictionaryContext", (PyObject *)&__pyx_type_4lxml_5etree__ParserDictionaryContext) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__ParserDictionaryContext = &__pyx_type_4lxml_5etree__ParserDictionaryContext;
  __pyx_vtabptr_4lxml_5etree__FileReaderContext = &__pyx_vtable_4lxml_5etree__FileReaderContext;
  __pyx_vtable_4lxml_5etree__FileReaderContext._close_file = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__FileReaderContext *))__pyx_f_4lxml_5etree_18_FileReaderContext__close_file;
  __pyx_vtable_4lxml_5etree__FileReaderContext._createParserInputBuffer = (xmlParserInputBuffer *(*)(struct __pyx_obj_4lxml_5etree__FileReaderContext *))__pyx_f_4lxml_5etree_18_FileReaderContext__createParserInputBuffer;
  __pyx_vtable_4lxml_5etree__FileReaderContext._createParserInput = (xmlParserInput *(*)(struct __pyx_obj_4lxml_5etree__FileReaderContext *, xmlParserCtxt *))__pyx_f_4lxml_5etree_18_FileReaderContext__createParserInput;
  __pyx_vtable_4lxml_5etree__FileReaderContext._readDtd = (xmlDtd *(*)(struct __pyx_obj_4lxml_5etree__FileReaderContext *))__pyx_f_4lxml_5etree_18_FileReaderContext__readDtd;
  __pyx_vtable_4lxml_5etree__FileReaderContext._readDoc = (xmlDoc *(*)(struct __pyx_obj_4lxml_5etree__FileReaderContext *, xmlParserCtxt *, int))__pyx_f_4lxml_5etree_18_FileReaderContext__readDoc;
  __pyx_vtable_4lxml_5etree__FileReaderContext.copyToBuffer = (int (*)(struct __pyx_obj_4lxml_5etree__FileReaderContext *, char *, int))__pyx_f_4lxml_5etree_18_FileReaderContext_copyToBuffer;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__FileReaderContext) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__FileReaderContext.tp_dict, __pyx_vtabptr_4lxml_5etree__FileReaderContext) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_FileReaderContext", (PyObject *)&__pyx_type_4lxml_5etree__FileReaderContext) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__FileReaderContext = &__pyx_type_4lxml_5etree__FileReaderContext;
  __pyx_vtabptr_4lxml_5etree__FeedParser = &__pyx_vtable_4lxml_5etree__FeedParser;
  __pyx_vtable_4lxml_5etree__FeedParser.__pyx_base = *__pyx_vtabptr_4lxml_5etree__BaseParser;
  __pyx_type_4lxml_5etree__FeedParser.tp_base = __pyx_ptype_4lxml_5etree__BaseParser;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__FeedParser) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1028; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__FeedParser.tp_dict, __pyx_vtabptr_4lxml_5etree__FeedParser) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1028; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_FeedParser", (PyObject *)&__pyx_type_4lxml_5etree__FeedParser) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1028; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__FeedParser = &__pyx_type_4lxml_5etree__FeedParser;
  __pyx_vtabptr_4lxml_5etree_XMLParser = &__pyx_vtable_4lxml_5etree_XMLParser;
  __pyx_vtable_4lxml_5etree_XMLParser.__pyx_base = *__pyx_vtabptr_4lxml_5etree__FeedParser;
  __pyx_type_4lxml_5etree_XMLParser.tp_base = __pyx_ptype_4lxml_5etree__FeedParser;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_XMLParser) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_XMLParser.tp_dict, __pyx_vtabptr_4lxml_5etree_XMLParser) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "XMLParser", (PyObject *)&__pyx_type_4lxml_5etree_XMLParser) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_XMLParser = &__pyx_type_4lxml_5etree_XMLParser;
  __pyx_vtabptr_4lxml_5etree_ETCompatXMLParser = &__pyx_vtable_4lxml_5etree_ETCompatXMLParser;
  __pyx_vtable_4lxml_5etree_ETCompatXMLParser.__pyx_base = *__pyx_vtabptr_4lxml_5etree_XMLParser;
  __pyx_type_4lxml_5etree_ETCompatXMLParser.tp_base = __pyx_ptype_4lxml_5etree_XMLParser;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_ETCompatXMLParser) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_ETCompatXMLParser.tp_dict, __pyx_vtabptr_4lxml_5etree_ETCompatXMLParser) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "ETCompatXMLParser", (PyObject *)&__pyx_type_4lxml_5etree_ETCompatXMLParser) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_ETCompatXMLParser = &__pyx_type_4lxml_5etree_ETCompatXMLParser;
  __pyx_vtabptr_4lxml_5etree_HTMLParser = &__pyx_vtable_4lxml_5etree_HTMLParser;
  __pyx_vtable_4lxml_5etree_HTMLParser.__pyx_base = *__pyx_vtabptr_4lxml_5etree__FeedParser;
  __pyx_type_4lxml_5etree_HTMLParser.tp_base = __pyx_ptype_4lxml_5etree__FeedParser;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_HTMLParser) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_HTMLParser.tp_dict, __pyx_vtabptr_4lxml_5etree_HTMLParser) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "HTMLParser", (PyObject *)&__pyx_type_4lxml_5etree_HTMLParser) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_HTMLParser = &__pyx_type_4lxml_5etree_HTMLParser;
  __pyx_vtabptr_4lxml_5etree__SaxParserTarget = &__pyx_vtable_4lxml_5etree__SaxParserTarget;
  __pyx_vtable_4lxml_5etree__SaxParserTarget._handleSaxStart = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxStart;
  __pyx_vtable_4lxml_5etree__SaxParserTarget._handleSaxEnd = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *))__pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxEnd;
  __pyx_vtable_4lxml_5etree__SaxParserTarget._handleSaxData = (int (*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *))__pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxData;
  __pyx_vtable_4lxml_5etree__SaxParserTarget._handleSaxDoctype = (int (*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxDoctype;
  __pyx_vtable_4lxml_5etree__SaxParserTarget._handleSaxPi = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxPi;
  __pyx_vtable_4lxml_5etree__SaxParserTarget._handleSaxComment = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *))__pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxComment;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__SaxParserTarget) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__SaxParserTarget.tp_dict, __pyx_vtabptr_4lxml_5etree__SaxParserTarget) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_SaxParserTarget", (PyObject *)&__pyx_type_4lxml_5etree__SaxParserTarget) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__SaxParserTarget = &__pyx_type_4lxml_5etree__SaxParserTarget;
  __pyx_vtabptr_4lxml_5etree_TreeBuilder = &__pyx_vtable_4lxml_5etree_TreeBuilder;
  __pyx_vtable_4lxml_5etree_TreeBuilder.__pyx_base = *__pyx_vtabptr_4lxml_5etree__SaxParserTarget;
  __pyx_vtable_4lxml_5etree_TreeBuilder.__pyx_base._handleSaxStart = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_11TreeBuilder__handleSaxStart;
  __pyx_vtable_4lxml_5etree_TreeBuilder.__pyx_base._handleSaxEnd = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *))__pyx_f_4lxml_5etree_11TreeBuilder__handleSaxEnd;
  __pyx_vtable_4lxml_5etree_TreeBuilder.__pyx_base._handleSaxData = (int (*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *))__pyx_f_4lxml_5etree_11TreeBuilder__handleSaxData;
  __pyx_vtable_4lxml_5etree_TreeBuilder.__pyx_base._handleSaxPi = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_11TreeBuilder__handleSaxPi;
  __pyx_vtable_4lxml_5etree_TreeBuilder.__pyx_base._handleSaxComment = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *))__pyx_f_4lxml_5etree_11TreeBuilder__handleSaxComment;
  __pyx_vtable_4lxml_5etree_TreeBuilder._flush = (int (*)(struct __pyx_obj_4lxml_5etree_TreeBuilder *))__pyx_f_4lxml_5etree_11TreeBuilder__flush;
  __pyx_type_4lxml_5etree_TreeBuilder.tp_base = __pyx_ptype_4lxml_5etree__SaxParserTarget;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_TreeBuilder) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_TreeBuilder.tp_dict, __pyx_vtabptr_4lxml_5etree_TreeBuilder) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "TreeBuilder", (PyObject *)&__pyx_type_4lxml_5etree_TreeBuilder) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_TreeBuilder = &__pyx_type_4lxml_5etree_TreeBuilder;
  __pyx_vtabptr_4lxml_5etree__PythonSaxParserTarget = &__pyx_vtable_4lxml_5etree__PythonSaxParserTarget;
  __pyx_vtable_4lxml_5etree__PythonSaxParserTarget.__pyx_base = *__pyx_vtabptr_4lxml_5etree__SaxParserTarget;
  __pyx_vtable_4lxml_5etree__PythonSaxParserTarget.__pyx_base._handleSaxStart = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxStart;
  __pyx_vtable_4lxml_5etree__PythonSaxParserTarget.__pyx_base._handleSaxEnd = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *))__pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxEnd;
  __pyx_vtable_4lxml_5etree__PythonSaxParserTarget.__pyx_base._handleSaxData = (int (*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *))__pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxData;
  __pyx_vtable_4lxml_5etree__PythonSaxParserTarget.__pyx_base._handleSaxDoctype = (int (*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxDoctype;
  __pyx_vtable_4lxml_5etree__PythonSaxParserTarget.__pyx_base._handleSaxPi = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxPi;
  __pyx_vtable_4lxml_5etree__PythonSaxParserTarget.__pyx_base._handleSaxComment = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *))__pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxComment;
  __pyx_type_4lxml_5etree__PythonSaxParserTarget.tp_base = __pyx_ptype_4lxml_5etree__SaxParserTarget;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__PythonSaxParserTarget) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__PythonSaxParserTarget.tp_dict, __pyx_vtabptr_4lxml_5etree__PythonSaxParserTarget) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_PythonSaxParserTarget", (PyObject *)&__pyx_type_4lxml_5etree__PythonSaxParserTarget) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__PythonSaxParserTarget = &__pyx_type_4lxml_5etree__PythonSaxParserTarget;
  __pyx_vtabptr_4lxml_5etree__FilelikeWriter = &__pyx_vtable_4lxml_5etree__FilelikeWriter;
  __pyx_vtable_4lxml_5etree__FilelikeWriter._createOutputBuffer = (xmlOutputBuffer *(*)(struct __pyx_obj_4lxml_5etree__FilelikeWriter *, xmlCharEncodingHandler *))__pyx_f_4lxml_5etree_15_FilelikeWriter__createOutputBuffer;
  __pyx_vtable_4lxml_5etree__FilelikeWriter.write = (int (*)(struct __pyx_obj_4lxml_5etree__FilelikeWriter *, char *, int))__pyx_f_4lxml_5etree_15_FilelikeWriter_write;
  __pyx_vtable_4lxml_5etree__FilelikeWriter.close = (int (*)(struct __pyx_obj_4lxml_5etree__FilelikeWriter *))__pyx_f_4lxml_5etree_15_FilelikeWriter_close;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__FilelikeWriter) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__FilelikeWriter.tp_dict, __pyx_vtabptr_4lxml_5etree__FilelikeWriter) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_FilelikeWriter", (PyObject *)&__pyx_type_4lxml_5etree__FilelikeWriter) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__FilelikeWriter = &__pyx_type_4lxml_5etree__FilelikeWriter;
  __pyx_vtabptr_4lxml_5etree__IterparseContext = &__pyx_vtable_4lxml_5etree__IterparseContext;
  __pyx_vtable_4lxml_5etree__IterparseContext.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ParserContext;
  __pyx_vtable_4lxml_5etree__IterparseContext.__pyx_base._initParserContext = (void (*)(struct __pyx_obj_4lxml_5etree__ParserContext *, xmlParserCtxt *))__pyx_f_4lxml_5etree_17_IterparseContext__initParserContext;
  __pyx_vtable_4lxml_5etree__IterparseContext._setEventFilter = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__IterparseContext *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_17_IterparseContext__setEventFilter;
  __pyx_vtable_4lxml_5etree__IterparseContext.startNode = (int (*)(struct __pyx_obj_4lxml_5etree__IterparseContext *, xmlNode *))__pyx_f_4lxml_5etree_17_IterparseContext_startNode;
  __pyx_vtable_4lxml_5etree__IterparseContext.endNode = (int (*)(struct __pyx_obj_4lxml_5etree__IterparseContext *, xmlNode *))__pyx_f_4lxml_5etree_17_IterparseContext_endNode;
  __pyx_vtable_4lxml_5etree__IterparseContext.pushEvent = (int (*)(struct __pyx_obj_4lxml_5etree__IterparseContext *, PyObject *, xmlNode *))__pyx_f_4lxml_5etree_17_IterparseContext_pushEvent;
  __pyx_vtable_4lxml_5etree__IterparseContext._assureDocGetsFreed = (void (*)(struct __pyx_obj_4lxml_5etree__IterparseContext *))__pyx_f_4lxml_5etree_17_IterparseContext__assureDocGetsFreed;
  __pyx_type_4lxml_5etree__IterparseContext.tp_base = __pyx_ptype_4lxml_5etree__ParserContext;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__IterparseContext) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__IterparseContext.tp_dict, __pyx_vtabptr_4lxml_5etree__IterparseContext) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_IterparseContext", (PyObject *)&__pyx_type_4lxml_5etree__IterparseContext) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__IterparseContext = &__pyx_type_4lxml_5etree__IterparseContext;
  __pyx_vtabptr_4lxml_5etree_iterparse = &__pyx_vtable_4lxml_5etree_iterparse;
  __pyx_vtable_4lxml_5etree_iterparse.__pyx_base = *__pyx_vtabptr_4lxml_5etree__BaseParser;
  __pyx_vtable_4lxml_5etree_iterparse.__pyx_base._createContext = (struct __pyx_obj_4lxml_5etree__ParserContext *(*)(struct __pyx_obj_4lxml_5etree__BaseParser *, PyObject *))__pyx_f_4lxml_5etree_9iterparse__createContext;
  __pyx_vtable_4lxml_5etree_iterparse._close_source = (PyObject *(*)(struct __pyx_obj_4lxml_5etree_iterparse *))__pyx_f_4lxml_5etree_9iterparse__close_source;
  __pyx_vtable_4lxml_5etree_iterparse._read_more_events = (PyObject *(*)(struct __pyx_obj_4lxml_5etree_iterparse *, struct __pyx_obj_4lxml_5etree__IterparseContext *))__pyx_f_4lxml_5etree_9iterparse__read_more_events;
  __pyx_type_4lxml_5etree_iterparse.tp_base = __pyx_ptype_4lxml_5etree__BaseParser;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_iterparse) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_iterparse.tp_dict, __pyx_vtabptr_4lxml_5etree_iterparse) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "iterparse", (PyObject *)&__pyx_type_4lxml_5etree_iterparse) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_iterparse = &__pyx_type_4lxml_5etree_iterparse;
  __pyx_vtabptr_4lxml_5etree_iterwalk = &__pyx_vtable_4lxml_5etree_iterwalk;
  __pyx_vtable_4lxml_5etree_iterwalk._setTagFilter = (void (*)(struct __pyx_obj_4lxml_5etree_iterwalk *, PyObject *))__pyx_f_4lxml_5etree_8iterwalk__setTagFilter;
  __pyx_vtable_4lxml_5etree_iterwalk._start_node = (int (*)(struct __pyx_obj_4lxml_5etree_iterwalk *, struct LxmlElement *))__pyx_f_4lxml_5etree_8iterwalk__start_node;
  __pyx_vtable_4lxml_5etree_iterwalk._end_node = (struct LxmlElement *(*)(struct __pyx_obj_4lxml_5etree_iterwalk *))__pyx_f_4lxml_5etree_8iterwalk__end_node;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_iterwalk) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_iterwalk.tp_dict, __pyx_vtabptr_4lxml_5etree_iterwalk) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "iterwalk", (PyObject *)&__pyx_type_4lxml_5etree_iterwalk) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_iterwalk = &__pyx_type_4lxml_5etree_iterwalk;
  __pyx_vtabptr_4lxml_5etree__IDDict = &__pyx_vtable_4lxml_5etree__IDDict;
  __pyx_vtable_4lxml_5etree__IDDict._build_keys = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__IDDict *))__pyx_f_4lxml_5etree_7_IDDict__build_keys;
  __pyx_vtable_4lxml_5etree__IDDict._build_items = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__IDDict *))__pyx_f_4lxml_5etree_7_IDDict__build_items;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__IDDict) < 0) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__IDDict.tp_dict, __pyx_vtabptr_4lxml_5etree__IDDict) < 0) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_IDDict", (PyObject *)&__pyx_type_4lxml_5etree__IDDict) < 0) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__IDDict = &__pyx_type_4lxml_5etree__IDDict;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_XInclude) < 0) {__pyx_filename = __pyx_f[16]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  {
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_4lxml_5etree_XInclude, "__call__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[16]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_4lxml_5etree_8XInclude_1__call__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_8XInclude_1__call__.doc = __pyx_doc_4lxml_5etree_8XInclude_1__call__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_8XInclude_1__call__;
    }
  }
  if (__Pyx_SetAttrString(__pyx_m, "XInclude", (PyObject *)&__pyx_type_4lxml_5etree_XInclude) < 0) {__pyx_filename = __pyx_f[16]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_XInclude = &__pyx_type_4lxml_5etree_XInclude;
  __pyx_vtabptr_4lxml_5etree__ExsltRegExp = &__pyx_vtable_4lxml_5etree__ExsltRegExp;
  __pyx_vtable_4lxml_5etree__ExsltRegExp._make_string = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__ExsltRegExp *, PyObject *))__pyx_f_4lxml_5etree_12_ExsltRegExp__make_string;
  __pyx_vtable_4lxml_5etree__ExsltRegExp._compile = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__ExsltRegExp *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_12_ExsltRegExp__compile;
  __pyx_vtable_4lxml_5etree__ExsltRegExp._register_in_context = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__ExsltRegExp *, struct __pyx_obj_4lxml_5etree__BaseContext *))__pyx_f_4lxml_5etree_12_ExsltRegExp__register_in_context;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__ExsltRegExp) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__ExsltRegExp.tp_dict, __pyx_vtabptr_4lxml_5etree__ExsltRegExp) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_ExsltRegExp", (PyObject *)&__pyx_type_4lxml_5etree__ExsltRegExp) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__ExsltRegExp = &__pyx_type_4lxml_5etree__ExsltRegExp;
  __pyx_vtabptr_4lxml_5etree__BaseContext = &__pyx_vtable_4lxml_5etree__BaseContext;
  __pyx_vtable_4lxml_5etree__BaseContext._copy = (struct __pyx_obj_4lxml_5etree__BaseContext *(*)(struct __pyx_obj_4lxml_5etree__BaseContext *))__pyx_f_4lxml_5etree_12_BaseContext__copy;
  __pyx_vtable_4lxml_5etree__BaseContext._to_utf = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseContext *, PyObject *))__pyx_f_4lxml_5etree_12_BaseContext__to_utf;
  __pyx_vtable_4lxml_5etree__BaseContext._set_xpath_context = (void (*)(struct __pyx_obj_4lxml_5etree__BaseContext *, xmlXPathContext *))__pyx_f_4lxml_5etree_12_BaseContext__set_xpath_context;
  __pyx_vtable_4lxml_5etree__BaseContext._register_context = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseContext *, struct LxmlDocument *))__pyx_f_4lxml_5etree_12_BaseContext__register_context;
  __pyx_vtable_4lxml_5etree__BaseContext._cleanup_context = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseContext *))__pyx_f_4lxml_5etree_12_BaseContext__cleanup_context;
  __pyx_vtable_4lxml_5etree__BaseContext._release_context = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseContext *))__pyx_f_4lxml_5etree_12_BaseContext__release_context;
  __pyx_vtable_4lxml_5etree__BaseContext.addNamespace = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseContext *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_12_BaseContext_addNamespace;
  __pyx_vtable_4lxml_5etree__BaseContext.registerNamespace = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseContext *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_12_BaseContext_registerNamespace;
  __pyx_vtable_4lxml_5etree__BaseContext.registerLocalNamespaces = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseContext *))__pyx_f_4lxml_5etree_12_BaseContext_registerLocalNamespaces;
  __pyx_vtable_4lxml_5etree__BaseContext.registerGlobalNamespaces = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseContext *))__pyx_f_4lxml_5etree_12_BaseContext_registerGlobalNamespaces;
  __pyx_vtable_4lxml_5etree__BaseContext.unregisterGlobalNamespaces = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseContext *))__pyx_f_4lxml_5etree_12_BaseContext_unregisterGlobalNamespaces;
  __pyx_vtable_4lxml_5etree__BaseContext._unregisterNamespace = (void (*)(struct __pyx_obj_4lxml_5etree__BaseContext *, PyObject *))__pyx_f_4lxml_5etree_12_BaseContext__unregisterNamespace;
  __pyx_vtable_4lxml_5etree__BaseContext._addLocalExtensionFunction = (void (*)(struct __pyx_obj_4lxml_5etree__BaseContext *, PyObject *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_12_BaseContext__addLocalExtensionFunction;
  __pyx_vtable_4lxml_5etree__BaseContext.registerGlobalFunctions = (void (*)(struct __pyx_obj_4lxml_5etree__BaseContext *, void *, __pyx_t_4lxml_5etree__register_function))__pyx_f_4lxml_5etree_12_BaseContext_registerGlobalFunctions;
  __pyx_vtable_4lxml_5etree__BaseContext.registerLocalFunctions = (void (*)(struct __pyx_obj_4lxml_5etree__BaseContext *, void *, __pyx_t_4lxml_5etree__register_function))__pyx_f_4lxml_5etree_12_BaseContext_registerLocalFunctions;
  __pyx_vtable_4lxml_5etree__BaseContext.unregisterAllFunctions = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseContext *, void *, __pyx_t_4lxml_5etree__register_function))__pyx_f_4lxml_5etree_12_BaseContext_unregisterAllFunctions;
  __pyx_vtable_4lxml_5etree__BaseContext.unregisterGlobalFunctions = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseContext *, void *, __pyx_t_4lxml_5etree__register_function))__pyx_f_4lxml_5etree_12_BaseContext_unregisterGlobalFunctions;
  __pyx_vtable_4lxml_5etree__BaseContext._find_cached_function = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseContext *, char *, char *))__pyx_f_4lxml_5etree_12_BaseContext__find_cached_function;
  __pyx_vtable_4lxml_5etree__BaseContext._release_temp_refs = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseContext *))__pyx_f_4lxml_5etree_12_BaseContext__release_temp_refs;
  __pyx_vtable_4lxml_5etree__BaseContext._hold = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseContext *, PyObject *))__pyx_f_4lxml_5etree_12_BaseContext__hold;
  __pyx_vtable_4lxml_5etree__BaseContext._findDocumentForNode = (struct LxmlDocument *(*)(struct __pyx_obj_4lxml_5etree__BaseContext *, xmlNode *))__pyx_f_4lxml_5etree_12_BaseContext__findDocumentForNode;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__BaseContext) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__BaseContext.tp_dict, __pyx_vtabptr_4lxml_5etree__BaseContext) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_BaseContext", (PyObject *)&__pyx_type_4lxml_5etree__BaseContext) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__BaseContext = &__pyx_type_4lxml_5etree__BaseContext;
  __pyx_type_4lxml_5etree__ElementUnicodeResult.tp_base = (&PyUnicode_Type);
  if (PyType_Ready(&__pyx_type_4lxml_5etree__ElementUnicodeResult) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_ElementUnicodeResult", (PyObject *)&__pyx_type_4lxml_5etree__ElementUnicodeResult) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__ElementUnicodeResult = &__pyx_type_4lxml_5etree__ElementUnicodeResult;
  __pyx_vtabptr_4lxml_5etree__XPathContext = &__pyx_vtable_4lxml_5etree__XPathContext;
  __pyx_vtable_4lxml_5etree__XPathContext.__pyx_base = *__pyx_vtabptr_4lxml_5etree__BaseContext;
  __pyx_vtable_4lxml_5etree__XPathContext.set_context = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__XPathContext *, xmlXPathContext *))__pyx_f_4lxml_5etree_13_XPathContext_set_context;
  __pyx_vtable_4lxml_5etree__XPathContext.register_context = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__XPathContext *, struct LxmlDocument *))__pyx_f_4lxml_5etree_13_XPathContext_register_context;
  __pyx_vtable_4lxml_5etree__XPathContext.unregister_context = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__XPathContext *))__pyx_f_4lxml_5etree_13_XPathContext_unregister_context;
  __pyx_vtable_4lxml_5etree__XPathContext.registerExsltFunctions = (void (*)(struct __pyx_obj_4lxml_5etree__XPathContext *))__pyx_f_4lxml_5etree_13_XPathContext_registerExsltFunctions;
  __pyx_vtable_4lxml_5etree__XPathContext.registerVariables = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__XPathContext *, PyObject *))__pyx_f_4lxml_5etree_13_XPathContext_registerVariables;
  __pyx_vtable_4lxml_5etree__XPathContext.registerVariable = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__XPathContext *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_13_XPathContext_registerVariable;
  __pyx_vtable_4lxml_5etree__XPathContext._registerVariable = (void (*)(struct __pyx_obj_4lxml_5etree__XPathContext *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_13_XPathContext__registerVariable;
  __pyx_vtable_4lxml_5etree__XPathContext._setupDict = (void (*)(struct __pyx_obj_4lxml_5etree__XPathContext *, xmlXPathContext *))__pyx_f_4lxml_5etree_13_XPathContext__setupDict;
  __pyx_type_4lxml_5etree__XPathContext.tp_base = __pyx_ptype_4lxml_5etree__BaseContext;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__XPathContext) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__XPathContext.tp_dict, __pyx_vtabptr_4lxml_5etree__XPathContext) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_XPathContext", (PyObject *)&__pyx_type_4lxml_5etree__XPathContext) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__XPathContext = &__pyx_type_4lxml_5etree__XPathContext;
  __pyx_vtabptr_4lxml_5etree__XPathEvaluatorBase = &__pyx_vtable_4lxml_5etree__XPathEvaluatorBase;
  __pyx_vtable_4lxml_5etree__XPathEvaluatorBase.set_context = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *, xmlXPathContext *))__pyx_f_4lxml_5etree_19_XPathEvaluatorBase_set_context;
  __pyx_vtable_4lxml_5etree__XPathEvaluatorBase._checkAbsolutePath = (int (*)(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *, char *))__pyx_f_4lxml_5etree_19_XPathEvaluatorBase__checkAbsolutePath;
  __pyx_vtable_4lxml_5etree__XPathEvaluatorBase._lock = (int (*)(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *))__pyx_f_4lxml_5etree_19_XPathEvaluatorBase__lock;
  __pyx_vtable_4lxml_5etree__XPathEvaluatorBase._unlock = (void (*)(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *))__pyx_f_4lxml_5etree_19_XPathEvaluatorBase__unlock;
  __pyx_vtable_4lxml_5etree__XPathEvaluatorBase._raise_parse_error = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *))__pyx_f_4lxml_5etree_19_XPathEvaluatorBase__raise_parse_error;
  __pyx_vtable_4lxml_5etree__XPathEvaluatorBase._raise_eval_error = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *))__pyx_f_4lxml_5etree_19_XPathEvaluatorBase__raise_eval_error;
  __pyx_vtable_4lxml_5etree__XPathEvaluatorBase._handle_result = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *, xmlXPathObject *, struct LxmlDocument *))__pyx_f_4lxml_5etree_19_XPathEvaluatorBase__handle_result;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__XPathEvaluatorBase) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__XPathEvaluatorBase.tp_dict, __pyx_vtabptr_4lxml_5etree__XPathEvaluatorBase) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_XPathEvaluatorBase", (PyObject *)&__pyx_type_4lxml_5etree__XPathEvaluatorBase) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__XPathEvaluatorBase = &__pyx_type_4lxml_5etree__XPathEvaluatorBase;
  __pyx_vtabptr_4lxml_5etree_XPathElementEvaluator = &__pyx_vtable_4lxml_5etree_XPathElementEvaluator;
  __pyx_vtable_4lxml_5etree_XPathElementEvaluator.__pyx_base = *__pyx_vtabptr_4lxml_5etree__XPathEvaluatorBase;
  __pyx_type_4lxml_5etree_XPathElementEvaluator.tp_base = __pyx_ptype_4lxml_5etree__XPathEvaluatorBase;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_XPathElementEvaluator) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  {
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_4lxml_5etree_XPathElementEvaluator, "__call__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_4lxml_5etree_21XPathElementEvaluator_3__call__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_21XPathElementEvaluator_3__call__.doc = __pyx_doc_4lxml_5etree_21XPathElementEvaluator_3__call__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_21XPathElementEvaluator_3__call__;
    }
  }
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_XPathElementEvaluator.tp_dict, __pyx_vtabptr_4lxml_5etree_XPathElementEvaluator) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "XPathElementEvaluator", (PyObject *)&__pyx_type_4lxml_5etree_XPathElementEvaluator) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_XPathElementEvaluator = &__pyx_type_4lxml_5etree_XPathElementEvaluator;
  __pyx_vtabptr_4lxml_5etree_XPathDocumentEvaluator = &__pyx_vtable_4lxml_5etree_XPathDocumentEvaluator;
  __pyx_vtable_4lxml_5etree_XPathDocumentEvaluator.__pyx_base = *__pyx_vtabptr_4lxml_5etree_XPathElementEvaluator;
  __pyx_type_4lxml_5etree_XPathDocumentEvaluator.tp_base = __pyx_ptype_4lxml_5etree_XPathElementEvaluator;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_XPathDocumentEvaluator) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  {
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_4lxml_5etree_XPathDocumentEvaluator, "__call__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_4lxml_5etree_22XPathDocumentEvaluator_1__call__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_22XPathDocumentEvaluator_1__call__.doc = __pyx_doc_4lxml_5etree_22XPathDocumentEvaluator_1__call__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_22XPathDocumentEvaluator_1__call__;
    }
  }
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_XPathDocumentEvaluator.tp_dict, __pyx_vtabptr_4lxml_5etree_XPathDocumentEvaluator) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "XPathDocumentEvaluator", (PyObject *)&__pyx_type_4lxml_5etree_XPathDocumentEvaluator) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_XPathDocumentEvaluator = &__pyx_type_4lxml_5etree_XPathDocumentEvaluator;
  __pyx_vtabptr_4lxml_5etree_XPath = &__pyx_vtable_4lxml_5etree_XPath;
  __pyx_vtable_4lxml_5etree_XPath.__pyx_base = *__pyx_vtabptr_4lxml_5etree__XPathEvaluatorBase;
  __pyx_type_4lxml_5etree_XPath.tp_base = __pyx_ptype_4lxml_5etree__XPathEvaluatorBase;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_XPath) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  {
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_4lxml_5etree_XPath, "__call__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_4lxml_5etree_5XPath_2__call__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_5XPath_2__call__.doc = __pyx_doc_4lxml_5etree_5XPath_2__call__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_5XPath_2__call__;
    }
  }
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_XPath.tp_dict, __pyx_vtabptr_4lxml_5etree_XPath) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "XPath", (PyObject *)&__pyx_type_4lxml_5etree_XPath) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_XPath = &__pyx_type_4lxml_5etree_XPath;
  __pyx_vtabptr_4lxml_5etree_ETXPath = &__pyx_vtable_4lxml_5etree_ETXPath;
  __pyx_vtable_4lxml_5etree_ETXPath.__pyx_base = *__pyx_vtabptr_4lxml_5etree_XPath;
  __pyx_vtable_4lxml_5etree_ETXPath._nsextract_path = (PyObject *(*)(struct __pyx_obj_4lxml_5etree_ETXPath *, PyObject *))__pyx_f_4lxml_5etree_7ETXPath__nsextract_path;
  __pyx_type_4lxml_5etree_ETXPath.tp_base = __pyx_ptype_4lxml_5etree_XPath;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_ETXPath) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_ETXPath.tp_dict, __pyx_vtabptr_4lxml_5etree_ETXPath) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "ETXPath", (PyObject *)&__pyx_type_4lxml_5etree_ETXPath) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_ETXPath = &__pyx_type_4lxml_5etree_ETXPath;
  __pyx_vtabptr_4lxml_5etree__XSLTResolverContext = &__pyx_vtable_4lxml_5etree__XSLTResolverContext;
  __pyx_vtable_4lxml_5etree__XSLTResolverContext.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ResolverContext;
  __pyx_vtable_4lxml_5etree__XSLTResolverContext._copy = (struct __pyx_obj_4lxml_5etree__XSLTResolverContext *(*)(struct __pyx_obj_4lxml_5etree__XSLTResolverContext *))__pyx_f_4lxml_5etree_20_XSLTResolverContext__copy;
  __pyx_type_4lxml_5etree__XSLTResolverContext.tp_base = __pyx_ptype_4lxml_5etree__ResolverContext;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__XSLTResolverContext) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__XSLTResolverContext.tp_dict, __pyx_vtabptr_4lxml_5etree__XSLTResolverContext) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_XSLTResolverContext", (PyObject *)&__pyx_type_4lxml_5etree__XSLTResolverContext) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__XSLTResolverContext = &__pyx_type_4lxml_5etree__XSLTResolverContext;
  __pyx_vtabptr_4lxml_5etree_XSLTAccessControl = &__pyx_vtable_4lxml_5etree_XSLTAccessControl;
  __pyx_vtable_4lxml_5etree_XSLTAccessControl._setAccess = (PyObject *(*)(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *, xsltSecurityOption, PyObject *))__pyx_f_4lxml_5etree_17XSLTAccessControl__setAccess;
  __pyx_vtable_4lxml_5etree_XSLTAccessControl._register_in_context = (void (*)(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *, xsltTransformContext *))__pyx_f_4lxml_5etree_17XSLTAccessControl__register_in_context;
  __pyx_vtable_4lxml_5etree_XSLTAccessControl._optval = (PyObject *(*)(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *, xsltSecurityOption))__pyx_f_4lxml_5etree_17XSLTAccessControl__optval;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_XSLTAccessControl) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_XSLTAccessControl.tp_dict, __pyx_vtabptr_4lxml_5etree_XSLTAccessControl) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "XSLTAccessControl", (PyObject *)&__pyx_type_4lxml_5etree_XSLTAccessControl) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_XSLTAccessControl = &__pyx_type_4lxml_5etree_XSLTAccessControl;
  __pyx_vtabptr_4lxml_5etree__XSLTContext = &__pyx_vtable_4lxml_5etree__XSLTContext;
  __pyx_vtable_4lxml_5etree__XSLTContext.__pyx_base = *__pyx_vtabptr_4lxml_5etree__BaseContext;
  __pyx_vtable_4lxml_5etree__XSLTContext.__pyx_base._copy = (struct __pyx_obj_4lxml_5etree__BaseContext *(*)(struct __pyx_obj_4lxml_5etree__BaseContext *))__pyx_f_4lxml_5etree_12_XSLTContext__copy;
  __pyx_vtable_4lxml_5etree__XSLTContext.register_context = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__XSLTContext *, xsltTransformContext *, struct LxmlDocument *))__pyx_f_4lxml_5etree_12_XSLTContext_register_context;
  __pyx_vtable_4lxml_5etree__XSLTContext.free_context = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__XSLTContext *))__pyx_f_4lxml_5etree_12_XSLTContext_free_context;
  __pyx_type_4lxml_5etree__XSLTContext.tp_base = __pyx_ptype_4lxml_5etree__BaseContext;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__XSLTContext) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__XSLTContext.tp_dict, __pyx_vtabptr_4lxml_5etree__XSLTContext) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_XSLTContext", (PyObject *)&__pyx_type_4lxml_5etree__XSLTContext) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__XSLTContext = &__pyx_type_4lxml_5etree__XSLTContext;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__XSLTQuotedStringParam) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_XSLTQuotedStringParam", (PyObject *)&__pyx_type_4lxml_5etree__XSLTQuotedStringParam) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__XSLTQuotedStringParam = &__pyx_type_4lxml_5etree__XSLTQuotedStringParam;
  __pyx_vtabptr_4lxml_5etree_XSLT = &__pyx_vtable_4lxml_5etree_XSLT;
  __pyx_vtable_4lxml_5etree_XSLT._run_transform = (xmlDoc *(*)(struct __pyx_obj_4lxml_5etree_XSLT *, xmlDoc *, char **, struct __pyx_obj_4lxml_5etree__XSLTContext *, xsltTransformContext *))__pyx_f_4lxml_5etree_4XSLT__run_transform;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_XSLT) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  {
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_4lxml_5etree_XSLT, "__call__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_4lxml_5etree_4XSLT_8__call__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_4XSLT_8__call__.doc = __pyx_doc_4lxml_5etree_4XSLT_8__call__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_4XSLT_8__call__;
    }
  }
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_XSLT.tp_dict, __pyx_vtabptr_4lxml_5etree_XSLT) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "XSLT", (PyObject *)&__pyx_type_4lxml_5etree_XSLT) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_XSLT = &__pyx_type_4lxml_5etree_XSLT;
  __pyx_vtabptr_4lxml_5etree__XSLTResultTree = &__pyx_vtable_4lxml_5etree__XSLTResultTree;
  __pyx_vtable_4lxml_5etree__XSLTResultTree.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ElementTree;
  __pyx_vtable_4lxml_5etree__XSLTResultTree._saveToStringAndSize = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__XSLTResultTree *, char **, int *))__pyx_f_4lxml_5etree_15_XSLTResultTree__saveToStringAndSize;
  __pyx_type_4lxml_5etree__XSLTResultTree.tp_base = __pyx_ptype_4lxml_5etree__ElementTree;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__XSLTResultTree) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__XSLTResultTree.tp_dict, __pyx_vtabptr_4lxml_5etree__XSLTResultTree) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_XSLTResultTree", (PyObject *)&__pyx_type_4lxml_5etree__XSLTResultTree) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__XSLTResultTree = &__pyx_type_4lxml_5etree__XSLTResultTree;
  __pyx_vtabptr_4lxml_5etree__XSLTProcessingInstruction = &__pyx_vtable_4lxml_5etree__XSLTProcessingInstruction;
  __pyx_vtable_4lxml_5etree__XSLTProcessingInstruction.__pyx_base = *__pyx_vtabptr_4lxml_5etree_PIBase;
  __pyx_type_4lxml_5etree__XSLTProcessingInstruction.tp_base = __pyx_ptype_4lxml_5etree_PIBase;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__XSLTProcessingInstruction) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__XSLTProcessingInstruction.tp_dict, __pyx_vtabptr_4lxml_5etree__XSLTProcessingInstruction) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_XSLTProcessingInstruction", (PyObject *)&__pyx_type_4lxml_5etree__XSLTProcessingInstruction) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__XSLTProcessingInstruction = &__pyx_type_4lxml_5etree__XSLTProcessingInstruction;
  __pyx_vtabptr_4lxml_5etree_XSLTExtension = &__pyx_vtable_4lxml_5etree_XSLTExtension;
  __pyx_vtable_4lxml_5etree_XSLTExtension._collectXSLTResultContent = (PyObject *(*)(struct __pyx_obj_4lxml_5etree_XSLTExtension *, struct __pyx_obj_4lxml_5etree__XSLTContext *, xmlNode *))__pyx_f_4lxml_5etree_13XSLTExtension__collectXSLTResultContent;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_XSLTExtension) < 0) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_XSLTExtension.tp_dict, __pyx_vtabptr_4lxml_5etree_XSLTExtension) < 0) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "XSLTExtension", (PyObject *)&__pyx_type_4lxml_5etree_XSLTExtension) < 0) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_XSLTExtension = &__pyx_type_4lxml_5etree_XSLTExtension;
  __pyx_vtabptr_4lxml_5etree_DTD = &__pyx_vtable_4lxml_5etree_DTD;
  __pyx_vtable_4lxml_5etree_DTD.__pyx_base = *__pyx_vtabptr_4lxml_5etree__Validator;
  __pyx_type_4lxml_5etree_DTD.tp_base = __pyx_ptype_4lxml_5etree__Validator;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_DTD) < 0) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  {
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_4lxml_5etree_DTD, "__call__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_4lxml_5etree_3DTD_3__call__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_3DTD_3__call__.doc = __pyx_doc_4lxml_5etree_3DTD_3__call__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_3DTD_3__call__;
    }
  }
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_DTD.tp_dict, __pyx_vtabptr_4lxml_5etree_DTD) < 0) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "DTD", (PyObject *)&__pyx_type_4lxml_5etree_DTD) < 0) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_DTD = &__pyx_type_4lxml_5etree_DTD;
  __pyx_vtabptr_4lxml_5etree_RelaxNG = &__pyx_vtable_4lxml_5etree_RelaxNG;
  __pyx_vtable_4lxml_5etree_RelaxNG.__pyx_base = *__pyx_vtabptr_4lxml_5etree__Validator;
  __pyx_type_4lxml_5etree_RelaxNG.tp_base = __pyx_ptype_4lxml_5etree__Validator;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_RelaxNG) < 0) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  {
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_4lxml_5etree_RelaxNG, "__call__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_4lxml_5etree_7RelaxNG_3__call__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_7RelaxNG_3__call__.doc = __pyx_doc_4lxml_5etree_7RelaxNG_3__call__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_7RelaxNG_3__call__;
    }
  }
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_RelaxNG.tp_dict, __pyx_vtabptr_4lxml_5etree_RelaxNG) < 0) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "RelaxNG", (PyObject *)&__pyx_type_4lxml_5etree_RelaxNG) < 0) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_RelaxNG = &__pyx_type_4lxml_5etree_RelaxNG;
  __pyx_vtabptr_4lxml_5etree_Schematron = &__pyx_vtable_4lxml_5etree_Schematron;
  __pyx_vtable_4lxml_5etree_Schematron.__pyx_base = *__pyx_vtabptr_4lxml_5etree__Validator;
  __pyx_type_4lxml_5etree_Schematron.tp_base = __pyx_ptype_4lxml_5etree__Validator;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_Schematron) < 0) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  {
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_4lxml_5etree_Schematron, "__call__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_4lxml_5etree_10Schematron_3__call__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_10Schematron_3__call__.doc = __pyx_doc_4lxml_5etree_10Schematron_3__call__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_10Schematron_3__call__;
    }
  }
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_Schematron.tp_dict, __pyx_vtabptr_4lxml_5etree_Schematron) < 0) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "Schematron", (PyObject *)&__pyx_type_4lxml_5etree_Schematron) < 0) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_Schematron = &__pyx_type_4lxml_5etree_Schematron;
  /*--- Type import code ---*/
  /*--- Function import code ---*/
  /*--- Execution code ---*/

  /* "src/lxml/lxml.etree.pyx":5
 * """
 * 
 * __docformat__ = u"restructuredtext en"             # <<<<<<<<<<<<<<
 * 
 * __all__ = [
 */
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____docformat__, ((PyObject *)__pyx_kp_u_457)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":7
 * __docformat__ = u"restructuredtext en"
 * 
 * __all__ = [             # <<<<<<<<<<<<<<
 *     'AttributeBasedElementClassLookup', 'C14NError', 'CDATA',
 *     'Comment', 'CommentBase', 'CustomElementClassLookup', 'DEBUG',
 */
  __pyx_t_1 = PyList_New(111); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(((PyObject *)__pyx_n_s_458));
  PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s_458));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s_458));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__C14NError));
  PyList_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_n_s__C14NError));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__C14NError));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__CDATA));
  PyList_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_n_s__CDATA));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__CDATA));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__Comment));
  PyList_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_n_s__Comment));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Comment));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__CommentBase));
  PyList_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_n_s__CommentBase));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__CommentBase));
  __Pyx_INCREF(((PyObject *)__pyx_n_s_459));
  PyList_SET_ITEM(__pyx_t_1, 5, ((PyObject *)__pyx_n_s_459));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s_459));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__DEBUG));
  PyList_SET_ITEM(__pyx_t_1, 6, ((PyObject *)__pyx_n_s__DEBUG));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__DEBUG));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__DTD));
  PyList_SET_ITEM(__pyx_t_1, 7, ((PyObject *)__pyx_n_s__DTD));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__DTD));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__DTDError));
  PyList_SET_ITEM(__pyx_t_1, 8, ((PyObject *)__pyx_n_s__DTDError));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__DTDError));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__DTDParseError));
  PyList_SET_ITEM(__pyx_t_1, 9, ((PyObject *)__pyx_n_s__DTDParseError));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__DTDParseError));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__DTDValidateError));
  PyList_SET_ITEM(__pyx_t_1, 10, ((PyObject *)__pyx_n_s__DTDValidateError));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__DTDValidateError));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__DocumentInvalid));
  PyList_SET_ITEM(__pyx_t_1, 11, ((PyObject *)__pyx_n_s__DocumentInvalid));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__DocumentInvalid));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ETCompatXMLParser));
  PyList_SET_ITEM(__pyx_t_1, 12, ((PyObject *)__pyx_n_s__ETCompatXMLParser));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ETCompatXMLParser));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ETXPath));
  PyList_SET_ITEM(__pyx_t_1, 13, ((PyObject *)__pyx_n_s__ETXPath));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ETXPath));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__Element));
  PyList_SET_ITEM(__pyx_t_1, 14, ((PyObject *)__pyx_n_s__Element));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Element));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ElementBase));
  PyList_SET_ITEM(__pyx_t_1, 15, ((PyObject *)__pyx_n_s__ElementBase));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ElementBase));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ElementClassLookup));
  PyList_SET_ITEM(__pyx_t_1, 16, ((PyObject *)__pyx_n_s__ElementClassLookup));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ElementClassLookup));
  __Pyx_INCREF(((PyObject *)__pyx_n_s_460));
  PyList_SET_ITEM(__pyx_t_1, 17, ((PyObject *)__pyx_n_s_460));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s_460));
  __Pyx_INCREF(((PyObject *)__pyx_n_s_461));
  PyList_SET_ITEM(__pyx_t_1, 18, ((PyObject *)__pyx_n_s_461));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s_461));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ElementTree));
  PyList_SET_ITEM(__pyx_t_1, 19, ((PyObject *)__pyx_n_s__ElementTree));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ElementTree));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__Entity));
  PyList_SET_ITEM(__pyx_t_1, 20, ((PyObject *)__pyx_n_s__Entity));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Entity));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__EntityBase));
  PyList_SET_ITEM(__pyx_t_1, 21, ((PyObject *)__pyx_n_s__EntityBase));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__EntityBase));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__Error));
  PyList_SET_ITEM(__pyx_t_1, 22, ((PyObject *)__pyx_n_s__Error));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Error));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ErrorDomains));
  PyList_SET_ITEM(__pyx_t_1, 23, ((PyObject *)__pyx_n_s__ErrorDomains));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ErrorDomains));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ErrorLevels));
  PyList_SET_ITEM(__pyx_t_1, 24, ((PyObject *)__pyx_n_s__ErrorLevels));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ErrorLevels));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ErrorTypes));
  PyList_SET_ITEM(__pyx_t_1, 25, ((PyObject *)__pyx_n_s__ErrorTypes));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ErrorTypes));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__Extension));
  PyList_SET_ITEM(__pyx_t_1, 26, ((PyObject *)__pyx_n_s__Extension));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Extension));
  __Pyx_INCREF(((PyObject *)__pyx_n_s_462));
  PyList_SET_ITEM(__pyx_t_1, 27, ((PyObject *)__pyx_n_s_462));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s_462));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__FunctionNamespace));
  PyList_SET_ITEM(__pyx_t_1, 28, ((PyObject *)__pyx_n_s__FunctionNamespace));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__FunctionNamespace));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__HTML));
  PyList_SET_ITEM(__pyx_t_1, 29, ((PyObject *)__pyx_n_s__HTML));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__HTML));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__HTMLParser));
  PyList_SET_ITEM(__pyx_t_1, 30, ((PyObject *)__pyx_n_s__HTMLParser));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__HTMLParser));
  __Pyx_INCREF(((PyObject *)__pyx_n_s_463));
  PyList_SET_ITEM(__pyx_t_1, 31, ((PyObject *)__pyx_n_s_463));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s_463));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__LIBXML_VERSION));
  PyList_SET_ITEM(__pyx_t_1, 32, ((PyObject *)__pyx_n_s__LIBXML_VERSION));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__LIBXML_VERSION));
  __Pyx_INCREF(((PyObject *)__pyx_n_s_464));
  PyList_SET_ITEM(__pyx_t_1, 33, ((PyObject *)__pyx_n_s_464));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s_464));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__LIBXSLT_VERSION));
  PyList_SET_ITEM(__pyx_t_1, 34, ((PyObject *)__pyx_n_s__LIBXSLT_VERSION));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__LIBXSLT_VERSION));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__LXML_VERSION));
  PyList_SET_ITEM(__pyx_t_1, 35, ((PyObject *)__pyx_n_s__LXML_VERSION));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__LXML_VERSION));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__LxmlError));
  PyList_SET_ITEM(__pyx_t_1, 36, ((PyObject *)__pyx_n_s__LxmlError));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__LxmlError));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__LxmlRegistryError));
  PyList_SET_ITEM(__pyx_t_1, 37, ((PyObject *)__pyx_n_s__LxmlRegistryError));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__LxmlRegistryError));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__LxmlSyntaxError));
  PyList_SET_ITEM(__pyx_t_1, 38, ((PyObject *)__pyx_n_s__LxmlSyntaxError));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__LxmlSyntaxError));
  __Pyx_INCREF(((PyObject *)__pyx_n_s_150));
  PyList_SET_ITEM(__pyx_t_1, 39, ((PyObject *)__pyx_n_s_150));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s_150));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__PI));
  PyList_SET_ITEM(__pyx_t_1, 40, ((PyObject *)__pyx_n_s__PI));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PI));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__PIBase));
  PyList_SET_ITEM(__pyx_t_1, 41, ((PyObject *)__pyx_n_s__PIBase));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PIBase));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ParseError));
  PyList_SET_ITEM(__pyx_t_1, 42, ((PyObject *)__pyx_n_s__ParseError));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ParseError));
  __Pyx_INCREF(((PyObject *)__pyx_n_s_465));
  PyList_SET_ITEM(__pyx_t_1, 43, ((PyObject *)__pyx_n_s_465));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s_465));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ParserError));
  PyList_SET_ITEM(__pyx_t_1, 44, ((PyObject *)__pyx_n_s__ParserError));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ParserError));
  __Pyx_INCREF(((PyObject *)__pyx_n_s_79));
  PyList_SET_ITEM(__pyx_t_1, 45, ((PyObject *)__pyx_n_s_79));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s_79));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__PyErrorLog));
  PyList_SET_ITEM(__pyx_t_1, 46, ((PyObject *)__pyx_n_s__PyErrorLog));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PyErrorLog));
  __Pyx_INCREF(((PyObject *)__pyx_n_s_466));
  PyList_SET_ITEM(__pyx_t_1, 47, ((PyObject *)__pyx_n_s_466));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s_466));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__QName));
  PyList_SET_ITEM(__pyx_t_1, 48, ((PyObject *)__pyx_n_s__QName));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__QName));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__RelaxNG));
  PyList_SET_ITEM(__pyx_t_1, 49, ((PyObject *)__pyx_n_s__RelaxNG));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__RelaxNG));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__RelaxNGError));
  PyList_SET_ITEM(__pyx_t_1, 50, ((PyObject *)__pyx_n_s__RelaxNGError));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__RelaxNGError));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__RelaxNGErrorTypes));
  PyList_SET_ITEM(__pyx_t_1, 51, ((PyObject *)__pyx_n_s__RelaxNGErrorTypes));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__RelaxNGErrorTypes));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__RelaxNGParseError));
  PyList_SET_ITEM(__pyx_t_1, 52, ((PyObject *)__pyx_n_s__RelaxNGParseError));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__RelaxNGParseError));
  __Pyx_INCREF(((PyObject *)__pyx_n_s_403));
  PyList_SET_ITEM(__pyx_t_1, 53, ((PyObject *)__pyx_n_s_403));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s_403));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__Resolver));
  PyList_SET_ITEM(__pyx_t_1, 54, ((PyObject *)__pyx_n_s__Resolver));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Resolver));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__Schematron));
  PyList_SET_ITEM(__pyx_t_1, 55, ((PyObject *)__pyx_n_s__Schematron));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Schematron));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__SchematronError));
  PyList_SET_ITEM(__pyx_t_1, 56, ((PyObject *)__pyx_n_s__SchematronError));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__SchematronError));
  __Pyx_INCREF(((PyObject *)__pyx_n_s_416));
  PyList_SET_ITEM(__pyx_t_1, 57, ((PyObject *)__pyx_n_s_416));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s_416));
  __Pyx_INCREF(((PyObject *)__pyx_n_s_419));
  PyList_SET_ITEM(__pyx_t_1, 58, ((PyObject *)__pyx_n_s_419));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s_419));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__SerialisationError));
  PyList_SET_ITEM(__pyx_t_1, 59, ((PyObject *)__pyx_n_s__SerialisationError));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__SerialisationError));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__SubElement));
  PyList_SET_ITEM(__pyx_t_1, 60, ((PyObject *)__pyx_n_s__SubElement));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__SubElement));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__TreeBuilder));
  PyList_SET_ITEM(__pyx_t_1, 61, ((PyObject *)__pyx_n_s__TreeBuilder));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__TreeBuilder));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__XInclude));
  PyList_SET_ITEM(__pyx_t_1, 62, ((PyObject *)__pyx_n_s__XInclude));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__XInclude));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__XIncludeError));
  PyList_SET_ITEM(__pyx_t_1, 63, ((PyObject *)__pyx_n_s__XIncludeError));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__XIncludeError));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__XML));
  PyList_SET_ITEM(__pyx_t_1, 64, ((PyObject *)__pyx_n_s__XML));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__XML));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__XMLDTDID));
  PyList_SET_ITEM(__pyx_t_1, 65, ((PyObject *)__pyx_n_s__XMLDTDID));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__XMLDTDID));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__XMLID));
  PyList_SET_ITEM(__pyx_t_1, 66, ((PyObject *)__pyx_n_s__XMLID));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__XMLID));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__XMLParser));
  PyList_SET_ITEM(__pyx_t_1, 67, ((PyObject *)__pyx_n_s__XMLParser));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__XMLParser));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__XMLSchema));
  PyList_SET_ITEM(__pyx_t_1, 68, ((PyObject *)__pyx_n_s__XMLSchema));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__XMLSchema));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__XMLSchemaError));
  PyList_SET_ITEM(__pyx_t_1, 69, ((PyObject *)__pyx_n_s__XMLSchemaError));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__XMLSchemaError));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__XMLSchemaParseError));
  PyList_SET_ITEM(__pyx_t_1, 70, ((PyObject *)__pyx_n_s__XMLSchemaParseError));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__XMLSchemaParseError));
  __Pyx_INCREF(((PyObject *)__pyx_n_s_412));
  PyList_SET_ITEM(__pyx_t_1, 71, ((PyObject *)__pyx_n_s_412));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s_412));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__XMLSyntaxError));
  PyList_SET_ITEM(__pyx_t_1, 72, ((PyObject *)__pyx_n_s__XMLSyntaxError));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__XMLSyntaxError));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__XMLTreeBuilder));
  PyList_SET_ITEM(__pyx_t_1, 73, ((PyObject *)__pyx_n_s__XMLTreeBuilder));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__XMLTreeBuilder));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__XPath));
  PyList_SET_ITEM(__pyx_t_1, 74, ((PyObject *)__pyx_n_s__XPath));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__XPath));
  __Pyx_INCREF(((PyObject *)__pyx_n_s_467));
  PyList_SET_ITEM(__pyx_t_1, 75, ((PyObject *)__pyx_n_s_467));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s_467));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__XPathError));
  PyList_SET_ITEM(__pyx_t_1, 76, ((PyObject *)__pyx_n_s__XPathError));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__XPathError));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__XPathEvalError));
  PyList_SET_ITEM(__pyx_t_1, 77, ((PyObject *)__pyx_n_s__XPathEvalError));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__XPathEvalError));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__XPathEvaluator));
  PyList_SET_ITEM(__pyx_t_1, 78, ((PyObject *)__pyx_n_s__XPathEvaluator));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__XPathEvaluator));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__XPathFunctionError));
  PyList_SET_ITEM(__pyx_t_1, 79, ((PyObject *)__pyx_n_s__XPathFunctionError));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__XPathFunctionError));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__XPathResultError));
  PyList_SET_ITEM(__pyx_t_1, 80, ((PyObject *)__pyx_n_s__XPathResultError));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__XPathResultError));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__XPathSyntaxError));
  PyList_SET_ITEM(__pyx_t_1, 81, ((PyObject *)__pyx_n_s__XPathSyntaxError));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__XPathSyntaxError));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__XSLT));
  PyList_SET_ITEM(__pyx_t_1, 82, ((PyObject *)__pyx_n_s__XSLT));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__XSLT));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__XSLTAccessControl));
  PyList_SET_ITEM(__pyx_t_1, 83, ((PyObject *)__pyx_n_s__XSLTAccessControl));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__XSLTAccessControl));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__XSLTApplyError));
  PyList_SET_ITEM(__pyx_t_1, 84, ((PyObject *)__pyx_n_s__XSLTApplyError));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__XSLTApplyError));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__XSLTError));
  PyList_SET_ITEM(__pyx_t_1, 85, ((PyObject *)__pyx_n_s__XSLTError));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__XSLTError));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__XSLTExtension));
  PyList_SET_ITEM(__pyx_t_1, 86, ((PyObject *)__pyx_n_s__XSLTExtension));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__XSLTExtension));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__XSLTExtensionError));
  PyList_SET_ITEM(__pyx_t_1, 87, ((PyObject *)__pyx_n_s__XSLTExtensionError));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__XSLTExtensionError));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__XSLTParseError));
  PyList_SET_ITEM(__pyx_t_1, 88, ((PyObject *)__pyx_n_s__XSLTParseError));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__XSLTParseError));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__XSLTSaveError));
  PyList_SET_ITEM(__pyx_t_1, 89, ((PyObject *)__pyx_n_s__XSLTSaveError));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__XSLTSaveError));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__cleanup_namespaces));
  PyList_SET_ITEM(__pyx_t_1, 90, ((PyObject *)__pyx_n_s__cleanup_namespaces));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cleanup_namespaces));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__clear_error_log));
  PyList_SET_ITEM(__pyx_t_1, 91, ((PyObject *)__pyx_n_s__clear_error_log));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__clear_error_log));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__dump));
  PyList_SET_ITEM(__pyx_t_1, 92, ((PyObject *)__pyx_n_s__dump));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dump));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fromstring));
  PyList_SET_ITEM(__pyx_t_1, 93, ((PyObject *)__pyx_n_s__fromstring));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fromstring));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fromstringlist));
  PyList_SET_ITEM(__pyx_t_1, 94, ((PyObject *)__pyx_n_s__fromstringlist));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fromstringlist));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__get_default_parser));
  PyList_SET_ITEM(__pyx_t_1, 95, ((PyObject *)__pyx_n_s__get_default_parser));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__get_default_parser));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__iselement));
  PyList_SET_ITEM(__pyx_t_1, 96, ((PyObject *)__pyx_n_s__iselement));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__iselement));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__iterparse));
  PyList_SET_ITEM(__pyx_t_1, 97, ((PyObject *)__pyx_n_s__iterparse));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__iterparse));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__iterwalk));
  PyList_SET_ITEM(__pyx_t_1, 98, ((PyObject *)__pyx_n_s__iterwalk));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__iterwalk));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__parse));
  PyList_SET_ITEM(__pyx_t_1, 99, ((PyObject *)__pyx_n_s__parse));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__parse));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__parseid));
  PyList_SET_ITEM(__pyx_t_1, 100, ((PyObject *)__pyx_n_s__parseid));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__parseid));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__register_namespace));
  PyList_SET_ITEM(__pyx_t_1, 101, ((PyObject *)__pyx_n_s__register_namespace));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__register_namespace));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__set_default_parser));
  PyList_SET_ITEM(__pyx_t_1, 102, ((PyObject *)__pyx_n_s__set_default_parser));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__set_default_parser));
  __Pyx_INCREF(((PyObject *)__pyx_n_s_184));
  PyList_SET_ITEM(__pyx_t_1, 103, ((PyObject *)__pyx_n_s_184));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s_184));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__strip_attributes));
  PyList_SET_ITEM(__pyx_t_1, 104, ((PyObject *)__pyx_n_s__strip_attributes));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__strip_attributes));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__strip_elements));
  PyList_SET_ITEM(__pyx_t_1, 105, ((PyObject *)__pyx_n_s__strip_elements));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__strip_elements));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__strip_tags));
  PyList_SET_ITEM(__pyx_t_1, 106, ((PyObject *)__pyx_n_s__strip_tags));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__strip_tags));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__tostring));
  PyList_SET_ITEM(__pyx_t_1, 107, ((PyObject *)__pyx_n_s__tostring));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__tostring));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__tostringlist));
  PyList_SET_ITEM(__pyx_t_1, 108, ((PyObject *)__pyx_n_s__tostringlist));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__tostringlist));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__tounicode));
  PyList_SET_ITEM(__pyx_t_1, 109, ((PyObject *)__pyx_n_s__tounicode));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__tounicode));
  __Pyx_INCREF(((PyObject *)__pyx_n_s_468));
  PyList_SET_ITEM(__pyx_t_1, 110, ((PyObject *)__pyx_n_s_468));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s_468));
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____all__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;

  /* "src/lxml/lxml.etree.pyx":47
 * cimport cstd
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import __builtin__
 * except ImportError:
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "src/lxml/lxml.etree.pyx":48
 * 
 * try:
 *     import __builtin__             # <<<<<<<<<<<<<<
 * except ImportError:
 *     # Python 3
 */
      __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s____builtin__), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s____builtin__, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L9_try_end;
    __pyx_L2_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "src/lxml/lxml.etree.pyx":49
 * try:
 *     import __builtin__
 * except ImportError:             # <<<<<<<<<<<<<<
 *     # Python 3
 *     import builtins as __builtin__
 */
    __pyx_t_2 = PyErr_ExceptionMatches(__pyx_builtin_ImportError);
    if (__pyx_t_2) {
      __Pyx_AddTraceback("lxml.etree");
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L4_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_4);

      /* "src/lxml/lxml.etree.pyx":51
 * except ImportError:
 *     # Python 3
 *     import builtins as __builtin__             # <<<<<<<<<<<<<<
 * 
 * cdef object _unicode
 */
      __pyx_t_5 = __Pyx_Import(((PyObject *)__pyx_n_s__builtins), 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L4_except_error;}
      __Pyx_GOTREF(__pyx_t_5);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s____builtin__, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L4_except_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L3_exception_handled;
    }
    __pyx_L4_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L3_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L9_try_end:;
  }

  /* "src/lxml/lxml.etree.pyx":54
 * 
 * cdef object _unicode
 * try:             # <<<<<<<<<<<<<<
 *     _unicode = __builtin__.unicode
 * except AttributeError:
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "src/lxml/lxml.etree.pyx":55
 * cdef object _unicode
 * try:
 *     _unicode = __builtin__.unicode             # <<<<<<<<<<<<<<
 * except AttributeError:
 *     # Python 3
 */
      __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s____builtin__); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__unicode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_v_4lxml_5etree__unicode);
      __Pyx_DECREF(__pyx_v_4lxml_5etree__unicode);
      __Pyx_GIVEREF(__pyx_t_3);
      __pyx_v_4lxml_5etree__unicode = __pyx_t_3;
      __pyx_t_3 = 0;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L19_try_end;
    __pyx_L12_error:;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "src/lxml/lxml.etree.pyx":56
 * try:
 *     _unicode = __builtin__.unicode
 * except AttributeError:             # <<<<<<<<<<<<<<
 *     # Python 3
 *     _unicode = __builtin__.str
 */
    __pyx_t_2 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
    if (__pyx_t_2) {
      __Pyx_AddTraceback("lxml.etree");
      if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_4, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_1);

      /* "src/lxml/lxml.etree.pyx":58
 * except AttributeError:
 *     # Python 3
 *     _unicode = __builtin__.str             # <<<<<<<<<<<<<<
 * 
 * del __builtin__
 */
      __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s____builtin__); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__str); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_v_4lxml_5etree__unicode);
      __Pyx_DECREF(__pyx_v_4lxml_5etree__unicode);
      __Pyx_GIVEREF(__pyx_t_6);
      __pyx_v_4lxml_5etree__unicode = __pyx_t_6;
      __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L13_exception_handled;
    }
    __pyx_L14_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L13_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L19_try_end:;
  }

  /* "src/lxml/lxml.etree.pyx":60
 *     _unicode = __builtin__.str
 * 
 * del __builtin__             # <<<<<<<<<<<<<<
 * 
 * cdef object os_path_abspath
 */
  if (__Pyx_DelAttrString(__pyx_m, "__builtin__") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":63
 * 
 * cdef object os_path_abspath
 * from os.path import abspath as os_path_abspath             # <<<<<<<<<<<<<<
 * 
 * cdef object BytesIO, StringIO
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__abspath));
  PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__abspath));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__abspath));
  __pyx_t_4 = __Pyx_Import(((PyObject *)__pyx_n_s_469), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__abspath); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_4lxml_5etree_os_path_abspath);
  __Pyx_DECREF(__pyx_v_4lxml_5etree_os_path_abspath);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_v_4lxml_5etree_os_path_abspath = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "src/lxml/lxml.etree.pyx":66
 * 
 * cdef object BytesIO, StringIO
 * try:             # <<<<<<<<<<<<<<
 *     from io import BytesIO, StringIO
 * except (ImportError, AttributeError):
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "src/lxml/lxml.etree.pyx":67
 * cdef object BytesIO, StringIO
 * try:
 *     from io import BytesIO, StringIO             # <<<<<<<<<<<<<<
 * except (ImportError, AttributeError):
 *     from StringIO import StringIO, StringIO as BytesIO
 */
      __pyx_t_4 = PyList_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__BytesIO));
      PyList_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_n_s__BytesIO));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__BytesIO));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__StringIO));
      PyList_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_n_s__StringIO));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__StringIO));
      __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__io), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__BytesIO); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_v_4lxml_5etree_BytesIO);
      __Pyx_DECREF(__pyx_v_4lxml_5etree_BytesIO);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_v_4lxml_5etree_BytesIO = __pyx_t_4;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__StringIO); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_v_4lxml_5etree_StringIO);
      __Pyx_DECREF(__pyx_v_4lxml_5etree_StringIO);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_v_4lxml_5etree_StringIO = __pyx_t_4;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L29_try_end;
    __pyx_L22_error:;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "src/lxml/lxml.etree.pyx":68
 * try:
 *     from io import BytesIO, StringIO
 * except (ImportError, AttributeError):             # <<<<<<<<<<<<<<
 *     from StringIO import StringIO, StringIO as BytesIO
 * 
 */
    __pyx_t_2 = PyErr_ExceptionMatches(__pyx_builtin_ImportError) || PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
    if (__pyx_t_2) {
      __Pyx_AddTraceback("lxml.etree");
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_4, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_3);

      /* "src/lxml/lxml.etree.pyx":69
 *     from io import BytesIO, StringIO
 * except (ImportError, AttributeError):
 *     from StringIO import StringIO, StringIO as BytesIO             # <<<<<<<<<<<<<<
 * 
 * cdef object _elementpath
 */
      __pyx_t_6 = PyList_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__StringIO));
      PyList_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_n_s__StringIO));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__StringIO));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__StringIO));
      PyList_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_n_s__StringIO));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__StringIO));
      __pyx_t_5 = __Pyx_Import(((PyObject *)__pyx_n_s__StringIO), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
      __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__StringIO); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_v_4lxml_5etree_StringIO);
      __Pyx_DECREF(__pyx_v_4lxml_5etree_StringIO);
      __Pyx_GIVEREF(__pyx_t_6);
      __pyx_v_4lxml_5etree_StringIO = __pyx_t_6;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__StringIO); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_v_4lxml_5etree_BytesIO);
      __Pyx_DECREF(__pyx_v_4lxml_5etree_BytesIO);
      __Pyx_GIVEREF(__pyx_t_6);
      __pyx_v_4lxml_5etree_BytesIO = __pyx_t_6;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L23_exception_handled;
    }
    __pyx_L24_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L23_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L29_try_end:;
  }

  /* "src/lxml/lxml.etree.pyx":72
 * 
 * cdef object _elementpath
 * import _elementpath             # <<<<<<<<<<<<<<
 * 
 * cdef object sys
 */
  __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s___elementpath), 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_4lxml_5etree__elementpath);
  __Pyx_DECREF(__pyx_v_4lxml_5etree__elementpath);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_v_4lxml_5etree__elementpath = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":75
 * 
 * cdef object sys
 * import sys             # <<<<<<<<<<<<<<
 * 
 * cdef object re
 */
  __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s__sys), 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_4lxml_5etree_sys);
  __Pyx_DECREF(__pyx_v_4lxml_5etree_sys);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_v_4lxml_5etree_sys = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":78
 * 
 * cdef object re
 * import re             # <<<<<<<<<<<<<<
 * 
 * cdef object gzip
 */
  __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s__re), 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_4lxml_5etree_re);
  __Pyx_DECREF(__pyx_v_4lxml_5etree_re);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_v_4lxml_5etree_re = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":81
 * 
 * cdef object gzip
 * import gzip             # <<<<<<<<<<<<<<
 * 
 * cdef object ITER_EMPTY
 */
  __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s__gzip), 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_4lxml_5etree_gzip);
  __Pyx_DECREF(__pyx_v_4lxml_5etree_gzip);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_v_4lxml_5etree_gzip = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":84
 * 
 * cdef object ITER_EMPTY
 * ITER_EMPTY = iter(())             # <<<<<<<<<<<<<<
 * 
 * cdef object EMPTY_READ_ONLY_DICT
 */
  __pyx_t_3 = PyObject_GetIter(((PyObject *)__pyx_empty_tuple)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_4lxml_5etree_ITER_EMPTY);
  __Pyx_DECREF(__pyx_v_4lxml_5etree_ITER_EMPTY);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_v_4lxml_5etree_ITER_EMPTY = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":87
 * 
 * cdef object EMPTY_READ_ONLY_DICT
 * EMPTY_READ_ONLY_DICT = python.PyDictProxy_New({})             # <<<<<<<<<<<<<<
 * 
 * # the rules
 */
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __pyx_t_4 = PyDictProxy_New(((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_GOTREF(__pyx_v_4lxml_5etree_EMPTY_READ_ONLY_DICT);
  __Pyx_DECREF(__pyx_v_4lxml_5etree_EMPTY_READ_ONLY_DICT);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_v_4lxml_5etree_EMPTY_READ_ONLY_DICT = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "src/lxml/lxml.etree.pyx":104
 * 
 * # make the compiled-in debug state publicly available
 * DEBUG = __DEBUG             # <<<<<<<<<<<<<<
 * 
 * # global per-thread setup
 */
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DEBUG, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "src/lxml/lxml.etree.pyx":107
 * 
 * # global per-thread setup
 * tree.xmlThrDefIndentTreeOutput(1)             # <<<<<<<<<<<<<<
 * tree.xmlThrDefLineNumbersDefaultValue(1)
 * 
 */
  xmlThrDefIndentTreeOutput(1);

  /* "src/lxml/lxml.etree.pyx":108
 * # global per-thread setup
 * tree.xmlThrDefIndentTreeOutput(1)
 * tree.xmlThrDefLineNumbersDefaultValue(1)             # <<<<<<<<<<<<<<
 * 
 * _initThreadLogging()
 */
  xmlThrDefLineNumbersDefaultValue(1);

  /* "src/lxml/lxml.etree.pyx":110
 * tree.xmlThrDefLineNumbersDefaultValue(1)
 * 
 * _initThreadLogging()             # <<<<<<<<<<<<<<
 * 
 * # initialize parser (and threading)
 */
  __pyx_f_4lxml_5etree__initThreadLogging();

  /* "src/lxml/lxml.etree.pyx":113
 * 
 * # initialize parser (and threading)
 * xmlparser.xmlInitParser()             # <<<<<<<<<<<<<<
 * 
 * # filename encoding
 */
  xmlInitParser();

  /* "src/lxml/lxml.etree.pyx":117
 * # filename encoding
 * cdef object _FILENAME_ENCODING
 * _FILENAME_ENCODING = sys.getfilesystemencoding()             # <<<<<<<<<<<<<<
 * if _FILENAME_ENCODING is None:
 *     _FILENAME_ENCODING = sys.getdefaultencoding()
 */
  __pyx_t_4 = PyObject_GetAttr(__pyx_v_4lxml_5etree_sys, __pyx_n_s_470); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_GOTREF(__pyx_v_4lxml_5etree__FILENAME_ENCODING);
  __Pyx_DECREF(__pyx_v_4lxml_5etree__FILENAME_ENCODING);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_v_4lxml_5etree__FILENAME_ENCODING = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":118
 * cdef object _FILENAME_ENCODING
 * _FILENAME_ENCODING = sys.getfilesystemencoding()
 * if _FILENAME_ENCODING is None:             # <<<<<<<<<<<<<<
 *     _FILENAME_ENCODING = sys.getdefaultencoding()
 * if _FILENAME_ENCODING is None:
 */
  __pyx_t_7 = (__pyx_v_4lxml_5etree__FILENAME_ENCODING == Py_None);
  if (__pyx_t_7) {

    /* "src/lxml/lxml.etree.pyx":119
 * _FILENAME_ENCODING = sys.getfilesystemencoding()
 * if _FILENAME_ENCODING is None:
 *     _FILENAME_ENCODING = sys.getdefaultencoding()             # <<<<<<<<<<<<<<
 * if _FILENAME_ENCODING is None:
 *     _FILENAME_ENCODING = b'ascii'
 */
    __pyx_t_3 = PyObject_GetAttr(__pyx_v_4lxml_5etree_sys, __pyx_n_s__getdefaultencoding); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_v_4lxml_5etree__FILENAME_ENCODING);
    __Pyx_DECREF(__pyx_v_4lxml_5etree__FILENAME_ENCODING);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_v_4lxml_5etree__FILENAME_ENCODING = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L32;
  }
  __pyx_L32:;

  /* "src/lxml/lxml.etree.pyx":120
 * if _FILENAME_ENCODING is None:
 *     _FILENAME_ENCODING = sys.getdefaultencoding()
 * if _FILENAME_ENCODING is None:             # <<<<<<<<<<<<<<
 *     _FILENAME_ENCODING = b'ascii'
 * else:
 */
  __pyx_t_7 = (__pyx_v_4lxml_5etree__FILENAME_ENCODING == Py_None);
  if (__pyx_t_7) {

    /* "src/lxml/lxml.etree.pyx":121
 *     _FILENAME_ENCODING = sys.getdefaultencoding()
 * if _FILENAME_ENCODING is None:
 *     _FILENAME_ENCODING = b'ascii'             # <<<<<<<<<<<<<<
 * else:
 *     _FILENAME_ENCODING = _FILENAME_ENCODING.encode(u"UTF-8")
 */
    __Pyx_INCREF(((PyObject *)__pyx_n_b__ascii));
    __Pyx_GOTREF(__pyx_v_4lxml_5etree__FILENAME_ENCODING);
    __Pyx_DECREF(__pyx_v_4lxml_5etree__FILENAME_ENCODING);
    __Pyx_GIVEREF(((PyObject *)__pyx_n_b__ascii));
    __pyx_v_4lxml_5etree__FILENAME_ENCODING = ((PyObject *)__pyx_n_b__ascii);
    goto __pyx_L33;
  }
  /*else*/ {

    /* "src/lxml/lxml.etree.pyx":123
 *     _FILENAME_ENCODING = b'ascii'
 * else:
 *     _FILENAME_ENCODING = _FILENAME_ENCODING.encode(u"UTF-8")             # <<<<<<<<<<<<<<
 * cdef char* _C_FILENAME_ENCODING
 * _C_FILENAME_ENCODING = _cstr(_FILENAME_ENCODING)
 */
    __pyx_t_4 = PyObject_GetAttr(__pyx_v_4lxml_5etree__FILENAME_ENCODING, __pyx_n_s__encode); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_471), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_v_4lxml_5etree__FILENAME_ENCODING);
    __Pyx_DECREF(__pyx_v_4lxml_5etree__FILENAME_ENCODING);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_v_4lxml_5etree__FILENAME_ENCODING = __pyx_t_3;
    __pyx_t_3 = 0;
  }
  __pyx_L33:;

  /* "src/lxml/lxml.etree.pyx":125
 *     _FILENAME_ENCODING = _FILENAME_ENCODING.encode(u"UTF-8")
 * cdef char* _C_FILENAME_ENCODING
 * _C_FILENAME_ENCODING = _cstr(_FILENAME_ENCODING)             # <<<<<<<<<<<<<<
 * 
 * # set up some default namespace prefixes
 */
  __pyx_v_4lxml_5etree__C_FILENAME_ENCODING = PyBytes_AS_STRING(__pyx_v_4lxml_5etree__FILENAME_ENCODING);

  /* "src/lxml/lxml.etree.pyx":129
 * # set up some default namespace prefixes
 * cdef object _DEFAULT_NAMESPACE_PREFIXES
 * _DEFAULT_NAMESPACE_PREFIXES = {             # <<<<<<<<<<<<<<
 *     b"http://www.w3.org/XML/1998/namespace": b'xml',
 *     b"http://www.w3.org/1999/xhtml": b"html",
 */
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_b_472), ((PyObject *)__pyx_n_b__xml)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_b_473), ((PyObject *)__pyx_n_b__html)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_b_371), ((PyObject *)__pyx_n_b__xsl)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_b_474), ((PyObject *)__pyx_n_b__rdf)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_b_475), ((PyObject *)__pyx_n_b__wsdl)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_b_408), ((PyObject *)__pyx_n_b__xs)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_b_476), ((PyObject *)__pyx_n_b__xsi)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_b_477), ((PyObject *)__pyx_n_b__dc)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_b_478), ((PyObject *)__pyx_n_b__py)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES);
  __Pyx_DECREF(__pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES);
  __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
  __pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES = ((PyObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":144
 * }
 * 
 * cdef object _check_internal_prefix = re.compile(b"ns\d+$").match             # <<<<<<<<<<<<<<
 * 
 * def register_namespace(prefix, uri):
 */
  __pyx_t_3 = PyObject_GetAttr(__pyx_v_4lxml_5etree_re, __pyx_n_s__compile); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_480), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__match); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_GOTREF(__pyx_v_4lxml_5etree__check_internal_prefix);
  __Pyx_DECREF(__pyx_v_4lxml_5etree__check_internal_prefix);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_v_4lxml_5etree__check_internal_prefix = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":146
 * cdef object _check_internal_prefix = re.compile(b"ns\d+$").match
 * 
 * def register_namespace(prefix, uri):             # <<<<<<<<<<<<<<
 *     u"""Registers a namespace prefix that newly created Elements in that
 *     namespace will use.  The registry is global, and any existing
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_register_namespace, NULL, __pyx_n_s_481); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__register_namespace, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":164
 * 
 * # Error superclass for ElementTree compatibility
 * class Error(Exception):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  __Pyx_INCREF(__pyx_builtin_Exception);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_builtin_Exception);
  __Pyx_GIVEREF(__pyx_builtin_Exception);
  __pyx_t_1 = __Pyx_CreateClass(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_3), __pyx_n_s__Error, __pyx_n_s_481); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__Error, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":168
 * 
 * # module level superclass for all exceptions
 * class LxmlError(Error):             # <<<<<<<<<<<<<<
 *     u"""Main exception base class for lxml.  All other exceptions inherit from
 *     this one.
 */
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));

  /* "src/lxml/lxml.etree.pyx":172
 *     this one.
 *     """
 *     def __init__(self, message, error_log=None):             # <<<<<<<<<<<<<<
 *         if python.PY_VERSION_HEX >= 0x02050000:
 *             # Python >= 2.5 uses new style class exceptions
 */
  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4lxml_5etree_9LxmlError___init__, NULL, __pyx_n_s_481); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s____init__, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/lxml.etree.pyx":168
 * 
 * # module level superclass for all exceptions
 * class LxmlError(Error):             # <<<<<<<<<<<<<<
 *     u"""Main exception base class for lxml.  All other exceptions inherit from
 *     this one.
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__Error); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  if (PyDict_SetItemString(((PyObject *)__pyx_t_3), "__doc__", ((PyObject *)__pyx_kp_s_482)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __Pyx_CreateClass(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_3), __pyx_n_s__LxmlError, __pyx_n_s_481); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__LxmlError, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":183
 *             self.error_log = error_log.copy()
 * 
 * cdef object _Error = Error if python.PY_VERSION_HEX >= 0x02050000 else None             # <<<<<<<<<<<<<<
 * cdef object error_super_init = Error.__init__ if python.PY_VERSION_HEX < 0x02050000 else None
 * 
 */
  if ((PY_VERSION_HEX >= 0x02050000)) {
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__Error); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __pyx_t_1;
    __pyx_t_1 = 0;
  } else {
    __Pyx_INCREF(Py_None);
    __pyx_t_3 = Py_None;
  }
  __Pyx_GOTREF(__pyx_v_4lxml_5etree__Error);
  __Pyx_DECREF(__pyx_v_4lxml_5etree__Error);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_v_4lxml_5etree__Error = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":184
 * 
 * cdef object _Error = Error if python.PY_VERSION_HEX >= 0x02050000 else None
 * cdef object error_super_init = Error.__init__ if python.PY_VERSION_HEX < 0x02050000 else None             # <<<<<<<<<<<<<<
 * 
 * 
 */
  if ((PY_VERSION_HEX < 0x02050000)) {
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__Error); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____init__); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = __pyx_t_4;
    __pyx_t_4 = 0;
  } else {
    __Pyx_INCREF(Py_None);
    __pyx_t_3 = Py_None;
  }
  __Pyx_GOTREF(__pyx_v_4lxml_5etree_error_super_init);
  __Pyx_DECREF(__pyx_v_4lxml_5etree_error_super_init);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_v_4lxml_5etree_error_super_init = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":188
 * 
 * # superclass for all syntax errors
 * class LxmlSyntaxError(LxmlError, SyntaxError):             # <<<<<<<<<<<<<<
 *     u"""Base class for all syntax errors.
 *     """
 */
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__LxmlError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_builtin_SyntaxError);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_builtin_SyntaxError);
  __Pyx_GIVEREF(__pyx_builtin_SyntaxError);
  __pyx_t_4 = 0;
  if (PyDict_SetItemString(((PyObject *)__pyx_t_3), "__doc__", ((PyObject *)__pyx_kp_s_483)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_CreateClass(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3), __pyx_n_s__LxmlSyntaxError, __pyx_n_s_481); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__LxmlSyntaxError, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":193
 *     pass
 * 
 * class C14NError(LxmlError):             # <<<<<<<<<<<<<<
 *     u"""Error during C14N serialisation.
 *     """
 */
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__LxmlError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  if (PyDict_SetItemString(((PyObject *)__pyx_t_3), "__doc__", ((PyObject *)__pyx_kp_s_484)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_CreateClass(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3), __pyx_n_s__C14NError, __pyx_n_s_481); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__C14NError, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":230
 * 
 * cdef int _LIBXML_VERSION_INT
 * try:             # <<<<<<<<<<<<<<
 *     _LIBXML_VERSION_INT = int(
 *         re.match(u'[0-9]+', (tree.xmlParserVersion).decode(u"ASCII")).group(0))
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "src/lxml/lxml.etree.pyx":232
 * try:
 *     _LIBXML_VERSION_INT = int(
 *         re.match(u'[0-9]+', (tree.xmlParserVersion).decode(u"ASCII")).group(0))             # <<<<<<<<<<<<<<
 * except Exception:
 *     print u"Unknown libxml2 version: %s" % (tree.xmlParserVersion).decode(u"ASCII")
 */
      __pyx_t_3 = PyObject_GetAttr(__pyx_v_4lxml_5etree_re, __pyx_n_s__match); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L34_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = ((PyObject *)PyUnicode_DecodeASCII(xmlParserVersion, strlen(xmlParserVersion), NULL)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L34_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L34_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      __Pyx_INCREF(((PyObject *)__pyx_kp_u_485));
      PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_u_485));
      __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_485));
      PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_t_4));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
      __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L34_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
      __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__group); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L34_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_486), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L34_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L34_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L34_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
      __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L34_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_4lxml_5etree__LIBXML_VERSION_INT = __pyx_t_2;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L41_try_end;
    __pyx_L34_error:;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "src/lxml/lxml.etree.pyx":233
 *     _LIBXML_VERSION_INT = int(
 *         re.match(u'[0-9]+', (tree.xmlParserVersion).decode(u"ASCII")).group(0))
 * except Exception:             # <<<<<<<<<<<<<<
 *     print u"Unknown libxml2 version: %s" % (tree.xmlParserVersion).decode(u"ASCII")
 *     _LIBXML_VERSION_INT = 0
 */
    __pyx_t_2 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
    if (__pyx_t_2) {
      __Pyx_AddTraceback("lxml.etree");
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_1, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L36_except_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_3);

      /* "src/lxml/lxml.etree.pyx":234
 *         re.match(u'[0-9]+', (tree.xmlParserVersion).decode(u"ASCII")).group(0))
 * except Exception:
 *     print u"Unknown libxml2 version: %s" % (tree.xmlParserVersion).decode(u"ASCII")             # <<<<<<<<<<<<<<
 *     _LIBXML_VERSION_INT = 0
 * 
 */
      __pyx_t_5 = ((PyObject *)PyUnicode_DecodeASCII(xmlParserVersion, strlen(xmlParserVersion), NULL)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L36_except_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
      __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_487), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L36_except_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
      if (__Pyx_PrintOne(0, ((PyObject *)__pyx_t_6)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L36_except_error;}
      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;

      /* "src/lxml/lxml.etree.pyx":235
 * except Exception:
 *     print u"Unknown libxml2 version: %s" % (tree.xmlParserVersion).decode(u"ASCII")
 *     _LIBXML_VERSION_INT = 0             # <<<<<<<<<<<<<<
 * 
 * LIBXML_VERSION = __unpackIntVersion(_LIBXML_VERSION_INT)
 */
      __pyx_v_4lxml_5etree__LIBXML_VERSION_INT = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L35_exception_handled;
    }
    __pyx_L36_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L35_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L41_try_end:;
  }

  /* "src/lxml/lxml.etree.pyx":237
 *     _LIBXML_VERSION_INT = 0
 * 
 * LIBXML_VERSION = __unpackIntVersion(_LIBXML_VERSION_INT)             # <<<<<<<<<<<<<<
 * LIBXML_COMPILED_VERSION = __unpackIntVersion(tree.LIBXML_VERSION)
 * LXML_VERSION = __unpackDottedVersion(tree.LXML_VERSION_STRING)
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree___unpackIntVersion(__pyx_v_4lxml_5etree__LIBXML_VERSION_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__LIBXML_VERSION, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":238
 * 
 * LIBXML_VERSION = __unpackIntVersion(_LIBXML_VERSION_INT)
 * LIBXML_COMPILED_VERSION = __unpackIntVersion(tree.LIBXML_VERSION)             # <<<<<<<<<<<<<<
 * LXML_VERSION = __unpackDottedVersion(tree.LXML_VERSION_STRING)
 * 
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree___unpackIntVersion(LIBXML_VERSION); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_463, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":239
 * LIBXML_VERSION = __unpackIntVersion(_LIBXML_VERSION_INT)
 * LIBXML_COMPILED_VERSION = __unpackIntVersion(tree.LIBXML_VERSION)
 * LXML_VERSION = __unpackDottedVersion(tree.LXML_VERSION_STRING)             # <<<<<<<<<<<<<<
 * 
 * __version__ = (tree.LXML_VERSION_STRING).decode(u"ASCII")
 */
  __pyx_t_3 = PyBytes_FromString(LXML_VERSION_STRING); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __pyx_t_1 = __pyx_f_4lxml_5etree___unpackDottedVersion(((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__LXML_VERSION, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "src/lxml/lxml.etree.pyx":241
 * LXML_VERSION = __unpackDottedVersion(tree.LXML_VERSION_STRING)
 * 
 * __version__ = (tree.LXML_VERSION_STRING).decode(u"ASCII")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = ((PyObject *)PyUnicode_DecodeASCII(LXML_VERSION_STRING, strlen(LXML_VERSION_STRING), NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____version__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":626
 * 
 * cdef object __RE_XML_ENCODING
 * __RE_XML_ENCODING = re.compile(             # <<<<<<<<<<<<<<
 *     ur'^(\s*<\?\s*xml[^>]+)\s+encoding\s*=\s*["\'][^"\']*["\']\s*', re.U)
 * 
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_4lxml_5etree_re, __pyx_n_s__compile); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":627
 * cdef object __RE_XML_ENCODING
 * __RE_XML_ENCODING = re.compile(
 *     ur'^(\s*<\?\s*xml[^>]+)\s+encoding\s*=\s*["\'][^"\']*["\']\s*', re.U)             # <<<<<<<<<<<<<<
 * 
 * cdef object __REPLACE_XML_ENCODING
 */
  __pyx_t_3 = PyObject_GetAttr(__pyx_v_4lxml_5etree_re, __pyx_n_s__U); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_488));
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_488));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_488));
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __Pyx_GOTREF(__pyx_v_4lxml_5etree___RE_XML_ENCODING);
  __Pyx_DECREF(__pyx_v_4lxml_5etree___RE_XML_ENCODING);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_v_4lxml_5etree___RE_XML_ENCODING = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":630
 * 
 * cdef object __REPLACE_XML_ENCODING
 * __REPLACE_XML_ENCODING = __RE_XML_ENCODING.sub             # <<<<<<<<<<<<<<
 * 
 * cdef object __HAS_XML_ENCODING
 */
  __pyx_t_3 = PyObject_GetAttr(__pyx_v_4lxml_5etree___RE_XML_ENCODING, __pyx_n_s__sub); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_4lxml_5etree___REPLACE_XML_ENCODING);
  __Pyx_DECREF(__pyx_v_4lxml_5etree___REPLACE_XML_ENCODING);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_v_4lxml_5etree___REPLACE_XML_ENCODING = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/apihelpers.pxi":633
 * 
 * cdef object __HAS_XML_ENCODING
 * __HAS_XML_ENCODING = __RE_XML_ENCODING.match             # <<<<<<<<<<<<<<
 * 
 * cdef object _stripEncodingDeclaration(object xml_string):
 */
  __pyx_t_3 = PyObject_GetAttr(__pyx_v_4lxml_5etree___RE_XML_ENCODING, __pyx_n_s__match); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_4lxml_5etree___HAS_XML_ENCODING);
  __Pyx_DECREF(__pyx_v_4lxml_5etree___HAS_XML_ENCODING);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_v_4lxml_5etree___HAS_XML_ENCODING = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":7
 * # module level API functions
 * 
 * def clear_error_log():             # <<<<<<<<<<<<<<
 *     u"""clear_error_log()
 * 
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_1clear_error_log, NULL, __pyx_n_s_481); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__clear_error_log, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":454
 * 
 * cdef _BaseErrorLog __GLOBAL_ERROR_LOG
 * __GLOBAL_ERROR_LOG = _RotatingErrorLog(__MAX_LOG_SIZE)             # <<<<<<<<<<<<<<
 * 
 * cdef _BaseErrorLog _getGlobalErrorLog():
 */
  __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__RotatingErrorLog)), ((PyObject *)__pyx_k_tuple_489), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GOTREF(((PyObject *)__pyx_v_4lxml_5etree___GLOBAL_ERROR_LOG));
  __Pyx_DECREF(((PyObject *)__pyx_v_4lxml_5etree___GLOBAL_ERROR_LOG));
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_v_4lxml_5etree___GLOBAL_ERROR_LOG = ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":483
 *     return _getGlobalErrorLog().copy()
 * 
 * def use_global_python_log(PyErrorLog log not None):             # <<<<<<<<<<<<<<
 *     u"""use_global_python_log(log)
 * 
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_2use_global_python_log, NULL, __pyx_n_s_481); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_468, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":608
 * 
 * 
 * class ErrorLevels(object):             # <<<<<<<<<<<<<<
 *     u"Libxml2 error levels"
 * 
 */
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  __Pyx_INCREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  if (PyDict_SetItemString(((PyObject *)__pyx_t_3), "__doc__", ((PyObject *)__pyx_kp_s_490)) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __Pyx_CreateClass(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_3), __pyx_n_s__ErrorLevels, __pyx_n_s_481); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ErrorLevels, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":611
 *     u"Libxml2 error levels"
 * 
 * class ErrorDomains(object):             # <<<<<<<<<<<<<<
 *     u"Libxml2 error domains"
 * 
 */
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  if (PyDict_SetItemString(((PyObject *)__pyx_t_3), "__doc__", ((PyObject *)__pyx_kp_s_491)) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_CreateClass(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3), __pyx_n_s__ErrorDomains, __pyx_n_s_481); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ErrorDomains, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":614
 *     u"Libxml2 error domains"
 * 
 * class ErrorTypes(object):             # <<<<<<<<<<<<<<
 *     u"Libxml2 error types"
 * 
 */
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  __Pyx_INCREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  if (PyDict_SetItemString(((PyObject *)__pyx_t_3), "__doc__", ((PyObject *)__pyx_kp_s_492)) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __Pyx_CreateClass(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_3), __pyx_n_s__ErrorTypes, __pyx_n_s_481); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ErrorTypes, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":617
 *     u"Libxml2 error types"
 * 
 * class RelaxNGErrorTypes(object):             # <<<<<<<<<<<<<<
 *     u"Libxml2 RelaxNG error types"
 * 
 */
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  if (PyDict_SetItemString(((PyObject *)__pyx_t_3), "__doc__", ((PyObject *)__pyx_kp_s_493)) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_CreateClass(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3), __pyx_n_s__RelaxNGErrorTypes, __pyx_n_s_481); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__RelaxNGErrorTypes, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":631
 * 
 * cdef object __ERROR_LEVELS
 * __ERROR_LEVELS = (u"""\             # <<<<<<<<<<<<<<
 * NONE=0
 * WARNING=1
 */
  __Pyx_INCREF(((PyObject *)__pyx_k_tuple_495));
  __Pyx_GOTREF(__pyx_v_4lxml_5etree___ERROR_LEVELS);
  __Pyx_DECREF(__pyx_v_4lxml_5etree___ERROR_LEVELS);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_495));
  __pyx_v_4lxml_5etree___ERROR_LEVELS = ((PyObject *)__pyx_k_tuple_495);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":639
 * 
 * cdef object __ERROR_DOMAINS
 * __ERROR_DOMAINS = (u"""\             # <<<<<<<<<<<<<<
 * NONE=0
 * PARSER=1
 */
  __Pyx_INCREF(((PyObject *)__pyx_k_tuple_497));
  __Pyx_GOTREF(__pyx_v_4lxml_5etree___ERROR_DOMAINS);
  __Pyx_DECREF(__pyx_v_4lxml_5etree___ERROR_DOMAINS);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_497));
  __pyx_v_4lxml_5etree___ERROR_DOMAINS = ((PyObject *)__pyx_k_tuple_497);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":672
 * 
 * cdef object __PARSER_ERROR_TYPES
 * __PARSER_ERROR_TYPES = (u"""\             # <<<<<<<<<<<<<<
 * ERR_OK=0
 * ERR_INTERNAL_ERROR=1
 */
  __Pyx_INCREF(((PyObject *)__pyx_k_tuple_509));
  __Pyx_GOTREF(__pyx_v_4lxml_5etree___PARSER_ERROR_TYPES);
  __Pyx_DECREF(__pyx_v_4lxml_5etree___PARSER_ERROR_TYPES);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_509));
  __pyx_v_4lxml_5etree___PARSER_ERROR_TYPES = ((PyObject *)__pyx_k_tuple_509);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":1429
 * 
 * cdef object __RELAXNG_ERROR_TYPES
 * __RELAXNG_ERROR_TYPES = (u"""\             # <<<<<<<<<<<<<<
 * RELAXNG_OK=0
 * RELAXNG_ERR_MEMORY=1
 */
  __Pyx_INCREF(((PyObject *)__pyx_k_tuple_511));
  __Pyx_GOTREF(__pyx_v_4lxml_5etree___RELAXNG_ERROR_TYPES);
  __Pyx_DECREF(__pyx_v_4lxml_5etree___RELAXNG_ERROR_TYPES);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_511));
  __pyx_v_4lxml_5etree___RELAXNG_ERROR_TYPES = ((PyObject *)__pyx_k_tuple_511);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlerror.pxi":1473
 * # --- END: GENERATED CONSTANTS ---
 * 
 * __initErrorConstants()             # <<<<<<<<<<<<<<
 */
  __pyx_f_4lxml_5etree___initErrorConstants();

  /* "src/lxml/lxml.etree.pyx":453
 * 
 * cdef tuple _PREFIX_CACHE
 * _PREFIX_CACHE = __initPrefixCache()             # <<<<<<<<<<<<<<
 * 
 * cdef extern from "etree_defs.h":
 */
  __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree___initPrefixCache()); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GOTREF(((PyObject *)__pyx_v_4lxml_5etree__PREFIX_CACHE));
  __Pyx_DECREF(((PyObject *)__pyx_v_4lxml_5etree__PREFIX_CACHE));
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_v_4lxml_5etree__PREFIX_CACHE = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":1280
 *         return _elementFactory(self._doc, c_node)
 * 
 *     def itersiblings(self, tag=None, *, preceding=False):             # <<<<<<<<<<<<<<
 *         u"""itersiblings(self, tag=None, preceding=False)
 * 
 */
  __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_k_73 = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":1316
 *         return ElementDepthFirstIterator(self, tag, inclusive=False)
 * 
 *     def iterchildren(self, tag=None, *, reversed=False):             # <<<<<<<<<<<<<<
 *         u"""iterchildren(self, tag=None, reversed=False)
 * 
 */
  __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_k_74 = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":1376
 *         return ElementDepthFirstIterator(self, tag)
 * 
 *     def itertext(self, tag=None, *, with_tail=True):             # <<<<<<<<<<<<<<
 *         u"""itertext(self, tag=None, with_tail=True)
 * 
 */
  __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_k_75 = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":1451
 * 
 *     def xpath(self, _path, *, namespaces=None, extensions=None,
 *               smart_strings=True, **_variables):             # <<<<<<<<<<<<<<
 *         u"""xpath(self, _path, namespaces=None, extensions=None, smart_strings=True, **_variables)
 * 
 */
  __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_k_76 = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":1791
 * 
 *     def write(self, file, *, encoding=None, method=u"xml",
 *               pretty_print=False, xml_declaration=None, with_tail=True,             # <<<<<<<<<<<<<<
 *               standalone=None, docstring=None, compression=0,
 *               exclusive=False, with_comments=True):
 */
  __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_k_90 = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_k_91 = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":1793
 *               pretty_print=False, xml_declaration=None, with_tail=True,
 *               standalone=None, docstring=None, compression=0,
 *               exclusive=False, with_comments=True):             # <<<<<<<<<<<<<<
 *         u"""write(self, file, encoding=None, method="xml",
 *                   pretty_print=False, xml_declaration=None, with_tail=True,
 */
  __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_k_92 = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_k_93 = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":2007
 * 
 *     def xpath(self, _path, *, namespaces=None, extensions=None,
 *               smart_strings=True, **_variables):             # <<<<<<<<<<<<<<
 *         u"""xpath(self, _path, namespaces=None, extensions=None, smart_strings=True, **_variables)
 * 
 */
  __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_k_103 = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":2101
 *         XInclude()(self._context_node)
 * 
 *     def write_c14n(self, file, *, exclusive=False, with_comments=True,             # <<<<<<<<<<<<<<
 *                    compression=0):
 *         u"""write_c14n(self, file, exclusive=False, with_comments=True,
 */
  __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_k_104 = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_k_105 = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":2367
 *     Iterates over the children of an element.
 *     """
 *     def __cinit__(self, _Element node not None, tag=None, *, reversed=False):             # <<<<<<<<<<<<<<
 *         cdef xmlNode* c_node
 *         _assertValidNode(node)
 */
  __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_k_107 = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":2393
 *     You can pass the boolean keyword ``preceding`` to specify the direction.
 *     """
 *     def __cinit__(self, _Element node not None, tag=None, *, preceding=False):             # <<<<<<<<<<<<<<
 *         _assertValidNode(node)
 *         self._initTagMatch(tag)
 */
  __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2393; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_k_108 = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":2436
 *     cdef _Element _next_node
 *     cdef _Element _top_node
 *     def __cinit__(self, _Element node not None, tag=None, *, inclusive=True):             # <<<<<<<<<<<<<<
 *         _assertValidNode(node)
 *         self._top_node  = node
 */
  __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_k_109 = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":2503
 *     cdef object _nextEvent
 *     cdef _Element _start_element
 *     def __cinit__(self, _Element element not None, tag=None, *, with_tail=True):             # <<<<<<<<<<<<<<
 *         _assertValidNode(element)
 *         if with_tail:
 */
  __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_k_110 = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":2547
 * # module-level API for ElementTree
 * 
 * def Element(_tag, attrib=None, nsmap=None, **_extra):             # <<<<<<<<<<<<<<
 *     u"""Element(_tag, attrib=None, nsmap=None, **_extra)
 * 
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_3Element, NULL, __pyx_n_s_481); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__Element, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":2560
 *                         attrib, nsmap, _extra)
 * 
 * def Comment(text=None):             # <<<<<<<<<<<<<<
 *     u"""Comment(text=None)
 * 
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_4Comment, NULL, __pyx_n_s_481); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__Comment, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":2579
 *     return _elementFactory(doc, c_node)
 * 
 * def ProcessingInstruction(target, text=None):             # <<<<<<<<<<<<<<
 *     u"""ProcessingInstruction(target, text=None)
 * 
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_5ProcessingInstruction, NULL, __pyx_n_s_481); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_79, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":2599
 *     return _elementFactory(doc, c_node)
 * 
 * PI = ProcessingInstruction             # <<<<<<<<<<<<<<
 * 
 * cdef class CDATA:
 */
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s_79); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__PI, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":2615
 *         self._utf8_data = _utf8(data)
 * 
 * def Entity(name):             # <<<<<<<<<<<<<<
 *     u"""Entity(name)
 * 
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_6Entity, NULL, __pyx_n_s_481); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__Entity, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":2641
 *     return _elementFactory(doc, c_node)
 * 
 * def SubElement(_Element _parent not None, _tag,             # <<<<<<<<<<<<<<
 *                attrib=None, nsmap=None, **_extra):
 *     u"""SubElement(_parent, _tag, attrib=None, nsmap=None, **_extra)
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_7SubElement, NULL, __pyx_n_s_481); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__SubElement, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":2650
 *     return _makeSubElement(_parent, _tag, None, None, attrib, nsmap, _extra)
 * 
 * def ElementTree(_Element element=None, *, file=None, _BaseParser parser=None):             # <<<<<<<<<<<<<<
 *     u"""ElementTree(element=None, file=None, parser=None)
 * 
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_8ElementTree, NULL, __pyx_n_s_481); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ElementTree, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":2675
 *     return _elementTreeFactory(doc, element)
 * 
 * def HTML(text, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     u"""HTML(text, parser=None, base_url=None)
 * 
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_9HTML, NULL, __pyx_n_s_481); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2675; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__HTML, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2675; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":2700
 *         return result_container.result
 * 
 * def XML(text, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     u"""XML(text, parser=None, base_url=None)
 * 
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_10XML, NULL, __pyx_n_s_481); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2700; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__XML, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2700; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":2728
 *         return result_container.result
 * 
 * def fromstring(text, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     u"""fromstring(text, parser=None, base_url=None)
 * 
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_11fromstring, NULL, __pyx_n_s_481); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__fromstring, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":2748
 *         return result_container.result
 * 
 * def fromstringlist(strings, _BaseParser parser=None):             # <<<<<<<<<<<<<<
 *     u"""fromstringlist(strings, parser=None)
 * 
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_12fromstringlist, NULL, __pyx_n_s_481); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__fromstringlist, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":2765
 *     return parser.close()
 * 
 * def iselement(element):             # <<<<<<<<<<<<<<
 *     u"""iselement(element)
 * 
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_13iselement, NULL, __pyx_n_s_481); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2765; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__iselement, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2765; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":2772
 *     return isinstance(element, _Element) and (<_Element>element)._c_node is not NULL
 * 
 * def dump(_Element elem not None, *, pretty_print=True, with_tail=True):             # <<<<<<<<<<<<<<
 *     u"""dump(elem, pretty_print=True, with_tail=True)
 * 
 */
  __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_k_115 = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_k_116 = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_14dump, NULL, __pyx_n_s_481); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__dump, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":2782
 * 
 * def tostring(element_or_tree, *, encoding=None, method=u"xml",
 *              xml_declaration=None, pretty_print=False, with_tail=True,             # <<<<<<<<<<<<<<
 *              standalone=None, doctype=None,
 *              exclusive=False, with_comments=True):
 */
  __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_k_117 = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_k_118 = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":2784
 *              xml_declaration=None, pretty_print=False, with_tail=True,
 *              standalone=None, doctype=None,
 *              exclusive=False, with_comments=True):             # <<<<<<<<<<<<<<
 *     u"""tostring(element_or_tree, encoding=None, method="xml",
 *                  xml_declaration=None, pretty_print=False, with_tail=True,
 */
  __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_k_119 = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_k_120 = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":2781
 *     _dumpToFile(sys.stdout, elem._c_node, pretty_print, with_tail)
 * 
 * def tostring(element_or_tree, *, encoding=None, method=u"xml",             # <<<<<<<<<<<<<<
 *              xml_declaration=None, pretty_print=False, with_tail=True,
 *              standalone=None, doctype=None,
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_15tostring, NULL, __pyx_n_s_481); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__tostring, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":2871
 *             python._fqtypename(element_or_tree)
 * 
 * def tostringlist(element_or_tree, *args, **kwargs):             # <<<<<<<<<<<<<<
 *     u"""tostringlist(element_or_tree, *args, **kwargs)
 * 
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_16tostringlist, NULL, __pyx_n_s_481); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__tostringlist, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":2882
 *     return [tostring(element_or_tree, *args, **kwargs)]
 * 
 * def tounicode(element_or_tree, *, method=u"xml", pretty_print=False,             # <<<<<<<<<<<<<<
 *               with_tail=True, doctype=None):
 *     u"""tounicode(element_or_tree, method="xml", pretty_print=False,
 */
  __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2882; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_k_126 = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":2883
 * 
 * def tounicode(element_or_tree, *, method=u"xml", pretty_print=False,
 *               with_tail=True, doctype=None):             # <<<<<<<<<<<<<<
 *     u"""tounicode(element_or_tree, method="xml", pretty_print=False,
 *                   with_tail=True, doctype=None)
 */
  __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_k_127 = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":2882
 *     return [tostring(element_or_tree, *args, **kwargs)]
 * 
 * def tounicode(element_or_tree, *, method=u"xml", pretty_print=False,             # <<<<<<<<<<<<<<
 *               with_tail=True, doctype=None):
 *     u"""tounicode(element_or_tree, method="xml", pretty_print=False,
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_17tounicode, NULL, __pyx_n_s_481); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2882; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__tounicode, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2882; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "src/lxml/lxml.etree.pyx":2916
 *             type(element_or_tree)
 * 
 * def parse(source, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     u"""parse(source, parser=None, base_url=None)
 * 
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_18parse, NULL, __pyx_n_s_481); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__parse, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/readonlytree.pxi":185
 *         return iter(self.getchildren())
 * 
 *     def iterchildren(self, tag=None, *, reversed=False):             # <<<<<<<<<<<<<<
 *         u"""iterchildren(self, tag=None, reversed=False)
 * 
 */
  __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_k_131 = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":526
 *     LOOKUP_ELEMENT_CLASS = function
 * 
 * def set_element_class_lookup(ElementClassLookup lookup = None):             # <<<<<<<<<<<<<<
 *     u"""set_element_class_lookup(lookup = None)
 * 
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_19set_element_class_lookup, NULL, __pyx_n_s_481); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_184, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":538
 * # default setup: parser delegation
 * cdef ParserBasedElementClassLookup DEFAULT_ELEMENT_CLASS_LOOKUP
 * DEFAULT_ELEMENT_CLASS_LOOKUP = ParserBasedElementClassLookup()             # <<<<<<<<<<<<<<
 * 
 * set_element_class_lookup(DEFAULT_ELEMENT_CLASS_LOOKUP)
 */
  __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_ParserBasedElementClassLookup)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GOTREF(((PyObject *)__pyx_v_4lxml_5etree_DEFAULT_ELEMENT_CLASS_LOOKUP));
  __Pyx_DECREF(((PyObject *)__pyx_v_4lxml_5etree_DEFAULT_ELEMENT_CLASS_LOOKUP));
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_v_4lxml_5etree_DEFAULT_ELEMENT_CLASS_LOOKUP = ((struct __pyx_obj_4lxml_5etree_ParserBasedElementClassLookup *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/classlookup.pxi":540
 * DEFAULT_ELEMENT_CLASS_LOOKUP = ParserBasedElementClassLookup()
 * 
 * set_element_class_lookup(DEFAULT_ELEMENT_CLASS_LOOKUP)             # <<<<<<<<<<<<<<
 */
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s_184); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  __Pyx_INCREF(((PyObject *)__pyx_v_4lxml_5etree_DEFAULT_ELEMENT_CLASS_LOOKUP));
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_4lxml_5etree_DEFAULT_ELEMENT_CLASS_LOOKUP));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_4lxml_5etree_DEFAULT_ELEMENT_CLASS_LOOKUP));
  __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":3
 * # module-level API for namespace implementations
 * 
 * class LxmlRegistryError(LxmlError):             # <<<<<<<<<<<<<<
 *     u"""Base class of lxml registry errors.
 *     """
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__LxmlError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  if (PyDict_SetItemString(((PyObject *)__pyx_t_1), "__doc__", ((PyObject *)__pyx_kp_s_512)) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_CreateClass(((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1), __pyx_n_s__LxmlRegistryError, __pyx_n_s_481); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__LxmlRegistryError, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":8
 *     pass
 * 
 * class NamespaceRegistryError(LxmlRegistryError):             # <<<<<<<<<<<<<<
 *     u"""Error registering a namespace extension.
 *     """
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__LxmlRegistryError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  if (PyDict_SetItemString(((PyObject *)__pyx_t_1), "__doc__", ((PyObject *)__pyx_kp_s_513)) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_CreateClass(((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1), __pyx_n_s_150, __pyx_n_s_481); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_150, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":167
 * 
 * cdef dict __FUNCTION_NAMESPACE_REGISTRIES
 * __FUNCTION_NAMESPACE_REGISTRIES = {}             # <<<<<<<<<<<<<<
 * 
 * def FunctionNamespace(ns_uri):
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_GOTREF(((PyObject *)__pyx_v_4lxml_5etree___FUNCTION_NAMESPACE_REGISTRIES));
  __Pyx_DECREF(((PyObject *)__pyx_v_4lxml_5etree___FUNCTION_NAMESPACE_REGISTRIES));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __pyx_v_4lxml_5etree___FUNCTION_NAMESPACE_REGISTRIES = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/nsclasses.pxi":169
 * __FUNCTION_NAMESPACE_REGISTRIES = {}
 * 
 * def FunctionNamespace(ns_uri):             # <<<<<<<<<<<<<<
 *     u"""FunctionNamespace(ns_uri)
 * 
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_20FunctionNamespace, NULL, __pyx_n_s_481); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__FunctionNamespace, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":13
 * cdef class XMLSchema(_Validator)
 * 
 * class ParseError(LxmlSyntaxError):             # <<<<<<<<<<<<<<
 *     u"""Syntax error while parsing an XML document.
 * 
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":18
 *     For compatibility with ElementTree 1.3 and later.
 *     """
 *     def __init__(self, message, code, line, column):             # <<<<<<<<<<<<<<
 *         if python.PY_VERSION_HEX >= 0x02050000:
 *             # Python >= 2.5 uses new style class exceptions
 */
  __pyx_t_4 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4lxml_5etree_10ParseError___init__, NULL, __pyx_n_s_481); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetItem(__pyx_t_1, __pyx_n_s____init__, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":13
 * cdef class XMLSchema(_Validator)
 * 
 * class ParseError(LxmlSyntaxError):             # <<<<<<<<<<<<<<
 *     u"""Syntax error while parsing an XML document.
 * 
 */
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__LxmlSyntaxError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  if (PyDict_SetItemString(((PyObject *)__pyx_t_1), "__doc__", ((PyObject *)__pyx_kp_s_514)) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_CreateClass(((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1), __pyx_n_s__ParseError, __pyx_n_s_481); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ParseError, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":27
 *         self.code = code
 * 
 * cdef object _LxmlSyntaxError = LxmlSyntaxError             # <<<<<<<<<<<<<<
 * cdef object _ParseError = ParseError
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__LxmlSyntaxError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_4lxml_5etree__LxmlSyntaxError);
  __Pyx_DECREF(__pyx_v_4lxml_5etree__LxmlSyntaxError);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_v_4lxml_5etree__LxmlSyntaxError = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":28
 * 
 * cdef object _LxmlSyntaxError = LxmlSyntaxError
 * cdef object _ParseError = ParseError             # <<<<<<<<<<<<<<
 * 
 * class XMLSyntaxError(ParseError):
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__ParseError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_4lxml_5etree__ParseError);
  __Pyx_DECREF(__pyx_v_4lxml_5etree__ParseError);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_v_4lxml_5etree__ParseError = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":30
 * cdef object _ParseError = ParseError
 * 
 * class XMLSyntaxError(ParseError):             # <<<<<<<<<<<<<<
 *     u"""Syntax error while parsing an XML document.
 *     """
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__ParseError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  if (PyDict_SetItemString(((PyObject *)__pyx_t_1), "__doc__", ((PyObject *)__pyx_kp_s_515)) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_CreateClass(((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1), __pyx_n_s__XMLSyntaxError, __pyx_n_s_481); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__XMLSyntaxError, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":35
 *     pass
 * 
 * class ParserError(LxmlError):             # <<<<<<<<<<<<<<
 *     u"""Internal lxml parser error.
 *     """
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__LxmlError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  if (PyDict_SetItemString(((PyObject *)__pyx_t_1), "__doc__", ((PyObject *)__pyx_kp_s_516)) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_CreateClass(((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1), __pyx_n_s__ParserError, __pyx_n_s_481); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ParserError, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":183
 * 
 * cdef _ParserDictionaryContext __GLOBAL_PARSER_CONTEXT
 * __GLOBAL_PARSER_CONTEXT = _ParserDictionaryContext()             # <<<<<<<<<<<<<<
 * __GLOBAL_PARSER_CONTEXT.initMainParserContext()
 * 
 */
  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ParserDictionaryContext)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GOTREF(((PyObject *)__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT));
  __Pyx_DECREF(((PyObject *)__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT));
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT = ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":184
 * cdef _ParserDictionaryContext __GLOBAL_PARSER_CONTEXT
 * __GLOBAL_PARSER_CONTEXT = _ParserDictionaryContext()
 * __GLOBAL_PARSER_CONTEXT.initMainParserContext()             # <<<<<<<<<<<<<<
 * 
 * cdef int _checkThreadDict(tree.xmlDict* c_dict):
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext *)__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT->__pyx_vtab)->initMainParserContext(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":201
 * 
 * # name of Python unicode encoding as known to libxml2
 * cdef char* _UNICODE_ENCODING = NULL             # <<<<<<<<<<<<<<
 * 
 * cdef void _setupPythonUnicode():
 */
  __pyx_v_4lxml_5etree__UNICODE_ENCODING = NULL;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":254
 *         return tree.xmlGetCharEncodingName(enc)
 * 
 * _setupPythonUnicode()             # <<<<<<<<<<<<<<
 * 
 * ############################################################
 */
  __pyx_f_4lxml_5etree__setupPythonUnicode();

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":479
 * 
 * cdef xmlparser.xmlExternalEntityLoader __DEFAULT_ENTITY_LOADER
 * __DEFAULT_ENTITY_LOADER = xmlparser.xmlGetExternalEntityLoader()             # <<<<<<<<<<<<<<
 * 
 * xmlparser.xmlSetExternalEntityLoader(_local_resolver)
 */
  __pyx_v_4lxml_5etree___DEFAULT_ENTITY_LOADER = xmlGetExternalEntityLoader();

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":481
 * __DEFAULT_ENTITY_LOADER = xmlparser.xmlGetExternalEntityLoader()
 * 
 * xmlparser.xmlSetExternalEntityLoader(_local_resolver)             # <<<<<<<<<<<<<<
 * 
 * ############################################################
 */
  xmlSetExternalEntityLoader(__pyx_f_4lxml_5etree__local_resolver);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1207
 *     xmlparser.XML_PARSE_NOCDATA |
 *     xmlparser.XML_PARSE_NONET   |
 *     xmlparser.XML_PARSE_COMPACT             # <<<<<<<<<<<<<<
 *     )
 * 
 */
  __pyx_v_4lxml_5etree__XML_DEFAULT_PARSE_OPTIONS = (((XML_PARSE_NOENT | XML_PARSE_NOCDATA) | XML_PARSE_NONET) | XML_PARSE_COMPACT);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1254
 *     apply to the default parser.
 *     """
 *     def __init__(self, *, encoding=None, attribute_defaults=False,             # <<<<<<<<<<<<<<
 *                  dtd_validation=False, load_dtd=False, no_network=True,
 *                  ns_clean=False, recover=False, XMLSchema schema=None,
 */
  __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_k_192 = __pyx_t_1;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1255
 *     """
 *     def __init__(self, *, encoding=None, attribute_defaults=False,
 *                  dtd_validation=False, load_dtd=False, no_network=True,             # <<<<<<<<<<<<<<
 *                  ns_clean=False, recover=False, XMLSchema schema=None,
 *                  huge_tree=False, remove_blank_text=False, resolve_entities=True,
 */
  __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_k_193 = __pyx_t_1;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_k_194 = __pyx_t_1;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_k_195 = __pyx_t_1;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1256
 *     def __init__(self, *, encoding=None, attribute_defaults=False,
 *                  dtd_validation=False, load_dtd=False, no_network=True,
 *                  ns_clean=False, recover=False, XMLSchema schema=None,             # <<<<<<<<<<<<<<
 *                  huge_tree=False, remove_blank_text=False, resolve_entities=True,
 *                  remove_comments=False, remove_pis=False, strip_cdata=True,
 */
  __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_k_196 = __pyx_t_1;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_k_197 = __pyx_t_1;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1257
 *                  dtd_validation=False, load_dtd=False, no_network=True,
 *                  ns_clean=False, recover=False, XMLSchema schema=None,
 *                  huge_tree=False, remove_blank_text=False, resolve_entities=True,             # <<<<<<<<<<<<<<
 *                  remove_comments=False, remove_pis=False, strip_cdata=True,
 *                  target=None, compact=True):
 */
  __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_k_198 = __pyx_t_1;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_k_199 = __pyx_t_1;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_k_200 = __pyx_t_1;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1258
 *                  ns_clean=False, recover=False, XMLSchema schema=None,
 *                  huge_tree=False, remove_blank_text=False, resolve_entities=True,
 *                  remove_comments=False, remove_pis=False, strip_cdata=True,             # <<<<<<<<<<<<<<
 *                  target=None, compact=True):
 *         cdef int parse_options
 */
  __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_k_201 = __pyx_t_1;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_k_202 = __pyx_t_1;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_k_203 = __pyx_t_1;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1259
 *                  huge_tree=False, remove_blank_text=False, resolve_entities=True,
 *                  remove_comments=False, remove_pis=False, strip_cdata=True,
 *                  target=None, compact=True):             # <<<<<<<<<<<<<<
 *         cdef int parse_options
 *         parse_options = _XML_DEFAULT_PARSE_OPTIONS
 */
  __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_k_204 = __pyx_t_1;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1307
 *     and thus ignores comments and processing instructions.
 *     """
 *     def __init__(self, *, encoding=None, attribute_defaults=False,             # <<<<<<<<<<<<<<
 *                  dtd_validation=False, load_dtd=False, no_network=True,
 *                  ns_clean=False, recover=False, schema=None,
 */
  __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_k_205 = __pyx_t_1;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1308
 *     """
 *     def __init__(self, *, encoding=None, attribute_defaults=False,
 *                  dtd_validation=False, load_dtd=False, no_network=True,             # <<<<<<<<<<<<<<
 *                  ns_clean=False, recover=False, schema=None,
 *                  huge_tree=False, remove_blank_text=False, resolve_entities=True,
 */
  __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_k_206 = __pyx_t_1;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_k_207 = __pyx_t_1;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_k_208 = __pyx_t_1;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1309
 *     def __init__(self, *, encoding=None, attribute_defaults=False,
 *                  dtd_validation=False, load_dtd=False, no_network=True,
 *                  ns_clean=False, recover=False, schema=None,             # <<<<<<<<<<<<<<
 *                  huge_tree=False, remove_blank_text=False, resolve_entities=True,
 *                  remove_comments=True, remove_pis=True, strip_cdata=True,
 */
  __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_k_209 = __pyx_t_1;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_k_210 = __pyx_t_1;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1310
 *                  dtd_validation=False, load_dtd=False, no_network=True,
 *                  ns_clean=False, recover=False, schema=None,
 *                  huge_tree=False, remove_blank_text=False, resolve_entities=True,             # <<<<<<<<<<<<<<
 *                  remove_comments=True, remove_pis=True, strip_cdata=True,
 *                  target=None, compact=True):
 */
  __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_k_211 = __pyx_t_1;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_k_212 = __pyx_t_1;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_k_213 = __pyx_t_1;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1311
 *                  ns_clean=False, recover=False, schema=None,
 *                  huge_tree=False, remove_blank_text=False, resolve_entities=True,
 *                  remove_comments=True, remove_pis=True, strip_cdata=True,             # <<<<<<<<<<<<<<
 *                  target=None, compact=True):
 *         XMLParser.__init__(self,
 */
  __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_k_214 = __pyx_t_1;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_k_215 = __pyx_t_1;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_k_216 = __pyx_t_1;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1312
 *                  huge_tree=False, remove_blank_text=False, resolve_entities=True,
 *                  remove_comments=True, remove_pis=True, strip_cdata=True,
 *                  target=None, compact=True):             # <<<<<<<<<<<<<<
 *         XMLParser.__init__(self,
 *                            attribute_defaults=attribute_defaults,
 */
  __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_k_217 = __pyx_t_1;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1332
 * 
 * # ET 1.2 compatible name
 * XMLTreeBuilder = ETCompatXMLParser             # <<<<<<<<<<<<<<
 * 
 * 
 */
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__XMLTreeBuilder, ((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_ETCompatXMLParser))) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1336
 * 
 * cdef XMLParser __DEFAULT_XML_PARSER
 * __DEFAULT_XML_PARSER = XMLParser()             # <<<<<<<<<<<<<<
 * 
 * __GLOBAL_PARSER_CONTEXT.setDefaultParser(__DEFAULT_XML_PARSER)
 */
  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_XMLParser)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GOTREF(((PyObject *)__pyx_v_4lxml_5etree___DEFAULT_XML_PARSER));
  __Pyx_DECREF(((PyObject *)__pyx_v_4lxml_5etree___DEFAULT_XML_PARSER));
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_v_4lxml_5etree___DEFAULT_XML_PARSER = ((struct __pyx_obj_4lxml_5etree_XMLParser *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1338
 * __DEFAULT_XML_PARSER = XMLParser()
 * 
 * __GLOBAL_PARSER_CONTEXT.setDefaultParser(__DEFAULT_XML_PARSER)             # <<<<<<<<<<<<<<
 * 
 * def set_default_parser(_BaseParser parser=None):
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext *)__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT->__pyx_vtab)->setDefaultParser(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_4lxml_5etree___DEFAULT_XML_PARSER));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1340
 * __GLOBAL_PARSER_CONTEXT.setDefaultParser(__DEFAULT_XML_PARSER)
 * 
 * def set_default_parser(_BaseParser parser=None):             # <<<<<<<<<<<<<<
 *     u"""set_default_parser(parser=None)
 * 
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_21set_default_parser, NULL, __pyx_n_s_481); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__set_default_parser, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1356
 *     __GLOBAL_PARSER_CONTEXT.setDefaultParser(parser)
 * 
 * def get_default_parser():             # <<<<<<<<<<<<<<
 *     u"get_default_parser()"
 *     return __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_22get_default_parser, NULL, __pyx_n_s_481); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__get_default_parser, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1368
 *     htmlparser.HTML_PARSE_RECOVER |
 *     htmlparser.HTML_PARSE_NONET   |
 *     htmlparser.HTML_PARSE_COMPACT             # <<<<<<<<<<<<<<
 *     )
 * 
 */
  __pyx_v_4lxml_5etree__HTML_DEFAULT_PARSE_OPTIONS = ((HTML_PARSE_RECOVER | HTML_PARSE_NONET) | HTML_PARSE_COMPACT);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1403
 *     reasons.
 *     """
 *     def __init__(self, *, encoding=None, remove_blank_text=False,             # <<<<<<<<<<<<<<
 *                  remove_comments=False, remove_pis=False, strip_cdata=True,
 *                  no_network=True, target=None, XMLSchema schema=None,
 */
  __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_k_218 = __pyx_t_1;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1404
 *     """
 *     def __init__(self, *, encoding=None, remove_blank_text=False,
 *                  remove_comments=False, remove_pis=False, strip_cdata=True,             # <<<<<<<<<<<<<<
 *                  no_network=True, target=None, XMLSchema schema=None,
 *                  recover=True, compact=True):
 */
  __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_k_219 = __pyx_t_1;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_k_220 = __pyx_t_1;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_k_221 = __pyx_t_1;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1405
 *     def __init__(self, *, encoding=None, remove_blank_text=False,
 *                  remove_comments=False, remove_pis=False, strip_cdata=True,
 *                  no_network=True, target=None, XMLSchema schema=None,             # <<<<<<<<<<<<<<
 *                  recover=True, compact=True):
 *         cdef int parse_options
 */
  __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_k_222 = __pyx_t_1;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1406
 *                  remove_comments=False, remove_pis=False, strip_cdata=True,
 *                  no_network=True, target=None, XMLSchema schema=None,
 *                  recover=True, compact=True):             # <<<<<<<<<<<<<<
 *         cdef int parse_options
 *         parse_options = _HTML_DEFAULT_PARSE_OPTIONS
 */
  __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_k_223 = __pyx_t_1;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_k_224 = __pyx_t_1;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parser.pxi":1423
 * 
 * cdef HTMLParser __DEFAULT_HTML_PARSER
 * __DEFAULT_HTML_PARSER = HTMLParser()             # <<<<<<<<<<<<<<
 * 
 * ############################################################
 */
  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_HTMLParser)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GOTREF(((PyObject *)__pyx_v_4lxml_5etree___DEFAULT_HTML_PARSER));
  __Pyx_DECREF(((PyObject *)__pyx_v_4lxml_5etree___DEFAULT_HTML_PARSER));
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_v_4lxml_5etree___DEFAULT_HTML_PARSER = ((struct __pyx_obj_4lxml_5etree_HTMLParser *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":4
 * 
 * cdef object inspect_getargspec
 * from inspect import getargspec as inspect_getargspec             # <<<<<<<<<<<<<<
 * 
 * class _TargetParserResult(Exception):
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__getargspec));
  PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__getargspec));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__getargspec));
  __pyx_t_4 = __Pyx_Import(((PyObject *)__pyx_n_s__inspect), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__getargspec); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_4lxml_5etree_inspect_getargspec);
  __Pyx_DECREF(__pyx_v_4lxml_5etree_inspect_getargspec);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_v_4lxml_5etree_inspect_getargspec = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":6
 * from inspect import getargspec as inspect_getargspec
 * 
 * class _TargetParserResult(Exception):             # <<<<<<<<<<<<<<
 *     # Admittedly, this is somewhat ugly, but it's the easiest way
 *     # to push the Python level parser result through the parser
 */
  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":10
 *     # to push the Python level parser result through the parser
 *     # machinery towards the API level functions
 *     def __init__(self, result):             # <<<<<<<<<<<<<<
 *         self.result = result
 * 
 */
  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4lxml_5etree_19_TargetParserResult___init__, NULL, __pyx_n_s_481); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s____init__, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/parsertarget.pxi":6
 * from inspect import getargspec as inspect_getargspec
 * 
 * class _TargetParserResult(Exception):             # <<<<<<<<<<<<<<
 *     # Admittedly, this is somewhat ugly, but it's the easiest way
 *     # to push the Python level parser result through the parser
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_builtin_Exception);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_builtin_Exception);
  __Pyx_GIVEREF(__pyx_builtin_Exception);
  __pyx_t_3 = __Pyx_CreateClass(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_4), __pyx_n_s___TargetParserResult, __pyx_n_s_481); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s___TargetParserResult, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/serializer.pxi":3
 * # XML serialization and output functions
 * 
 * class SerialisationError(LxmlError):             # <<<<<<<<<<<<<<
 *     u"""A libxml2 error that occurred during serialisation.
 *     """
 */
  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__LxmlError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  if (PyDict_SetItemString(((PyObject *)__pyx_t_4), "__doc__", ((PyObject *)__pyx_kp_s_518)) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_CreateClass(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_4), __pyx_n_s__SerialisationError, __pyx_n_s_481); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__SerialisationError, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":365
 * 
 *     def __init__(self, source, events=(u"end",), *, tag=None,
 *                  attribute_defaults=False, dtd_validation=False,             # <<<<<<<<<<<<<<
 *                  load_dtd=False, no_network=True, remove_blank_text=False,
 *                  compact=True, resolve_entities=True, remove_comments=False,
 */
  __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_k_265 = __pyx_t_4;
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_k_266 = __pyx_t_4;
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":366
 *     def __init__(self, source, events=(u"end",), *, tag=None,
 *                  attribute_defaults=False, dtd_validation=False,
 *                  load_dtd=False, no_network=True, remove_blank_text=False,             # <<<<<<<<<<<<<<
 *                  compact=True, resolve_entities=True, remove_comments=False,
 *                  remove_pis=False, strip_cdata=True, encoding=None,
 */
  __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_k_267 = __pyx_t_4;
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_k_268 = __pyx_t_4;
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_k_269 = __pyx_t_4;
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":367
 *                  attribute_defaults=False, dtd_validation=False,
 *                  load_dtd=False, no_network=True, remove_blank_text=False,
 *                  compact=True, resolve_entities=True, remove_comments=False,             # <<<<<<<<<<<<<<
 *                  remove_pis=False, strip_cdata=True, encoding=None,
 *                  html=False, huge_tree=False, XMLSchema schema=None):
 */
  __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_k_270 = __pyx_t_4;
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_k_271 = __pyx_t_4;
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_k_272 = __pyx_t_4;
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":368
 *                  load_dtd=False, no_network=True, remove_blank_text=False,
 *                  compact=True, resolve_entities=True, remove_comments=False,
 *                  remove_pis=False, strip_cdata=True, encoding=None,             # <<<<<<<<<<<<<<
 *                  html=False, huge_tree=False, XMLSchema schema=None):
 *         cdef _IterparseContext context
 */
  __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_k_273 = __pyx_t_4;
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_k_274 = __pyx_t_4;
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/iterparse.pxi":369
 *                  compact=True, resolve_entities=True, remove_comments=False,
 *                  remove_pis=False, strip_cdata=True, encoding=None,
 *                  html=False, huge_tree=False, XMLSchema schema=None):             # <<<<<<<<<<<<<<
 *         cdef _IterparseContext context
 *         cdef char* c_encoding
 */
  __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_k_275 = __pyx_t_4;
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_k_276 = __pyx_t_4;
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":3
 * cdef object _find_id_attributes
 * 
 * def XMLID(text, parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     u"""XMLID(text, parser=None, base_url=None)
 * 
 */
  __pyx_t_4 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_23XMLID, NULL, __pyx_n_s_481); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__XMLID, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":24
 *     return (root, dic)
 * 
 * def XMLDTDID(text, parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     u"""XMLDTDID(text, parser=None, base_url=None)
 * 
 */
  __pyx_t_4 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_24XMLDTDID, NULL, __pyx_n_s_481); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__XMLDTDID, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlid.pxi":44
 *         return (root, _IDDict(root))
 * 
 * def parseid(source, parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     u"""parseid(source, parser=None)
 * 
 */
  __pyx_t_4 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_25parseid, NULL, __pyx_n_s_481); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__parseid, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xinclude.pxi":5
 * cimport xinclude
 * 
 * class XIncludeError(LxmlError):             # <<<<<<<<<<<<<<
 *     u"""Error during XInclude processing.
 *     """
 */
  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[16]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__LxmlError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[16]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[16]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  if (PyDict_SetItemString(((PyObject *)__pyx_t_4), "__doc__", ((PyObject *)__pyx_kp_s_519)) < 0) {__pyx_filename = __pyx_f[16]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_CreateClass(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_4), __pyx_n_s__XIncludeError, __pyx_n_s_481); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[16]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__XIncludeError, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[16]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":3
 * # functions for tree cleanup and removing elements from subtrees
 * 
 * def cleanup_namespaces(tree_or_element):             # <<<<<<<<<<<<<<
 *     u"""cleanup_namespaces(tree_or_element)
 * 
 */
  __pyx_t_4 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_26cleanup_namespaces, NULL, __pyx_n_s_481); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__cleanup_namespaces, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":13
 *     _removeUnusedNamespaceDeclarations(element._c_node)
 * 
 * def strip_attributes(tree_or_element, *attribute_names):             # <<<<<<<<<<<<<<
 *     u"""strip_attributes(tree_or_element, *attribute_names)
 * 
 */
  __pyx_t_4 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_27strip_attributes, NULL, __pyx_n_s_481); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__strip_attributes, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":80
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 * 
 * def strip_elements(tree_or_element, *tag_names, bint with_tail=True):             # <<<<<<<<<<<<<<
 *     u"""strip_elements(tree_or_element, *tag_names, with_tail=True)
 * 
 */
  __pyx_t_4 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_28strip_elements, NULL, __pyx_n_s_481); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__strip_elements, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/cleanup.pxi":172
 * 
 * 
 * def strip_tags(tree_or_element, *tag_names):             # <<<<<<<<<<<<<<
 *     u"""strip_tags(tree_or_element, *tag_names)
 * 
 */
  __pyx_t_4 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_29strip_tags, NULL, __pyx_n_s_481); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__strip_tags, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":3
 * # support for extension functions in XPath and XSLT
 * 
 * class XPathError(LxmlError):             # <<<<<<<<<<<<<<
 *     u"""Base class of all XPath errors.
 *     """
 */
  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__LxmlError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  if (PyDict_SetItemString(((PyObject *)__pyx_t_4), "__doc__", ((PyObject *)__pyx_kp_s_520)) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_CreateClass(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_4), __pyx_n_s__XPathError, __pyx_n_s_481); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__XPathError, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":8
 *     pass
 * 
 * class XPathEvalError(XPathError):             # <<<<<<<<<<<<<<
 *     u"""Error during XPath evaluation.
 *     """
 */
  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__XPathError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  if (PyDict_SetItemString(((PyObject *)__pyx_t_4), "__doc__", ((PyObject *)__pyx_kp_s_521)) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_CreateClass(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_4), __pyx_n_s__XPathEvalError, __pyx_n_s_481); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__XPathEvalError, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":13
 *     pass
 * 
 * class XPathFunctionError(XPathEvalError):             # <<<<<<<<<<<<<<
 *     u"""Internal error looking up an XPath extension function.
 *     """
 */
  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__XPathEvalError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  if (PyDict_SetItemString(((PyObject *)__pyx_t_4), "__doc__", ((PyObject *)__pyx_kp_s_522)) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_CreateClass(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_4), __pyx_n_s__XPathFunctionError, __pyx_n_s_481); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__XPathFunctionError, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":18
 *     pass
 * 
 * class XPathResultError(XPathEvalError):             # <<<<<<<<<<<<<<
 *     u"""Error handling an XPath result.
 *     """
 */
  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__XPathEvalError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  if (PyDict_SetItemString(((PyObject *)__pyx_t_4), "__doc__", ((PyObject *)__pyx_kp_s_523)) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_CreateClass(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_4), __pyx_n_s__XPathResultError, __pyx_n_s_481); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__XPathResultError, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":349
 *         return None
 * 
 * def Extension(module, function_mapping=None, *, ns=None):             # <<<<<<<<<<<<<<
 *     u"""Extension(module, function_mapping=None, ns=None)
 * 
 */
  __pyx_t_4 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_30Extension, NULL, __pyx_n_s_481); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__Extension, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":664
 *         return self._parent
 * 
 * class _ElementStringResult(bytes):             # <<<<<<<<<<<<<<
 *     # we need to use a Python class here, bytes cannot be C-subclassed
 *     # in Pyrex/Cython
 */
  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 664; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":667
 *     # we need to use a Python class here, bytes cannot be C-subclassed
 *     # in Pyrex/Cython
 *     def getparent(self):             # <<<<<<<<<<<<<<
 *         return self._parent
 * 
 */
  __pyx_t_3 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4lxml_5etree_20_ElementStringResult_getparent, NULL, __pyx_n_s_481); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s__getparent, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/extensions.pxi":664
 *         return self._parent
 * 
 * class _ElementStringResult(bytes):             # <<<<<<<<<<<<<<
 *     # we need to use a Python class here, bytes cannot be C-subclassed
 *     # in Pyrex/Cython
 */
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 664; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(((PyObject *)((PyObject*)(&PyBytes_Type))));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((PyObject*)(&PyBytes_Type))));
  __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyBytes_Type))));
  __pyx_t_1 = __Pyx_CreateClass(((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_4), __pyx_n_s_319, __pyx_n_s_481); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 664; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_319, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 664; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":3
 * # XPath evaluation
 * 
 * class XPathSyntaxError(LxmlSyntaxError, XPathError):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__LxmlSyntaxError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__XPathError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_6));
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_1 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_CreateClass(((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_4), __pyx_n_s__XPathSyntaxError, __pyx_n_s_481); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__XPathSyntaxError, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":11
 * cdef object _XPATH_SYNTAX_ERRORS
 * _XPATH_SYNTAX_ERRORS = (
 *     xmlerror.XML_XPATH_NUMBER_ERROR,             # <<<<<<<<<<<<<<
 *     xmlerror.XML_XPATH_UNFINISHED_LITERAL_ERROR,
 *     xmlerror.XML_XPATH_VARIABLE_REF_ERROR,
 */
  __pyx_t_4 = PyInt_FromLong(XML_XPATH_NUMBER_ERROR); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":12
 * _XPATH_SYNTAX_ERRORS = (
 *     xmlerror.XML_XPATH_NUMBER_ERROR,
 *     xmlerror.XML_XPATH_UNFINISHED_LITERAL_ERROR,             # <<<<<<<<<<<<<<
 *     xmlerror.XML_XPATH_VARIABLE_REF_ERROR,
 *     xmlerror.XML_XPATH_INVALID_PREDICATE_ERROR,
 */
  __pyx_t_3 = PyInt_FromLong(XML_XPATH_UNFINISHED_LITERAL_ERROR); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":13
 *     xmlerror.XML_XPATH_NUMBER_ERROR,
 *     xmlerror.XML_XPATH_UNFINISHED_LITERAL_ERROR,
 *     xmlerror.XML_XPATH_VARIABLE_REF_ERROR,             # <<<<<<<<<<<<<<
 *     xmlerror.XML_XPATH_INVALID_PREDICATE_ERROR,
 *     xmlerror.XML_XPATH_UNCLOSED_ERROR,
 */
  __pyx_t_6 = PyInt_FromLong(XML_XPATH_VARIABLE_REF_ERROR); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":14
 *     xmlerror.XML_XPATH_UNFINISHED_LITERAL_ERROR,
 *     xmlerror.XML_XPATH_VARIABLE_REF_ERROR,
 *     xmlerror.XML_XPATH_INVALID_PREDICATE_ERROR,             # <<<<<<<<<<<<<<
 *     xmlerror.XML_XPATH_UNCLOSED_ERROR,
 *     xmlerror.XML_XPATH_INVALID_CHAR_ERROR
 */
  __pyx_t_1 = PyInt_FromLong(XML_XPATH_INVALID_PREDICATE_ERROR); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":15
 *     xmlerror.XML_XPATH_VARIABLE_REF_ERROR,
 *     xmlerror.XML_XPATH_INVALID_PREDICATE_ERROR,
 *     xmlerror.XML_XPATH_UNCLOSED_ERROR,             # <<<<<<<<<<<<<<
 *     xmlerror.XML_XPATH_INVALID_CHAR_ERROR
 * )
 */
  __pyx_t_5 = PyInt_FromLong(XML_XPATH_UNCLOSED_ERROR); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":16
 *     xmlerror.XML_XPATH_INVALID_PREDICATE_ERROR,
 *     xmlerror.XML_XPATH_UNCLOSED_ERROR,
 *     xmlerror.XML_XPATH_INVALID_CHAR_ERROR             # <<<<<<<<<<<<<<
 * )
 * 
 */
  __pyx_t_8 = PyInt_FromLong(XML_XPATH_INVALID_CHAR_ERROR); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = PyTuple_New(6); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_9));
  PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_9, 3, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_9, 4, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_9, 5, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_8);
  __pyx_t_4 = 0;
  __pyx_t_3 = 0;
  __pyx_t_6 = 0;
  __pyx_t_1 = 0;
  __pyx_t_5 = 0;
  __pyx_t_8 = 0;
  __Pyx_GOTREF(__pyx_v_4lxml_5etree__XPATH_SYNTAX_ERRORS);
  __Pyx_DECREF(__pyx_v_4lxml_5etree__XPATH_SYNTAX_ERRORS);
  __Pyx_GIVEREF(((PyObject *)__pyx_t_9));
  __pyx_v_4lxml_5etree__XPATH_SYNTAX_ERRORS = ((PyObject *)__pyx_t_9);
  __pyx_t_9 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":21
 * cdef object _XPATH_EVAL_ERRORS
 * _XPATH_EVAL_ERRORS = (
 *     xmlerror.XML_XPATH_UNDEF_VARIABLE_ERROR,             # <<<<<<<<<<<<<<
 *     xmlerror.XML_XPATH_UNDEF_PREFIX_ERROR,
 *     xmlerror.XML_XPATH_UNKNOWN_FUNC_ERROR,
 */
  __pyx_t_9 = PyInt_FromLong(XML_XPATH_UNDEF_VARIABLE_ERROR); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":22
 * _XPATH_EVAL_ERRORS = (
 *     xmlerror.XML_XPATH_UNDEF_VARIABLE_ERROR,
 *     xmlerror.XML_XPATH_UNDEF_PREFIX_ERROR,             # <<<<<<<<<<<<<<
 *     xmlerror.XML_XPATH_UNKNOWN_FUNC_ERROR,
 *     xmlerror.XML_XPATH_INVALID_OPERAND,
 */
  __pyx_t_8 = PyInt_FromLong(XML_XPATH_UNDEF_PREFIX_ERROR); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":23
 *     xmlerror.XML_XPATH_UNDEF_VARIABLE_ERROR,
 *     xmlerror.XML_XPATH_UNDEF_PREFIX_ERROR,
 *     xmlerror.XML_XPATH_UNKNOWN_FUNC_ERROR,             # <<<<<<<<<<<<<<
 *     xmlerror.XML_XPATH_INVALID_OPERAND,
 *     xmlerror.XML_XPATH_INVALID_TYPE,
 */
  __pyx_t_5 = PyInt_FromLong(XML_XPATH_UNKNOWN_FUNC_ERROR); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":24
 *     xmlerror.XML_XPATH_UNDEF_PREFIX_ERROR,
 *     xmlerror.XML_XPATH_UNKNOWN_FUNC_ERROR,
 *     xmlerror.XML_XPATH_INVALID_OPERAND,             # <<<<<<<<<<<<<<
 *     xmlerror.XML_XPATH_INVALID_TYPE,
 *     xmlerror.XML_XPATH_INVALID_ARITY,
 */
  __pyx_t_1 = PyInt_FromLong(XML_XPATH_INVALID_OPERAND); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":25
 *     xmlerror.XML_XPATH_UNKNOWN_FUNC_ERROR,
 *     xmlerror.XML_XPATH_INVALID_OPERAND,
 *     xmlerror.XML_XPATH_INVALID_TYPE,             # <<<<<<<<<<<<<<
 *     xmlerror.XML_XPATH_INVALID_ARITY,
 *     xmlerror.XML_XPATH_INVALID_CTXT_SIZE,
 */
  __pyx_t_6 = PyInt_FromLong(XML_XPATH_INVALID_TYPE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":26
 *     xmlerror.XML_XPATH_INVALID_OPERAND,
 *     xmlerror.XML_XPATH_INVALID_TYPE,
 *     xmlerror.XML_XPATH_INVALID_ARITY,             # <<<<<<<<<<<<<<
 *     xmlerror.XML_XPATH_INVALID_CTXT_SIZE,
 *     xmlerror.XML_XPATH_INVALID_CTXT_POSITION
 */
  __pyx_t_3 = PyInt_FromLong(XML_XPATH_INVALID_ARITY); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":27
 *     xmlerror.XML_XPATH_INVALID_TYPE,
 *     xmlerror.XML_XPATH_INVALID_ARITY,
 *     xmlerror.XML_XPATH_INVALID_CTXT_SIZE,             # <<<<<<<<<<<<<<
 *     xmlerror.XML_XPATH_INVALID_CTXT_POSITION
 * )
 */
  __pyx_t_4 = PyInt_FromLong(XML_XPATH_INVALID_CTXT_SIZE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":28
 *     xmlerror.XML_XPATH_INVALID_ARITY,
 *     xmlerror.XML_XPATH_INVALID_CTXT_SIZE,
 *     xmlerror.XML_XPATH_INVALID_CTXT_POSITION             # <<<<<<<<<<<<<<
 * )
 * 
 */
  __pyx_t_10 = PyInt_FromLong(XML_XPATH_INVALID_CTXT_POSITION); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_11 = PyTuple_New(8); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_11));
  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_11, 3, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_11, 4, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_11, 5, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_11, 6, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_11, 7, __pyx_t_10);
  __Pyx_GIVEREF(__pyx_t_10);
  __pyx_t_9 = 0;
  __pyx_t_8 = 0;
  __pyx_t_5 = 0;
  __pyx_t_1 = 0;
  __pyx_t_6 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_10 = 0;
  __Pyx_GOTREF(__pyx_v_4lxml_5etree__XPATH_EVAL_ERRORS);
  __Pyx_DECREF(__pyx_v_4lxml_5etree__XPATH_EVAL_ERRORS);
  __Pyx_GIVEREF(((PyObject *)__pyx_t_11));
  __pyx_v_4lxml_5etree__XPATH_EVAL_ERRORS = ((PyObject *)__pyx_t_11);
  __pyx_t_11 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":123
 * 
 * cdef bint _XPATH_VERSION_WARNING_REQUIRED
 * if _LIBXML_VERSION_INT == 20627:             # <<<<<<<<<<<<<<
 *     _XPATH_VERSION_WARNING_REQUIRED = 1
 * else:
 */
  __pyx_t_7 = (__pyx_v_4lxml_5etree__LIBXML_VERSION_INT == 20627);
  if (__pyx_t_7) {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":124
 * cdef bint _XPATH_VERSION_WARNING_REQUIRED
 * if _LIBXML_VERSION_INT == 20627:
 *     _XPATH_VERSION_WARNING_REQUIRED = 1             # <<<<<<<<<<<<<<
 * else:
 *     _XPATH_VERSION_WARNING_REQUIRED = 0
 */
    __pyx_v_4lxml_5etree__XPATH_VERSION_WARNING_REQUIRED = 1;
    goto __pyx_L44;
  }
  /*else*/ {

    /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":126
 *     _XPATH_VERSION_WARNING_REQUIRED = 1
 * else:
 *     _XPATH_VERSION_WARNING_REQUIRED = 0             # <<<<<<<<<<<<<<
 * 
 * cdef class _XPathEvaluatorBase:
 */
    __pyx_v_4lxml_5etree__XPATH_VERSION_WARNING_REQUIRED = 0;
  }
  __pyx_L44:;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":268
 *     cdef _Element _element
 *     def __init__(self, _Element element not None, *, namespaces=None,
 *                  extensions=None, regexp=True, smart_strings=True):             # <<<<<<<<<<<<<<
 *         cdef xpath.xmlXPathContext* xpathCtxt
 *         cdef int ns_register_status
 */
  __pyx_t_11 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_k_333 = __pyx_t_11;
  __Pyx_GIVEREF(__pyx_t_11);
  __pyx_t_11 = 0;
  __pyx_t_11 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_k_334 = __pyx_t_11;
  __Pyx_GIVEREF(__pyx_t_11);
  __pyx_t_11 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":344
 *     """
 *     def __init__(self, _ElementTree etree not None, *, namespaces=None,
 *                  extensions=None, regexp=True, smart_strings=True):             # <<<<<<<<<<<<<<
 *         XPathElementEvaluator.__init__(
 *             self, etree._context_node, namespaces=namespaces,
 */
  __pyx_t_11 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_k_336 = __pyx_t_11;
  __Pyx_GIVEREF(__pyx_t_11);
  __pyx_t_11 = 0;
  __pyx_t_11 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_k_337 = __pyx_t_11;
  __Pyx_GIVEREF(__pyx_t_11);
  __pyx_t_11 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":391
 * 
 * def XPathEvaluator(etree_or_element, *, namespaces=None, extensions=None,
 *                    regexp=True, smart_strings=True):             # <<<<<<<<<<<<<<
 *     u"""XPathEvaluator(etree_or_element, namespaces=None, extensions=None, regexp=True, smart_strings=True)
 * 
 */
  __pyx_t_11 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_k_338 = __pyx_t_11;
  __Pyx_GIVEREF(__pyx_t_11);
  __pyx_t_11 = 0;
  __pyx_t_11 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_k_339 = __pyx_t_11;
  __Pyx_GIVEREF(__pyx_t_11);
  __pyx_t_11 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":390
 * 
 * 
 * def XPathEvaluator(etree_or_element, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *                    regexp=True, smart_strings=True):
 *     u"""XPathEvaluator(etree_or_element, namespaces=None, extensions=None, regexp=True, smart_strings=True)
 */
  __pyx_t_11 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_31XPathEvaluator, NULL, __pyx_n_s_481); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__XPathEvaluator, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":433
 * 
 *     def __init__(self, path, *, namespaces=None, extensions=None,
 *                  regexp=True, smart_strings=True):             # <<<<<<<<<<<<<<
 *         cdef xpath.xmlXPathContext* xpathCtxt
 *         _XPathEvaluatorBase.__init__(self, namespaces, extensions,
 */
  __pyx_t_11 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_k_340 = __pyx_t_11;
  __Pyx_GIVEREF(__pyx_t_11);
  __pyx_t_11 = 0;
  __pyx_t_11 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_k_341 = __pyx_t_11;
  __Pyx_GIVEREF(__pyx_t_11);
  __pyx_t_11 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":492
 * cdef object _replace_strings
 * cdef object _find_namespaces
 * _replace_strings = re.compile(b'("[^"]*")|(\'[^\']*\')').sub             # <<<<<<<<<<<<<<
 * _find_namespaces = re.compile(b'({[^}]+})').findall
 * 
 */
  __pyx_t_11 = PyObject_GetAttr(__pyx_v_4lxml_5etree_re, __pyx_n_s__compile); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_10 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_k_tuple_525), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_11 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__sub); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_GOTREF(__pyx_v_4lxml_5etree__replace_strings);
  __Pyx_DECREF(__pyx_v_4lxml_5etree__replace_strings);
  __Pyx_GIVEREF(__pyx_t_11);
  __pyx_v_4lxml_5etree__replace_strings = __pyx_t_11;
  __pyx_t_11 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":493
 * cdef object _find_namespaces
 * _replace_strings = re.compile(b'("[^"]*")|(\'[^\']*\')').sub
 * _find_namespaces = re.compile(b'({[^}]+})').findall             # <<<<<<<<<<<<<<
 * 
 * cdef class ETXPath(XPath):
 */
  __pyx_t_11 = PyObject_GetAttr(__pyx_v_4lxml_5etree_re, __pyx_n_s__compile); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_10 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_k_tuple_527), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_11 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__findall); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_GOTREF(__pyx_v_4lxml_5etree__find_namespaces);
  __Pyx_DECREF(__pyx_v_4lxml_5etree__find_namespaces);
  __Pyx_GIVEREF(__pyx_t_11);
  __pyx_v_4lxml_5etree__find_namespaces = __pyx_t_11;
  __pyx_t_11 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":504
 *     you pass ``smart_strings=False``.
 *     """
 *     def __init__(self, path, *, extensions=None, regexp=True,             # <<<<<<<<<<<<<<
 *                  smart_strings=True):
 *         path, namespaces = self._nsextract_path(path)
 */
  __pyx_t_11 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_k_343 = __pyx_t_11;
  __Pyx_GIVEREF(__pyx_t_11);
  __pyx_t_11 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xpath.pxi":505
 *     """
 *     def __init__(self, path, *, extensions=None, regexp=True,
 *                  smart_strings=True):             # <<<<<<<<<<<<<<
 *         path, namespaces = self._nsextract_path(path)
 *         XPath.__init__(self, path, namespaces=namespaces,
 */
  __pyx_t_11 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_k_344 = __pyx_t_11;
  __Pyx_GIVEREF(__pyx_t_11);
  __pyx_t_11 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":5
 * cimport xslt
 * 
 * class XSLTError(LxmlError):             # <<<<<<<<<<<<<<
 *     u"""Base class of all XSLT errors.
 *     """
 */
  __pyx_t_11 = PyDict_New(); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_11));
  __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__LxmlError); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_10);
  __Pyx_GIVEREF(__pyx_t_10);
  __pyx_t_10 = 0;
  if (PyDict_SetItemString(((PyObject *)__pyx_t_11), "__doc__", ((PyObject *)__pyx_kp_s_528)) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_10 = __Pyx_CreateClass(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_11), __pyx_n_s__XSLTError, __pyx_n_s_481); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__XSLTError, __pyx_t_10) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":10
 *     pass
 * 
 * class XSLTParseError(XSLTError):             # <<<<<<<<<<<<<<
 *     u"""Error parsing a stylesheet document.
 *     """
 */
  __pyx_t_11 = PyDict_New(); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_11));
  __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__XSLTError); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_10);
  __Pyx_GIVEREF(__pyx_t_10);
  __pyx_t_10 = 0;
  if (PyDict_SetItemString(((PyObject *)__pyx_t_11), "__doc__", ((PyObject *)__pyx_kp_s_529)) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_10 = __Pyx_CreateClass(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_11), __pyx_n_s__XSLTParseError, __pyx_n_s_481); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__XSLTParseError, __pyx_t_10) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":15
 *     pass
 * 
 * class XSLTApplyError(XSLTError):             # <<<<<<<<<<<<<<
 *     u"""Error running an XSL transformation.
 *     """
 */
  __pyx_t_11 = PyDict_New(); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_11));
  __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__XSLTError); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_10);
  __Pyx_GIVEREF(__pyx_t_10);
  __pyx_t_10 = 0;
  if (PyDict_SetItemString(((PyObject *)__pyx_t_11), "__doc__", ((PyObject *)__pyx_kp_s_530)) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_10 = __Pyx_CreateClass(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_11), __pyx_n_s__XSLTApplyError, __pyx_n_s_481); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__XSLTApplyError, __pyx_t_10) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":20
 *     pass
 * 
 * class XSLTSaveError(XSLTError):             # <<<<<<<<<<<<<<
 *     u"""Error serialising an XSLT result.
 *     """
 */
  __pyx_t_11 = PyDict_New(); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_11));
  __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__XSLTError); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_10);
  __Pyx_GIVEREF(__pyx_t_10);
  __pyx_t_10 = 0;
  if (PyDict_SetItemString(((PyObject *)__pyx_t_11), "__doc__", ((PyObject *)__pyx_kp_s_531)) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_10 = __Pyx_CreateClass(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_11), __pyx_n_s__XSLTSaveError, __pyx_n_s_481); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__XSLTSaveError, __pyx_t_10) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":25
 *     pass
 * 
 * class XSLTExtensionError(XSLTError):             # <<<<<<<<<<<<<<
 *     u"""Error registering an XSLT extension.
 *     """
 */
  __pyx_t_11 = PyDict_New(); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_11));
  __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__XSLTError); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_10);
  __Pyx_GIVEREF(__pyx_t_10);
  __pyx_t_10 = 0;
  if (PyDict_SetItemString(((PyObject *)__pyx_t_11), "__doc__", ((PyObject *)__pyx_kp_s_532)) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_10 = __Pyx_CreateClass(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_11), __pyx_n_s__XSLTExtensionError, __pyx_n_s_481); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__XSLTExtensionError, __pyx_t_10) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":31
 * 
 * # version information
 * LIBXSLT_COMPILED_VERSION = __unpackIntVersion(xslt.LIBXSLT_VERSION)             # <<<<<<<<<<<<<<
 * LIBXSLT_VERSION = __unpackIntVersion(xslt.xsltLibxsltVersion)
 * 
 */
  __pyx_t_11 = __pyx_f_4lxml_5etree___unpackIntVersion(LIBXSLT_VERSION); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_464, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":32
 * # version information
 * LIBXSLT_COMPILED_VERSION = __unpackIntVersion(xslt.LIBXSLT_VERSION)
 * LIBXSLT_VERSION = __unpackIntVersion(xslt.xsltLibxsltVersion)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_11 = __pyx_f_4lxml_5etree___unpackIntVersion(xsltLibxsltVersion); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__LIBXSLT_VERSION, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":159
 * 
 * cdef xslt.xsltDocLoaderFunc XSLT_DOC_DEFAULT_LOADER
 * XSLT_DOC_DEFAULT_LOADER = xslt.xsltDocDefaultLoader             # <<<<<<<<<<<<<<
 * 
 * xslt.xsltSetLoaderFunc(_xslt_doc_loader)
 */
  __pyx_v_4lxml_5etree_XSLT_DOC_DEFAULT_LOADER = xsltDocDefaultLoader;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":161
 * XSLT_DOC_DEFAULT_LOADER = xslt.xsltDocDefaultLoader
 * 
 * xslt.xsltSetLoaderFunc(_xslt_doc_loader)             # <<<<<<<<<<<<<<
 * 
 * ################################################################################
 */
  xsltSetLoaderFunc(__pyx_f_4lxml_5etree__xslt_doc_loader);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":188
 *     """
 *     cdef xslt.xsltSecurityPrefs* _prefs
 *     def __cinit__(self, *, read_file=True, write_file=True, create_dir=True,             # <<<<<<<<<<<<<<
 *                  read_network=True, write_network=True):
 *         self._prefs = xslt.xsltNewSecurityPrefs()
 */
  __pyx_t_11 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_k_349 = __pyx_t_11;
  __Pyx_GIVEREF(__pyx_t_11);
  __pyx_t_11 = 0;
  __pyx_t_11 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_k_350 = __pyx_t_11;
  __Pyx_GIVEREF(__pyx_t_11);
  __pyx_t_11 = 0;
  __pyx_t_11 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_k_351 = __pyx_t_11;
  __Pyx_GIVEREF(__pyx_t_11);
  __pyx_t_11 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":189
 *     cdef xslt.xsltSecurityPrefs* _prefs
 *     def __cinit__(self, *, read_file=True, write_file=True, create_dir=True,
 *                  read_network=True, write_network=True):             # <<<<<<<<<<<<<<
 *         self._prefs = xslt.xsltNewSecurityPrefs()
 *         if self._prefs is NULL:
 */
  __pyx_t_11 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_k_352 = __pyx_t_11;
  __Pyx_GIVEREF(__pyx_t_11);
  __pyx_t_11 = 0;
  __pyx_t_11 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_k_353 = __pyx_t_11;
  __Pyx_GIVEREF(__pyx_t_11);
  __pyx_t_11 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":199
 *         self._setAccess(xslt.XSLT_SECPREF_WRITE_NETWORK, write_network)
 * 
 *     DENY_ALL = XSLTAccessControl(             # <<<<<<<<<<<<<<
 *         read_file=False, write_file=False, create_dir=False,
 *         read_network=False, write_network=False)
 */
  __pyx_t_11 = PyDict_New(); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_11));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":200
 * 
 *     DENY_ALL = XSLTAccessControl(
 *         read_file=False, write_file=False, create_dir=False,             # <<<<<<<<<<<<<<
 *         read_network=False, write_network=False)
 * 
 */
  __pyx_t_10 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  if (PyDict_SetItem(__pyx_t_11, ((PyObject *)__pyx_n_s__read_file), __pyx_t_10) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  if (PyDict_SetItem(__pyx_t_11, ((PyObject *)__pyx_n_s__write_file), __pyx_t_10) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  if (PyDict_SetItem(__pyx_t_11, ((PyObject *)__pyx_n_s__create_dir), __pyx_t_10) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":201
 *     DENY_ALL = XSLTAccessControl(
 *         read_file=False, write_file=False, create_dir=False,
 *         read_network=False, write_network=False)             # <<<<<<<<<<<<<<
 * 
 *     DENY_WRITE = XSLTAccessControl(
 */
  __pyx_t_10 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  if (PyDict_SetItem(__pyx_t_11, ((PyObject *)__pyx_n_s__read_network), __pyx_t_10) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  if (PyDict_SetItem(__pyx_t_11, ((PyObject *)__pyx_n_s__write_network), __pyx_t_10) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_XSLTAccessControl)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_11)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_4lxml_5etree_XSLTAccessControl->tp_dict, __pyx_n_s__DENY_ALL, __pyx_t_10) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_XSLTAccessControl);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":203
 *         read_network=False, write_network=False)
 * 
 *     DENY_WRITE = XSLTAccessControl(             # <<<<<<<<<<<<<<
 *         read_file=True, write_file=False, create_dir=False,
 *         read_network=True, write_network=False)
 */
  __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_10));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":204
 * 
 *     DENY_WRITE = XSLTAccessControl(
 *         read_file=True, write_file=False, create_dir=False,             # <<<<<<<<<<<<<<
 *         read_network=True, write_network=False)
 * 
 */
  __pyx_t_11 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__read_file), __pyx_t_11) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_11 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__write_file), __pyx_t_11) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_11 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__create_dir), __pyx_t_11) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":205
 *     DENY_WRITE = XSLTAccessControl(
 *         read_file=True, write_file=False, create_dir=False,
 *         read_network=True, write_network=False)             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __pyx_t_11 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__read_network), __pyx_t_11) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_11 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__write_network), __pyx_t_11) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_11 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_XSLTAccessControl)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_4lxml_5etree_XSLTAccessControl->tp_dict, __pyx_n_s__DENY_WRITE, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_XSLTAccessControl);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":267
 *         NULL)
 * 
 * cdef dict EMPTY_DICT = {}             # <<<<<<<<<<<<<<
 * 
 * cdef class _XSLTContext(_BaseContext):
 */
  __pyx_t_11 = PyDict_New(); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_11));
  __Pyx_GOTREF(((PyObject *)__pyx_v_4lxml_5etree_EMPTY_DICT));
  __Pyx_DECREF(((PyObject *)__pyx_v_4lxml_5etree_EMPTY_DICT));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_11));
  __pyx_v_4lxml_5etree_EMPTY_DICT = __pyx_t_11;
  __pyx_t_11 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":363
 *         self._c_style = NULL
 * 
 *     def __init__(self, xslt_input, *, extensions=None, regexp=True,             # <<<<<<<<<<<<<<
 *                  access_control=None):
 *         cdef xslt.xsltStylesheet* c_style
 */
  __pyx_t_11 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_k_359 = __pyx_t_11;
  __Pyx_GIVEREF(__pyx_t_11);
  __pyx_t_11 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":429
 * 
 *     @classmethod
 *     def strparam(_, strval):             # <<<<<<<<<<<<<<
 *         u"""strparam(strval)
 * 
 */
  __pyx_t_11 = __Pyx_GetName((PyObject *)__pyx_ptype_4lxml_5etree_XSLT, __pyx_n_s__strparam); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_10 = __Pyx_Method_ClassMethod(__pyx_t_11); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_4lxml_5etree_XSLT->tp_dict, __pyx_n_s__strparam, __pyx_t_10) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_XSLT);

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":442
 *         return _XSLTQuotedStringParam(strval)
 * 
 *     def apply(self, _input, *, profile_run=False, **kw):             # <<<<<<<<<<<<<<
 *         u"""apply(self, _input,  profile_run=False, **kw)
 * 
 */
  __pyx_t_10 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_k_363 = __pyx_t_10;
  __Pyx_GIVEREF(__pyx_t_10);
  __pyx_t_10 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":463
 *         return _copyXSLT(self)
 * 
 *     def __call__(self, _input, *, profile_run=False, **kw):             # <<<<<<<<<<<<<<
 *         u"""__call__(self, _input, profile_run=False, **kw)
 * 
 */
  __pyx_t_10 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_k_364 = __pyx_t_10;
  __Pyx_GIVEREF(__pyx_t_10);
  __pyx_t_10 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":797
 * # functions like "output" and "write" are a potential security risk, but we
 * # rely on the user to configure XSLTAccessControl as needed
 * xslt.xsltRegisterAllExtras()             # <<<<<<<<<<<<<<
 * 
 * # enable EXSLT support for XSLT
 */
  xsltRegisterAllExtras();

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":800
 * 
 * # enable EXSLT support for XSLT
 * xslt.exsltRegisterAll()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  exsltRegisterAll();

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":807
 * 
 * cdef object _FIND_PI_ATTRIBUTES
 * _FIND_PI_ATTRIBUTES = re.compile(ur'\s+(\w+)\s*=\s*["\']([^"\']+)["\']', re.U).findall             # <<<<<<<<<<<<<<
 * 
 * cdef object _RE_PI_HREF
 */
  __pyx_t_10 = PyObject_GetAttr(__pyx_v_4lxml_5etree_re, __pyx_n_s__compile); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_11 = PyObject_GetAttr(__pyx_v_4lxml_5etree_re, __pyx_n_s__U); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_533));
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_533));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_533));
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_11);
  __Pyx_GIVEREF(__pyx_t_11);
  __pyx_t_11 = 0;
  __pyx_t_11 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_GetAttr(__pyx_t_11, __pyx_n_s__findall); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __Pyx_GOTREF(__pyx_v_4lxml_5etree__FIND_PI_ATTRIBUTES);
  __Pyx_DECREF(__pyx_v_4lxml_5etree__FIND_PI_ATTRIBUTES);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_v_4lxml_5etree__FIND_PI_ATTRIBUTES = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":810
 * 
 * cdef object _RE_PI_HREF
 * _RE_PI_HREF = re.compile(ur'\s+href\s*=\s*["\']([^"\']+)["\']')             # <<<<<<<<<<<<<<
 * 
 * cdef object _FIND_PI_HREF
 */
  __pyx_t_4 = PyObject_GetAttr(__pyx_v_4lxml_5etree_re, __pyx_n_s__compile); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_11 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_535), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_GOTREF(__pyx_v_4lxml_5etree__RE_PI_HREF);
  __Pyx_DECREF(__pyx_v_4lxml_5etree__RE_PI_HREF);
  __Pyx_GIVEREF(__pyx_t_11);
  __pyx_v_4lxml_5etree__RE_PI_HREF = __pyx_t_11;
  __pyx_t_11 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":813
 * 
 * cdef object _FIND_PI_HREF
 * _FIND_PI_HREF = _RE_PI_HREF.findall             # <<<<<<<<<<<<<<
 * 
 * cdef object _REPLACE_PI_HREF
 */
  __pyx_t_11 = PyObject_GetAttr(__pyx_v_4lxml_5etree__RE_PI_HREF, __pyx_n_s__findall); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_GOTREF(__pyx_v_4lxml_5etree__FIND_PI_HREF);
  __Pyx_DECREF(__pyx_v_4lxml_5etree__FIND_PI_HREF);
  __Pyx_GIVEREF(__pyx_t_11);
  __pyx_v_4lxml_5etree__FIND_PI_HREF = __pyx_t_11;
  __pyx_t_11 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":816
 * 
 * cdef object _REPLACE_PI_HREF
 * _REPLACE_PI_HREF = _RE_PI_HREF.sub             # <<<<<<<<<<<<<<
 * 
 * cdef XPath __findStylesheetByID
 */
  __pyx_t_11 = PyObject_GetAttr(__pyx_v_4lxml_5etree__RE_PI_HREF, __pyx_n_s__sub); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_GOTREF(__pyx_v_4lxml_5etree__REPLACE_PI_HREF);
  __Pyx_DECREF(__pyx_v_4lxml_5etree__REPLACE_PI_HREF);
  __Pyx_GIVEREF(__pyx_t_11);
  __pyx_v_4lxml_5etree__REPLACE_PI_HREF = __pyx_t_11;
  __pyx_t_11 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xslt.pxi":819
 * 
 * cdef XPath __findStylesheetByID
 * __findStylesheetByID = None             # <<<<<<<<<<<<<<
 * 
 * cdef _findStylesheetByID(_Document doc, id):
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GOTREF(((PyObject *)__pyx_v_4lxml_5etree___findStylesheetByID));
  __Pyx_DECREF(((PyObject *)__pyx_v_4lxml_5etree___findStylesheetByID));
  __Pyx_GIVEREF(Py_None);
  __pyx_v_4lxml_5etree___findStylesheetByID = ((struct __pyx_obj_4lxml_5etree_XPath *)Py_None);

  /* "src/lxml/lxml.etree.pyx":2977
 * # Validation
 * 
 * class DocumentInvalid(LxmlError):             # <<<<<<<<<<<<<<
 *     u"""Validation error.
 * 
 */
  __pyx_t_11 = PyDict_New(); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_11));
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__LxmlError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_10));
  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  if (PyDict_SetItemString(((PyObject *)__pyx_t_11), "__doc__", ((PyObject *)__pyx_kp_s_536)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_CreateClass(((PyObject *)__pyx_t_10), ((PyObject *)__pyx_t_11), __pyx_n_s__DocumentInvalid, __pyx_n_s_481); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DocumentInvalid, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":4
 * cimport dtdvalid
 * 
 * class DTDError(LxmlError):             # <<<<<<<<<<<<<<
 *     u"""Base class for DTD errors.
 *     """
 */
  __pyx_t_11 = PyDict_New(); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_11));
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__LxmlError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_10));
  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  if (PyDict_SetItemString(((PyObject *)__pyx_t_11), "__doc__", ((PyObject *)__pyx_kp_s_537)) < 0) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_CreateClass(((PyObject *)__pyx_t_10), ((PyObject *)__pyx_t_11), __pyx_n_s__DTDError, __pyx_n_s_481); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DTDError, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":9
 *     pass
 * 
 * class DTDParseError(DTDError):             # <<<<<<<<<<<<<<
 *     u"""Error while parsing a DTD.
 *     """
 */
  __pyx_t_11 = PyDict_New(); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_11));
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTDError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_10));
  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  if (PyDict_SetItemString(((PyObject *)__pyx_t_11), "__doc__", ((PyObject *)__pyx_kp_s_538)) < 0) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_CreateClass(((PyObject *)__pyx_t_10), ((PyObject *)__pyx_t_11), __pyx_n_s__DTDParseError, __pyx_n_s_481); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DTDParseError, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/dtd.pxi":14
 *     pass
 * 
 * class DTDValidateError(DTDError):             # <<<<<<<<<<<<<<
 *     u"""Error while validating an XML document with a DTD.
 *     """
 */
  __pyx_t_11 = PyDict_New(); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_11));
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTDError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_10));
  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  if (PyDict_SetItemString(((PyObject *)__pyx_t_11), "__doc__", ((PyObject *)__pyx_kp_s_539)) < 0) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_CreateClass(((PyObject *)__pyx_t_10), ((PyObject *)__pyx_t_11), __pyx_n_s__DTDValidateError, __pyx_n_s_481); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DTDValidateError, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":4
 * cimport relaxng
 * 
 * class RelaxNGError(LxmlError):             # <<<<<<<<<<<<<<
 *     u"""Base class for RelaxNG errors.
 *     """
 */
  __pyx_t_11 = PyDict_New(); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_11));
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__LxmlError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_10));
  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  if (PyDict_SetItemString(((PyObject *)__pyx_t_11), "__doc__", ((PyObject *)__pyx_kp_s_540)) < 0) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_CreateClass(((PyObject *)__pyx_t_10), ((PyObject *)__pyx_t_11), __pyx_n_s__RelaxNGError, __pyx_n_s_481); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__RelaxNGError, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":9
 *     pass
 * 
 * class RelaxNGParseError(RelaxNGError):             # <<<<<<<<<<<<<<
 *     u"""Error while parsing an XML document as RelaxNG.
 *     """
 */
  __pyx_t_11 = PyDict_New(); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_11));
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__RelaxNGError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_10));
  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  if (PyDict_SetItemString(((PyObject *)__pyx_t_11), "__doc__", ((PyObject *)__pyx_kp_s_541)) < 0) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_CreateClass(((PyObject *)__pyx_t_10), ((PyObject *)__pyx_t_11), __pyx_n_s__RelaxNGParseError, __pyx_n_s_481); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__RelaxNGParseError, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/relaxng.pxi":14
 *     pass
 * 
 * class RelaxNGValidateError(RelaxNGError):             # <<<<<<<<<<<<<<
 *     u"""Error while validating an XML document with a RelaxNG schema.
 *     """
 */
  __pyx_t_11 = PyDict_New(); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_11));
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__RelaxNGError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_10));
  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  if (PyDict_SetItemString(((PyObject *)__pyx_t_11), "__doc__", ((PyObject *)__pyx_kp_s_542)) < 0) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_CreateClass(((PyObject *)__pyx_t_10), ((PyObject *)__pyx_t_11), __pyx_n_s_403, __pyx_n_s_481); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_403, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":4
 * cimport xmlschema
 * 
 * class XMLSchemaError(LxmlError):             # <<<<<<<<<<<<<<
 *     u"""Base class of all XML Schema errors
 *     """
 */
  __pyx_t_11 = PyDict_New(); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_11));
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__LxmlError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_10));
  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  if (PyDict_SetItemString(((PyObject *)__pyx_t_11), "__doc__", ((PyObject *)__pyx_kp_s_543)) < 0) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_CreateClass(((PyObject *)__pyx_t_10), ((PyObject *)__pyx_t_11), __pyx_n_s__XMLSchemaError, __pyx_n_s_481); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__XMLSchemaError, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":9
 *     pass
 * 
 * class XMLSchemaParseError(XMLSchemaError):             # <<<<<<<<<<<<<<
 *     u"""Error while parsing an XML document as XML Schema.
 *     """
 */
  __pyx_t_11 = PyDict_New(); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_11));
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__XMLSchemaError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_10));
  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  if (PyDict_SetItemString(((PyObject *)__pyx_t_11), "__doc__", ((PyObject *)__pyx_kp_s_544)) < 0) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_CreateClass(((PyObject *)__pyx_t_10), ((PyObject *)__pyx_t_11), __pyx_n_s__XMLSchemaParseError, __pyx_n_s_481); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__XMLSchemaParseError, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":14
 *     pass
 * 
 * class XMLSchemaValidateError(XMLSchemaError):             # <<<<<<<<<<<<<<
 *     u"""Error while validating an XML document with an XML Schema.
 *     """
 */
  __pyx_t_11 = PyDict_New(); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_11));
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__XMLSchemaError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_10));
  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  if (PyDict_SetItemString(((PyObject *)__pyx_t_11), "__doc__", ((PyObject *)__pyx_kp_s_545)) < 0) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_CreateClass(((PyObject *)__pyx_t_10), ((PyObject *)__pyx_t_11), __pyx_n_s_412, __pyx_n_s_481); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_412, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":22
 * # XMLSchema
 * 
 * cdef XPath _check_for_default_attributes = XPath(             # <<<<<<<<<<<<<<
 *     u"boolean(//xs:attribute[@default or @fixed][1])",
 *     namespaces={u'xs': u'http://www.w3.org/2001/XMLSchema'})
 */
  __pyx_t_11 = PyDict_New(); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_11));

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":24
 * cdef XPath _check_for_default_attributes = XPath(
 *     u"boolean(//xs:attribute[@default or @fixed][1])",
 *     namespaces={u'xs': u'http://www.w3.org/2001/XMLSchema'})             # <<<<<<<<<<<<<<
 * 
 * cdef class XMLSchema(_Validator):
 */
  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_u__xs), ((PyObject *)__pyx_kp_u_408)) < 0) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_11, ((PyObject *)__pyx_n_s__namespaces), ((PyObject *)__pyx_t_4)) < 0) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __pyx_t_4 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_XPath)), ((PyObject *)__pyx_k_tuple_547), ((PyObject *)__pyx_t_11)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
  __Pyx_GOTREF(((PyObject *)__pyx_v_4lxml_5etree__check_for_default_attributes));
  __Pyx_DECREF(((PyObject *)__pyx_v_4lxml_5etree__check_for_default_attributes));
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_v_4lxml_5etree__check_for_default_attributes = ((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/xmlschema.pxi":44
 *         self._add_attribute_defaults = False
 * 
 *     def __init__(self, etree=None, *, file=None, attribute_defaults=False):             # <<<<<<<<<<<<<<
 *         cdef _Document doc
 *         cdef _Element root_node
 */
  __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_k_407 = __pyx_t_4;
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":4
 * cimport schematron
 * 
 * class SchematronError(LxmlError):             # <<<<<<<<<<<<<<
 *     u"""Base class of all Schematron errors.
 *     """
 */
  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  __pyx_t_11 = __Pyx_GetName(__pyx_m, __pyx_n_s__LxmlError); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_10));
  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_11);
  __Pyx_GIVEREF(__pyx_t_11);
  __pyx_t_11 = 0;
  if (PyDict_SetItemString(((PyObject *)__pyx_t_4), "__doc__", ((PyObject *)__pyx_kp_s_548)) < 0) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_11 = __Pyx_CreateClass(((PyObject *)__pyx_t_10), ((PyObject *)__pyx_t_4), __pyx_n_s__SchematronError, __pyx_n_s_481); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__SchematronError, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":9
 *     pass
 * 
 * class SchematronParseError(SchematronError):             # <<<<<<<<<<<<<<
 *     u"""Error while parsing an XML document as Schematron schema.
 *     """
 */
  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  __pyx_t_11 = __Pyx_GetName(__pyx_m, __pyx_n_s__SchematronError); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_10));
  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_11);
  __Pyx_GIVEREF(__pyx_t_11);
  __pyx_t_11 = 0;
  if (PyDict_SetItemString(((PyObject *)__pyx_t_4), "__doc__", ((PyObject *)__pyx_kp_s_549)) < 0) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_11 = __Pyx_CreateClass(((PyObject *)__pyx_t_10), ((PyObject *)__pyx_t_4), __pyx_n_s_416, __pyx_n_s_481); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_416, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;

  /* "/home/sbehnel/source/Python/lxml/lxml-HEAD/src/lxml/schematron.pxi":14
 *     pass
 * 
 * class SchematronValidateError(SchematronError):             # <<<<<<<<<<<<<<
 *     u"""Error while validating an XML document with a Schematron schema.
 *     """
 */
  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  __pyx_t_11 = __Pyx_GetName(__pyx_m, __pyx_n_s__SchematronError); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_10));
  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_11);
  __Pyx_GIVEREF(__pyx_t_11);
  __pyx_t_11 = 0;
  if (PyDict_SetItemString(((PyObject *)__pyx_t_4), "__doc__", ((PyObject *)__pyx_kp_s_550)) < 0) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_11 = __Pyx_CreateClass(((PyObject *)__pyx_t_10), ((PyObject *)__pyx_t_4), __pyx_n_s_419, __pyx_n_s_481); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_419, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;

  /* "src/lxml/lxml.etree.pyx":1
 * u"""The ``lxml.etree`` module implements the extended ElementTree API             # <<<<<<<<<<<<<<
 * for XML.
 * """
 */
  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_kp_u_551), ((PyObject *)__pyx_kp_u_552)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_4)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;

  /* "cstd.pxd":2
 * 
 * cdef extern from "string.h":             # <<<<<<<<<<<<<<
 *     cdef int strlen(char* s) nogil
 *     cdef char* strstr(char* haystack, char* needle) nogil
 */
  if (__Pyx_RegisterCleanup()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  if (__pyx_m) {
    __Pyx_AddTraceback("init lxml.etree");
    Py_DECREF(__pyx_m); __pyx_m = 0;
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init lxml.etree");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if PY_MAJOR_VERSION < 3
  return;
  #else
  return __pyx_m;
  #endif
}

static void __Pyx_CleanupGlobals(void) {
  Py_XDECREF(__pyx_k_tuple_2); __pyx_k_tuple_2 = 0;
  Py_XDECREF(__pyx_k_tuple_3); __pyx_k_tuple_3 = 0;
  Py_XDECREF(__pyx_k_tuple_6); __pyx_k_tuple_6 = 0;
  Py_XDECREF(__pyx_k_tuple_7); __pyx_k_tuple_7 = 0;
  Py_XDECREF(__pyx_k_tuple_8); __pyx_k_tuple_8 = 0;
  Py_XDECREF(__pyx_k_tuple_9); __pyx_k_tuple_9 = 0;
  Py_XDECREF(__pyx_k_tuple_10); __pyx_k_tuple_10 = 0;
  Py_XDECREF(__pyx_k_tuple_23); __pyx_k_tuple_23 = 0;
  Py_XDECREF(__pyx_k_tuple_48); __pyx_k_tuple_48 = 0;
  Py_XDECREF(__pyx_k_tuple_56); __pyx_k_tuple_56 = 0;
  Py_XDECREF(__pyx_k_tuple_95); __pyx_k_tuple_95 = 0;
  Py_XDECREF(__pyx_k_tuple_97); __pyx_k_tuple_97 = 0;
  Py_XDECREF(__pyx_k_tuple_99); __pyx_k_tuple_99 = 0;
  Py_XDECREF(__pyx_k_tuple_111); __pyx_k_tuple_111 = 0;
  Py_XDECREF(__pyx_k_tuple_112); __pyx_k_tuple_112 = 0;
  Py_XDECREF(__pyx_k_tuple_121); __pyx_k_tuple_121 = 0;
  Py_XDECREF(__pyx_k_tuple_122); __pyx_k_tuple_122 = 0;
  Py_XDECREF(__pyx_k_tuple_123); __pyx_k_tuple_123 = 0;
  Py_XDECREF(__pyx_k_tuple_139); __pyx_k_tuple_139 = 0;
  
#if PY_VERSION_HEX < 0x02040000
Py_XDECREF(__Pyx_PySet_Type); __Pyx_PySet_Type = NULL;
Py_XDECREF(__Pyx_PyFrozenSet_Type); __Pyx_PyFrozenSet_Type = NULL;
#endif /* < Py2.4  */
Py_XDECREF(__pyx_k_tuple_238); __pyx_k_tuple_238 = 0;
  Py_XDECREF(__pyx_k_tuple_257); __pyx_k_tuple_257 = 0;
  Py_XDECREF(__pyx_k_tuple_263); __pyx_k_tuple_263 = 0;
  Py_XDECREF(__pyx_k_tuple_264); __pyx_k_tuple_264 = 0;
  Py_XDECREF(__pyx_k_tuple_277); __pyx_k_tuple_277 = 0;
  Py_XDECREF(__pyx_k_tuple_279); __pyx_k_tuple_279 = 0;
  Py_XDECREF(__pyx_k_tuple_281); __pyx_k_tuple_281 = 0;
  Py_XDECREF(__pyx_k_tuple_282); __pyx_k_tuple_282 = 0;
  Py_XDECREF(__pyx_k_tuple_283); __pyx_k_tuple_283 = 0;
  Py_XDECREF(__pyx_k_tuple_284); __pyx_k_tuple_284 = 0;
  Py_XDECREF(__pyx_k_tuple_285); __pyx_k_tuple_285 = 0;
  Py_XDECREF(__pyx_k_tuple_287); __pyx_k_tuple_287 = 0;
  Py_XDECREF(__pyx_k_tuple_288); __pyx_k_tuple_288 = 0;
  Py_XDECREF(__pyx_k_tuple_306); __pyx_k_tuple_306 = 0;
  Py_XDECREF(__pyx_k_tuple_307); __pyx_k_tuple_307 = 0;
  Py_XDECREF(__pyx_k_tuple_308); __pyx_k_tuple_308 = 0;
  Py_XDECREF(__pyx_k_tuple_330); __pyx_k_tuple_330 = 0;
  Py_XDECREF(__pyx_k_tuple_342); __pyx_k_tuple_342 = 0;
  Py_XDECREF(__pyx_k_tuple_355); __pyx_k_tuple_355 = 0;
  Py_XDECREF(__pyx_k_tuple_370); __pyx_k_tuple_370 = 0;
  Py_XDECREF(__pyx_k_tuple_386); __pyx_k_tuple_386 = 0;
  Py_XDECREF(__pyx_k_tuple_471); __pyx_k_tuple_471 = 0;
  Py_XDECREF(__pyx_k_tuple_480); __pyx_k_tuple_480 = 0;
  Py_XDECREF(__pyx_k_tuple_486); __pyx_k_tuple_486 = 0;
  Py_XDECREF(__pyx_k_tuple_489); __pyx_k_tuple_489 = 0;
  Py_XDECREF(__pyx_k_tuple_495); __pyx_k_tuple_495 = 0;
  Py_XDECREF(__pyx_k_tuple_497); __pyx_k_tuple_497 = 0;
  Py_XDECREF(__pyx_k_tuple_509); __pyx_k_tuple_509 = 0;
  Py_XDECREF(__pyx_k_tuple_511); __pyx_k_tuple_511 = 0;
  Py_XDECREF(__pyx_k_tuple_525); __pyx_k_tuple_525 = 0;
  Py_XDECREF(__pyx_k_tuple_527); __pyx_k_tuple_527 = 0;
  Py_XDECREF(__pyx_k_tuple_535); __pyx_k_tuple_535 = 0;
  Py_XDECREF(__pyx_k_tuple_547); __pyx_k_tuple_547 = 0;
  
#if PY_MAJOR_VERSION >= 3
Py_CLEAR(__pyx_print);
Py_CLEAR(__pyx_print_kwargs);
#endif
}
static PyObject *__pyx_module_cleanup(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED PyObject *unused) {
  /*--- Global cleanup code ---*/
  Py_DECREF((PyObject *)__pyx_v_4lxml_5etree__check_for_default_attributes); __pyx_v_4lxml_5etree__check_for_default_attributes = 0;
  Py_DECREF((PyObject *)__pyx_v_4lxml_5etree___findStylesheetByID); __pyx_v_4lxml_5etree___findStylesheetByID = 0;
  Py_DECREF(__pyx_v_4lxml_5etree__REPLACE_PI_HREF); __pyx_v_4lxml_5etree__REPLACE_PI_HREF = 0;
  Py_DECREF(__pyx_v_4lxml_5etree__FIND_PI_HREF); __pyx_v_4lxml_5etree__FIND_PI_HREF = 0;
  Py_DECREF(__pyx_v_4lxml_5etree__RE_PI_HREF); __pyx_v_4lxml_5etree__RE_PI_HREF = 0;
  Py_DECREF(__pyx_v_4lxml_5etree__FIND_PI_ATTRIBUTES); __pyx_v_4lxml_5etree__FIND_PI_ATTRIBUTES = 0;
  Py_DECREF(__pyx_v_4lxml_5etree_EMPTY_DICT); __pyx_v_4lxml_5etree_EMPTY_DICT = 0;
  Py_DECREF(__pyx_v_4lxml_5etree__find_namespaces); __pyx_v_4lxml_5etree__find_namespaces = 0;
  Py_DECREF(__pyx_v_4lxml_5etree__replace_strings); __pyx_v_4lxml_5etree__replace_strings = 0;
  Py_DECREF(__pyx_v_4lxml_5etree__XPATH_EVAL_ERRORS); __pyx_v_4lxml_5etree__XPATH_EVAL_ERRORS = 0;
  Py_DECREF(__pyx_v_4lxml_5etree__XPATH_SYNTAX_ERRORS); __pyx_v_4lxml_5etree__XPATH_SYNTAX_ERRORS = 0;
  Py_DECREF(__pyx_v_4lxml_5etree__find_id_attributes); __pyx_v_4lxml_5etree__find_id_attributes = 0;
  Py_DECREF(__pyx_v_4lxml_5etree_inspect_getargspec); __pyx_v_4lxml_5etree_inspect_getargspec = 0;
  Py_DECREF((PyObject *)__pyx_v_4lxml_5etree___DEFAULT_HTML_PARSER); __pyx_v_4lxml_5etree___DEFAULT_HTML_PARSER = 0;
  Py_DECREF((PyObject *)__pyx_v_4lxml_5etree___DEFAULT_XML_PARSER); __pyx_v_4lxml_5etree___DEFAULT_XML_PARSER = 0;
  Py_DECREF((PyObject *)__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT); __pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT = 0;
  Py_DECREF(__pyx_v_4lxml_5etree__ParseError); __pyx_v_4lxml_5etree__ParseError = 0;
  Py_DECREF(__pyx_v_4lxml_5etree__LxmlSyntaxError); __pyx_v_4lxml_5etree__LxmlSyntaxError = 0;
  Py_DECREF(__pyx_v_4lxml_5etree___FUNCTION_NAMESPACE_REGISTRIES); __pyx_v_4lxml_5etree___FUNCTION_NAMESPACE_REGISTRIES = 0;
  Py_DECREF((PyObject *)__pyx_v_4lxml_5etree_DEFAULT_ELEMENT_CLASS_LOOKUP); __pyx_v_4lxml_5etree_DEFAULT_ELEMENT_CLASS_LOOKUP = 0;
  Py_DECREF(__pyx_v_4lxml_5etree_ELEMENT_CLASS_LOOKUP_STATE); __pyx_v_4lxml_5etree_ELEMENT_CLASS_LOOKUP_STATE = 0;
  Py_DECREF(__pyx_v_4lxml_5etree__PREFIX_CACHE); __pyx_v_4lxml_5etree__PREFIX_CACHE = 0;
  Py_DECREF(__pyx_v_4lxml_5etree___RELAXNG_ERROR_TYPES); __pyx_v_4lxml_5etree___RELAXNG_ERROR_TYPES = 0;
  Py_DECREF(__pyx_v_4lxml_5etree___PARSER_ERROR_TYPES); __pyx_v_4lxml_5etree___PARSER_ERROR_TYPES = 0;
  Py_DECREF(__pyx_v_4lxml_5etree___ERROR_DOMAINS); __pyx_v_4lxml_5etree___ERROR_DOMAINS = 0;
  Py_DECREF(__pyx_v_4lxml_5etree___ERROR_LEVELS); __pyx_v_4lxml_5etree___ERROR_LEVELS = 0;
  Py_DECREF((PyObject *)__pyx_v_4lxml_5etree___GLOBAL_ERROR_LOG); __pyx_v_4lxml_5etree___GLOBAL_ERROR_LOG = 0;
  Py_DECREF(__pyx_v_4lxml_5etree___HAS_XML_ENCODING); __pyx_v_4lxml_5etree___HAS_XML_ENCODING = 0;
  Py_DECREF(__pyx_v_4lxml_5etree___REPLACE_XML_ENCODING); __pyx_v_4lxml_5etree___REPLACE_XML_ENCODING = 0;
  Py_DECREF(__pyx_v_4lxml_5etree___RE_XML_ENCODING); __pyx_v_4lxml_5etree___RE_XML_ENCODING = 0;
  Py_DECREF(__pyx_v_4lxml_5etree_error_super_init); __pyx_v_4lxml_5etree_error_super_init = 0;
  Py_DECREF(__pyx_v_4lxml_5etree__Error); __pyx_v_4lxml_5etree__Error = 0;
  Py_DECREF(__pyx_v_4lxml_5etree__check_internal_prefix); __pyx_v_4lxml_5etree__check_internal_prefix = 0;
  Py_DECREF(__pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES); __pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES = 0;
  Py_DECREF(__pyx_v_4lxml_5etree__FILENAME_ENCODING); __pyx_v_4lxml_5etree__FILENAME_ENCODING = 0;
  Py_DECREF(__pyx_v_4lxml_5etree_EMPTY_READ_ONLY_DICT); __pyx_v_4lxml_5etree_EMPTY_READ_ONLY_DICT = 0;
  Py_DECREF(__pyx_v_4lxml_5etree_ITER_EMPTY); __pyx_v_4lxml_5etree_ITER_EMPTY = 0;
  Py_DECREF(__pyx_v_4lxml_5etree_gzip); __pyx_v_4lxml_5etree_gzip = 0;
  Py_DECREF(__pyx_v_4lxml_5etree_re); __pyx_v_4lxml_5etree_re = 0;
  Py_DECREF(__pyx_v_4lxml_5etree_sys); __pyx_v_4lxml_5etree_sys = 0;
  Py_DECREF(__pyx_v_4lxml_5etree__elementpath); __pyx_v_4lxml_5etree__elementpath = 0;
  Py_DECREF(__pyx_v_4lxml_5etree_StringIO); __pyx_v_4lxml_5etree_StringIO = 0;
  Py_DECREF(__pyx_v_4lxml_5etree_BytesIO); __pyx_v_4lxml_5etree_BytesIO = 0;
  Py_DECREF(__pyx_v_4lxml_5etree_os_path_abspath); __pyx_v_4lxml_5etree_os_path_abspath = 0;
  Py_DECREF(__pyx_v_4lxml_5etree__unicode); __pyx_v_4lxml_5etree__unicode = 0;
  __Pyx_CleanupGlobals();
  /*--- Type import cleanup code ---*/
  /*--- Builtin cleanup code ---*/
  Py_DECREF(__pyx_builtin_ImportError); __pyx_builtin_ImportError = 0;
  Py_DECREF(__pyx_builtin_AttributeError); __pyx_builtin_AttributeError = 0;
  Py_DECREF(__pyx_builtin_Exception); __pyx_builtin_Exception = 0;
  Py_DECREF(__pyx_builtin_SyntaxError); __pyx_builtin_SyntaxError = 0;
  Py_DECREF(__pyx_builtin_object); __pyx_builtin_object = 0;
  Py_DECREF(__pyx_builtin_ValueError); __pyx_builtin_ValueError = 0;
  Py_DECREF(__pyx_builtin_super); __pyx_builtin_super = 0;
  Py_DECREF(__pyx_builtin_id); __pyx_builtin_id = 0;
  Py_DECREF(__pyx_builtin_TypeError); __pyx_builtin_TypeError = 0;
  Py_DECREF(__pyx_builtin_KeyError); __pyx_builtin_KeyError = 0;
  Py_DECREF(__pyx_builtin_UnicodeEncodeError); __pyx_builtin_UnicodeEncodeError = 0;
  Py_DECREF(__pyx_builtin_UnicodeDecodeError); __pyx_builtin_UnicodeDecodeError = 0;
  Py_DECREF(__pyx_builtin_range); __pyx_builtin_range = 0;
  Py_DECREF(__pyx_builtin_IndexError); __pyx_builtin_IndexError = 0;
  Py_DECREF(__pyx_builtin_FutureWarning); __pyx_builtin_FutureWarning = 0;
  Py_DECREF(__pyx_builtin_StopIteration); __pyx_builtin_StopIteration = 0;
  Py_DECREF(__pyx_builtin_IOError); __pyx_builtin_IOError = 0;
  Py_DECREF(__pyx_builtin_LookupError); __pyx_builtin_LookupError = 0;
  Py_DECREF(__pyx_builtin_open); __pyx_builtin_open = 0;
  Py_DECREF(__pyx_builtin_enumerate); __pyx_builtin_enumerate = 0;
  Py_DECREF(__pyx_builtin_NotImplementedError); __pyx_builtin_NotImplementedError = 0;
  Py_DECREF(__pyx_builtin_AssertionError); __pyx_builtin_AssertionError = 0;
  /*--- Intern cleanup code ---*/
  Py_DECREF(__pyx_empty_tuple); __pyx_empty_tuple = 0;
  Py_INCREF(Py_None); return Py_None;
}

/* Runtime support code */

static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
    PyObject *result;
    result = PyObject_GetAttr(dict, name);
    if (!result)
        PyErr_SetObject(PyExc_NameError, name);
    return result;
}

static void __Pyx_RaiseArgtupleInvalid(
    const char* func_name,
    int exact,
    Py_ssize_t num_min,
    Py_ssize_t num_max,
    Py_ssize_t num_found)
{
    Py_ssize_t num_expected;
    const char *number, *more_or_less;

    if (num_found < num_min) {
        num_expected = num_min;
        more_or_less = "at least";
    } else {
        num_expected = num_max;
        more_or_less = "at most";
    }
    if (exact) {
        more_or_less = "exactly";
    }
    number = (num_expected == 1) ? "" : "s";
    PyErr_Format(PyExc_TypeError,
        #if PY_VERSION_HEX < 0x02050000
            "%s() takes %s %d positional argument%s (%d given)",
        #else
            "%s() takes %s %zd positional argument%s (%zd given)",
        #endif
        func_name, more_or_less, num_expected, number, num_found);
}

static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name,
    PyObject* kw_name)
{
    PyErr_Format(PyExc_TypeError,
        #if PY_MAJOR_VERSION >= 3
        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
        #else
        "%s() got multiple values for keyword argument '%s'", func_name,
        PyString_AS_STRING(kw_name));
        #endif
}

static int __Pyx_ParseOptionalKeywords(
    PyObject *kwds,
    PyObject **argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name)
{
    PyObject *key = 0, *value = 0;
    Py_ssize_t pos = 0;
    PyObject*** name;
    PyObject*** first_kw_arg = argnames + num_pos_args;

    while (PyDict_Next(kwds, &pos, &key, &value)) {
        name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (*name) {
            values[name-argnames] = value;
        } else {
            #if PY_MAJOR_VERSION < 3
            if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) {
            #else
            if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) {
            #endif
                goto invalid_keyword_type;
            } else {
                for (name = first_kw_arg; *name; name++) {
                    #if PY_MAJOR_VERSION >= 3
                    if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
                        PyUnicode_Compare(**name, key) == 0) break;
                    #else
                    if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
                        _PyString_Eq(**name, key)) break;
                    #endif
                }
                if (*name) {
                    values[name-argnames] = value;
                } else {
                    /* unexpected keyword found */
                    for (name=argnames; name != first_kw_arg; name++) {
                        if (**name == key) goto arg_passed_twice;
                        #if PY_MAJOR_VERSION >= 3
                        if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
                            PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice;
                        #else
                        if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
                            _PyString_Eq(**name, key)) goto arg_passed_twice;
                        #endif
                    }
                    if (kwds2) {
                        if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
                    } else {
                        goto invalid_keyword;
                    }
                }
            }
        }
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, **name);
    goto bad;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%s() keywords must be strings", function_name);
    goto bad;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%s() got an unexpected keyword argument '%s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
bad:
    return -1;
}

static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();

    tmp_type = tstate->curexc_type;
    tmp_value = tstate->curexc_value;
    tmp_tb = tstate->curexc_traceback;
    tstate->curexc_type = type;
    tstate->curexc_value = value;
    tstate->curexc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}

static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
    PyThreadState *tstate = PyThreadState_GET();
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;

    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
}


#if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
    Py_XINCREF(type);
    Py_XINCREF(value);
    Py_XINCREF(tb);
    /* First, check the traceback argument, replacing None with NULL. */
    if (tb == Py_None) {
        Py_DECREF(tb);
        tb = 0;
    }
    else if (tb != NULL && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto raise_error;
    }
    /* Next, replace a missing value with None */
    if (value == NULL) {
        value = Py_None;
        Py_INCREF(value);
    }
    #if PY_VERSION_HEX < 0x02050000
    if (!PyClass_Check(type))
    #else
    if (!PyType_Check(type))
    #endif
    {
        /* Raising an instance.  The value should be a dummy. */
        if (value != Py_None) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        /* Normalize to raise <class>, <instance> */
        Py_DECREF(value);
        value = type;
        #if PY_VERSION_HEX < 0x02050000
            if (PyInstance_Check(type)) {
                type = (PyObject*) ((PyInstanceObject*)type)->in_class;
                Py_INCREF(type);
            }
            else {
                type = 0;
                PyErr_SetString(PyExc_TypeError,
                    "raise: exception must be an old-style class or instance");
                goto raise_error;
            }
        #else
            type = (PyObject*) Py_TYPE(type);
            Py_INCREF(type);
            if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
                PyErr_SetString(PyExc_TypeError,
                    "raise: exception class must be a subclass of BaseException");
                goto raise_error;
            }
        #endif
    }

    __Pyx_ErrRestore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}

#else /* Python 3+ */

static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
    if (tb == Py_None) {
        tb = 0;
    } else if (tb && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto bad;
    }
    if (value == Py_None)
        value = 0;

    if (PyExceptionInstance_Check(type)) {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto bad;
        }
        value = type;
        type = (PyObject*) Py_TYPE(value);
    } else if (!PyExceptionClass_Check(type)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: exception class must be a subclass of BaseException");
        goto bad;
    }

    PyErr_SetObject(type, value);

    if (tb) {
        PyThreadState *tstate = PyThreadState_GET();
        PyObject* tmp_tb = tstate->curexc_traceback;
        if (tb != tmp_tb) {
            Py_INCREF(tb);
            tstate->curexc_traceback = tb;
            Py_XDECREF(tmp_tb);
        }
    }

bad:
    return;
}
#endif

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
    PyErr_Format(PyExc_ValueError,
        #if PY_VERSION_HEX < 0x02050000
                 "need more than %d value%s to unpack", (int)index,
        #else
                 "need more than %zd value%s to unpack", index,
        #endif
                 (index == 1) ? "" : "s");
}

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
    PyErr_Format(PyExc_ValueError,
        #if PY_VERSION_HEX < 0x02050000
            "too many values to unpack (expected %d)", (int)expected);
        #else
            "too many values to unpack (expected %zd)", expected);
        #endif
}

static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) {
    PyObject *item;
    if (!(item = PyIter_Next(iter))) {
        if (!PyErr_Occurred()) {
            __Pyx_RaiseNeedMoreValuesError(index);
        }
    }
    return item;
}

static int __Pyx_EndUnpack(PyObject *iter, Py_ssize_t expected) {
    PyObject *item;
    if ((item = PyIter_Next(iter))) {
        Py_DECREF(item);
        __Pyx_RaiseTooManyValuesError(expected);
        return -1;
    }
    else if (!PyErr_Occurred())
        return 0;
    else
        return -1;
}

static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *local_type, *local_value, *local_tb;
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();
    local_type = tstate->curexc_type;
    local_value = tstate->curexc_value;
    local_tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
    PyErr_NormalizeException(&local_type, &local_value, &local_tb);
    if (unlikely(tstate->curexc_type))
        goto bad;
    #if PY_MAJOR_VERSION >= 3
    if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
        goto bad;
    #endif
    *type = local_type;
    *value = local_value;
    *tb = local_tb;
    Py_INCREF(local_type);
    Py_INCREF(local_value);
    Py_INCREF(local_tb);
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = local_type;
    tstate->exc_value = local_value;
    tstate->exc_traceback = local_tb;
    /* Make sure tstate is in a consistent state when we XDECREF
       these objects (XDECREF may run arbitrary code). */
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
    return 0;
bad:
    *type = 0;
    *value = 0;
    *tb = 0;
    Py_XDECREF(local_type);
    Py_XDECREF(local_value);
    Py_XDECREF(local_tb);
    return -1;
}


static CYTHON_INLINE long __Pyx_mod_long(long a, long b) {
    long r = a % b;
    r += ((r != 0) & ((r ^ b) < 0)) * b;
    return r;
}

static CYTHON_INLINE long __Pyx_div_long(long a, long b) {
    long q = a / b;
    long r = a - q*b;
    q -= ((r != 0) & ((r ^ b) < 0));
    return q;
}

static CYTHON_INLINE int __Pyx_CheckKeywordStrings(
    PyObject *kwdict,
    const char* function_name,
    int kw_allowed)
{
    PyObject* key = 0;
    Py_ssize_t pos = 0;
    while (PyDict_Next(kwdict, &pos, &key, 0)) {
        #if PY_MAJOR_VERSION < 3
        if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key)))
        #else
        if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key)))
        #endif
            goto invalid_keyword_type;
    }
    if ((!kw_allowed) && unlikely(key))
        goto invalid_keyword;
    return 1;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%s() keywords must be strings", function_name);
    return 0;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%s() got an unexpected keyword argument '%s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
    return 0;
}

static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
    if (unlikely(!type)) {
        PyErr_Format(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (likely(PyObject_TypeCheck(obj, type)))
        return 1;
    PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
                 Py_TYPE(obj)->tp_name, type->tp_name);
    return 0;
}

static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
}

static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) {
    if (t == Py_None) {
      __Pyx_RaiseNoneNotIterableError();
    } else if (PyTuple_GET_SIZE(t) < index) {
      __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t));
    } else {
      __Pyx_RaiseTooManyValuesError(index);
    }
}

static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b) {
    Py_ssize_t q = a / b;
    Py_ssize_t r = a - q*b;
    q -= ((r != 0) & ((r ^ b) < 0));
    return q;
}



static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
    const char *name, int exact)
{
    if (!type) {
        PyErr_Format(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (none_allowed && obj == Py_None) return 1;
    else if (exact) {
        if (Py_TYPE(obj) == type) return 1;
    }
    else {
        if (PyObject_TypeCheck(obj, type)) return 1;
    }
    PyErr_Format(PyExc_TypeError,
        "Argument '%s' has incorrect type (expected %s, got %s)",
        name, type->tp_name, Py_TYPE(obj)->tp_name);
    return 0;
}

static CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is unsubscriptable");
}

static int __Pyx_RegisterCleanup(void) {
    /* Don't use Py_AtExit because that has a 32-call limit
     * and is called after python finalization.
     */

    PyObject *cleanup_func = 0;
    PyObject *atexit = 0;
    PyObject *reg = 0;
    PyObject *args = 0;
    PyObject *res = 0;
    int ret = -1;

    cleanup_func = PyCFunction_New(&cleanup_def, 0);
    args = PyTuple_New(1);
    if (!cleanup_func || !args)
        goto bad;
    PyTuple_SET_ITEM(args, 0, cleanup_func);
    cleanup_func = 0;

    atexit = __Pyx_ImportModule("atexit");
    if (!atexit)
        goto bad;
    reg = __Pyx_GetAttrString(atexit, "register");
    if (!reg)
        goto bad;
    res = PyObject_CallObject(reg, args);
    if (!res)
        goto bad;
    ret = 0;
bad:
    Py_XDECREF(cleanup_func);
    Py_XDECREF(atexit);
    Py_XDECREF(reg);
    Py_XDECREF(args);
    Py_XDECREF(res);
    return ret;
}

static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) {
    PyThreadState *tstate = PyThreadState_GET();
    *type = tstate->exc_type;
    *value = tstate->exc_value;
    *tb = tstate->exc_traceback;
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
}

static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = type;
    tstate->exc_value = value;
    tstate->exc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) {
    PyObject *py_import = 0;
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    py_import = __Pyx_GetAttrString(__pyx_b, "__import__");
    if (!py_import)
        goto bad;
    if (from_list)
        list = from_list;
    else {
        empty_list = PyList_New(0);
        if (!empty_list)
            goto bad;
        list = empty_list;
    }
    global_dict = PyModule_GetDict(__pyx_m);
    if (!global_dict)
        goto bad;
    empty_dict = PyDict_New();
    if (!empty_dict)
        goto bad;
    module = PyObject_CallFunctionObjArgs(py_import,
        name, global_dict, empty_dict, list, NULL);
bad:
    Py_XDECREF(empty_list);
    Py_XDECREF(py_import);
    Py_XDECREF(empty_dict);
    return module;
}

static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases) {
    PyObject *metaclass;
    /* Default metaclass */
#if PY_MAJOR_VERSION < 3
    if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
        PyObject *base = PyTuple_GET_ITEM(bases, 0);
        metaclass = PyObject_GetAttrString(base, "__class__");
        if (!metaclass) {
            PyErr_Clear();
            metaclass = (PyObject*) Py_TYPE(base);
        }
    } else {
        metaclass = (PyObject *) &PyClass_Type;
    }
#else
    if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
        PyObject *base = PyTuple_GET_ITEM(bases, 0);
        metaclass = (PyObject*) Py_TYPE(base);
    } else {
        metaclass = (PyObject *) &PyType_Type;
    }
#endif
    Py_INCREF(metaclass);
    return metaclass;
}

static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name,
                                   PyObject *modname) {
    PyObject *result;
    PyObject *metaclass;

    if (PyDict_SetItemString(dict, "__module__", modname) < 0)
        return NULL;

    /* Python2 __metaclass__ */
    metaclass = PyDict_GetItemString(dict, "__metaclass__");
    if (metaclass) {
        Py_INCREF(metaclass);
    } else {
        metaclass = __Pyx_FindPy2Metaclass(bases);
    }
    result = PyObject_CallFunctionObjArgs(metaclass, name, bases, dict, NULL);
    Py_DECREF(metaclass);
    return result;
}


static PyObject *__pyx_binding_PyCFunctionType_NewEx(PyMethodDef *ml, PyObject *self, PyObject *module) {
	__pyx_binding_PyCFunctionType_object *op = PyObject_GC_New(__pyx_binding_PyCFunctionType_object, __pyx_binding_PyCFunctionType);
    if (op == NULL)
        return NULL;
	op->func.m_ml = ml;
	Py_XINCREF(self);
	op->func.m_self = self;
	Py_XINCREF(module);
	op->func.m_module = module;
	PyObject_GC_Track(op);
	return (PyObject *)op;
}

static void __pyx_binding_PyCFunctionType_dealloc(__pyx_binding_PyCFunctionType_object *m) {
	PyObject_GC_UnTrack(m);
	Py_XDECREF(m->func.m_self);
	Py_XDECREF(m->func.m_module);
    PyObject_GC_Del(m);
}

static PyObject *__pyx_binding_PyCFunctionType_descr_get(PyObject *func, PyObject *obj, PyObject *type) {
	if (obj == Py_None)
		obj = NULL;
	return PyMethod_New(func, obj, type);
}

static int __pyx_binding_PyCFunctionType_init(void) {
    __pyx_binding_PyCFunctionType_type = PyCFunction_Type;
    __pyx_binding_PyCFunctionType_type.tp_name = __Pyx_NAMESTR("cython_binding_builtin_function_or_method");
    __pyx_binding_PyCFunctionType_type.tp_dealloc = (destructor)__pyx_binding_PyCFunctionType_dealloc;
    __pyx_binding_PyCFunctionType_type.tp_descr_get = __pyx_binding_PyCFunctionType_descr_get;
    if (PyType_Ready(&__pyx_binding_PyCFunctionType_type) < 0) {
        return -1;
    }
    __pyx_binding_PyCFunctionType = &__pyx_binding_PyCFunctionType_type;
    return 0;

}

#if PY_MAJOR_VERSION < 3
static PyObject *__Pyx_GetStdout(void) {
    PyObject *f = PySys_GetObject((char *)"stdout");
    if (!f) {
        PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout");
    }
    return f;
}

static int __Pyx_Print(PyObject* f, PyObject *arg_tuple, int newline) {
    PyObject* v;
    int i;

    if (!f) {
        if (!(f = __Pyx_GetStdout()))
            return -1;
    }
    for (i=0; i < PyTuple_GET_SIZE(arg_tuple); i++) {
        if (PyFile_SoftSpace(f, 1)) {
            if (PyFile_WriteString(" ", f) < 0)
                return -1;
        }
        v = PyTuple_GET_ITEM(arg_tuple, i);
        if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0)
            return -1;
        if (PyString_Check(v)) {
            char *s = PyString_AsString(v);
            Py_ssize_t len = PyString_Size(v);
            if (len > 0 &&
                isspace(Py_CHARMASK(s[len-1])) &&
                s[len-1] != ' ')
                    PyFile_SoftSpace(f, 0);
        }
    }
    if (newline) {
        if (PyFile_WriteString("\n", f) < 0)
            return -1;
        PyFile_SoftSpace(f, 0);
    }
    return 0;
}

#else /* Python 3 has a print function */

static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) {
    PyObject* kwargs = 0;
    PyObject* result = 0;
    PyObject* end_string;
    if (unlikely(!__pyx_print)) {
        __pyx_print = __Pyx_GetAttrString(__pyx_b, "print");
        if (!__pyx_print)
            return -1;
    }
    if (stream) {
        kwargs = PyDict_New();
        if (unlikely(!kwargs))
            return -1;
        if (unlikely(PyDict_SetItemString(kwargs, "file", stream) < 0))
            goto bad;
        if (!newline) {
            end_string = PyUnicode_FromStringAndSize(" ", 1);
            if (unlikely(!end_string))
                goto bad;
            if (PyDict_SetItemString(kwargs, "end", end_string) < 0) {
                Py_DECREF(end_string);
                goto bad;
            }
            Py_DECREF(end_string);
        }
    } else if (!newline) {
        if (unlikely(!__pyx_print_kwargs)) {
            __pyx_print_kwargs = PyDict_New();
            if (unlikely(!__pyx_print_kwargs))
                return -1;
            end_string = PyUnicode_FromStringAndSize(" ", 1);
            if (unlikely(!end_string))
                return -1;
            if (PyDict_SetItemString(__pyx_print_kwargs, "end", end_string) < 0) {
                Py_DECREF(end_string);
                return -1;
            }
            Py_DECREF(end_string);
        }
        kwargs = __pyx_print_kwargs;
    }
    result = PyObject_Call(__pyx_print, arg_tuple, kwargs);
    if (unlikely(kwargs) && (kwargs != __pyx_print_kwargs))
        Py_DECREF(kwargs);
    if (!result)
        return -1;
    Py_DECREF(result);
    return 0;
bad:
    if (kwargs != __pyx_print_kwargs)
        Py_XDECREF(kwargs);
    return -1;
}

#endif

#if PY_MAJOR_VERSION < 3

static int __Pyx_PrintOne(PyObject* f, PyObject *o) {
    if (!f) {
        if (!(f = __Pyx_GetStdout()))
            return -1;
    }
    if (PyFile_SoftSpace(f, 0)) {
        if (PyFile_WriteString(" ", f) < 0)
            return -1;
    }
    if (PyFile_WriteObject(o, f, Py_PRINT_RAW) < 0)
        return -1;
    if (PyFile_WriteString("\n", f) < 0)
        return -1;
    return 0;
    /* the line below is just to avoid compiler
     * compiler warnings about unused functions */
    return __Pyx_Print(f, NULL, 0);
}

#else /* Python 3 has a print function */

static int __Pyx_PrintOne(PyObject* stream, PyObject *o) {
    int res;
    PyObject* arg_tuple = PyTuple_New(1);
    if (unlikely(!arg_tuple))
        return -1;
    Py_INCREF(o);
    PyTuple_SET_ITEM(arg_tuple, 0, o);
    res = __Pyx_Print(stream, arg_tuple, 1);
    Py_DECREF(arg_tuple);
    return res;
}

#endif

static PyObject* __Pyx_Method_ClassMethod(PyObject *method) {
    /* It appears that PyMethodDescr_Type is not anywhere exposed in the Python/C API */
    static PyTypeObject *methoddescr_type = NULL;
    if (methoddescr_type == NULL) {
       PyObject *meth = __Pyx_GetAttrString((PyObject*)&PyList_Type, "append");
       if (!meth) return NULL;
       methoddescr_type = Py_TYPE(meth);
       Py_DECREF(meth);
    }
    if (PyObject_TypeCheck(method, methoddescr_type)) { /* cdef classes */
        PyMethodDescrObject *descr = (PyMethodDescrObject *)method;
        #if PY_VERSION_HEX < 0x03020000
        PyTypeObject *d_type = descr->d_type;
        #else
        PyTypeObject *d_type = descr->d_common.d_type;
        #endif
        return PyDescr_NewClassMethod(d_type, descr->d_method);
    }
    else if (PyMethod_Check(method)) { /* python classes */
        return PyClassMethod_New(PyMethod_GET_FUNCTION(method));
    }
    else if (PyCFunction_Check(method)) {
        return PyClassMethod_New(method);
    }
#ifdef __pyx_binding_PyCFunctionType_USED
    else if (PyObject_TypeCheck(method, __pyx_binding_PyCFunctionType)) { /* binded CFunction */
        return PyClassMethod_New(method);
    }
#endif
    PyErr_Format(PyExc_TypeError,
                 "Class-level classmethod() can only be called on "
                 "a method_descriptor or instance method.");
    return NULL;
}

static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
    if (s1 == s2) {   /* as done by PyObject_RichCompareBool(); also catches the (interned) empty string */
        return (equals == Py_EQ);
    } else if (PyUnicode_CheckExact(s1) & PyUnicode_CheckExact(s2)) {
        if (PyUnicode_GET_SIZE(s1) != PyUnicode_GET_SIZE(s2)) {
            return (equals == Py_NE);
        } else if (PyUnicode_GET_SIZE(s1) == 1) {
            if (equals == Py_EQ)
                return (PyUnicode_AS_UNICODE(s1)[0] == PyUnicode_AS_UNICODE(s2)[0]);
            else
                return (PyUnicode_AS_UNICODE(s1)[0] != PyUnicode_AS_UNICODE(s2)[0]);
        } else {
            int result = PyUnicode_Compare(s1, s2);
            if ((result == -1) && unlikely(PyErr_Occurred()))
                return -1;
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & (s2 == Py_None)) {
        return (equals == Py_EQ);
    } else if ((s1 == Py_None) & PyUnicode_CheckExact(s2)) {
        return (equals == Py_NE);
    } else if ((s2 == Py_None) & PyUnicode_CheckExact(s1)) {
        return (equals == Py_NE);
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
}

static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
    PyObject *r = PyObject_GetAttr(o, n);
    if (!r) {
        if (!PyErr_ExceptionMatches(PyExc_AttributeError))
            goto bad;
        PyErr_Clear();
        r = d;
        Py_INCREF(d);
    }
    return r;
bad:
    return NULL;
}

static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) {
    const unsigned char neg_one = (unsigned char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(unsigned char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to unsigned char" :
                    "value too large to convert to unsigned char");
            }
            return (unsigned char)-1;
        }
        return (unsigned char)val;
    }
    return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x);
}

static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) {
    const unsigned short neg_one = (unsigned short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(unsigned short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to unsigned short" :
                    "value too large to convert to unsigned short");
            }
            return (unsigned short)-1;
        }
        return (unsigned short)val;
    }
    return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x);
}

static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) {
    const unsigned int neg_one = (unsigned int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(unsigned int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to unsigned int" :
                    "value too large to convert to unsigned int");
            }
            return (unsigned int)-1;
        }
        return (unsigned int)val;
    }
    return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x);
}

static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) {
    const char neg_one = (char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to char" :
                    "value too large to convert to char");
            }
            return (char)-1;
        }
        return (char)val;
    }
    return (char)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) {
    const short neg_one = (short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to short" :
                    "value too large to convert to short");
            }
            return (short)-1;
        }
        return (short)val;
    }
    return (short)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) {
    const int neg_one = (int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to int" :
                    "value too large to convert to int");
            }
            return (int)-1;
        }
        return (int)val;
    }
    return (int)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) {
    const signed char neg_one = (signed char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed char" :
                    "value too large to convert to signed char");
            }
            return (signed char)-1;
        }
        return (signed char)val;
    }
    return (signed char)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) {
    const signed short neg_one = (signed short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed short" :
                    "value too large to convert to signed short");
            }
            return (signed short)-1;
        }
        return (signed short)val;
    }
    return (signed short)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) {
    const signed int neg_one = (signed int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed int" :
                    "value too large to convert to signed int");
            }
            return (signed int)-1;
        }
        return (signed int)val;
    }
    return (signed int)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) {
    const int neg_one = (int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to int" :
                    "value too large to convert to int");
            }
            return (int)-1;
        }
        return (int)val;
    }
    return (int)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
    const unsigned long neg_one = (unsigned long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to unsigned long");
            return (unsigned long)-1;
        }
        return (unsigned long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to unsigned long");
                return (unsigned long)-1;
            }
            return PyLong_AsUnsignedLong(x);
        } else {
            return PyLong_AsLong(x);
        }
    } else {
        unsigned long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (unsigned long)-1;
        val = __Pyx_PyInt_AsUnsignedLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
    const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to unsigned PY_LONG_LONG");
            return (unsigned PY_LONG_LONG)-1;
        }
        return (unsigned PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to unsigned PY_LONG_LONG");
                return (unsigned PY_LONG_LONG)-1;
            }
            return PyLong_AsUnsignedLongLong(x);
        } else {
            return PyLong_AsLongLong(x);
        }
    } else {
        unsigned PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (unsigned PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsUnsignedLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
    const long neg_one = (long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to long");
            return (long)-1;
        }
        return (long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to long");
                return (long)-1;
            }
            return PyLong_AsUnsignedLong(x);
        } else {
            return PyLong_AsLong(x);
        }
    } else {
        long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (long)-1;
        val = __Pyx_PyInt_AsLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
    const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to PY_LONG_LONG");
            return (PY_LONG_LONG)-1;
        }
        return (PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to PY_LONG_LONG");
                return (PY_LONG_LONG)-1;
            }
            return PyLong_AsUnsignedLongLong(x);
        } else {
            return PyLong_AsLongLong(x);
        }
    } else {
        PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
    const signed long neg_one = (signed long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to signed long");
            return (signed long)-1;
        }
        return (signed long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to signed long");
                return (signed long)-1;
            }
            return PyLong_AsUnsignedLong(x);
        } else {
            return PyLong_AsLong(x);
        }
    } else {
        signed long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (signed long)-1;
        val = __Pyx_PyInt_AsSignedLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
    const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to signed PY_LONG_LONG");
            return (signed PY_LONG_LONG)-1;
        }
        return (signed PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to signed PY_LONG_LONG");
                return (signed PY_LONG_LONG)-1;
            }
            return PyLong_AsUnsignedLongLong(x);
        } else {
            return PyLong_AsLongLong(x);
        }
    } else {
        signed PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (signed PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsSignedLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static void __Pyx_WriteUnraisable(const char *name) {
    PyObject *old_exc, *old_val, *old_tb;
    PyObject *ctx;
    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
    #if PY_MAJOR_VERSION < 3
    ctx = PyString_FromString(name);
    #else
    ctx = PyUnicode_FromString(name);
    #endif
    __Pyx_ErrRestore(old_exc, old_val, old_tb);
    if (!ctx) {
        PyErr_WriteUnraisable(Py_None);
    } else {
        PyErr_WriteUnraisable(ctx);
        Py_DECREF(ctx);
    }
}

static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig) {
    PyObject *d = 0;
    PyObject *cobj = 0;
    union {
        void (*fp)(void);
        void *p;
    } tmp;

    d = PyObject_GetAttrString(__pyx_m, (char *)"__pyx_capi__");
    if (!d) {
        PyErr_Clear();
        d = PyDict_New();
        if (!d)
            goto bad;
        Py_INCREF(d);
        if (PyModule_AddObject(__pyx_m, (char *)"__pyx_capi__", d) < 0)
            goto bad;
    }
    tmp.fp = f;
#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
    cobj = PyCapsule_New(tmp.p, sig, 0);
#else
    cobj = PyCObject_FromVoidPtrAndDesc(tmp.p, (void *)sig, 0);
#endif
    if (!cobj)
        goto bad;
    if (PyDict_SetItemString(d, name, cobj) < 0)
        goto bad;
    Py_DECREF(cobj);
    Py_DECREF(d);
    return 0;
bad:
    Py_XDECREF(cobj);
    Py_XDECREF(d);
    return -1;
}

static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
    PyObject *ob = PyCapsule_New(vtable, 0, 0);
#else
    PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
#endif
    if (!ob)
        goto bad;
    if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0)
        goto bad;
    Py_DECREF(ob);
    return 0;
bad:
    Py_XDECREF(ob);
    return -1;
}

#ifndef __PYX_HAVE_RT_ImportModule
#define __PYX_HAVE_RT_ImportModule
static PyObject *__Pyx_ImportModule(const char *name) {
    PyObject *py_name = 0;
    PyObject *py_module = 0;

    #if PY_MAJOR_VERSION < 3
    py_name = PyString_FromString(name);
    #else
    py_name = PyUnicode_FromString(name);
    #endif
    if (!py_name)
        goto bad;
    py_module = PyImport_Import(py_name);
    Py_DECREF(py_name);
    return py_module;
bad:
    Py_XDECREF(py_name);
    return 0;
}
#endif

#include "compile.h"
#include "frameobject.h"
#include "traceback.h"

static void __Pyx_AddTraceback(const char *funcname) {
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    PyObject *py_globals = 0;
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;

    #if PY_MAJOR_VERSION < 3
    py_srcfile = PyString_FromString(__pyx_filename);
    #else
    py_srcfile = PyUnicode_FromString(__pyx_filename);
    #endif
    if (!py_srcfile) goto bad;
    if (__pyx_clineno) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
        #endif
    }
    else {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromString(funcname);
        #else
        py_funcname = PyUnicode_FromString(funcname);
        #endif
    }
    if (!py_funcname) goto bad;
    py_globals = PyModule_GetDict(__pyx_m);
    if (!py_globals) goto bad;
    py_code = PyCode_New(
        0,            /*int argcount,*/
        #if PY_MAJOR_VERSION >= 3
        0,            /*int kwonlyargcount,*/
        #endif
        0,            /*int nlocals,*/
        0,            /*int stacksize,*/
        0,            /*int flags,*/
        __pyx_empty_bytes, /*PyObject *code,*/
        __pyx_empty_tuple,  /*PyObject *consts,*/
        __pyx_empty_tuple,  /*PyObject *names,*/
        __pyx_empty_tuple,  /*PyObject *varnames,*/
        __pyx_empty_tuple,  /*PyObject *freevars,*/
        __pyx_empty_tuple,  /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        __pyx_lineno,   /*int firstlineno,*/
        __pyx_empty_bytes  /*PyObject *lnotab*/
    );
    if (!py_code) goto bad;
    py_frame = PyFrame_New(
        PyThreadState_GET(), /*PyThreadState *tstate,*/
        py_code,             /*PyCodeObject *code,*/
        py_globals,          /*PyObject *globals,*/
        0                    /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    py_frame->f_lineno = __pyx_lineno;
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        #if PY_MAJOR_VERSION < 3
        if (t->is_unicode) {
            *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
        } else if (t->intern) {
            *t->p = PyString_InternFromString(t->s);
        } else {
            *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
        }
        #else  /* Python 3+ has unicode identifiers */
        if (t->is_unicode | t->is_str) {
            if (t->intern) {
                *t->p = PyUnicode_InternFromString(t->s);
            } else if (t->encoding) {
                *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
            } else {
                *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
            }
        } else {
            *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
        }
        #endif
        if (!*t->p)
            return -1;
        ++t;
    }
    return 0;
}

/* Type Conversion Functions */

static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   int is_true = x == Py_True;
   if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
   else return PyObject_IsTrue(x);
}

static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
  PyNumberMethods *m;
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_VERSION_HEX < 0x03000000
  if (PyInt_Check(x) || PyLong_Check(x))
#else
  if (PyLong_Check(x))
#endif
    return Py_INCREF(x), x;
  m = Py_TYPE(x)->tp_as_number;
#if PY_VERSION_HEX < 0x03000000
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = PyNumber_Long(x);
  }
#else
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Long(x);
  }
#endif
  if (res) {
#if PY_VERSION_HEX < 0x03000000
    if (!PyInt_Check(res) && !PyLong_Check(res)) {
#else
    if (!PyLong_Check(res)) {
#endif
      PyErr_Format(PyExc_TypeError,
                   "__%s__ returned non-%s (type %.200s)",
                   name, name, Py_TYPE(res)->tp_name);
      Py_DECREF(res);
      return NULL;
    }
  }
  else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_TypeError,
                    "an integer is required");
  }
  return res;
}

static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  Py_ssize_t ival;
  PyObject* x = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyInt_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}

static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
#if PY_VERSION_HEX < 0x02050000
   if (ival <= LONG_MAX)
       return PyInt_FromLong((long)ival);
   else {
       unsigned char *bytes = (unsigned char *) &ival;
       int one = 1; int little = (int)*(unsigned char*)&one;
       return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0);
   }
#else
   return PyInt_FromSize_t(ival);
#endif
}

static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
   unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
   if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) {
       return (size_t)-1;
   } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
       PyErr_SetString(PyExc_OverflowError,
                       "value too large to convert to size_t");
       return (size_t)-1;
   }
   return (size_t)val;
}


#endif /* Py_PYTHON_H */
