# public Cython/C interface to lxml.etree
from lxml.includes cimport tree
from lxml.includes.tree cimport const_xmlChar
cdef extern from "lxml-version.h":
cdef char* LXML_VERSION_STRING
cdef extern from "etree_defs.h":
# test if c_node is considered an Element (i.e. Element, Comment, etc.)
cdef bint _isElement(tree.xmlNode* c_node) nogil
# return the namespace URI of the node or NULL
cdef const_xmlChar* _getNs(tree.xmlNode* node) nogil
# pair of macros for tree traversal
cdef void BEGIN_FOR_EACH_ELEMENT_FROM(tree.xmlNode* tree_top,
tree.xmlNode* start_node,
int start_node_inclusive) nogil
cdef void END_FOR_EACH_ELEMENT_FROM(tree.xmlNode* start_node) nogil
cdef extern from "etree_api.h":
# first function to call!
cdef int import_lxml__etree() except -1
##########################################################################
# public ElementTree API classes
cdef class lxml.etree._Document [ object LxmlDocument ]:
cdef class lxml.etree._Element [ object LxmlElement ]:
cdef tree.xmlNode* _c_node
cdef class lxml.etree.ElementBase(_Element) [ object LxmlElementBase ]:
cdef class lxml.etree._ElementTree [ object LxmlElementTree ]:
cdef _Element _context_node